Commit 296e2461 by Zachary Snow

fix multi-dimensional array unbased unsized pattern conversion

parent 95208947
...@@ -192,7 +192,7 @@ convertExpr t (Mux c e1 e2) = ...@@ -192,7 +192,7 @@ convertExpr t (Mux c e1 e2) =
-- populate arrays. Maybe this should be somewhere else? -- populate arrays. Maybe this should be somewhere else?
convertExpr (IntegerVector t sg (r:rs)) (Pattern [(":default", e)]) = convertExpr (IntegerVector t sg (r:rs)) (Pattern [(":default", e)]) =
Repeat (rangeSize r) [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 -- TODO: This is a conversion for concat array literals with elements
-- that are unsized numbers. This probably belongs somewhere else. -- that are unsized numbers. This probably belongs somewhere else.
convertExpr (t @ IntegerVector{}) (Pattern items) = convertExpr (t @ IntegerVector{}) (Pattern items) =
......
...@@ -102,6 +102,16 @@ module top; ...@@ -102,6 +102,16 @@ module top;
`TEST_OP(1, ==, 2'h3 == '1, 1'b1) `TEST_OP(1, ==, 2'h3 == '1, 1'b1)
end 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 endmodule
module M(a, b, c, d); module M(a, b, c, d);
......
...@@ -97,6 +97,16 @@ module top; ...@@ -97,6 +97,16 @@ module top;
`TEST_OP(1, ==, 2'h3 == '1, 1'b1) `TEST_OP(1, ==, 2'h3 == '1, 1'b1)
end 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 endmodule
module M(a, b, c, d); module M(a, b, c, d);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment