Ovm_in_order_class_comparator mismatch

Hi

Can any one help me in understanding using ovm_in_order_class_comparator?
Actually I am trying to implement an end-to-end checker wherein a_tracker gets the data at higher rate than b_tracker. The comparator compares only recent write which was happened on a_tracker and missing the earlier data.
I didn’t specified the tlm_fifo size any where in my code and let me know whether we need to specify the fifo size or please suggest some better way to use the in-order comparator when the data rates are different.
Example port connections:
function void export_connections();
a_tracker.ap.connect(m_comparator.after_export);
b_tracker.ap.connect(m_comparator.before_export);
endfunction

Thanks in advance.

Regards
Anand-

Hi Anand,

The ovm_in_order_class_comparator works with pairs of values. The data items that you are writing to the analysis ports on your tracker_a and tracker_b components do not have to arrive at the same rate but you do need to make sure that the same number of items are sent from each.

You do not need to set the depth of the FIFOs used within the comparator (they are infinite depth already).

One thing that you must do, is to make sure that you write a copy of each data item to the analysis port if the data item will change before the comparison is made. The tlm_analysis_fifos in the comparator hold class handles - if the data in the tracker changes then so does the data in the FIFO, unless you have sent it a copy. Your write to the analysis port should look something like

ap.write(data_item.copy());

Regards,
Dave

Hi David,

Thanks for your explanantion. But how to make a copy in that tlm_analysis_fifo becuase the tlm_analysis_fifo is local to the ovm_in_order_comparator class and accessing those before_fifo, after_fifo is not possible.

Please provide me some more details with an example.

Thanks & Regards
Anand-

Hi Anand,

You do not need to access the FIFOs in the comparator. You copy the data before you write it to the analysis port, e.g. if your transaction class looked something like:

class basic_transaction extends ovm_sequence_item;
     rand bit[7:0] addr, data;
    
     function new (string name = "",ovm_sequencer_base sequencer=null,
                   ovm_sequence parent_seq=null);
        super.new(name,sequencer,parent_seq);
     endfunction: new
  
`ovm_object_utils_begin(basic_transaction)
  `ovm_field_int(addr,OVM_ALL_ON + OVM_DEC)
  `ovm_field_int(data,OVM_ALL_ON + OVM_DEC)
`ovm_object_utils_end
   
endclass : basic_transaction

You could send it to the comparator from e.g. a monitor (your a/b_tracker components) like this:

class monitor extends ovm_monitor;
   ovm_analysis_port #(basic_transaction) ap;
...
   virtual task run();
     basic_transaction tx;
     forever begin
        basic_transaction tx_clone;
        //wait for new data - in this case from another fifo
        m_fifo.get(tx);
        //take copy of data
        $cast(tx_clone,tx.clone());
        //write copy to analysis port
        ap.write(tx_clone);
     end
   endtask: run
...
endclass: monitor

Regards,
Dave

Hi David,

Thanks alot.

My problem got resolved.

Regards
Anand-