diff options
author | Zachary Snow <zach@zachjs.com> | 2020-08-09 09:52:55 -0600 |
---|---|---|
committer | Zachary Snow <zach@zachjs.com> | 2020-08-09 17:21:08 -0400 |
commit | 2ee0b8ebeacb8f4324545bbbc5003ddc3d96a6c5 (patch) | |
tree | dfd799cefa251c6a46feb463fadd39092dcc3bf2 /tests | |
parent | 9a4f420b4b8285bd05181b6988c35ce45e3c979a (diff) | |
download | yosys-2ee0b8ebeacb8f4324545bbbc5003ddc3d96a6c5.tar.gz yosys-2ee0b8ebeacb8f4324545bbbc5003ddc3d96a6c5.tar.bz2 yosys-2ee0b8ebeacb8f4324545bbbc5003ddc3d96a6c5.zip |
Propagate const_fold through generate blocks and branches
Diffstat (limited to 'tests')
-rw-r--r-- | tests/simple/const_branch_finish.v | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/simple/const_branch_finish.v b/tests/simple/const_branch_finish.v new file mode 100644 index 000000000..8166688e6 --- /dev/null +++ b/tests/simple/const_branch_finish.v @@ -0,0 +1,39 @@ +`define CONSTANT_CHECK \ + if (WIDTH === 'bx) begin \ + $display("FAIL"); \ + $finish; \ + end + +module top; + parameter WIDTH = 32; + integer j; + initial begin + `CONSTANT_CHECK + if (WIDTH == 32) begin : procedural_conditional_block + `CONSTANT_CHECK + end + case (WIDTH) + 32: `CONSTANT_CHECK + default: ; + endcase + for (j = 0; j < 2; j = j + 1) begin : procedural_loop_block + `CONSTANT_CHECK + end + end + generate + begin : unconditional_block + initial `CONSTANT_CHECK + end + if (WIDTH == 32) begin : conditional_block + initial `CONSTANT_CHECK + end + case (WIDTH) + 32: initial `CONSTANT_CHECK + default: ; + endcase + genvar i; + for (i = 0; i < 2; i = i + 1) begin : loop_block + initial `CONSTANT_CHECK + end + endgenerate +endmodule |