Synopsys AXI VIP为master和slave agent中的monitor提供了名为item_started_port和item_observed_port的analysis port,前者仅在总线事务传输开始时发送,后者则在总线事务传输完成后发送完整svt_axi_master_transaction和svt_axi_slave_transaction对象到item_observed_port端口,并且在vip agent为passive和active模式下都有效。可以将该端口连接至现有scoreboard用以分析总线事务信号,方法如下:
首先创建自定义callback类,并在read_address_phase_ended方法中添加自定义端口item_observed_port_addr
class axiMasterMonitorCallbacks extends svt_axi_port_monitor_callback;
int master_num=0;
svt_axi_system_configuration vip_cfg;
//user-defined analysis ports
uvm_analysis_port #(svt_axi_transaction) item_observed_port_addr;
function new(int master_num=0,svt_axi_system_configuration vip_cfg,uvm_component parent=null);
this.master_num=master_num;
this.vip_cfg=vip_cfg;
item_observed_port_addr=new("",parent);
endfunction
//for initiating masters
extern virtual function void read_address_phase_ended(
svt_axi_port_monitor axi_monitor,
svt_axi_transaction item);
endclass
function void axiMasterMonitorCallbacks::read_address_phase_ended(
svt_axi_port_monitor axi_monitor,
svt_axi_transaction item);
svt_axi_transaction item_copy;
//user-defined analysis port
$cast(item_copy,item.clone());
item_copy.port_id=master_num;
item_observed_port_addr.write(item_copy);
endfunction
2. 在scoreboard中创建export端口和write()方法,这一步同上步骤1、2、3,代码略去
3. 在env中连接TLM端口,需要在uvm_env::build_phase()中创建callback,在connect_phase()中连接端口,并在start_of_simulation_phase() 中注册callback
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
axi_system_env = svt_axi_system_env::type_id::create("axi_system_env", this);
uvm_config_db#(svt_axi_system_configuration)::set(this, "axi_system_env", "cfg", cfg);
axi_sb = axiSB::type_id::create("axi_sb", this);
master_monitor_cb=new[cfg.num_masters];
foreach(cfg.master_cfg[i]) begin
master_monitor_cb[i]=new(i,cfg,this);
end
endfunction
function void connect_phase(uvm_phase phase);
master_monitor_cb[0].item_observed_port_addr.connect(axi_sb.master_cb_addr_export[0]);
master_monitor_cb[1].item_observed_port_addr.connect(axi_sb.master_cb_addr_export[1]);
master_monitor_cb[2].item_observed_port_addr.connect(axi_sb.master_cb_addr_export[2]);
master_monitor_cb[3].item_observed_port_addr.connect(axi_sb.master_cb_addr_export[3]);
endfunction
virtual function void start_of_simulation_phase(uvm_phase phase);
super.start_of_simulation_phase(phase);
//Master Monitor callbacks
foreach(cfg.master_cfg[i]) begin
uvm_callbacks#(svt_axi_port_monitor)::add(axi_system_env.master[i].monitor,master_monitor_cb[i]);
end
endfunction
参考资料:VC Verification IP AMBA AXI UVM User Guide R-2020.09
没有回复内容