Jump to content

uvm_in_order_comparator flush() method not clearing internal FIFOs


Recommended Posts

I want to flush a uvm_in_order_comparator mid-simulation in order to return it to a known state. The flush() method is clearing the match/mismatch counters but not the internal FIFO, so if there is data left in m_before_fifo or m_after_fifo this does not get cleared.

The method description says "The <uvm_tlm_fifo::flush> takes care of flushing the FIFOs.", this implies that the intention was to clear these FIFOs, but it looks like the relevant code was not added.

The FIFOs themselves are declared "local", so I can't fix this by overriding the flush() method, it also looks like "run_phase()" would not properly handle flushing the FIFOs (the first get may already have finished when the flush is called and this would have to be dealt with).

I think this is a bug, does anyone agree?

Link to comment
Share on other sites

  • 3 years later...

Hi, is this do_flush working?

I used that function but it is not flushing the FIFOS.

I have a uvm_in_order_class_comparator in my scoreboard. This is the code:

 

virtual function void build_phase(uvm_phase phase);
  comp_cmd = uvm_in_order_class_comparator#(packet)::type_id::create("comp_cmd", this);
endfunction
 
virtual function void write_exp_imp(packet tr);
  if(tr.reset) begin
    comp_cmd.do_flush();
  end
endfunction

Link to comment
Share on other sites

hi,

 

to stay with the common pattern in UVM you should be invoking a function "XYZ()" to get a functionality "XYZ" and implement own functionality which should be considered/run during the execution of "XYZ()" in "do_XYZ()". however you should never invoke do_XYZ directly. 

 

this pattern at least applies to pack,unpack,print,compare,record,copy,accept_tr,begin_tr and a few other places and i believe we should stick to the same pattern throughout UVM 

 

from my point of view uvm_component::flush and uvm_component::do:_flush are exactly the other way around (and not documented). 

 

so essentially

 

1. uvm_component::flush -> uvm_component::do_flush

2. uvm_component::do_flush -> uvm_component::flush

3. implementation of uvm_component::flush needs to perform traversal and propagate flush() down to children and invoke do_flush()

4. uvm_in_order_comparator::flush -> uvm_in_order_comparator::do_flush

5. do_flush should be virtual

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...