Synopsys验证VIP学习笔记(4)检查AXI的outstanding数

在使用AXI-VIP验证时,需要检查AXI的outstanding数,由于VIP的monitor port本身仅监测单笔burst,而outstanding涉及多笔burst,可以采用回调机制实现:

  1. svt_axi_port_monitor_callback 类扩展用户自定义回调类 cust_svt_axi_monitor_callback
class cust_svt_axi_monitor_callback extends svt_axi_port_monitor_callback ;
   ...
endclass
  1. 在callback类内定义变量如 num_outstanding_xact 来存储上述用户定义类中outstanding事务的总数,或也可定义num_read_outstanding_xact/num_write_outstanding_xact变量分别存储读/写outstanding事务数。
int num_outstanding_xact = 0;
int num_read_outstanding_xact = 0;
int num_write_outstanding_xact = 0;
  1. 在callback类内实现 new_transaction_startedtransaction_ended 方法以统计outstanding数,并可添加一些log打印信息:
virtual function void new_transaction_started (svt_axi_port_monitor axi_monitor, 
svt_axi_transaction item);

  super.new_transaction_started(axi_monitor, item);
  num_outstanding_xact++;
  if(item.xact_type == svt_axi_transaction::READ) begin
    num_read_outstanding_xact++;     
  end
  else if (item.xact_type == svt_axi_transaction::WRITE) begin
    num_write_outstanding_xact++;  
  end
  
  `uvm_info(get_type_name(), $sformatf("num_outstanding_xact %d", num_outstanding_xact), UVM_LOW)
  `uvm_info(get_type_name(), $sformatf("num_read_outstanding_xact %d", num_read_outstanding_xact), UVM_LOW)
  `uvm_info(get_type_name(), $sformatf("num_write_outstanding_xact %d", num_write_outstanding_xact), UVM_LOW)
 endfunction

virtual function void transaction_ended (svt_axi_port_monitor axi_monitor,
svt_axi_transaction item);

  super.transaction_ended(axi_monitor, item);
  num_outstanding_xact--;
  if(item.xact_type == svt_axi_transaction::READ) begin
    num_read_outstanding_xact--;     
  end
  else if (item.xact_type == svt_axi_transaction::WRITE) begin
    num_write_outstanding_xact--;  
  end

endfunction
  1. 现在,变量num_outstanding_xact内存储了相应的outstanding事务数,可以在 new_transaction_started 方法内检查相应outstanding值是否超过规定值了,例如:
if(num_read_outstanding_xact > `REQ_NUM)
`uvm_error(get_type_name(), $sformatf("read outstanding depth exceeds!, num_read_outstanding_xact is %d, the depth is set to %d", num_read_outstanding_xact, `REQ_NUM))
  1. 最后需要在 axi_basic_env.sv 内为 slave agent 添加callback对象。
virtual function void connect_phase(uvm_phase phase);
  cust_svt_axi_monitor_callback cb1;
  `uvm_info("connect_phase", "Entered...",UVM_LOW)
  cb1 = new("cust_svt_axi_monitor_callback_slave");
  uvm_callbacks#(svt_axi_port_monitor)::add(axi_system_env.slave[0].monitor,cb1);
endfunction
  • 10
    点赞
  • 72
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小破同学

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值