🧩 UVM Base Classes#
🚀 Introduction#
The UVM library is built on a hierarchy of base classes that form the foundation for all UVM components. These classes provide essential features that make UVM powerful and flexible.
🏗️ UVM Class Hierarchy#
This section presents the class hierarchy of UVM. It clearly shows the base classes and which classes are derived from which.
uvm_void
└── uvm_object
├── uvm_transaction
├── uvm_sequence_item
├── uvm_sequence_base
└── uvm_component
├── uvm_test
├── uvm_env
├── uvm_agent
├── uvm_driver
├── uvm_monitor
└── uvm_sequencer
🪝 uvm_void#
This class sits at the top of the UVM class tree and is an abstract class with no data members or functions.
✨ Key Features#
virtual class uvm_void;
// 🔹 Base abstract class for all UVM classes.
// 🔹 Contains no members or methods by default.
endclass
📦 uvm_object#
uvm_object
is the base class for all UVM objects. It includes basic object operations such as copying, comparing, and printing.
✨ Key Features#
virtual class uvm_object extends uvm_void;
// 🔹 Constructor: creates a new object with an optional name
extern function new(string name = "");
// 🔹 Returns the object's local name
extern virtual function string get_name();
// 🔹 Returns the object's full hierarchical name
extern virtual function string get_full_name();
// 🔹 Returns the object's type wrapper (note: static)
extern static function uvm_object_wrapper get_type();
// 🔹 Creates a new object dynamically via the factory
virtual function uvm_object create(string name="");
return null;
endfunction
// 🔹 Clones (deep copies) the object
extern virtual function uvm_object clone();
// 🔹 Copies values from another object of the same type
extern function void copy(uvm_object rhs);
// 🔹 Compares this object to another object
extern function bit compare(uvm_object rhs, uvm_comparer comparer=null);
// 🔹 Prints the object's contents
extern function void print(uvm_printer printer=null);
// 🔹 Converts the object to a string representation
extern virtual function string convert2string();
endclass
🗂️ uvm_root#
uvm_root
is the global manager of the UVM testbench. It uses the singleton pattern to manage test execution and phase control.
✨ Key Features#
class uvm_root extends uvm_component;
// 🔹 Returns the singleton instance of uvm_root
static function uvm_root get();
// 🔹 Starts the specified test and manages phase control
virtual task run_test (string test_name="");
...
endclass
🏗️ uvm_component#
uvm_component
is the base class for all testbench components. It includes build, connect, and run phase methods.
✨ Key Features#
virtual class uvm_component extends uvm_report_object;
// 🔹 Constructor: creates the component with its name and parent
function new (string name, uvm_component parent);
// 🔹 Main simulation phase where component functionality is implemented
virtual task run_phase(uvm_phase phase);
// 🔹 Phase for building sub-components and setting up configurations
virtual function void build_phase(uvm_phase phase);
// 🔹 Phase for connecting TLM ports and interfaces
virtual function void connect_phase(uvm_phase phase);
...
endclass
📝 Summary#
UVM base classes provide:
- Hierarchical structure (enables modular and reusable designs)
- Code reuse (standard methods like copy, compare, print)
- Standardization (consistent APIs and naming)
- Phase management (supports build, connect, run, etc.)
- Factory and type override support (dynamic object creation)
- Configuration management (sharing config objects across hierarchy)