[sv-bc] RE: enum name() method return value

From: Alsop, Thomas R <thomas.r.alsop@intel.com>
Date: Thu Mar 21 2013 - 13:50:34 PDT
Okay, I get the syntax now, thanks Shalom.  This is not supported yet.  I tried it on one simulator and it is described as an unimplemented feature.  The mantis was returned to new state because it did not get into the 2012 LRM.

-Tom

From: Bresticker, Shalom
Sent: Thursday, March 21, 2013 1:42 PM
To: Alsop, Thomas R; Janick Bergeron; Arturo Salz; SV-BC
Cc: Justin Refice
Subject: RE: enum name() method return value

See similar issue in Mantis 2735.

Shalom

From: Alsop, Thomas R
Sent: Thursday, March 21, 2013 22:29
To: Alsop, Thomas R; Janick Bergeron; Arturo Salz; Bresticker, Shalom; SV-BC
Cc: Justin Refice
Subject: RE: enum name() method return value

BTW, Arturo, what is this?

command.next().name();

The LRM defines and provides examples of functions that can be used based on the enumerate object.  Please educate me on this syntax.

Thanks, -Tom

From: owner-sv-bc@eda.org<mailto:owner-sv-bc@eda.org> [mailto:owner-sv-bc@eda.org] On Behalf Of Alsop, Thomas R
Sent: Thursday, March 21, 2013 1:23 PM
To: Janick Bergeron; Arturo Salz; Bresticker, Shalom; SV-BC
Cc: Justin Refice
Subject: [sv-bc] RE: enum name() method return value

I agree and I am happy to file the change in mantis and own it.  -Tom

From: Janick Bergeron [mailto:Janick.Bergeron@synopsys.com]
Sent: Thursday, March 21, 2013 12:30 PM
To: Arturo Salz; Bresticker, Shalom; Alsop, Thomas R; SV-BC
Cc: Justin Refice
Subject: RE: enum name() method return value

May I suggest that the LRM be amended to something like:

6.19.5.6 Name()
The prototype for the name() method is as follows:
function string name();

The name() method returns the string representation of the enum_name_declaration for the given enumeration value. If the given value is
not a member of the enumeration, the name() method returns the empty string


From: Arturo Salz
Sent: Thursday, March 21, 2013 14:42
To: Bresticker, Shalom; Alsop, Thomas R; SV-BC
Cc: Janick Bergeron; Justin Refice
Subject: RE: enum name() method return value

As Shalom wrote, returning  just the unadorned name of the enumeration is exactly the intent.
Note that passing command.namenext() as an argument to the "%s" format of $display is possibly a non-standard extension. You should use command.next().name();
To get the declaration scope you probably want to use $typename.
In order to implement a helper function that converts a string to an enum would require the helper function to unambiguously know the type of the destination enum so possibly a built-in method may be a better option.

                Arturo

From: owner-sv-bc@eda.org<mailto:owner-sv-bc@eda.org> [mailto:owner-sv-bc@eda.org]<mailto:[mailto:owner-sv-bc@eda.org]> On Behalf Of Bresticker, Shalom
Sent: Thursday, March 21, 2013 10:59 AM
To: Alsop, Thomas R; SV-BC
Cc: Janick Bergeron; Justin Refice
Subject: [sv-bc] RE: enum name() method return value

I would expect 'READ WRITE'.

Shalom

From: owner-sv-bc@eda.org<mailto:owner-sv-bc@eda.org> [mailto:owner-sv-bc@eda.org] On Behalf Of Alsop, Thomas R
Sent: Thursday, March 21, 2013 18:53
To: SV-BC
Cc: Janick Bergeron; Justin Refice
Subject: [sv-bc] enum name() method return value

Hi,

The VIP-TSC committee (UVM) had a request come up to create a helper function which will take a string and convert it to enum.  Many users implement this themselves and we'd like to create a utility which does this in UVM.  See mantis  3693 for more details:

http://www.eda.org/svdb/view.php?id=3693

In the ticket there is an example that Justin Refice provided which uses the enum name() method to convert the string to enum.  Here is the LRM's description of this method:

6.19.5.6 Name()
The prototype for the name() method is as follows:
function string name();

The name() method returns the string representation of the given enumeration value. If the given value is
not a member of the enumeration, the name() method returns the empty string


The committee noted that this method may in fact produce different results depending on what the vendor chose to implement for name().  I wrote a simple SV example and I use name() and it simply prints out the strings:

class Xaction;

  enum {READ, WRITE} command;

  virtual function void printvirtual();
    $display("VIRTUAL command: %s %s", command.name(), command.next());
  endfunction

endclass

When this is run I see this print out:

VIRTUAL command: READ WRITE

However the committee noted that a vendor could chose to print this instead highlighting the composition:

VIRTUAL command: Xaction::READ Xaction::WRITE

We wanted to get clarification on whether or not this is correct, that what is printed can be vendor independent.

Thanks, -Tom



--
This message has been scanned for viruses and
dangerous content by MailScanner<http://www.mailscanner.info/>, and is
believed to be clean.

---------------------------------------------------------------------
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<http://www.mailscanner.info/>, and is
believed to be clean.

--
This message has been scanned for viruses and
dangerous content by MailScanner<http://www.mailscanner.info/>, and is
believed to be clean.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Mar 21 13:51:30 2013

This archive was generated by hypermail 2.1.8 : Thu Mar 21 2013 - 13:51:35 PDT