Don't use null as a sequencer argument to uvm_reg_sequence

Back when I started using UVM, I had no use for a register model for the specific unit I was testing. As such, sequences were written which needed a sequencer which would hand the items in the sequence to the driver.
Over time, we moved to use the register model and its uvm_reg_sequence. At first I would pass the sequencer of the agent responsible for sending the transaction to the sequence. But then I discovered this to be error prone: sometimes the sequencer would not exist because the agent had been declared to be UVM_PASSIVE, in another case I needed to dig deep to find the sequencer to be used.

Looking at the code I also discovered that while sending a protocol sequence to a specific sequencer made a lot of sense, a register model (or more specifically a register map) would already be bound by the environment's maintainer to the correct sequencer causing the reg sequence to disregard the sequencer argument given to it and accessing the register according to the map's definition.

That's where I started sending null as an argument to the sequence's sequencer. Things went fine, up until the moment I forgot to add objections before and after running the sequence. You see, a sequence has no notion of phases due to the fact it doesn't inherit from uvm_component; therefore it's not an objector to the phase. What will happen, is the moment the phase gets done, the sequence will get killed no matter if it's done or not.
Conclusion: always start register sequences with a sequencer, even though the sequencer isn't used directly, the sequencer has more uses then simply handing down the sequence items to the driver.
So as to avoid needing to dig in all the way to the agent, give it a virtual sequencer of the environment.

That's it for now,

Tsvi

Comments

Popular posts from this blog

The crooked ways of UVM's register model's coverage methods

uvm_config_db vs uvm_resource_db, where they come from and what are they good for