【发布时间】:2019-04-21 07:29:52
【问题描述】:
我第一次尝试处理功能覆盖,所以我创建了一个 mem_cov.sv 文件,在其中创建了一个从 uvm_subscriber 类扩展它的覆盖类,并实现了写入函数来对覆盖进行采样。我正在尝试在 report_phase 中打印它,但它没有被打印出来,我不确定我是否遗漏了一些东西来打印它。
This is the link of the code
https://www.edaplayground.com/x/3R8m
提供代码示例,这是我从 uvm_subscriber 类扩展而来的覆盖率类
class mem_cov extends uvm_subscriber#(mem_seq_item);
`uvm_component_utils(mem_cov)
real cov;
mem_seq_item tx;
covergroup cg;
READ_EN:coverpoint tx.rd_en {bins bin_0_1[] ={0,1};}
endgroup
extern function new(string name="mem_cov",uvm_component parent);
extern function void write( mem_seq_item t);
extern function void extract_phase(uvm_phase phase);
extern function void report_phase(uvm_phase phase);
endclass
function mem_cov::new(string name,uvm_component parent);
super.new(name,parent);
cg=new();
endfunction
function void mem_cov::write(mem_seq_item t);
tx=t;
cg.sample();
endfunction
function void mem_cov::extract_phase(uvm_phase phase);
cov=cg.get_coverage();
endfunction
function void mem_cov::report_phase(uvm_phase phase);
`uvm_info(get_full_name(),$sformatf("Coverage is
%d",cov),UVM_HIGH);
endfunction
在我的 env 类中,我已将监视器分析端口连接到订阅者的分析导出端口,这里是 env 类的 sn-p :
function void build_phase(uvm_phase phase);
super.build_phase(phase);
mem_cv= mem_cov::type_id::create("mem_cv",this);
endfunction : build_phase
function void connect_phase(uvm_phase phase);
mem_agnt.monitor.item_collected_port.connect(mem_cv.analysis_export);
endfunction : connect_phase
【问题讨论】:
-
请在问题中发布您的 ode 样本。不要提供链接。
-
好的,我这里加了sn-ps的代码,谢谢。
标签: system-verilog uvm test-coverage