T
Tim Johnson
Guest
I need to implement an assertion statement, with pseudo-code as
follows:
assert(expr) begin
... take this branch if expr is 0 or unknown
$finish;
end
Probably dumb question: what's the simplest way to do the conditional?
The problem is handling X or Z values in 'expr'. The '$finish' is only
taken if expr is 0 or unknown. In other words, is there a simple
negative-logic version of "if(expr)"?
"if(!expr)" doesn't work because the assertion block isn't entered if
expr contains an X or Z. "if(expr == 0)" and "if(expr === 0)" are the
same.
At first sight, I need
if((expr === 0) || (!expr === X)) begin
...
end
or even
lbl: begin
if(expr)
disable lbl;
$finish;
end
Have I missed something?
Thanks - Tim
follows:
assert(expr) begin
... take this branch if expr is 0 or unknown
$finish;
end
Probably dumb question: what's the simplest way to do the conditional?
The problem is handling X or Z values in 'expr'. The '$finish' is only
taken if expr is 0 or unknown. In other words, is there a simple
negative-logic version of "if(expr)"?
"if(!expr)" doesn't work because the assertion block isn't entered if
expr contains an X or Z. "if(expr == 0)" and "if(expr === 0)" are the
same.
At first sight, I need
if((expr === 0) || (!expr === X)) begin
...
end
or even
lbl: begin
if(expr)
disable lbl;
$finish;
end
Have I missed something?
Thanks - Tim