Writing the first test class in UVM
In UVM, how does a test connect with environment and create stimulus?
Here comes the answer
- create a test derived from "uvm_test"
e.g
class tx_test extends uvm_test;
`uvm_component_utils (tx_test)
function new (string name, uvm_component parent);
super.new(name,parent);
endfunction
tx_env env; // define env handle
virtual function void build_phase (uvm_phase phase);
env = tx_env :: type_id :: create("env", this);
endfunction
virtual task run_phase (uvm_phase phase);
tx_sequence seq ; // define the sequence handle
seq = tx_sequence :: type_id :: create ("seq", this);
phase.raise_objection (this);
seq.start(env.sqr.start);
phase.drop_objection(this);
endtask
endclass
Comments
Post a Comment