|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
本帖最后由 851018986 于 2018-6-5 16:55 编辑
class apb_monitor extends uvm_monitor;
virtual apb_if.passive sigs;
uvm_analysis_port#(apb_rw) ap;
apb_config cfg;
`uvm_component_utils(apb_monitor)
function new(string name, uvm_component parent = null);
super.new(name, parent);
ap = new("ap", this);
endfunction: new
virtual function void build_phase(uvm_phase phase);
apb_agent agent;
if ($cast(agent, get_parent()) && agent != null) begin
sigs = agent.vif;
end
else begin
virtual apb_if tmp;
if (!uvm_config_db#(apb_vif)::get(this, "", "vif", tmp)) begin
`uvm_fatal("APB/MON/NOVIF", "No virtual interface specified for this monitor instance")
end
sigs = tmp;
end
endfunction
virtual protected task run_phase(uvm_phase phase);
super.run_phase(phase);
forever begin
apb_rw tr;
// Wait for a SETUP cycle
do begin
@ (this.sigs.pck);
end
while (this.sigs.pck.psel !== 1'b1 ||
this.sigs.pck.penable !== 1'b0);
tr = apb_rw::type_id::create("tr", this);
.....................
........................
endclass: apb_monitor
两个class类型转换的结果是什么,怎么理解
if ($cast(agent, get_parent()) && agent != null) begin
sigs = agent.vif;
get_parent()得到的还是agent,为什么还要转换一下 |
|
|