Multiple threads in the uvm_do_with

Hi

I have a code which is

fork
begin
uvm_do_with (); uvm_do_with ();
uvm_do_with (); uvm_do_with ();
end
join

All the txns are through same sequencer but the cmd sent is different , who and how will all txns go through the driver.
Also which txn will be sent first and which one last.
Should I set the arbitration rule here ?

Please help

regards
Avinash

What do you expect to happen? Is this what you want to happen or do you want something different to happen?

Have you run your code and see how it behaves? Is this different than what you expected?

Additionally, there may be conflicts within your fork…join block if you reused sequence variables, but the code you posted didn’t provide enough details.

In reply to cgales:

Hi Cgales

Thanks for your reply.

Here is more detail on the code

fork

begin
`uvm_do_with (txn,p_sequenencer.my_seq,cmd1);
end

begin
#rnd_delay1;
`uvm_do_with (txn,p_sequenencer.my_seq,cmd2);
end

begin
#rnd_delay2;
`uvm_do_with (txn,p_sequenencer.my_seq,cmd3);
end

begin
#rnd_delay3;
`uvm_do_with (txn,p_sequenencer.my_seq,cmd4);
end

join

Here I was just trying to understand when the cmd1 starts executing , and cmd2 txn uvm_do_with gets active , will the cmd2 getted pushed into a buffer and will get executed after cmd1.

I am just trying know how this code is executed.

I ran the code and I see that all the commands are executed.

Avinash

In reply to Avinash:

Several comments:

  • You should never have time delays in your sequences. Time delays should only be used in your drivers and all other UVM components/objects should be completely untimed.
  • You should never use the `uvm_do_* macros.
  • You should never reference p_sequencer. This creates a dependency on a specific sequencer which reduces re-use.

See the UVM Guidelines for additional explanations.

When you call start() for a sequence, or start_item() for a sequence_item, the sequence/sequence_item is added to the list of available sequences/sequence_items for the specified sequencer. The sequencer will wait for the driver to request an item, and then in turn activate the a sequence/sequence_item based on it’s arbitration method. Using fork/join will allow you to add multiple sequences/sequence_items to the list of available items. Read this article about the UVM Sequence APIs.