RE: [sv-bc] enumerated types


Subject: RE: [sv-bc] enumerated types
From: Peter Flake (Peter.Flake@synopsys.com)
Date: Mon Sep 01 2003 - 05:37:21 PDT


Hi Mark,

As I understand it, constant expressions allow only parameter, specparam or
localparam, not const. Maybe they should be called "parameter expressions".

These expressions also do not allow hierarchical names, so I think the
answer to Steven's question "Is it legal to make a hierarchical reference
to an enum constant name used in a type definition in another scope?" is no.

Regards,

Peter.

At 08:54 30/08/2003 -0700, Karen Pieper wrote:
>Bounced mail...
>
>
>>From: "Mark Hartoog" <Mark.Hartoog@synopsys.com>
>>To: <sv-bc@server.eda.org>
>>Subject: RE: [sv-bc] enumerated types
>>Date: Fri, 29 Aug 2003 13:02:11 -0700
>>Message-ID: <NGEBIPIGDOEMMEDCGNHPKEKKEDAA.markh@synopsys.com>
>>MIME-Version: 1.0
>>Content-Type: text/plain;
>> charset="us-ascii"
>>Content-Transfer-Encoding: 7bit
>>X-Priority: 3 (Normal)
>>X-MSMail-Priority: Normal
>>X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0)
>>X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
>>Importance: Normal
>>In-Reply-To: <HPECIHFPOFICGBKPKCGMOEFFDCAA.bpierce@synopsys.com>
>>
>> > Two places that constant expressions are defined --
>> >
>> > A.8.3 (p. 294) in SV3.1 LRM
>> >
>> > Third paragraph of Clause 4 in V2K LRM, plus 10.3.5 in V2K LRM
>> >
>> > -- Brad
>>
>>Section 5.3 in the SV3.1 LRM also discusses constants. It says that
>>localparam, specparm and 'const' variables are named constants.
>>
>>So is this legal:
>>
>>const int i = 5;
>>typedef enum {A=i} ET;
>>
>>The final paragraph of section 5.3 points out that localparams, specparams,
>>and parameters are elaboration time constants, while 'const' variables
>>are simulation time constants. I believe that the constant_expression
>>BNF production is intended to cover elaboration time constants, not
>>simulation time constants. I think this means the above is illegal.
>>
>>Another question, are enum labels themselves constant expressions?
>>This would be something like:
>>
>>typedef enum {A, B=A+1} ET;
>>
>>What if you wrote:
>>
>>typedef enum {A, B=A+1} ET;
>>logic [B:0] l;
>>
>>The current BNF for constant_primaries does not include enum labels,
>>so the current BNF would appear to exclude this.
>>
>>Mark Hartoog
>>700 E. Middlefield Road
>>Mountain View, CA 94043
>>650 584-5404
>>markh@synopsys.com
>
>



This archive was generated by hypermail 2b28 : Mon Sep 01 2003 - 05:40:47 PDT