[source]

Class uvm_pkg::uvm_enum_wrapper

Copyright 2007-2011 Mentor Graphics Corporation Copyright 2007-2011 Cadence Design Systems, Inc. Copyright 2010-2011 Synopsys, Inc. Copyright 2013-2014 NVIDIA Corporation All Rights Reserved Worldwide

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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

from_name(string name, uvm_active_passive_enum value)

Function

from_name

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 '0', as "foo" isn't a value
 // in uvm_radix_enum:
 radix_wrapper::from_name("foo", r_v);

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

 // The following would return '1', and r_v would be set to
 // the value of UVM_BIN
 radix_wrapper::from_name("UVM_BIN", r_v);
Parameters: