diff options
author | Claire Xenia Wolf <claire@clairexen.net> | 2023-01-11 04:10:12 +0100 |
---|---|---|
committer | Claire Xenia Wolf <claire@clairexen.net> | 2023-01-11 04:10:12 +0100 |
commit | 6d56d4ecfc2c9afda3fd58f945a5f10daf87a999 (patch) | |
tree | 8b2e2cd5018674f287ae8b2c20877615fec8b555 /tests | |
parent | 029b0aac7f10ff5e1d927fb6ec1d9571a5350176 (diff) | |
parent | 7b476996df962b63656152f643ff2181143f516e (diff) | |
download | yosys-6d56d4ecfc2c9afda3fd58f945a5f10daf87a999.tar.gz yosys-6d56d4ecfc2c9afda3fd58f945a5f10daf87a999.tar.bz2 yosys-6d56d4ecfc2c9afda3fd58f945a5f10daf87a999.zip |
Merge branch 'master' of github.com:YosysHQ/yosys into claire/eqystuff
Diffstat (limited to 'tests')
-rw-r--r-- | tests/svtypes/struct_array.sv | 60 | ||||
-rw-r--r-- | tests/various/cellarray_array_connections.ys | 45 |
2 files changed, 105 insertions, 0 deletions
diff --git a/tests/svtypes/struct_array.sv b/tests/svtypes/struct_array.sv index f69c4c577..739f202ab 100644 --- a/tests/svtypes/struct_array.sv +++ b/tests/svtypes/struct_array.sv @@ -81,6 +81,66 @@ module top; always_comb assert(s3_b==80'hFC00_4200_0012_3400_FFFC); + struct packed { + bit [0:7] [0:1] [0:3] a; + bit [0:15] b; // filler for non-zero offset + } s3_lll; + + initial begin + s3_lll = '0; + + s3_lll.a[5:6] = 16'h1234; + s3_lll.a[2] = 8'h42; + + s3_lll.a[0] = '1; + s3_lll.a[0][1][2:3] = '0; + + s3_lll.b = '1; + s3_lll.b[14:15] = '0; + end + + always_comb assert(s3_lll==80'hFC00_4200_0012_3400_FFFC); + + struct packed { + bit [0:7] [1:0] [0:3] a; + bit [0:15] b; // filler for non-zero offset + } s3_lbl; + + initial begin + s3_lbl = '0; + + s3_lbl.a[5:6] = 16'h1234; + s3_lbl.a[2] = 8'h42; + + s3_lbl.a[0] = '1; + s3_lbl.a[0][0][2:3] = '0; + + s3_lbl.b = '1; + s3_lbl.b[14:15] = '0; + end + + always_comb assert(s3_lbl==80'hFC00_4200_0012_3400_FFFC); + + struct packed { + bit [0:7] [0:1] [3:0] a; + bit [0:15] b; // filler for non-zero offset + } s3_llb; + + initial begin + s3_llb = '0; + + s3_llb.a[5:6] = 16'h1234; + s3_llb.a[2] = 8'h42; + + s3_llb.a[0] = '1; + s3_llb.a[0][1][1:0] = '0; + + s3_llb.b = '1; + s3_llb.b[14:15] = '0; + end + + always_comb assert(s3_llb==80'hFC00_4200_0012_3400_FFFC); + `ifndef VERIFIC // Note that the tests below for unpacked arrays in structs rely on the // fact that they are actually packed in Yosys. diff --git a/tests/various/cellarray_array_connections.ys b/tests/various/cellarray_array_connections.ys new file mode 100644 index 000000000..ef36a9a45 --- /dev/null +++ b/tests/various/cellarray_array_connections.ys @@ -0,0 +1,45 @@ +# Regression test for #3467 +read_verilog <<EOT + +module bit_buf ( + input wire bit_in, + output wire bit_out +); + assign bit_out = bit_in; +endmodule + +module top ( + input wire [3:0] data_in, + output wire [3:0] data_out +); + + wire [3:0] data [0:4]; + + assign data[0] = data_in; + assign data_out = data[4]; + + genvar i; + generate + for (i=0; i<=3; i=i+1) begin + bit_buf bit_buf_instance[3:0] ( + .bit_in(data[i]), + .bit_out(data[i + 1]) + ); + end + endgenerate +endmodule + +module top2 ( + input wire [3:0] data_in, + output wire [3:0] data_out +); + assign data_out = data_in; +endmodule + +EOT + +hierarchy +proc + +miter -equiv -make_assert -flatten top top2 miter +sat -prove-asserts -verify miter |