fix premature elaboration of single element patterns

This commit is contained in:
Zachary Snow 2020-12-07 16:23:29 -07:00
parent ad18c583ab
commit d137fd3d68
3 changed files with 21 additions and 0 deletions

View File

@ -36,6 +36,7 @@ simplifyStep (UniOp LogNot (BinOp Ne a b)) = BinOp Eq a b
simplifyStep (UniOp UniSub (UniOp UniSub e)) = e
simplifyStep (UniOp UniSub (BinOp Sub e1 e2)) = BinOp Sub e2 e1
simplifyStep (e @ (Concat [Pattern{}])) = e
simplifyStep (Concat [e]) = e
simplifyStep (Concat es) = Concat $ filter (/= Concat []) es
simplifyStep (Repeat (Dec 0) _) = Concat []

View File

@ -0,0 +1,16 @@
module top;
typedef struct packed {
logic a, b;
} T;
typedef struct packed {
logic x;
T y;
} S;
localparam WIDTH = 1;
S [WIDTH] s = '{
'{x: 1, y: '{a: 1, b: 0}}
};
initial #1 $display("%b", s);
endmodule

View File

@ -0,0 +1,4 @@
module top;
wire [2:0] s = 3'b110;
initial #1 $display("%b", s);
endmodule