Hello everyone. Here in this post we will learn how driver and sequencer communicate with each other in UVM in a simple way.
Driver is a component which is used to provide stimulus for DUT. Sequencer is a component which gets the sequence item from sequence and provide it to driver.
We now will understand how driver communicate with sequencer in simple points.


Driver is a component which is used to provide stimulus for DUT. Sequencer is a component which gets the sequence item from sequence and provide it to driver.
We now will understand how driver communicate with sequencer in simple points.
- Driver class should be derived from uvm_driver base class and should be parameterized with uvm_sequence_item.
- sequencer class should be derived from uvm_sequencer base class which is also parameterized with uvm_sequence_item.
- Sequencer has number of methods defined to get sequence items from sequence level. Below is the list.
- get_next_item(output REQ req) : This is a virtual task which is a blocking method. Until sequencer gets sequence item from sequence this will be blocked.This must be associated with Item_done.
- try_next_item(output REQ req): This is a virtual task and same as get_next_item(). It will return immediately and it is non-blocking method. Only successful getting of sequence item must be associated with item_done().
- get(output REQ req): This is a virtual task which is blocking until sequencer gets sequence item. item_done will be implicitly called. explicit item_done shall not be called.
- item_done(input RSP rsp=null): It is a function which does not require any argument by default. successful try_next_item or get_next_item must call this method at the end of complete driver action.
- put(input RSP rsp) : This is a virtual task which is used to give response to sequence. This will be used along with get method. This will internally call put_response method.
- peek(output REQ req): This method will be internally called by get_next_item, try_next_item and get method. This is the base for all these methods.
- We are now familiar with the sequencer methods. But now this method should be called in our driver to get the sequence items and to send response back to the sequence.
- This is done with the help of special TLM connection. uvm_driver base class have a handle of uvm_seq_item_pull_port known as "seq_item_port".
- Same way uvm_sequencer base class have a handle of uvm_sequence_item_pull_imp known as "seq_item_export".
- These port/export is constructed in uvm driver/ uvm_sequencer base class by default.
- In the agent, which instantiates sequencer and driver these TLM's should be connected. (seq_item_port.connect(seq_item_export)).
- Now we will go little in depth to understand how driver can access sequencer's method.
- below you can see seq_item_pull_port and seq_item_pull_imp class has UVM_SEQ_ITEM_PULL_IMP macros which is common.
- We will see what that macro defines
- All the methods required to access sequence items in driver are defined here.
- So when we call get_next_item from our driver class, the above defined method will be called which will call implementations methods.
- Implementation is the sequencer which has all the required methods.
Hope this post helped in understanding uvm_driver communication in easy, better and detailed way. Stay tuned for more posts on UVM...!! we will also have posts from System Verilog.
Good Explanation Raghuraj, Thankyou
ReplyDeleteThanks a lot. My doubts are cleared with your explanation. can you please explains the sequence and sequencer methods.
ReplyDeleteThanks a lot for your detailed explanation of sequencer and driver methods.
ReplyDeleteExcellent job.
Great Job.. very well written .
ReplyDeleteGood One
ReplyDeleteInformative..
ReplyDelete