模塊級環境需要集成到系統級的環境中(主要複用checker(scoreboard & reference model)),需要做哪些改動呢?
- dut 的hierarchy和激勵來源發生變化,涉及到的改動如下:
- 通過uvm_config_db set interface的部分發生變化,需要修改hierarchy;
- 激勵由agnet變爲上層module,故需要額外drive DUT 相關的interface(reference model 和scoreboard需要得到上層module的輸出)
基於以上改動,在block level ENV中推薦的做法:
- 聲明DUT相關的interface 採用harness(把interface 例化在DUT下面)的方式;
interface test_harness();
aa_if aa_vif(
.clk (irq_top.clk),
.rst_n(irq_top.rst_n),
.data (irq_top.data),
.valid(irq_top.valid),
.rdy (irq_top.rdy)
);
function void set_vifs(string path);
uvm_config_db#(virtual aa_if)::set(null,{path,"aa_agent*"},"mst_vif",aa_vif);
endfunction
endinterface
//top.sv
`include if_conn.sv
irq_top u_irq_top();
bind irq_top test_harness harness();
initial begin
top.u_irq_top.harness.set_vifs("uvm_test_top.top_env");
end
//harness的方式要求interface中不能使用modport !!!
- 把dut instance 和set interface 分別放在兩個不同的文件,比如(if_conn.sv和dut_inst.sv);
- reference model 只用interface來拿資源;
- if_conn.sv 中 provided agent PASSIVE or ACTIVE control ;
//if_conn.sv
function set_active_mode(string path = "",uvm_active_passive_enum is_active=UVM_ACTIVE);
uvm_config_db#(uvm_active_passive_enum)::set(uvm_root::get(),{path,$sformatf(".aa_agent[%0d]*",0)},"is_active",is_active);
endfunction
- interface先set 到test_base或env,再通過env set下去;
- define的時候先undef 再define;
`undef AGNET_NUM
`define AGENT_NUM (1)