How does a UVM sequence change the transactions based on DUT Outputs

I am looking for ways to modify my UVM sequence to call a diff sequence/transaction or stop the stimulus requests to the DUT based on DUT outputs.

For example: if the DUT has an output packet size greater than 1000, the Sequence should slow down driving packets to the DUT. Or modify the transactions… How can this be achieved?

I could think of

  1. Some kind of communication between monitor and Sequencer?
  2. Driver sending a response back to the sequence? But driver doesnt know about DUT outputs , only monitor knows.

Please suggest!

In reply to n347:

This link may be useful for you.
https://verificationacademy.com/forums/uvm/sending-data-monitor-sequence

Alternatively, you can use uvm_queue#(seq_item) together with uvm_pool.
In monitor:


typedef uvm_object_string_pool #(uvm_queue#(seq_item)) uvm_queue_pool;
uvm_queue#(seq_item) queue = uvm_queue_pool::get_global("key");
queue.push_back(item);

In your sequence, you get the queue from the same key and check how many items are existed in the queue, then you can do whatever you want.


typedef uvm_object_string_pool #(uvm_queue#(seq_item)) uvm_queue_pool;
uvm_queue#(seq_item) queue = uvm_queue_pool::get_global("key");
if(queue.size() > 100) begin
 // Do something
end

In reply to cuonghle:

I believe this is not a good idea. You are storing seq_items in a queue and do not evaluate the item content. You are only looking for the number of seq_items. It is suffifient to count the number of seq_items.
BTW the driver can count the number of packets and opass them back to the sequence. This is in my eyes the best solution

you can use reactive slaves technique to modify your UVM sequence based on the DUT output.

In reply to n347:

I am looking for ways to modify my UVM sequence to call a diff sequence/transaction or stop the stimulus requests to the DUT based on DUT outputs.
For example: if the DUT has an output packet size greater than 1000, the Sequence should slow down driving packets to the DUT. Or modify the transactions… How can this be achieved?
I could think of

  1. Some kind of communication between monitor and Sequencer?
  2. Driver sending a response back to the sequence? But driver doesnt know about DUT outputs , only monitor knows.
    Please suggest!

Driver can collect the DUT outputs and it can send it back to sequence using the following methods

seq_item_port.item_done(rsp);
seq_item_port.put_response(rsp);
rsp_port.write(rsp);

Sequence can get the response using

get_response(rsp)

and can modify the transactions

In reply to shanthi:

Sending back responses is more easy as you are saying. It simply

seq_item_port.item_done(rsp);

sending back data to the sequence using seq_item_port.
The lines

seq_item_port.put_response(rsp);
rsp_port.write(rsp);

are 2 alternatives sending back data.
The last one needs an additional connection to the sequencer.

In reply to chr_sue:

In reply to shanthi:
Sending back responses is more easy as you are saying. It simply

seq_item_port.item_done(rsp);

sending back data to the sequence using seq_item_port.
The lines

seq_item_port.put_response(rsp);
rsp_port.write(rsp);

are 2 alternatives sending back data.
The last one needs an additional connection to the sequencer.

Sending response is only efficient when the response is capture for the same signal interface that driver controls.
What happened when your driver controls an interface (virtual interface) but DUT returns response in different interface?

Reactive agent is also a good solution for this requirement.

In reply to cuonghle:

If you receive the response in a different agent then there is no simple answer. It needs some more investigations. If the respinse is an interrupt you might add the interrupt signal/signals to the initializing interface. If there is no direct relationship you have to use horizontal synchronization. There are different approaches. One is to send data from 1 agent to another one using uvm_event/uvm_event_pool. This approach allows to pass data along with the uvm_event. I have posted here in the forum a solution for this.