There’s this 2 approaches:
- connecting analysis ports to analysis exports, and in analysis components, connect the export with analysis FIFO.
- connecting analysis ports to analysis imp, and then inserting class handle in user defined queue (if needed).
I don’t know why would I need to choose one over the other? and do i? any pros and cons of 1 method over the other?
I am inclined to generalize the use of analysis exports connected to analysis fifos (even if there is only 1 analysis port/producer).
Any insights on when to use exp/fifo combo over imp?
Also, in previous environments i made, i used analysis imp in the scoreboard, where the first line in the write method was to clone, if i use a tlm fifo, the class handle will be the one sent and no manual cloning could be done upon reception (as it is automatically inserted into fifo), so in that case should i clone the object before putting it through the analysis port (for ex at the monitor), so that all analysis components wouldn’t worry about corruption and wouldn’t need to clone themselves?
This was the reason i preferred imp method as it allows me to clone before queueing (in case the class handles sit for a while at the scoreboard before processing), but i learned that analysis components shouldn’t override received class handle content, so each analysis component’s clone is an added overhead, so it comes back to the point do i clone at monitor? mon_ap.write(txn.clone())?
So, my question is where i must clone my objects?
NOTE:
I have learned about MCOW: Manual Copy on Write, and that its actually best practice to clone before using any analysis port’s write method, but here do i now really need to create a new sequence item at the beginning of each forever loop or can i just reuse it?
// EX1: @ MONITOR
task collect_input ();
forever begin
m_in_item = seq_item::type_id::create("m_in_item");
...
$cast(m_in_cloned_item, m_in_item.clone());
m_in_port.write(m_in_cloned_item);
end
endtask
Thank you.