Driver Sequencer Handshake
How does a sequencer communicate with the driver ?
The driver class contains a TLM port called
uvm_seq_item_pull_port which is connected to a
uvm_seq_item_pull_export in the sequencer in the connect phase of a UVM agent. The driver can use TLM functions to get the next item from the sequencer when required.
Why do we need the driver sequencer API methods ?
These API methods help the driver to get a series of sequence_items from the sequencer's FIFO that contains data for the driver to drive to the DUT. Also, there is a way for the driver to communicate back with the sequence that it has finished driving the given sequence item and can request for the next item.
What is the port in driver called ?
Declaration for the TLM ports can be found in the class definitions of
uvm_sequencer as follows.
// Definition of uvm_driver class uvm_driver #(type REQ=uvm_sequence_item, type RSP=REQ) extends uvm_component; // Port: seq_item_port // Derived driver classes should use this port to request items from the // sequencer. They may also use it to send responses back. uvm_seq_item_pull_port #(REQ, RSP) seq_item_port; // Port: rsp_port // This port provides an alternate way of sending responses back to the // originating sequencer. Which port to use depends on which export the // sequencer provides for connection. uvm_analysis_port #(RSP) rsp_port; REQ req; RSP rsp; // Rest of the code follows ... endclass
What is the TLM port in sequencer called ?
uvm_sequencer has an inbuilt TLM pull implementation port called
seq_item_export which is used to connect with the driver's pull port.
// Definition of uvm_sequencer class uvm_sequencer #(type REQ=uvm_sequence_item, RSP=REQ) extends uvm_sequencer_param_base #(REQ, RSP); // Variable: seq_item_export // This export provides access to this sequencer's implementation of the // sequencer interface. uvm_seq_item_pull_imp #(REQ, RSP, this_type) seq_item_export; // Rest of the class contents follow ... endclass
How is a driver connected to a sequencer ?
The port in
uvm_driver is connected to the export in
uvm_sequencer in the
connect phase of the UVM component in which both the driver and sequencer are instantiated. Typically, a driver and sequencer are instantiated in a
class my_agent extends uvm_agent; `uvm_component_utils (my_agent) my_driver #(my_sequence_item) m_drv; uvm_sequencer #(my_sequence_item) m_seqr; virtual function void connect_phase (uvm_phase phase); // Always the port is connected to an export m_drv.seq_item_port.connect(m_seqr.seq_item_export); endfunction endclass
The connect between a driver and sequencer is a one-to-one connection. Multiple drivers are not connected to a sequencer nor are multiple sequencers connected to a single driver. Once the connection is made, the driver can utilize API calls in the TLM port definitions to receive sequence items from the sequencer.