( Post 59 Item # 1 ) ------------------------------------------------------
From: parkin@ultrasparc.Eng.Sun.COM (Michael Parkin)
This is in response to Posting 56 Item #1 Topic 4.
Unknown propagation
I believe x propagation is important at the behavioral/RTL
level. A few simply techniques can greatly enhance
x propagation. X propagation in an RTL level design
most likely means there are logical bugs. These bugs
can easily be masked with improper RTL coding. They
can also be masked in the gate level design. It is
therefore important to propagate x's in the RTL so
this behaviour becomes visible to the designer.
Some simple techniques in verilog can facilitate x
propagation:
If statements should be used with care since they do
not properly handle unknowns during simulation. While
this is not a problem for synthesis it can cause
incorrect results in the behavioral verilog simulation.
When the if expression is unknown, the then-clause will
not be executed and the unknown value will not be propagated.
The else-clause will be executed if one exists and a known
value will be returned.
always @(a or in0 or in1)
if (a)
result = in0:
else result = in1;
The selector operator will propagate unknowns (provided
in0 & in1 are different) and is more concise.
assign result = a ? in0 : in1;
If "a" is unknown and (in0 == in1) the return value should be
known. Muxes should be modeled in this way so that the
gate-level logic simulates correctly, otherwise some flip-flops
will not reset.
Case statements
For x propagation through a case statement always use a
default statement:
default: dout = 3'bx;
Never use the full_case directive.
The casez statement allows don't-care conditions to be specified
on the inputs as well as the outputs. The casex construct
should not be used because of the way in handles unknowns. For
the purposes of synthesis casez and casex are the same but for
simulation they are significantly different. The problem with
casex occurs when any bit of the case expression becomes unknown.
This unknown becomes a wildcard which will match any corresponding
bit in the case-item. If the entire case expression becomes unkown
it will match the first case-item instead of the default which is
desired.
|
|