Guest
Hi everyone,
I have run this small code and seeing many variations can you plaese
suggest why is that so:
module top;
reg [1:0] c;
reg [1:0] a = 2'b10;
reg [1:0] b = 2'b01;
reg [1:0] if_out;
wire [1:0] out;
assign out = c ? a : b;
initial
begin
#1 c = 2'b1x;
if(c)
if_out = a;
else
if_out = b;
#1 $display("out:%b, if_out:%b, c:%b",out,if_out,c);
end
endmodule
output:
out:10, if_out:10, c:1x
Now if i change c to 2'bXX
out:xx, if_out:01, c:xx
Now if i change c to 2'bx0
out:xx, if_out:01, c:x0
I have run this small code and seeing many variations can you plaese
suggest why is that so:
module top;
reg [1:0] c;
reg [1:0] a = 2'b10;
reg [1:0] b = 2'b01;
reg [1:0] if_out;
wire [1:0] out;
assign out = c ? a : b;
initial
begin
#1 c = 2'b1x;
if(c)
if_out = a;
else
if_out = b;
#1 $display("out:%b, if_out:%b, c:%b",out,if_out,c);
end
endmodule
output:
out:10, if_out:10, c:1x
Now if i change c to 2'bXX
out:xx, if_out:01, c:xx
Now if i change c to 2'bx0
out:xx, if_out:01, c:x0