Add regression test for 2-state array initial value propagation
Check that the initial value that gets propagated for 2-state arrays is '0. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
0eb01fff1e
commit
6e81891de0
|
|
@ -0,0 +1,34 @@
|
|||
// Check that the initial value of a 2-state array is properly propagated
|
||||
|
||||
module test;
|
||||
|
||||
bit failed = 1'b0;
|
||||
|
||||
`define check(expr, val) \
|
||||
if (expr !== val) begin \
|
||||
$display("FAILED(%0d): `%s`, expected %0d, got %0d", `__LINE__, `"expr`", val, expr); \
|
||||
failed = 1'b1; \
|
||||
end
|
||||
|
||||
bit [1:0] a[2];
|
||||
integer i = 0;
|
||||
|
||||
wire [1:0] x = a[0];
|
||||
wire [1:0] y = a[i];
|
||||
wire [2:0] z = {1'b1, a[0]};
|
||||
wire w = a[0][0];
|
||||
|
||||
initial begin
|
||||
#1;
|
||||
`check(a[0], 2'b00);
|
||||
`check(x, 2'b00);
|
||||
`check(y, 2'b00);
|
||||
`check(z, 3'b100);
|
||||
`check(w, 1'b0);
|
||||
|
||||
if (!failed) begin
|
||||
$display("PASSED");
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
|
|
@ -48,6 +48,7 @@ pv_wr_fn_vec2 vvp_tests/pv_wr_fn_vec2.json
|
|||
pv_wr_fn_vec4 vvp_tests/pv_wr_fn_vec4.json
|
||||
struct_packed_write_read vvp_tests/struct_packed_write_read.json
|
||||
struct_packed_write_read2 vvp_tests/struct_packed_write_read2.json
|
||||
sv_2state_array_init_prop vvp_tests/sv_2state_array_init_prop.json
|
||||
sv_ap_uarray1 vvp_tests/sv_ap_uarray1.json
|
||||
sv_ap_uarray2 vvp_tests/sv_ap_uarray2.json
|
||||
sv_ap_uarray3 vvp_tests/sv_ap_uarray3.json
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"type" : "normal",
|
||||
"source" : "sv_2state_array_init_prop.v",
|
||||
"iverilog-args" : [ "-g2005-sv" ]
|
||||
}
|
||||
Loading…
Reference in New Issue