-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix test case for duplicate FSM optimization (#2204)
@parthsarkar17 The runt test for duplicate FSMs was passing in the incorrect parameter. What probably happened was that it was using an old pass input parameter name that was updated but then the runt command was not updated. This is one of the reasons why we should have at least one snapshot test for the FSM optimizations, so things like this are easier to catch (not a big deal at all, but I think it's good practice from now on). --------- Co-authored-by: Parth Sarkar <[email protected]>
- Loading branch information
1 parent
b7ccc79
commit 894e221
Showing
4 changed files
with
161 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import "primitives/core.futil"; | ||
import "primitives/memories/comb.futil"; | ||
component main(@go go: 1, @clk clk: 1, @reset reset: 1) -> (@done done: 1) { | ||
cells { | ||
a = std_reg(2); | ||
b = std_reg(2); | ||
c = std_reg(2); | ||
@generated fsm0 = std_reg(2); | ||
@generated fsm1 = std_reg(2); | ||
} | ||
wires { | ||
group A { | ||
a.in = 2'd0; | ||
a.write_en = 1'd1; | ||
A[done] = a.done; | ||
} | ||
group B { | ||
b.in = 2'd1; | ||
b.write_en = 1'd1; | ||
B[done] = b.done; | ||
} | ||
group C { | ||
c.in = 2'd2; | ||
c.write_en = 1'd1; | ||
C[done] = c.done; | ||
} | ||
group tdcc { | ||
A[go] = !A[done] & fsm0.out == 2'd0 ? 1'd1; | ||
B[go] = !B[done] & fsm0.out == 2'd1 ? 1'd1; | ||
C[go] = !C[done] & fsm1.out == 2'd2 ? 1'd1; | ||
fsm0.in = fsm0.out == 2'd0 & A[done] ? 2'd1; | ||
fsm0.write_en = fsm0.out == 2'd0 & A[done] ? 1'd1; | ||
fsm1.in = fsm0.out == 2'd0 & A[done] ? 2'd1; | ||
fsm1.write_en = fsm0.out == 2'd0 & A[done] ? 1'd1; | ||
fsm0.in = fsm0.out == 2'd1 & B[done] ? 2'd2; | ||
fsm0.write_en = fsm0.out == 2'd1 & B[done] ? 1'd1; | ||
fsm1.in = fsm0.out == 2'd1 & B[done] ? 2'd2; | ||
fsm1.write_en = fsm0.out == 2'd1 & B[done] ? 1'd1; | ||
fsm0.in = fsm0.out == 2'd2 & C[done] ? 2'd3; | ||
fsm0.write_en = fsm0.out == 2'd2 & C[done] ? 1'd1; | ||
fsm1.in = fsm0.out == 2'd2 & C[done] ? 2'd3; | ||
fsm1.write_en = fsm0.out == 2'd2 & C[done] ? 1'd1; | ||
tdcc[done] = fsm0.out == 2'd3 ? 1'd1; | ||
} | ||
fsm0.in = fsm0.out == 2'd3 ? 2'd0; | ||
fsm0.write_en = fsm0.out == 2'd3 ? 1'd1; | ||
fsm1.in = fsm0.out == 2'd3 ? 2'd0; | ||
fsm1.write_en = fsm0.out == 2'd3 ? 1'd1; | ||
} | ||
control { | ||
tdcc; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// -x tdcc:duplicate-cutoff=0 -p tdcc | ||
|
||
import "primitives/core.futil"; | ||
import "primitives/memories/comb.futil"; | ||
|
||
component main() -> () { | ||
cells { | ||
a = std_reg(2); | ||
b = std_reg(2); | ||
c = std_reg(2); | ||
} | ||
|
||
wires { | ||
group A { | ||
a.in = 2'd0; | ||
a.write_en = 1'b1; | ||
A[done] = a.done; | ||
} | ||
|
||
group B { | ||
b.in = 2'd1; | ||
b.write_en = 1'b1; | ||
B[done] = b.done; | ||
} | ||
|
||
group C { | ||
c.in = 2'd2; | ||
c.write_en = 1'b1; | ||
C[done] = c.done; | ||
} | ||
} | ||
|
||
control { | ||
seq { A; B; C; } | ||
} | ||
} |