mirror of
https://github.com/zachjs/sv2v.git
synced 2026-08-30 17:31:40 +02:00
fix struct typing of ternary expressions (resolves #73)
This commit is contained in:
@@ -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
|
||||
@@ -0,0 +1,5 @@
|
||||
module Example(flag, out);
|
||||
output wire [1:0] out;
|
||||
input wire flag;
|
||||
assign out = flag ? 2'b10 : 2'b11;
|
||||
endmodule
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user