fix multi-dimensional array unbased unsized pattern conversion

This commit is contained in:
Zachary Snow 2020-07-06 22:26:04 -06:00
parent 9520894720
commit 296e246158
3 changed files with 21 additions and 1 deletions

View File

@ -192,7 +192,7 @@ convertExpr t (Mux c e1 e2) =
-- populate arrays. Maybe this should be somewhere else?
convertExpr (IntegerVector t sg (r:rs)) (Pattern [(":default", e)]) =
Repeat (rangeSize r) [e']
where e' = convertExpr (IntegerVector t sg rs) e
where e' = Cast (Left $ IntegerVector t sg rs) e
-- TODO: This is a conversion for concat array literals with elements
-- that are unsized numbers. This probably belongs somewhere else.
convertExpr (t @ IntegerVector{}) (Pattern items) =

View File

@ -102,6 +102,16 @@ module top;
`TEST_OP(1, ==, 2'h3 == '1, 1'b1)
end
parameter A = 8;
parameter B = 5;
logic [A-1:0][B-1:0] arr;
initial begin
arr = '{default: '1}; $display("%b", arr);
arr = '{default: '0}; $display("%b", arr);
arr = '{default: 'x}; $display("%b", arr);
arr = '{default: 'z}; $display("%b", arr);
end
endmodule
module M(a, b, c, d);

View File

@ -97,6 +97,16 @@ module top;
`TEST_OP(1, ==, 2'h3 == '1, 1'b1)
end
parameter A = 8;
parameter B = 5;
reg [A*B-1:0] arr;
initial begin
arr = 1'sb1; $display("%b", arr);
arr = 1'sb0; $display("%b", arr);
arr = 1'sbx; $display("%b", arr);
arr = 1'sbz; $display("%b", arr);
end
endmodule
module M(a, b, c, d);