Lifespan of memory of objects created during run_phase

I want to know about lifespan of objects created during run_phase because to compare between 2 methods for receiving data in scoreboard.

  1. IP Monitor : Input monitor will have analysis port so it will broadcast the input
    Scoreboard : Scoreboard will have uvm_tlm_analysis_fifo

    Right now analysis port has only 1 subscriber so handle of seq_item will only be pass to scoreboard. Now only uvm_tlm_analysis_fifo has handle of seq_item sent from input_monitor. So if I do get method on it I will retrieve the handle, and when next time I do get the last handle will no longer be referenced by any variable in TB. So should the memory space of that object destroy instantly or it will be destroyed after run time.(I am aware about provision that SV provides that it depends upon simulator design. If your answer is tool specific then I am specifically asking about Siemens Questa. But I am more interested in generalized answer which method is better which one should I use.)

In this method I will create object inside driver s forever loop and IP monitor will pass it’s handle. So every loop will create new object of seq_item and I assume they are getting destroyed after use and get derferenced.

  1. IP Monitor : Input monitor will have analysis port so it will broadcast the input
    Scoreboard : Scoreboard will have uvm_analysis_imp_port

In this method I will create a queue to store input then process input(from ip monitor) and output from (op monitor), then process input compare with DUT output and then discard it. This method will surely destroy memory of the object after use.

In this method I will create object outside driver s forever loop only one time and IP monitor will pass it’s handle and in scoreboard my data will be copied down into seq_item handle and store inside queue so the next time when data gets randomize it will not be corrupted.

So the comparison is between using this two methods. Because method 2 is of no use if method 1 is memory efficient to write. Because in method 1 you have to provide you own write method implementation in scoreboard and also you have to create a queue insert element into it.

You haven’t provided enough information to answer the question. We would need to see some code or at least a bit of pseudo-code. After you perform the get() you now have a handle to the transaction even though it’s gone out of the analysis FIFO.

Input Monitor:

forever
begin
@(intrf.ip_mon_cb); //this will unblock at reactive region of 30
**my_seq_item = seq_item::type_id::create("my_seq_item");**
my_seq_item.wr_cs = intrf.ip_mon_cb.wr_cs;
my_seq_item.rd_cs = intrf.ip_mon_cb.rd_cs;
my_seq_item.wr_en = intrf.ip_mon_cb.wr_en;
my_seq_item.rd_en = intrf.ip_mon_cb.rd_en;
my_seq_item.data_in = intrf.ip_mon_cb.data_in;
ip_mon_analysis_port.write(my_seq_item);
//\`uvm_info(get_type_name(),$sformatf("\[%0t\]: IP_MON: WR_CS=%0d RD_CS=%0d WR_EN=%0d RD_EN=%0d DATA_IN=%0d",$time,my_seq_item.wr_cs,my_seq_item.rd_cs,my_seq_item.wr_en,my_seq_item.rd_en,my_seq_item.data_in),UVM_MEDIUM);
end

I am creating a new object at every clock cycle and writing its handle to the analysis port, and my only subscriber to this analysis port is the scoreboard.

So in score board side:

uvm_tlm_analysis_fifo#(seq_item) ip_fifo;
task run_phase(uvm_phase phase);
forever
begin
op_fifo.get(op);
ip_fifo.get(ip);
ref_model();
chekk();
end
endtask

So, on the scoreboard, I am retrieving my data from the FIFO every time. Now, will objects that are dereferenced after getting checked in the scoreboard be immediately destroyed, or will they wait for the run phase to complete before destroying?

Your two methods are basically the same as far as I can see. A FIFO is built using a queue and has the same effect whether using a get() or pop() method. A class object can be destroyed once there is no way to access a reference to it. You should only be concerned that your references get removed.