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, and is believed to be clean.Received on Thu Mar 21 13:24:12 2013
This archive was generated by hypermail 2.1.8 : Thu Mar 21 2013 - 13:24:19 PDT