从小父亲就教育我,做一个对社会有用的人!
关于握手协议的文章,网上有很多很多,这篇文章是最原滋原味的介绍,希望可以帮助到有缘人!
uvm_driver #(REQ,RSP)
The base class for drivers that initiate requests for new transactions via a uvm_seq_item_pull_port. The ports are typically connected to the exports of an appropriate sequencer component.
This driver operates in pull mode. Its ports are typically connected to the corresponding exports in a pull sequencer as follows:
driver.seq_item_port.connect(sequencer.seq_item_export); driver.rsp_port.connect(sequencer.rsp_export);
uvm_driver is a child of uvm_component]that has a TLM port to communicate with the sequencer. Thedriver is a parameterized class with the type of request and response sequence items.This allows the driver to send back a different sequence item type back to the sequencer as the response.However, most drivers use a response object of the same type as the request sequence item.
The_uvm_driver gets request sequence items (REQ) from the sequencer FIFO using a handshake mechanismand optionally returns a response sequence item (RSP) back to the sequencer response FIFO.There are primarily two ways for the driver to get a sequence item from the sequencer. In this article, we'll look at anexample that uses the first style.
Using get_next_item method in a driver
In this case, the driver requests for a sequence item from the sequencer using the get_next_item methodthrough the seq_item_port TLM handle. Since the implementation of this port is defined in the sequencer,the function call makes the sequencer to pop an item from its internal FIFO and provide it to the driver viathe argument provided in get_next_item method.
Once driver gets the next item, it can drive the data in the received sequence item to the DUT via a virtual interface handle. After the driver has finished driving the item, it has to let the sequencer know that theprocess has finished using item_done method.
How does the sequencer get these sequence items ?
A uvm_sequenceis started on a sequencer which pushes the sequence item onto the sequencer's FIFO.
// ------------- / get_next_item // ------------- task uvm_sequencer::get_next_item(output REQ t); REQ req_item; // If a sequence_item has already been requested, then get_next_item() // should not be called again until item_done() has been called. if (get_next_item_called == 1) uvm_report_error(get_full_name(), "Get_next_item called twice without item_done or get in between", UVM_NONE); if (!sequence_item_requested) m_select_sequence(); // Set flag indicating that the item has been requested to ensure that item_done or get // is called between requests sequence_item_requested = 1; get_next_item_called = 1; m_req_fifo.peek(t); endtask