diff options
author | Marcelina KoĆcielnicka <mwk@0x04.net> | 2021-05-22 20:27:51 +0200 |
---|---|---|
committer | Marcelina KoĆcielnicka <mwk@0x04.net> | 2021-05-23 14:30:56 +0200 |
commit | a23d9409e7d04fcfa31a139d0cf6169be4c46fca (patch) | |
tree | 9ae67eb7826799ab60fabdcaf44c93e660f69996 /tests/opt | |
parent | 039f4f48d55609f254850112a948f26e66550095 (diff) | |
download | yosys-a23d9409e7d04fcfa31a139d0cf6169be4c46fca.tar.gz yosys-a23d9409e7d04fcfa31a139d0cf6169be4c46fca.tar.bz2 yosys-a23d9409e7d04fcfa31a139d0cf6169be4c46fca.zip |
opt_mem: Remove write ports with const-0 EN.
Fixes #2765.
Diffstat (limited to 'tests/opt')
-rw-r--r-- | tests/opt/bug2765.ys | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/opt/bug2765.ys b/tests/opt/bug2765.ys new file mode 100644 index 000000000..de670c2d1 --- /dev/null +++ b/tests/opt/bug2765.ys @@ -0,0 +1,34 @@ +read_verilog << EOT + +module top(...); + +input clk; +input [3:0] wa; +input [15:0] wd; +input [3:0] ra; +output [15:0] rd; + +reg [15:0] mem[0:15]; + +integer i; +reg x; + +always @(posedge clk) begin + for (i = 0; i < 2; i = i + 1) begin + x = i == 1; + if (x) + mem[wa] <= wd; + end +end + +assign rd = mem[ra]; + +endmodule + +EOT + +proc +opt +select -assert-count 2 t:$memwr +opt_mem +select -assert-count 1 t:$memwr |