Files
iverilog/ivtest/ivltests/display_bug.v
T
Stephen Williams cea237b407 Add ivtest to the iverilog source tree
By adding ivtest to the iverilog source tree, it is easier to keep
the regression test synchronized with the source that is being tested.
This should be especially helpful for PRs that add a new feature, and
have a matching ivtest PR with the regression test for that feature.
2022-01-15 10:18:50 -08:00

30 lines
749 B
Verilog

module main;
typedef struct packed {
logic [7:0] high;
logic [7:0] low;
} word;
word [2] array; // word[0:1] exposes the bug as well
word single;
initial begin
array[0].high = "a";
array[0].low = "b";
array[1].high = "c";
array[1].low = "d";
$display("%s", array[0]); // good
$display("%s %s", array[0].high, array[0].low);
$display("%s", array[1]); // good
// the line below displays contents of array[0] instead of array[1]
$display("%s %s", array[1].high, array[1].low);
// below everything is fine
single = array[0];
$display("%s", single);
$display("%s %s", single.high, single.low);
end
endmodule