UVM Sequencer

In Universal Verification Methodology (UVM), the sequencer is a critical component responsible for managing and controlling the flow of transactions to the driver, ensuring a well-structured and flexible testbench architecture. It coordinates the generation of stimulus by interacting with sequences and passing transactions to the driver. It acts as a mediator between the sequence, which generates transaction-level stimulus, and the driver, which converts these transactions into pin-level signals for the design under test (DUT).

A user-defined sequencer class is extended from uvm_sequencer. It should be parameterized with request(REQ) and response(RSP) item types. Response is optional. uvm_sequencer is inherited by uvm_component.

class <sequencer_name> extends uvm_sequencer #(type REQ = uvm_sequence_item);

The sequencer and driver are connected using a TLM (Transaction-Level Modeling) interface. Specifically, this connection is established through the seq_item_port in the driver and the seq_item_export in the sequencer. This interface allows the sequencer to send transactions (generated by a sequence) to the driver, enabling the driver to interact with the Design Under Test (DUT).

Sequencer and Driver handshake mechanism:

  1. Driver’s seq_item_port:
    • The driver declares a uvm_seq_item_pull_port, commonly named seq_item_port.
    • This port is used to fetch transactions from the sequencer.
  2. Sequencer’s seq_item_export:
    • The sequencer declares a uvm_seq_item_pull_export, typically named seq_item_export.
    • This export serves as the receiving end of the TLM connection, allowing the driver to pull transactions.
  3. Connection in the Agent/Environment:
    • In the connect_phase() of the UVM agent, the driver’s seq_item_port is connected to the sequencer’s seq_item_export.
driver.seq_item_port.connect(sequencer.seq_item_export);

Example: Implementing a UVM Sequencer

Let’s implement a simple UVM sequencer.

class pt_sequencer extends uvm_sequencer#(p_transaction);
  `uvm_component_utils(pt_sequencer)
  
  function new(string name, uvm_component parent);
    super.new(name,parent);
  endfunction
  
endclass