From aec91c7754717fa0348ab7fce48d2f6d160908bb Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 5 Jul 2025 18:21:01 +0100 Subject: [PATCH] Add regression tests for issue #1256. --- ivtest/ivltests/br_gh1256a.v | 24 ++++++++++++++++++++++++ ivtest/ivltests/br_gh1256b.v | 25 +++++++++++++++++++++++++ ivtest/regress-vvp.list | 2 ++ ivtest/vvp_tests/br_gh1256a.json | 5 +++++ ivtest/vvp_tests/br_gh1256b.json | 5 +++++ 5 files changed, 61 insertions(+) create mode 100644 ivtest/ivltests/br_gh1256a.v create mode 100644 ivtest/ivltests/br_gh1256b.v create mode 100644 ivtest/vvp_tests/br_gh1256a.json create mode 100644 ivtest/vvp_tests/br_gh1256b.json diff --git a/ivtest/ivltests/br_gh1256a.v b/ivtest/ivltests/br_gh1256a.v new file mode 100644 index 000000000..6dcb5005d --- /dev/null +++ b/ivtest/ivltests/br_gh1256a.v @@ -0,0 +1,24 @@ +module test(); + +typedef struct packed { + logic [3:0] a; +} inner_t; + +typedef struct packed { + inner_t [1:0][3:0] fields; +} outer_t; + +outer_t var1; +outer_t var2; + +initial begin + var1 = 32'h12345678; + var2.fields = var1.fields; + $display("%h", var2); + if (var2 === 32'h12345678) + $display("PASSED"); + else + $display("FAILED"); +end + +endmodule diff --git a/ivtest/ivltests/br_gh1256b.v b/ivtest/ivltests/br_gh1256b.v new file mode 100644 index 000000000..8ca8cd5b6 --- /dev/null +++ b/ivtest/ivltests/br_gh1256b.v @@ -0,0 +1,25 @@ +module test(); + +typedef struct packed { + logic [3:0] a; +} inner_t; + +typedef struct packed { + inner_t [1:0][3:0] fields; +} outer_t; + +outer_t var1; +outer_t var2; + +initial begin + var1 = 32'h12345678; + var2.fields[0] = var1.fields[1]; + var2.fields[1] = var1.fields[0]; + $display("%h", var2); + if (var2 === 32'h56781234) + $display("PASSED"); + else + $display("FAILED"); +end + +endmodule diff --git a/ivtest/regress-vvp.list b/ivtest/regress-vvp.list index 72a2fd2cf..4075dd59d 100644 --- a/ivtest/regress-vvp.list +++ b/ivtest/regress-vvp.list @@ -65,6 +65,8 @@ br_gh1180b vvp_tests/br_gh1180b.json br_gh1181 vvp_tests/br_gh1181.json br_gh1184 vvp_tests/br_gh1184.json br_gh1242 vvp_tests/br_gh1242.json +br_gh1256a vvp_tests/br_gh1256a.json +br_gh1256b vvp_tests/br_gh1256b.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_gh1256a.json b/ivtest/vvp_tests/br_gh1256a.json new file mode 100644 index 000000000..c1598a869 --- /dev/null +++ b/ivtest/vvp_tests/br_gh1256a.json @@ -0,0 +1,5 @@ +{ + "type" : "normal", + "source" : "br_gh1256a.v", + "iverilog-args" : [ "-g2009" ] +} diff --git a/ivtest/vvp_tests/br_gh1256b.json b/ivtest/vvp_tests/br_gh1256b.json new file mode 100644 index 000000000..c1598a869 --- /dev/null +++ b/ivtest/vvp_tests/br_gh1256b.json @@ -0,0 +1,5 @@ +{ + "type" : "normal", + "source" : "br_gh1256a.v", + "iverilog-args" : [ "-g2009" ] +}