Sequences Priority/Arbitration

Hi,

I have written tests using “Sequences/Priority” from the cookbook with no problem on a single sequencer.

Is there an easy way to have 5 more read sequence than the write sequence ?


      fork
        seq_read.start(my_agent_read.sequencer_read, null, HIGH_PRIORITY);
        seq_write.start(my_agent_write.sequencer_write, null, NORMAL_PRIORITY);
      join

// With HIGH_PRIORITY = 500 and NORMAL_PRIORITY = 100


Thank you

You have a couple of problems. The first is that you’re starting two sequences on two different sequencers, so the arbitration scheme is irrelevant. Sequencer arbitration is only valid for a given sequencer.
However, even if you were to start both sequences on the same sequencer, the weighted arbitration algorithm is still random. So, over the course of many iterations, you would be statistically likely to get 5x reads to x writes, but that doesn’t appear to be what you’re looking for.
The way you’ve written your code, each pass through the fork-join will do a single read and a single write. As you’ve written it, the weights are irrelevant.
If you really want reads and writes to execute on different sequencers, and you want 5x reads to each write, I would do:


fork
  for(int i = 0; i<5; i++)
    seq_read.start(my_agent_read.sequencer_read);
  seq_write.start(my_agent_write.sequencer_write);
join

Since the fork-join doesn’t exit until each statement has completed, this will do what you say you want.