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

From: Bresticker, Shalom <shalom.bresticker@intel.com>
Date: Thu Mar 21 2013 - 10:58:44 PDT
I would expect 'READ WRITE'.

Shalom

From: 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, and is
believed to be clean.
Received on Thu Mar 21 10:59:35 2013

This archive was generated by hypermail 2.1.8 : Thu Mar 21 2013 - 10:59:45 PDT