【DV】验证环境集成

模块级环境需要集成到系统级的环境中(主要复用checker(scoreboard & reference model)),需要做哪些改动呢?

  1.  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下面)的方式;

    

//======================================================================================
//top_harness.sv
//======================================================================================

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)
  );

  bb_if bb0_vif[2](.clk(irq_top.clk),.rst_n(irq_top.rst_n))

  //System Verilog does not allow you to loop over static constructs
  //SV does allow you to loop over virtual interfaces
  virtual bb_if bb0_vif_tmp[2];
  
  initial begin
    bb0_vif_tmp = bb0_vif[0:1];
  end

  function void set_vifs(string path);
    uvm_config_db#(virtual aa_if)::set(null,{path,"aa_agent*"},"mst_vif",aa_vif);
    for(int ii=0;ii<2;ii++)
    uvm_config_db#(virtual aa_if)::set(null, 
        {path,$sformatf("bb_agent[%0d]*",ii)},"mst_vif",bb0_vif_tmp[ii]);
  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_bitstream_t)::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)

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值