Never ever do the following:
Code:inr = V(in);
V(out) <- $transition(inr,0,t,t);
In other words, the first argument to the transition function should never be a continuous function of an electrical signal, even if you believe the electrical signal is constant. In contrast, the following is perfectly fine:
Code:@(cross( V(clk) - thres, 1))
inr = V(in);
V(out) <- $transition(inr,0,t,t);
The difference her is that
inr is set in an event block and so cannot vary continuously with
V(in).
Many times I have seen code that looks like the following:
Code:if (...)
val = 1;
else
val = 0;
V(out) <+ transition(val*V(vdd), 0, 10n);
Such code leads to heartbreak and misery. The problem is that
V(vdd) is computed by the simulator, and can change slightly from time point to time point (often time these changes are at the attovolt level). Those changes will activate the transition function, which limits the time steps and slow the simulation. You should instead use:
Code:if (...)
val = 1;
else
val = 0;
V(out) <+ V(vdd)*transition(val, 0, 10n);
-Ken