From ae78218c2f2c8c8defe8c4c3248d89afcb31b662 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Tue, 3 Sep 2024 21:38:09 +0100 Subject: [PATCH] Add regression test for issue #1155. --- ivtest/ivltests/br_gh1155.v | 34 +++++++++++++++++++++++++++++++++ ivtest/regress-vvp.list | 1 + ivtest/vvp_tests/br_gh1155.json | 4 ++++ 3 files changed, 39 insertions(+) create mode 100644 ivtest/ivltests/br_gh1155.v create mode 100644 ivtest/vvp_tests/br_gh1155.json diff --git a/ivtest/ivltests/br_gh1155.v b/ivtest/ivltests/br_gh1155.v new file mode 100644 index 000000000..7ab7d6dde --- /dev/null +++ b/ivtest/ivltests/br_gh1155.v @@ -0,0 +1,34 @@ +module test; + +// The test is sensitive to the order in which the code is generated for +// the individual assignments, which currently depends on the alphabetic +// order of the array names. So duplicate the test with the order reversed +// to protect against future compiler changes. + +wire [7:0] array1[0:1]; +wire [7:0] array2[0:0]; + +assign array2[0] = 8'h55; + +assign array1[0] = { array2[0] }; +assign array1[1] = { array2[0] }; + +wire [7:0] array3[0:0]; +wire [7:0] array4[0:1]; + +assign array3[0] = 8'haa; + +assign array4[0] = { array3[0] }; +assign array4[1] = { array3[0] }; + +initial begin + #0 $display("%h %h", array1[0], array1[1]); + #0 $display("%h %h", array4[0], array4[1]); + if (array1[0] === 8'h55 && array1[1] === 8'h55 && + array4[0] === 8'haa && array4[1] === 8'haa) + $display("PASSED"); + else + $display("FAILED"); +end + +endmodule diff --git a/ivtest/regress-vvp.list b/ivtest/regress-vvp.list index 6f3d6da74..0730ccfbf 100644 --- a/ivtest/regress-vvp.list +++ b/ivtest/regress-vvp.list @@ -58,6 +58,7 @@ br_gh1143e vvp_tests/br_gh1143e.json br_gh1143f vvp_tests/br_gh1143f.json br_gh1143g vvp_tests/br_gh1143g.json br_gh1143h vvp_tests/br_gh1143h.json +br_gh1155 vvp_tests/br_gh1155.json ca_time_real` vvp_tests/ca_time_real.json case1 vvp_tests/case1.json case2 vvp_tests/case2.json diff --git a/ivtest/vvp_tests/br_gh1155.json b/ivtest/vvp_tests/br_gh1155.json new file mode 100644 index 000000000..254478aed --- /dev/null +++ b/ivtest/vvp_tests/br_gh1155.json @@ -0,0 +1,4 @@ +{ + "type" : "normal", + "source" : "br_gh1155.v" +}