Skip to content

Commit

Permalink
Add few more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
prithayan committed Aug 15, 2023
1 parent a43efd0 commit d4d5db4
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/Dialect/FIRRTL/check-comb-cycles.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,29 @@ firrtl.circuit "strictConnectAndConnect" {

// -----

firrtl.circuit "outputPortCycle" {
// expected-error @below {{outputPortCycle.{reg[0].a <- w.a <- reg[0].a}}}
firrtl.module @outputPortCycle(out %reg: !firrtl.vector<bundle<a: uint<8>>, 2>) {
%0 = firrtl.subindex %reg[0] : !firrtl.vector<bundle<a: uint<8>>, 2>
%1 = firrtl.subindex %reg[0] : !firrtl.vector<bundle<a: uint<8>>, 2>
%w = firrtl.wire : !firrtl.bundle<a:uint<8>>
firrtl.connect %w, %0 : !firrtl.bundle<a:uint<8>>, !firrtl.bundle<a:uint<8>>
firrtl.connect %1, %w : !firrtl.bundle<a:uint<8>>, !firrtl.bundle<a:uint<8>>
}
}

// -----

firrtl.circuit "outputRead" {
firrtl.module @outputRead(out %reg: !firrtl.vector<bundle<a: uint<8>>, 2>) {
%0 = firrtl.subindex %reg[0] : !firrtl.vector<bundle<a: uint<8>>, 2>
%1 = firrtl.subindex %reg[1] : !firrtl.vector<bundle<a: uint<8>>, 2>
firrtl.connect %1, %0 : !firrtl.bundle<a:uint<8>>, !firrtl.bundle<a:uint<8>>
}
}

// -----

firrtl.circuit "vectorRegInit" {
firrtl.module @vectorRegInit(in %clk: !firrtl.clock) {
%reg = firrtl.reg %clk : !firrtl.clock, !firrtl.vector<bundle<a: uint<8>>, 2>
Expand Down Expand Up @@ -194,6 +217,20 @@ firrtl.circuit "Foo" {

// -----

firrtl.circuit "outputPortCycle" {
firrtl.module private @Bar(in %a: !firrtl.bundle<a: uint<8>, b: uint<4>>) {}
// expected-error @below {{outputPortCycle.{bar.a.a <- port[0].a <- bar.a.a}}}
firrtl.module @outputPortCycle(out %port: !firrtl.vector<bundle<a: uint<8>, b: uint<4>>, 2>) {
%0 = firrtl.subindex %port[0] : !firrtl.vector<bundle<a: uint<8>, b: uint<4>>, 2>
%1 = firrtl.subindex %port[0] : !firrtl.vector<bundle<a: uint<8>, b: uint<4>>, 2>
%w = firrtl.instance bar interesting_name @Bar(in a: !firrtl.bundle<a: uint<8>, b: uint<4>>)
firrtl.connect %w, %0 : !firrtl.bundle<a: uint<8>, b: uint<4>>, !firrtl.bundle<a: uint<8>, b: uint<4>>
firrtl.connect %1, %w : !firrtl.bundle<a: uint<8>, b: uint<4>>, !firrtl.bundle<a: uint<8>, b: uint<4>>
}
}

// -----

// Node combinational loop through vector subindex
// CHECK-NOT: firrtl.circuit "hasloops"
firrtl.circuit "hasloops" {
Expand Down

0 comments on commit d4d5db4

Please sign in to comment.