41 lines
1.2 KiB
Systemverilog
41 lines
1.2 KiB
Systemverilog
|
// Top class
|
||
|
class testbench_env extends uvm_component;
|
||
|
string name;
|
||
|
virtual testbench_if tb_if;
|
||
|
|
||
|
agent_reset rst_agt;
|
||
|
sequencer_tb tb_sequencer;
|
||
|
|
||
|
`uvm_component_utils(testbench_env)
|
||
|
|
||
|
function new(string name, uvm_component parent);
|
||
|
super.new(name, parent);
|
||
|
`uvm_info("new", $sformatf("Initialized testbench %s", name), UVM_LOW)
|
||
|
endfunction
|
||
|
|
||
|
function void build_phase(uvm_phase phase);
|
||
|
super.build_phase(phase);
|
||
|
|
||
|
rst_agt = agent_reset::type_id::create("reset_agent", this);
|
||
|
tb_sequencer = sequencer_tb::type_id::create("tb_sequencer", this);
|
||
|
endfunction
|
||
|
|
||
|
function void connect_phase(uvm_phase phase);
|
||
|
super.connect_phase(phase);
|
||
|
|
||
|
if (!uvm_config_db#(virtual testbench_if)::get(this, "", "tb_vif", tb_if)) begin
|
||
|
`uvm_fatal("CFG_DB_FAIL", $sformatf("Failed to fetch interface for %0s", get_full_name()))
|
||
|
end
|
||
|
|
||
|
`uvm_info("connect_phase", $sformatf("Build phase complete"), UVM_LOW)
|
||
|
endfunction
|
||
|
|
||
|
function uvm_sequencer get_tb_sequencer();
|
||
|
return tb_sequencer;
|
||
|
endfunction
|
||
|
|
||
|
function uvm_sequencer get_rst_sequencer();
|
||
|
return rst_agt.sequencer;
|
||
|
endfunction
|
||
|
endclass
|