马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
本人希望用adapter操作ahb vip实现对寄存器的前门读写操作,但是连接后出现以下问题,下面是错误提示和代码:Error-[NOA] Null object access
/home/IC/VIP/vip/svt/amba_svt/M-2016.12/sverilog/src/vcs/svt_ahb_master_transaction.svp, 522
The object at dereference depth 1 is being used before it was
constructed/allocated.
Please make sure that the object is allocated before using it.
#0 in \svt_ahb_master_transaction::is_transaction_valid at
/home/IC/VIP/vip/svt/amba_svt/M-2016.12/sverilog/src/vcs/svt_ahb_master_transaction.svp:522
#1 in
\svt_ahb_master_active_common#(svt_ahb_master_if.svt_ahb_master_modport,svt_ahb_master_if.svt_ahb_monitor_modport,svt_ahb_master_if.svt_ahb_debug_modport)::is_slave_boundary_crossed
at
/home/IC/VIP/vip/svt/amba_svt/M-2016.12/ahb_master_svt/sverilog/src/vcs/svt_ahb_master_active_common.svp:258
下面是我的代码
/////////////
adapter.sv
/////////////
class my_adapter extends uvm_reg_adapter;
string tID = get_type_name();
`uvm_object_utils(my_adapter)
function new(string name="my_adapter");
super.new(name);
provides_responses = 1;
endfunction : new
function uvm_sequence_item reg2bus(const ref uvm_reg_bus_op rw);
svt_ahb_master_transaction tr;
tr = svt_ahb_master_transaction::type_id::create("tr");
tr.data=new[1];
tr.data_huser=new[1];
tr.cfg=get_cfg;
tr.idle_xact_hwrite=0;
tr.num_incr_beats=0;
tr.addr = rw.addr;
tr.trans_type=svt_ahb_transaction::NSEQ;
tr.beat_htrans=svt_ahb_transaction::NSEQ;
tr.xact_type = (rw.kind == UVM_READ) ? svt_ahb_transaction::READ : svt_ahb_transaction::WRITE;
tr.burst_type = svt_ahb_transaction::SINGLE;
tr.burst_size = svt_ahb_transaction::BURST_SIZE_32BIT;
if (tr.xact_type == svt_ahb_transaction::WRITE)
tr.data[0] = rw.data;
return tr;
endfunction : reg2bus
function void bus2reg(uvm_sequence_item bus_item, ref uvm_reg_bus_op rw);
svt_ahb_master_transaction tr;
if(!$cast(tr, bus_item)) begin
`uvm_fatal(tID,
"Provided bus_item is not of the correct type. Expecting bus_transaction")
return;
end
rw.kind = (tr.xact_type == svt_ahb_transaction::READ) ? UVM_READ : UVM_WRITE;
rw.addr = tr.addr;
rw.byte_en = 'h3;
rw.data = tr.data[0];
rw.status = UVM_IS_OK;
`uvm_info("RAL ADAPTER",$sformatf("read data %h",rw.data),UVM_LOW)
endfunction : bus2reg
endclass : my_adapter
//////////////
reg_seq.sv
/////////////
class case0_vseq extends uvm_reg_sequence ;
reg_model rm;
`uvm_object_utils(case0_vseq)
`uvm_declare_p_sequencer(my_vsqr)
function new(string name= "case0_vseq");
super.new(name);
endfunction
virtual task body();
uvm_status_e status;
uvm_reg_data_t value;
uvm_reg_mem_hdl_paths_seq ckseq;
if(starting_phase != null)
starting_phase.raise_objection(this);
p_sequencer.p_rm.mm.write(status,0,'ha,UVM_FRONTDOOR);
p_sequencer.p_rm.mm.read(status,0,value,UVM_FRONTDOOR);
if(starting_phase != null)
starting_phase.drop_objection(this);
endtask
endclass
class reg_model_test extends ahb_base_test;
function new(string name = "reg_model_test", uvm_component parent = null);
super.new(name,parent);
endfunction
extern virtual function void build_phase(uvm_phase phase);
`uvm_component_utils(reg_model_test)
endclass
function void reg_model_test::build_phase(uvm_phase phase);
super.build_phase(phase);
uvm_config_db#(uvm_object_wrapper)::set(this,
"v_sqr.main_phase",
"default_sequence",
case0_vseq::type_id::get());
endfunction
//////////////////////////////
寄存器模型的连接方法与张强的UVM实战一致。已经被这个问题缠绕了好几周,希望大牛们帮忙解决 |