Skip to content

split views not lowered correctly #388

Open
@rachitnigam

Description

@rachitnigam

The following program type checks and generates the expected output with the C++ backend:

decl out: ubit<32>[1];

let A: ubit<32>[4 bank 2];
split A_sp = A[by 2];

for (let i: ubit<3> = 0..2) {
  for (let j: ubit<3> = 0..2) unroll 2 {
    let t = A_sp[j][i];
  } combine {
    out[0] += t;
  }
}

However, with --lower, we get the cryptic error:

% ./fuse split.fuse --lower
[Type error] [Line 4, Column 14] `A' is not bound in scope.
split A_sp = A[by 2];

Using --pass-debug, we can see that Lower for loops doesn't handle split views:

...
let A0: ubit<32>[2];
let A1: ubit<32>[2];
split A_sp = A[by 2]; // <-- oops
...

It rewrites A to A0 and A1 but doesn't change the instances of A in the split view.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Comp: CalyxIssue related to the Calyx backendtype: bugBug in the compiler

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions