Controlling sequences based on observed transactions on other interfaces

Hi Tom,

I have a requirement where I need to control sequences (and data in the sequence item associated with it) based on observed transactions on other interfaces and processed to determine what to do on the sequences running on the virtual sequencer. A simple example would be like:

I have an input sequence which has to generate a unique message id which is part of the sequence item associated with it. For this I think I will have a scoreboard which will get transactions from both the input sequence and output sequence (both has the message id) and the scoreboard records the message id from the input sequence in a queue / array and removes them when the output sequence arrives from the DUT. Now this queue/array needs to be seen/accessed by the active sequences (running on virtual sequencer) to not to generate the message id’s in use.

I was told that this could be achieved using config db, but I can’t quite understand how to actually implement.

(Q) How can I implement such a behaviour, which could potentially be reusable (if required) and scalable?

Could you share an example to explain this or may be explain with an example. It would be good if the VAcademy has an example code to address requirements of this kind.

Thanks,
Madhu

Hi Madhu,
My first suggestion is not to use a virtual sequencer. See the UVM Cookbook for more details (especially the comment at the bottom about why virtual sequencers are not a good idea).

I think the easiest way to use the config_db might be to create an instance of the queue/array that you want in the test or env, and then use the config_db to pass that pointer to the scoreboard and the sequence(s) that also need to access it.

In reply to tfitz:

Hi Tom,

An alternative methodology for running virtual sequences is to use a virtual sequencer, which is a uvm_sequencer which contains the handles for the target sequencers. In this methodology, the virtual sequence is started on the virtual sequencer and it gets the handles for the target sequencers from the virtual sequencer. The limitation of this approach is that it is a fixed implementation which is very tightly coupled to the local hierarchy of an env and this adds complications with vertical reuse.

So, how can we control the aspect of coordinating between sequences, without a virtual sequence which runs on a virtual sequencer. I have a virtual sequencer which has handles to various sequencers.

Coming to my original question of using some data which is populated based on observed activity from monitors and stimulus generated on this data. I have few questions ?

  1. I am not very clear when you say “create an instance of queue/array”. where does this array exist as a member ?
  2. I wonder what happens if both scoreboard and the sequence both trying to access the same index at the same time ? Do we need any semaphores to take care of this shared resource access ?
  3. Will this approach reusable, in the sense that when this env is used at top level where env may be replaced with top level env with all agents being passive ?
  4. Also, what if I want to access different pieces of information such as array of objects (cloned from observed traffic) and maintained in a system monitor or some other component?

Could you please elaborate ?

Thanks,
Madhu

In reply to mseyunni:

Even if using a virtual sequencer, the virtual sequence needs to have pointers to the “regular” sequencers in the virtual sequencer. You can just as easily set these pointers to the actual sequencer instances and save yourself a level of indirection.

  1. I am not very clear when you say “create an instance of queue/array”. where does this array exist as a member ?

Wherever you want to put it. The point is that you’ll use the config_db to pass the same object to both your scoreboard and your sequences, so they’ll all use the same actual data structure.

  1. I wonder what happens if both scoreboard and the sequence both trying to access the same index at the same time ? Do we need any semaphores to take care of this shared resource access ?

That’s an application-specific programming question that you’ll have to answer yourself. But a semaphore is probably a good idea.

  1. Will this approach reusable, in the sense that when this env is used at top level where env may be replaced with top level env with all agents being passive ?

Whatever env you use must set up the sequences and scoreboard in such a way that they will be useful. If you replace your env with another, you must still do the setup.

  1. Also, what if I want to access different pieces of information such as array of objects (cloned from observed traffic) and maintained in a system monitor or some other component?

If that’s what you want to do, then you may do it. You can either share the array via config_db, or you can have each of your monitors’ analysis_ports connected to a system monitor (which would probably best have multiple analysis_exports).

Hope this helps,
-Tom

In reply to tfitz:

Hi Tom,

Thanks for the answers.

  1. Also, what if I want to access different pieces of information such as array of objects (cloned from observed traffic) and maintained in a system monitor or some other component?
    If that’s what you want to do, then you may do it. You can either share the array via config_db, or you can have each of your monitors’ analysis_ports connected to a system monitor (which would probably best have multiple analysis_exports).

For the case where I want to use few methods and variables (arrays or queues), can I put an instance of system monitor in config db and access in both scoreboard and sequences ?

In reply to mseyunni:

Hi Tom,

I created a “config object” which has an array to track the id’s based on request and responses. I would like to put this object in the config db and retrieve it in both system monitor to set/clear the id’s. Again, in vseq/sequence I would like to retrieve a handle to this object and generate id’s not in the list of active_id’s.

class id_tracker extends uvm_object;

endclass

so I have created this config object in my env and then did something like below:

m_id_tracker = new(“m_id_tracker”);

uvm_config_db #(id_tracker)::set(this,“m_id_tracker”,“id_tracker”,m_id_tracker);

and then in my system monitor trying to retrieve like:

if(!uvm_config_db #(id_tracker)::get(null,“”,“id_tracker”,m_id_tracker)) begin
`uvm_error(“Unable to retrieve id_tracker object”)
end

I get the above error for uanble to retrieve the config object. I don’t seem to understand why the config db set / get failed.

Could you explain?

Thanks,
Madhu