I was given a 2x2 router. which routes the data to two output ports of the arbiter. Any input port can send transaction to any output port.
Below is my scoreboard code for the following.
class my_scoreboard extends uvm_scoreboard;
`uvm_component_utils(my_scoreboard)
//declaration
uvm_analysis_imp_decl(_exp0);
uvm_analysis_imp_decl(_exp1);
uvm_analysis_imp_decl(_act);
uvm_analysis_imp_exp0 #(my_transaction, my_scoreboard) i02fifo;
uvm_analysis_imp_exp1 #(my_transaction, my_scoreboard) i12fifo;
uvm_analysis_imp_act #(my_transaction, my_scoreboard) mon2sco;
my_transaction i0_q [$];]
my_transaction i1_q [$];
my_transaction o_q [$];
bit [7:0] match;
bit [7:0] mismatch;
function new(string name, uvm_component parent);
super.new(name, parent);
endfunction
function void build_phase(uvm_phase phase);
super.build_phase(phase);
i0fifo = new(my_transaction, this);
i1fifo = new(my_transaction, this);
mon2sco = new(my_transaction, this);
endfunction
task void write_exp0(my_transaction txn);
my_transaction tx;
tx.copy(txn);
//using tx and then applying arbiter logic to send into either i0_q or i1_q
bit flag;
// LOGIC arbiter
if(flag)
i0_q.push_back(tx);
else
i1_q.push_back(tx);
endfunction
task void write_exp1(my_transaction txn);
my_transaction tx;
tx.copy(txn);
//using tx and then applying arbiter logic to send into either i0_q or i1_q
bit flag;
// LOGIC arbiter
if(flag)
i0_q.push_back(tx);
else
i1_q.push_back(tx);
endfunction
task void write_act(my_transaction txn);
my_transaction tx;
tx.copy(txn);
o_q.push_back(tx);
if(o_q[0] == i0_q[0])
begin
`uvm_info("SCO","Match found for packet in i0_q")
i0_q.pop_front();
o_q.pop_front();
match++;
end
if(o_q[0] == i1_q[0])
begin
`uvm_info("SCO","Match found for packet in i1_q")
i1_q.pop_front();
o_q.pop_front();
match++;
end
else
begin
`uvm_info("SCO","No MAtch found")
mismatch++;
end
endfunction
endclass
About the comment for arbiter logic -
The arbiter logic would translate and send the values to corresponding queue.
Can someone tell me the limitation of my scoreboard.
One optimization would be to not make the queue for mon2sco analysis port.