RE: [sv-bc] enumerated variable used with an equality operator

From: Bresticker, Shalom <shalom.bresticker@intel.com>
Date: Mon Mar 24 2014 - 21:59:02 PDT
The intent (at least my intent) was to remove relational operators from the following sentence:

"Enumerated variables are type-checked in assignments, arguments, and relational operators."

That is, to remove the requirement that type-checking occur in relational operators.

I believe the requirement contradicts the following sentence in the LRM:

"Enumerated variables are auto-cast into integral values, but assignment of arbitrary expressions to an enumerated
variable requires an explicit cast."

and the following statements from 6.19.4:

"Elements of enumerated type variables can be used in numerical expressions. The value used in the
expression is the numerical value associated with the enumerated value."

"An enum variable or identifier used as part of an expression is automatically cast to the base type of the
enum declaration (either explicitly or using int as the default). A cast shall be required for an expression
that is assigned to an enum variable where the type of the expression is not equivalent to the enumeration
type of the variable."

These other statements say that when enums are used in expressions, they are cast to their base types, and that casting to the enum type is required in an assignment to an enum (but other cases are not mentioned).

Regards,
Shalom

> -----Original Message-----
> From: Greg Jaxon [mailto:Greg.Jaxon@synopsys.com]
> Sent: Monday, March 24, 2014 21:06
> To: Bresticker, Shalom; stuart@sutherland-hdl.com; 'SV_BC List'
> Subject: Re: [sv-bc] enumerated variable used with an equality operator
> 
> I'm not parsing this discussion; could you clarify?
> The published LRM specifies type-checks, an errata is on file saying we
> don't check.
> When the "errata is fixed", will the LRM continue to say that
> relationals between enums must check their strict types?
> Or will the errata be retracted?
> 
> One reason few, if any, implementations check this error is because
> their type-balancing lattice
> may prefer to rewrite enums as base-type literals earlier than the
> checking rule requires.
> The progress of (System)Verilog type determination is already one of
> the deepest mysteries in IEEE-1800
> 
> On 3/23/2014 4:12 AM, Bresticker, Shalom wrote:
> > I did. It is Mantis 4708.
> >
> >> The one exception is to fix the errata in the LRM Shalom noted
> >> in this e-mail thread that says the strong type checking applies to
> >> relational operators on enumerated labels.  This errata is something
> I
> >> discussed with Shalom last year, and I thought he had filed a Mantis
> > item
> >> about it.  All simulators and synthesis compilers I have checked
> ignore
> >> that errata.

---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Mon Mar 24 21:59:43 2014

This archive was generated by hypermail 2.1.8 : Mon Mar 24 2014 - 21:59:49 PDT