Here,in the code below ,I have taken two queues exp_que and ex_que. Actually I want to compare third member of exp_que with first member of ex_que.
`uvm_analysis_imp_decl(_rcvd_pkt)
`uvm_analysis_imp_decl(_sent_pkt)
class scoreboard extends uvm_scoreboard;
`uvm_component_utils(scoreboard)
uvm_analysis_imp_rcvd_pkt #(packet1,scoreboard) p1;
uvm_analysis_imp_sent_pkt #(packet1,scoreboard) p2;
packet1 exp_que[$];
packet1 ex_que [$];
function new(string name , uvm_component parent);
super.new(name,parent);
endfunction
function void build_phase(uvm_phase phase);
p1=new("p1",this);
p2=new("p2",this);
// exp_que = packet1::type_id::create();
// ex_que = packet1::type_id::create();
endfunction : build_phase
virtual function void write_rcvd_pkt (packet1 pkt);
exp_que.push_back(pkt);
`uvm_info("scoreboard","i am here",UVM_LOW);
`uvm_info("m1",$psprintf("%d",pkt.output_data),UVM_LOW);
for(int i=0;i<30;i++)
begin
if(exp_que[i].compare(exp_que[i-3]))
`uvm_info("PASS","sent packet matched",UVM_MEDIUM)
else
`uvm_info("FAIL","sent packet not matched",UVM_MEDIUM)
end
endfunction
virtual function void write_sent_pkt (packet1 ckt);
ex_que.push_back(ckt);
`uvm_info("m2",$psprintf("%d",ckt.output_data),UVM_LOW);
endfunction
//task run_phase (uvm_phase phase);
// forever
// begin
// for(int i=0;i<30;i++)
// begin
// if(exp_que[i].compare(exp_que[i-3]))
// `uvm_info("PASS","sent packet matched",UVM_MEDIUM)
// else
// `uvm_info("FAIL","sent packet not matched",UVM_MEDIUM)
// end
// end
//endtask :run_phase
endclass: scoreboard
The error for above code is:
**
Error-[NOA] Null object access
scoreboard.sv, 40
The object is being used before it was constructed/allocated.
Please make sure that the object is allocated before using it.
#0 in \scoreboard::write_rcvd_pkt at scoreboard.sv:40
#1 in
\uvm_analysis_imp_rcvd_pkt#(_vcs_unit__2552115745::packet1,_vcs_unit__25521157
at scoreboard.sv:1
#2 in \uvm_analysis_port#(_vcs_unit__2552115745::packet1)::write at
/home/tools/vcsmx/etc/uvm-1.1/tlm1/uvm_analysis_port.svh:76
#3 in \monitor::run_phase at monitor.sv:51
#4 in \uvm_run_phase::exec_task at
/home/tools/vcsmx/etc/uvm-1.1/base/uvm_common_phases.svh:245
#5 in \uvm_task_phase::execute at
/home/tools/vcsmx/etc/uvm-1.1/base/uvm_task_phase.svh:150
#6 in \uvm_phase::execute_phase at
/home/tools/vcsmx/etc/uvm-1.1/base/uvm_phase.svh:1171
#7 in \uvm_phase::m_run_phases at
/home/tools/vcsmx/etc/uvm-1.1/base/uvm_phase.svh:1851
#8 in \uvm_root::run_test at
/home/tools/vcsmx/etc/uvm-1.1/base/uvm_root.svh:425
**