Hi All,
I was wondering if there is a way we can use $sformatf in an if condition? I tried using it as shown below
module run_module();
int i=1;
initial
begin
if(i == $sformatf("%d",1))
$display("worked");
else
$display("dint work");
$display(i);
$display("%d",1);
end
endmodule : run_module
By running the above code I get the following output :
didn’t work
1
1
There are no errors or warnings but somehow the behavior is not what I expected. Can someone explain if this is possible?
Thanks