diff options
author | Clifford Wolf <clifford@clifford.at> | 2019-05-03 15:29:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-03 15:29:44 +0200 |
commit | 71ede7cb05ae35c90eccb80ffc413b4559ba7e60 (patch) | |
tree | 73229c3e02655a9fd3c9f2bb987f44b226d65fc7 /tests | |
parent | 97423caddaafa0fbaca6f541a9c3e17f036b198b (diff) | |
parent | 6bbe2fdbf32e6335cdbecc21547e54992c3a606d (diff) | |
download | yosys-71ede7cb05ae35c90eccb80ffc413b4559ba7e60.tar.gz yosys-71ede7cb05ae35c90eccb80ffc413b4559ba7e60.tar.bz2 yosys-71ede7cb05ae35c90eccb80ffc413b4559ba7e60.zip |
Merge pull request #976 from YosysHQ/clifford/fix974
Fix width detection of memory access with bit slice
Diffstat (limited to 'tests')
-rw-r--r-- | tests/simple/mem2reg.v | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/simple/mem2reg.v b/tests/simple/mem2reg.v index 9839fd4a8..100426785 100644 --- a/tests/simple/mem2reg.v +++ b/tests/simple/mem2reg.v @@ -92,3 +92,25 @@ module mem2reg_test5(input ctrl, output out); assign out = bar[foo[0]]; endmodule +// ------------------------------------------------------ + +module mem2reg_test6 (din, dout); + input wire [3:0] din; + output reg [3:0] dout; + + reg [1:0] din_array [1:0]; + reg [1:0] dout_array [1:0]; + + always @* begin + din_array[0] = din[0 +: 2]; + din_array[1] = din[2 +: 2]; + + dout_array[0] = din_array[0]; + dout_array[1] = din_array[1]; + + {dout_array[0][1], dout_array[0][0]} = dout_array[0][0] + dout_array[1][0]; + + dout[0 +: 2] = dout_array[0]; + dout[2 +: 2] = dout_array[1]; + end +endmodule |