-
Notifications
You must be signed in to change notification settings - Fork 893
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test roundtripping some processes to Verilog and back
- Loading branch information
Showing
1 changed file
with
65 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Test "casez to if/elif/else conversion" in backend | ||
|
||
read_verilog <<EOT | ||
module top(a, b, c, out); | ||
input wire a, b, c; | ||
output reg [3:0] out; | ||
always @(*) begin | ||
casez ({c, b, a}) | ||
3'b??1: begin | ||
out = 0; | ||
end | ||
3'b?1?: begin | ||
out = 1; | ||
end | ||
3'b1??: begin | ||
out = 2; | ||
end | ||
default: begin | ||
out = 3; | ||
end | ||
endcase | ||
end | ||
endmodule | ||
EOT | ||
write_verilog roundtrip_proc_1.v | ||
design -stash gold | ||
read_verilog roundtrip_proc_1.v | ||
design -stash gate | ||
design -copy-from gold -as gold top | ||
design -copy-from gate -as gate top | ||
prep | ||
miter -equiv -flatten -make_assert gold gate miter | ||
hierarchy -top miter | ||
sat -prove-asserts -verify | ||
|
||
design -reset | ||
read_verilog <<EOT | ||
module top(a, b, c, out); | ||
input wire a, b, c; | ||
output reg [3:0] out; | ||
always @(*) begin | ||
out <= 0; | ||
if (a) begin | ||
if (b) | ||
out <= 1; | ||
end else begin | ||
if (c) | ||
out <= 2; | ||
else | ||
out <= 3; | ||
end | ||
end | ||
endmodule | ||
EOT | ||
proc_clean | ||
write_verilog roundtrip_proc_2.v | ||
design -stash gold | ||
read_verilog roundtrip_proc_2.v | ||
design -stash gate | ||
design -copy-from gold -as gold top | ||
design -copy-from gate -as gate top | ||
prep | ||
miter -equiv -flatten -make_assert gold gate miter | ||
hierarchy -top miter | ||
sat -prove-asserts -verify |