Re: [sv-bc] Re: if-else

From: Steven Sharp <sharp_at_.....>
Date: Thu Nov 01 2007 - 07:51:06 PDT
John,

As you have noted,

	if (expression)
	
is equivalent to

	if (expression != 0)

The problem is then that the results of the equality operator are not
clearly specified when unknowns are involved.  The correct answer is
that (value1 != value2) is equivalent to (|(value1 ^ value2)).  So for
(expression != 0), that is equivalent to (|expression), as you have
suggested.

This definition makes sense.  If any of the bits are 1, then the value
is definitely not equal to zero, no matter what any unknown bits are.
If all of the bits are 0, then the value is definitely equal to zero.
If the bits are a mixture of 0 and X/Z, then it is unknown whether the
value is equal to zero.  It depends on the value of the unknown bits.

After that, there is the issue of how if-else deals with an unknown
condition.  It rather arbitrarily treats an unknown condition as false.
Jonathan's suggestion of a cast to "bit" has this same effect.  This
treatment can cause simulation to produce optimistic results, which is
undesirable, but that is how it works.
	
Steven Sharp
sharp@cadence.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Nov 1 07:51:25 2007

This archive was generated by hypermail 2.1.8 : Thu Nov 01 2007 - 07:51:42 PDT