Multiple sequences can interact concurrently with a driver connected to a single interface. The sequencer supports an arbitration mechanism to ensure that at any point of time only one sequence has access to the driver. The choice of which sequence can send a sequence_item is dependent on a user selectable sequencer arbitration algorithm.
There are six built-in sequencer arbitration mechanisms that are implemented in UVM. There is also an additional hook to implement a user defined algorithm. The sequencer has a method called set_arbitration() that can be called to select which algorithm the sequencer should use for arbitration.
The six algorithms that can be selected are as follows:
- SEQ_ARB_FIFO (Default if none specified). If this arbitration mode is specified, then the sequencer picks sequence items in a FIFO order from all sequences running on the sequencer.
Example: if seq1, seq2 and seq3 are running on a sequencer, it will pick an item from seq1 first, followed by seq2, and then seq3 if available, and continue.
- SEQ_ARB_WEIGHTED: If this arbitration mode is selected, sequence items from the highest priority sequence are always picked first until none available, then the sequence items from next priority sequence, and so on. If two sequences have equal priority, then the items from them are picked in a random order.
- SEQ_ARB_RANDOM: If this arbitration mode is selected, sequence items from different sequences are picked in a random order by ignoring all priorities.
- SEQ_ARB_STRICT_FIFO: This is similar to SEQ_ARB_WEIGHTED except that if two sequences have the same priority, then the items from those sequences are picked in a FIFO order rather than in a random order.
- SEQ_ARB_STRICT_RANDOM: This is similar to SEQ_ARB_RANDOM except that the priorities are NOT ignored. The items are picked randomly from sequences with highest priority first followed by next and in that order.
- SEQ_ARB_USER: This algorithm allows a user to define a custom algorithm for arbitration between sequences. This is done by extending the uvm_sequencer class and overriding the user_priority_arbitration() method.
How to prioritize a sequence?
The priority is specified by passing an argument to the start() method of the sequence. The priority is decided based on relative values specified for difference sequences.
For Example: If two sequences are started as follows, the third argument specifies the priority of the sequence.
seq_1.start(m_sequencer, this, 700); //Highest priority seq_2.start(m_sequencer, this, 500); //Next Highest priority seq_3.start(m_sequencer, this, 300); //Lowest priority among three sequences