http://www.eetop.cn/blog/index.php?uid/13812/action/viewspace/itemid/6826765/php/1
two derived comparator:
“uvm_in_order_build_in_comparator”: comparing streams of built-in types
“uvm_in_order_class_comparator”: comparing streams of class objects
“uvm_algorithmic_comparator": Compares two streams of data objects of different types, BEFORE and AFTER
基本代码:
class xcoreboard extends uvm_scoreboard;
typedef uvm_in_order_class_comparator#(packet) cmpr_t;
cmpr_t cmpr;
uvm_analysis_export#(packet) before_export;
uvm_analysis_export#(packet) after_export;
virtual function viod build_phase(uvm_phase phase);
super.build_phase(phase);
cmpr = cmpr_t::type_id::create("cmpr", this);
before_export = new("before_export", this);
after_export = new("after_export", this);
endfunction: build_phase
virtual function void connect_phase (uvm_hase phase);
before_export.connect(cmpr.before_export);
after_export.connect(cmpr.after_export);
endfunction: connect_phase
endclass
class iMonitor extends uvm_monitor;
...
uvm_analysis_port#(packet) analysis_port;
..
virtual task main_phase(uvm_phase phase);
...
tr = packet::type_id::create("tr");
...
analysis_port.write(tr);
endfunction: main_phase