HI All,
Consider the following basic uvm_scoreboard with two implementation ports.
Question_1:
`uvm_analysis_imp_decl(_port1) //for input transaction
`uvm_analysis_imp_decl(_port2) //for output transaction
class mem_scoreboard extends uvm_scoreboard;
`uvm_component_utils(mem_scoreboard)
uvm_analysis_imp_port1#(mem_seq_item,mem_scoreboard) input_port;
uvm_analysis_imp_port2#(mem_seq_item,mem_scoreboard) output_port;
//---------------------------------------
// Virtual Interface
//---------------------------------------
virtual mem_if vif;
//---------------------------------------
// declaring pkt_qu to store the pkt's recived from monitor
//---------------------------------------
mem_seq_item input_pkt_queue[*]; // Associative Array
mem_seq_item output_pkt_queue[*]; // Associative Array
//---------------------------------------
// new - constructor
//---------------------------------------
function new (string name, uvm_component parent);
super.new(name, parent);
endfunction : new
//---------------------------------------
// build_phase - create port and initialize local memory
//---------------------------------------
function void build_phase(uvm_phase phase);
super.build_phase(phase);
input_port = new("input port", this);
output_port = new("output port", this);
endfunction: build_phase
//---------------------------------------
// write task - recives the pkt from monitor and pushes into queue
//---------------------------------------
virtual function void write_port1(mem_seq_item input_pkt);
input_pkt_queue[input_pkt.axi_id] = input_pkt;
endfunction
virtual function void write_port2(mem_seq_item output_pkt);
output_pkt_queue[output_pkt.axi_id] = output_pkt;
endfunction : write
//---------------------------------------
// run_phase - compare's the read data with the expected data(stored in local memory)
// local memory will be updated on the write operation.
//---------------------------------------
virtual task run_phase(uvm_phase phase);
mem_seq_item mem_pkt1;
mem_seq_item mem_pkt2;
forever begin
wait(input_pkt_queue.num() > 0 && output_pkt_queue.num() > 0); //this line
if(input_pkt_queue.axi_id.exists(output_pkt_queue.axi_id))
begin
mem_pkt1 = input_pkt_queue[axi_id];
mem_pkt2 = output_pkt_queue[axi_id];
if(mem_pkt1.compare(mem_pkt2))
$display("packet matches");
else
$display("packet mis-matches");
end
end
endtask : run_phase
IN the run_phase, I have used wait statement for both input and output pkt queue to have at least one element.
But what in case only one packet arrived and another packet has not yet come, in this case, the entire scoreboard is blocked or its blocked until we receive both packets.
so my question is "This approach of run_phase is blocking the entire scoreboard operation if either packet did not come. How can I modify the run_phase of the above scoreboard so that scoreboard won't be blocked but still the check should keep happening"
Kindly share your thoughts on this.
-----------------------------------------------------------
Quesstion_2 :
=============
class my_scoreboard extends uvm_scoreboard;
....
//associative array for out of order matching
my_transaction exp_trans[string];
my_transaction act_trans[string];
function void write_expected(my_transaction txn);
exp_trans[txn.id] = txn;
check_and_match(txn.id);
endfunction
function void write_actual(my_transaction txn);
act_trans[txn.id] = txn;
check_and_match(txn.id);
endfunction
function void check_and_compare(string id);
if (exp_trans.exists(id) &&
act_trans.exists(id) )begin //{
if (exp_trans[id].compare(act_trans[id])
`uvm_info(PASSED, match found for ID)
else
`uvm_error(FAILED, match found for ID)
exp_trans.delete(id);
act_trans.delete(id);
end //}
endfunction
endclass
In this approach, I could see scoreboard is not blocking. But the data integrity check is happening at "check_phase". Also, it is not with "forever begin", consider a case;
pkt1 with ID1 arrived
pkt2 with ID2 arrived
since ID mismatch, so this check will not happen, it will be in associative array only.
Again this check should happen when the exact packet arrives with same ID.
Will this happens with this approach?
Means, my question is "since we do not have forever, will the check happens for all the packets even with packets coming sooner or later" or anything is missing in this approach for data integrity.
Kindly suggest for both questions
Thank you,