Open transaction-stream

I know that first call to begin_tr will create a transaction stream. However, how to pre-open a stream in advance in the build_phase ? I want to display the transactions on my wave viewer which is opened always after the first simulation step. At the moment I receive an error that object (the transaction stream) was not found, as the first begin_tr is called later during the verification. Is there any good practice to tackle this issue ?

In reply to adrianf0:

I guess you want to make the transactions visible in the waveform viewer of your simulator.
For this reason you have to switch-on transaction recording by setting recording_detail to 1.
All dynamic components and the first sequence item will be built after runtime zero.
Then you can add the transactions to your wave window.

The transactions are visible in the waveform viewer, but only if I open it after first begin_tr call.
In my workflow, I start simulation, I open wave viewer after first simulation step and I continue simulation afterwards. In this scenario, the transactions are not visible, as the the stream was dynamically opened later.

In reply to adrianf0:

Calling begin_tr brings a transaction to live. It does not exist before.

You can open a stream using:


uvm_default_recorder.create_stream("stream_name", "TVM", get_full_name());

This opens a stream and shows it under the component you call the code from. You can do this some time before the run phase (start of simualation, end of elaboration, it doesn’t really matter). If you load your waves after the UVM hierarchy was created, you’ll see the stream there.

I’ve no idea what “TVM” means, I just looked around at what begin_tr does and at some point it calls this function with “TVM” as an argument.

After you’ve opened your stream, make sure to use the same name for calls to begin_tr.

In reply to Tudor Timi:
Thanks for inspiration.
The whole required code would be:


integer stream_h=0;
if (uvm_verbosity'(recording_detail) != UVM_NONE) begin
   stream_h = recordr.create_stream(stream_name, "TVM", get_full_name());
   m_stream_handle[stream_name] = stream_h;
end

Only after the last assignment the stream becomes available in my monitor for a waveform viewer. The problem is that m_stream_handle is a local variable, thus it can’t be modified from an inheriting class.

In reply to adrianf0:

Transaction recording is the place where each vendor can do his own thing. It’s kind of silly that yours requires the assignment to m_stream_handle, because that variable only acts as a cache for future calls to begin_tr(…). The streams that are created are a property of the recorder and not of any component. I say this because streams have names and scopes, but the scope is just a string in the end. Because its scope matches with a component, a stream gets shown under that component in the waveform viewer.

What you can do in this case is force an assignment to m_stream_handle by calling record_event(…) at the beginning of your simulation.