[source]

Class uvm_enum_wrapper

uvm_pkg::uvm_enum_wrapper <T> + from_name(): bit

Inheritance Diagram of uvm_enum_wrapper

Class

uvm_enum_wrapper#(T)

The uvm_enum_wrapper#(T) class is a utility mechanism provided as a convenience to the end user. It provides a from_name method which is the logical inverse of the System Verilog name
method which is built into all enumerations.

Parameters

Name

Default value

Description

T

uvm_active_passive_enum

Functions

static function bit from_name ( string name, uvm_active_passive_enum value ) [source]

Attempts to convert a string name to an enumerated value.

If the conversion is successful, the method will return 1, otherwise 0.

Note that the name passed in to the method must exactly match the value which would be produced by enum::name , and is case sensitive.

For example:

typedef uvm_enum_wrapper#(uvm_radix_enum) radix_wrapper;
uvm_radix_enum r_v;

// The following would return &#39;0&#39;, as &quot;foo&quot; isn&#39;t a value
// in uvm_radix_enum:
radix_wrapper::from_name(&quot;foo&quot;, r_v);

// The following would return &#39;0&#39;, as &quot;uvm_bin&quot; isn&#39;t a value
// in uvm_radix_enum (although the upper case &quot;UVM_BIN&quot; is):
radix_wrapper::from_name(&quot;uvm_bin&quot;, r_v);

// The following would return &#39;1&#39;, and r_v would be set to
// the value of UVM_BIN
radix_wrapper::from_name(&quot;UVM_BIN&quot;, r_v);