james.wells Posted April 14, 2011 Report Share Posted April 14, 2011 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? Quote Link to comment Share on other sites More sharing options...
jadec Posted April 18, 2011 Report Share Posted April 18, 2011 The description means that the flush method of the fifos themselves handles that. It looks like you can call "comp.do_flush()" instead of "comp.flush()" directly to get what you want. Quote Link to comment Share on other sites More sharing options...
james.wells Posted April 25, 2011 Author Report Share Posted April 25, 2011 Thanks jadec, that's now working as expected. By the way, the do_flush() method in uvm_component is not documented anywhere - I had to grep the UVM source code to find it! Would the lack of documentation count as a bug? Quote Link to comment Share on other sites More sharing options...
jadec Posted April 25, 2011 Report Share Posted April 25, 2011 Yes, such an issue should be filed in Mantis. Quote Link to comment Share on other sites More sharing options...
Reuben Mijares Posted October 24, 2014 Report Share Posted October 24, 2014 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(); endendfunction Quote Link to comment Share on other sites More sharing options...
dave_59 Posted October 24, 2014 Report Share Posted October 24, 2014 The mantis was never field. I entered 0005047 uvm_component:::do_flush is not documentedRefGuide - 2014-10-21 23:12 Quote Link to comment Share on other sites More sharing options...
uwes Posted October 24, 2014 Report Share Posted October 24, 2014 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.