ISSUE 83

Add Proposal  Add Analysis  Edit Class, Environment, or Release
Number 83
Category errata
Synopsis 4.5: Expression type/evaluation issues with real operands
State open
Class errata-discuss
Arrival-DateJul 30 2002
Originator Dennis Marsa
Release 2001b: 4.5
Environment
Description
1) Section 4.5.1 includes the following text in the rules
for determining the result type of an expression:

"Reals converted to integers by type coercion are signed"

Does the above statement belong here?

According to Section 3.9.2, a real is converted to
integer only when a real result is assigned to an
integer variable.

But an assignment is not an expression, and the type
of the LHS of an assignment does not effect how the
RHS expression is processed.

Reals can be explicitly converted to an integer value
by using either the $rtoi or $realtobits system
functions. However, the result type of those functions
are defined to be "integer" and "[63:0]", respectively,
and the rules for handling operands of those types ar
already defined by the other statements in section 4.5.1.

2) Section 4.5.1 also includes the following statement:

"For non-self-determined operands the following rules
apply:
if any operand is real the result is real;"

Taking this statement together with the rules for
evaluating an expression from section 4.5.2 would
seem to indicate that the expression:

(1 / 2) + 0.0

should evaluate to 0.5, because one operand (0.0) being
real, would force all non-self-determined operands to
be converted to real before the expression is evaluated.
Thus, after type conversion, we would have:

(1.0 / 2.0) + 0.0

which would yield a result of 0.5.

Is this the correct interpretation of how real operands
should be handled?

Verilog-XL, NC-Verilog and MTI all currently evaluate
the above expression to 0.0.

3) Section 4.5.2 contains the statement:

"Determine the sign of the expression using the rules
outlined in 4.5.1."

It be better for the word "sign" to be changed
to "type", so that the statement reads:

"Determine the type of the expression usiing the rules
outlined in 4.5.1."

4) The title of section 4.5 is "Signed Expressions" though
it really discusses how to determine the type of, and
evaluate, an expression. Perhaps a better title would
be something like:

"Expression Type Determination and Evaluation"

or maybe just:

"Expression Evaluation"
Fix

Audit-Trail
Unformatted


Hosted by Boyd Technology