Re: [sv-bc] Question about #110 divide by 0

From: Steven Sharp <sharp@cadence.com>
Date: Fri Dec 03 2004 - 17:03:39 PST

>What are "operands in the 2-state value set" in Verilog-2005

"Operands in the 2-state value set" means any operand that contains
only bits that are 0 or 1, not X or Z. Those are the values in the
2-state value set. Note that it would be incorrect to refer to
these as 2-state operands. A Verilog reg is 4-state, even if its
current value is 0. All vectors are 4-state in Verilog.

It would have been more accurate (and verbose) to have written
"operands with values in the 2-state value set" instead. However,
I assume that your concern is the question about array indexing.

>What other operators can produce an X?

Lots of them, but not for operands in the 2-state value set :-)

There are at least 3 operators that can do that. Division, as has
been mentioned. Modulo by zero also produces x. And exponentiation
when the first operand is zero and the second operand is negative.
The text was written very generally to ensure we didn't miss any.

> Is an index into an array considered an operator?

I'm afraid not, according to the Verilog LRM. I do like your suggestion
that an out-of-range index should produce an X for an array of 2-state
vectors. I just don't think this proposal does that. Nor would I have
written the proposal intending it to do that without discussing it with
the group.

>int A[5];
>
>integer I = A[7]; This will always produce an X in Verilog-2005. Will it
>in SystemVerilog?

I don't think so. To change that, we would have to change the rule at
the end of section 4.3 (and presumably Table 4-1 for associative arrays).

Steven Sharp
sharp@cadence.com
Received on Fri Dec 3 17:03:44 2004

This archive was generated by hypermail 2.1.8 : Fri Dec 03 2004 - 17:03:52 PST