Hello Mavens,
Can anyone explain me how to use uvm_algorithmic_comparator in scoreboard, I tried myself with the following code for comparing the data of two different transaction classes such as after_item and before_item.
Can anybody guide me where I’ve gone wrong.
class scoreboard extends uvm_algorithmic_comparator#(before_item, after_item, after_item);
// before after transformer
`uvm_component_utils(scoreboard)
uvm_tlm_analysis_fifo #(after_item) before_fifo; // from master_uvc
uvm_tlm_analysis_fifo #(before_item) after_fifo; // from slave_uvc
after_item hi; // transaction class of after
after_item hi1 = new;; // transaction class of after
before_item pi; // transaction class of before
function new(string name = "scoreboard", uvm_component parent, TRANSFORMER after_item);
super.new(name, parent, "hi1");
before_fifo = new("before_fifo", this);
after_fifo = new("after_fifo", this);
endfunction
//function after transform before handle
function after_item transform (before_item item);
// super.transform(item); //Dont know what to write in this function
hi1.data = item.data;
endfunction
task run_phase(uvm_phase phase);
forever
begin
before_fifo.get(pi); // getting from before_item
after_fifo.get(hi); // getting from after_item
transform(pi);
if(!hi.compare(hi1)) //I'm calling compare function of after transaction class which only do data comparision
$display("DATA MISMATCH");
else
$display("DATA MATCHED");
end
endtask
endclass
Thanks in advance