fix struct typing of ternary expressions (resolves #73)

This commit is contained in:
Zachary Snow
2020-02-15 14:44:49 -05:00
parent b124a561f2
commit fe8839eaec
4 changed files with 34 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
module Example(flag, out);
typedef struct packed {
logic a, b;
} T;
output T out;
input logic flag;
assign out =
flag
? '{ a: 1'b1, b: 1'b0 }
: '{ a: 1'b1, b: 1'b1 }
;
endmodule
+5
View File
@@ -0,0 +1,5 @@
module Example(flag, out);
output wire [1:0] out;
input wire flag;
assign out = flag ? 2'b10 : 2'b11;
endmodule
+12
View File
@@ -0,0 +1,12 @@
module top;
reg flag;
wire [1:0] out;
Example example(flag, out);
initial begin
$monitor("%2d %b %b", $time, flag, out);
#1 flag = 0;
#1 flag = 1;
#1 flag = 0;
#1 flag = 1;
end
endmodule