Please explain the difference between two statement as they are behaving differently in side hardware.
reg [31:0]A;
wire B;
Statement 1
assign B = (A==32'h0)?(1'b1):(1'b0);
Statement 2
assign B = (A==32'h0);
Please explain the difference between two statement as they are behaving differently in side hardware.
reg [31:0]A;
wire B;
Statement 1
assign B = (A==32'h0)?(1'b1):(1'b0);
Statement 2
assign B = (A==32'h0);
I suspect the A
contains 'x
, this would make result in (A==32'h0) to be evaluated as 'x
; then you have B = 1'bx
.
What is the meaning of this in the circuit? I guess it 'x
will be handled by the tool as Don't care
and this will be used to further simplify the hardware.
#Edit:
As noted by Serge in the comments, the ternary would give 'x not '0. A if('x) B=1'b1; else B=1'b0;
in a procedural block would give '0, but not what the ternary does in verilog.