Hi Forum,
Consider the following Tb
// Assume 'write_beat' class is defined as
class write_beat;
bit [3:0] id;
byte unsigned data[];
// Other properties and APIs
endclass
// Within 'env' component ::
// (1) Declare the class :: `uvm_analysis_imp_decl(_wdata)
// (2) Declare handle of (1)
// uvm_analysis_imp_wdata#(write_beat,env) wr_beat_imp;
// semaphore s1;
// (3) Within constructor of 'env' ::
// wr_beat_imp = new("wr_beat_imp",this);
// s1 = new(0);
// (4) TLM Connection to Monitor in connect_phase() ::
// axi_slv.agent.monitor.wr_beat_port.connect(wr_beat_imp);
// (5) Defining the write* function in 'env' ::
function automatic void write_wdata(write_beat tr);
$display("Input transaction has id: %0d",tr.id);
fork
begin
s1.get(1);
$display("Post s1.get(1), input transaction has id: %0d",tr.id);
// Additional logic here
end
join_none
endfunction:write_wdata
// Assume that s1.put(1) is done in a separate write_* function
Assume that the AXI slave monitor calls ap.write(txn) thrice before the 1st s1.put(1) executes.
Hence function ‘write_wdata’ would be called thrice and all 3 calls would be blocked via s1.get(1)
(Q1) Monitor creates a new object ( i.e calls new() ) every time it broadcasts an AXI pkt, how is it that write function is still able to see the properties associated with previous broadcast ?.
In other words, in the monitor upon creation of a new object the previous object would cease to exist yet how is that upon getting a key, we are able to observe properties associated with previous objects
(Q2) If the monitor clones the object before calling ap.write(txn), would it make any difference ? ( assuming that user never alters the properties in respective write* functions )