Re: [sv-bc] SV_BC #26 - Enumerated Literals in Packages - Feedback Requested

From: Neil Korpusik <Neil.Korpusik@sun.com>
Date: Mon Nov 29 2004 - 15:48:33 PST

Clifford E. Cummings wrote:

> 1) if the passed type is a struct, can the fields of a passed type be
> referenced using mytype.field1 notation or not?
> 2) if the passed type is an enumerated type, can the enumerated literals be
> referenced directly?
>
> I thought the answer to both questions was yes, but Greg Jaxon suggests
> that in both cases, SV should be extended to reference passed type struct
> fields using the :: operator (mytype::field1) and passed enum type literals
> also be referenced using the :: operator (myenum::literal1).
>
> I prefer to use the mytype.field1 and literal1 notation and leave :: for
> importing packages and package contents (just my preference).
>

There are a couple of other uses for :: today.

Section 11.21 Class scope resolution operator ::

"The class scope operator :: is used to specify an identifier defined within
the scope of a class. It has the following form:

   class_identifier :: {class_identifier :: } identifier"

The following example is given:

   class Base;
      typedef enum {bin,oct,dec,hex} radix;
      static task print(radix r, integer n); ... endtask
   endclass

   ...
   Base b = new;
   int bin = 123;
   b.print(Base::bin, bin); // Base::bin and bin are different
   Base::print(Base::hex,66);

"In System Verilog, the class scope operator applies to all static elements
of a class: static class properties, static methods, typedefs, enumerations,
structures, unions and nested class declarations."

Section 9.9 Fine-grain process control. The built-in process class uses the
   syntax defined in Section 11.21.
Section 11.22 Out of block declarations // classes
   Allows class methods to be declared outside the class body.
Section 12.4.1 External constraint blocks
   Allows constraints to be declared outside the class body.

-- 
---------------------------------------------------------------------
Neil Korpusik                                     Tel: 408-720-4852
Member of Technical Staff                         Fax: 408-720-4850
Frontend Technologies - ASICs & Processors (FTAP)
Sun Microsystems
email: neil.korpusik@sun.com
---------------------------------------------------------------------
Received on Mon Nov 29 15:48:36 2004

This archive was generated by hypermail 2.1.8 : Mon Nov 29 2004 - 15:48:41 PST