uvm_transaction——事物
文件:
src/base/uvm_transaction.svh
类:
uvm_transaction
uvm_transaction继承自uvm_object,添加了timing和recording接口,该类是uvm_sequence_item的基类。这个类提供了时间戳属性(timestamp properties),通知事件(notification events),和交易记录(transaction recording)支持。其子类uvm_sequence_item应当作为基类为所有用户定义的事务类型。
//------------------------------------------------------------------------------ // // CLASS: uvm_transaction // // The uvm_transaction class is the root base class for UVM transactions. // Inheriting all the methods of <uvm_object>, uvm_transaction adds a timing and // recording interface. // // This class provides timestamp properties, notification events, and transaction // recording support. // // Use of this class as a base for user-defined transactions // is deprecated. Its subtype, <uvm_sequence_item>, shall be used as the // base class for all user-defined transaction types. // // The intended use of this API is via a <uvm_driver #(REQ,RSP)> to call <uvm_component::accept_tr>, // <uvm_component::begin_tr>, and <uvm_component::end_tr> during the course of // sequence item execution. These methods in the component base class will // call into the corresponding methods in this class to set the corresponding // timestamps (~accept_time~, ~begin_time~, and ~end_time~), trigger the // corresponding event (<begin_event> and <end_event>, and, if enabled, // record the transaction contents to a vendor-specific transaction database. // // Note that get_next_item/item_done when called on a uvm_seq_item_pull_port // will automatically trigger the begin_event and end_events via calls to begin_tr and end_tr. // While convenient, it is generally the responsibility of drivers to mark a // transaction's progress during execution. To allow the driver or layering sequence // to control sequence item timestamps, events, and recording, you must call // <uvm_sqr_if_base#(REQ,RSP)::disable_auto_item_recording> at the beginning // of the driver's ~run_phase~ task. // // Users may also use the transaction's event pool, <events>, // to define custom events for the driver to trigger and the sequences to wait on. Any // in-between events such as marking the beginning of the address and data // phases of transaction execution could be implemented via the // <events> pool. // // In pipelined protocols, the driver may release a sequence (return from // finish_item() or it's `uvm_do macro) before the item has been completed. // If the driver uses the begin_tr/end_tr API in uvm_component, the sequence can // wait on the item's <end_event> to block until the item was fully executed, // as in the following example. // //| task uvm_execute(item, ...); //| // can use the `uvm_do macros as well //| start_item(item); //| item.randomize(); //| finish_item(item); //| item.end_event.wait_on(); //| // get_response(rsp, item.get_transaction_id()); //if needed //| endtask //| // // A simple two-stage pipeline driver that can execute address and // data phases concurrently might be implemented as follows: // //| task run(); //| // this driver supports a two-deep pipeline //| fork //| do_item(); //| do_item(); //| join //| endtask //| //| //| task do_item(); //| //| forever begin //| mbus_item req; //| //| lock.get(); //| //| seq_item_port.get(req); // Completes the sequencer-driver handshake //| //| accept_tr(req); //| //| // request bus, wait for grant, etc. //| //| begin_tr(req); //| //| // execute address phase //| //| // allows next transaction to begin address phase //| lock.put(); //| //| // execute data phase //| // (may trigger custom "data_phase" event here) //| //| end_tr(req); //| //| end //| //| endtask: do_item // //------------------------------------------------------------------------------ virtual class uvm_transaction extends uvm_object; // Function: new // // Creates a new transaction object. The name is the instance name of the // transaction. If not supplied, then the object is unnamed. extern function new (string name="", uvm_component initiator=null); ...... endclass
参考文献:
1 uvm_transaction. http://blog.sina.com.cn/s/blog_466496f30100y7u9.html
2 UVM基础之———uvm_transaction. http://www.cnblogs.com/bob62/p/3871858.html