module ass_op;
bit [3:0]a=4'hF;
bit [3:0]b=4'b111z;
initial begin
if(a=?=b) $display("a==?b");
if(a=?=4'b111z) $display("a==?4'b1x1z");
if(b =?=a)$display("b==?a");
end
endmodule
Result is # a==?4’b1x1z .
Why first if loop display is not coming?
for “==?” operands to be in integral. Try using “integer”.
=?= are not present in LRM.
module ass_op;
bit [3:0]a=4'hF;
bit [3:0]b=4'b111z;
initial begin
if(a==?b) $display("a==?b");
if(a==?4'b111z) $display("a==?4'b1x1z");
if(b ==?a)$display("b==?a");
end
endmodule
*In reply to rakesh reddy:*b needs to be declared with a 4-state to hold a ‘z’ state. Try
module ass_op;
bit [3:0]a=4'hF;
logic [3:0]b=4'b111z;
initial begin
if(a==?b) $display("a==?b"); //match
if(a==?4'b111z) $display("a==?4'b1x1z"); // match
if(b ==?a)$display("b==?a"); // no match
end
endmodule
you are declaring a and b as bit type so it will treat x and z as 0. so it the first statement is not getting printed. If you use logic as data type you can observe all three statements.