UVM Test

The top-level component that instantiates the environment and starts sequences.

Structure

The Test is selected at runtime using +UVM_TESTNAME=my_test.

class my_test extends uvm_test;
    `uvm_component_utils(my_test)
    
    my_env env;
    
    function new(string name, uvm_component parent);
        super.new(name, parent);
    endfunction

    function void build_phase(uvm_phase phase);
        super.build_phase(phase);
        env = my_env::type_id::create("env", this);
    endfunction

    task run_phase(uvm_phase phase);
        my_sequence seq;
        seq = my_sequence::type_id::create("seq");
        
        phase.raise_objection(this);
        seq.start(env.agent.sqr);
        phase.drop_objection(this);
    endtask
endclass