UVM basics ------ uvm_transaction

Source: Internet
Author: User
Uvm_transaction is inherited from uvm_object and added the timing and recording interfaces. This class is the base class of uvm_sequence_item. This class provides timestamp properties, notification events, and transaction recording. 2. Using this class as the basic transaction defined by the user is deprecated. Its subclass uvm_sequence_item should be used as the base class for all user-defined transaction types. 3. The purpose of this API is to call uvm_component <uvm_driver>: accept_tr uvm_component: begin_tr uvm_component: end_tr during sequence item execution. In this way, set the corresponding timestamp (accept_time, begin_time, and end_tr) to trigger the corresponding event (begin_event and end_event). If enabled, record the transaction content specific to the supplier's transaction database. 4. note that start_item/finish_item (or 'uvm _ do * macro) executed from a uvm_sequence # (req, RSP) will automatically trigger the begin_event and end_events via callto begin_tr and end_tr.5. although convenient, triggering these events should usually be done by drivers to mark the progress during the transaction execution, marking the progress during the execution of a transaction. To allow the driver to control sequence item timestamps, events, and recording, you must add + define + uvm_disable_auto_item_recording when compiling the UVM package. 6. in addition, you may use event pools and events of transactions to define custom events driver triggers and sequences. The addresses marked by any intermediate event and the start-stage transaction execution of data can be implemented through events pools. 7. 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.8. task uvm_execute (item ,...); // can use the 'vm _ 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 neededendtask
9. 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 (); joinendtask 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
1. variable local integer m_transaction_id =-1; // ID local time begin_time =-1; // start record time local time end_time =-1; // The End record time local time accept_time =-1; // The accepted time local uvm_component initiator; // The component local integer stream_handle of the instance; // local integer tr_handle of the stream to which this instance belongs; // handle of this instance, that is, an index value of this instance, which records the tr somewhere. local bit record_enable = 0; // record enabling local uvm_recorder m_recorder; // recorder const uvm_event_pool events = new; uvm_event begin_event; uvm_event end_event;
2. function uvm_transaction: New (string name = "", uvm_component initiator = NULL); // This function sets the Instance name, component, transaction_id, start event, and end event 3. function void uvm_transaction: Set/get_transaction_id (integer ID); Access to m_transaction_id 4. function void uvm_transaction: Set/get_initiator (uvm_component initiator); Access to initiator 5. function uvm_event_pool uvm_transaction: get_event_pool (); // returns events 6. function bit uvm_transaction: is_active (); // test whether tr_handle is null. 7. the following functions require the function time uvm_transaction: hour (); function time uvm_transaction: get_end_time (); function time uvm_transaction: get_accept_time (); Function Integer uvm_transaction: accept (); function void uvm_transaction: disable_recording (); function bit uvm_transaction: is_recording_enabled (); 8. the following function is just a hook and can be called by the corresponding function in the appropriate place void uvm_transaction: do_accept_tr (); function void uvm_transaction: do_begin_tr (); function void uvm_transaction :: do_end_tr (); // The following three methods are used to implement the methods in uvm_object, Function void uvm_transaction: do_print (uvm_printer printer); // print accept/begin/End Time, initiator name Function void uvm_transaction: do_copy (uvm_object RHs); // copy the internal variables Function void uvm_transaction: do_record (uvm_recorder recorder); // record initiator and accept time9. function void uvm_transaction: enable_recording (string stream, uvm_recorder recorder = NULL); // generate stream_handle Based on stream to enable_record If transaction recording is on, then a call to record is made when the transaction is started and when it is ended. 10. function void uvm_transaction: accept_tr (Time accept_time = 0); // generate or set accept_time, trigger accept_event, and call do_accept_tr 1. calling accept_tr indicates that the transaction item has been encrypted ed by a consumer component. 2. typically a <uvm_driver> wocould call uvm_component: accept_tr, which callthis Method -- upon return from a get_next_item (), get (), or PEEK () call on its sequencer port, <uvm_driver: seq_item_port>. 3. with some protocols, the specified ed item may not be started immediately after it is accepted. for example, a bus driver, having accepted a request transaction, may still have to wait A bus grantBefore begining to execute the request.
4. this function performs the following actions: 1. the transaction's internal accept time is set to the current simulation time, or to accept_time if provided and non-zero. the accept_time may be any time, past or future. 2. The transaction's internal accept event is triggered. Any processes waiting on the this event will resume in the next Delta cycle. 3. Do_accept_trMethod is called to allow for any post-accept action in Derived classes.
11. function Integer uvm_transaction: begin_tr (Time begin_time = 0); call 12 1. this function indicates that transaction has been started and is not the child 2 of another transaction. typically a <uvm_driver> wocould call uvm_component: begin_tr, which CILS this method, before actual execution of a sequence item transaction. sequence items stored ed by a driver are always a child of a parent sequence. in this case, begin_tr obtains the parent handle and delegates to begin_child_tr. 3. this function performs the following actions: 1. the transaction's internal start time is set to the current simulation time, or to begin_time if provided and non-zero. the begin_time may be any time, past or future, but shoshould not be less than the Accept time. 2. if recording is enabled, then a new database-transaction is started with the same begin time as above. 3. the do_begin_tr method is called to allow for any post-begin action in Derived classes. 4. the transaction's internal begin event is triggered. any processes waiting on this event will resume in the next Delta cycle.
12. function Integer uvm_transaction: m_begin_tr (Time begin_time = 0, integer parent_handle = 0, bit has_parent = 0); // set begin_time; If record_enable, first check whether the tr_handle is in Recorder, if it already exists, the end_tr is printed. Otherwise, the record is recorded and tr_handle is returned. If there is a parent handle, a connection is established between tr_handle and parent_handle. Finally, check whether tr_handle is valid. If record_enable = 0, tr_handle = 0; then do_begin_tr () is called, begin_event is triggered, and tr_handle is returned. 13. function Integer uvm_transaction: begin_child_tr (Time begin_time = 0, integer parent_handle = 0); // call 12, set has_parent = 1. 14. function void uvm_transaction: end_tr (Time end_time = 0, bit free_handle = 1); // set end_time, call do_end_tr, and call recorder. edn_tr, recorder. free_tr, finally triggered end_eventthis function indicates that the transaction execution has ended. generally, a consumer component ends execution of the transactions it events es. you must have previusly called begin_tr or begin_child_tr for this call to be successful. typically a <uvm_driver> wocould call uvm_component: end_tr, which callthis method, upon completion of a sequence item transaction. sequence items stored ed by a driver are always a child of a parent sequence. in this case, begin_tr obtain the parent handle and delegate to begin_child_tr.this function performs the following actions the transaction's internal end time is set to the current simulation time, or to end_time if provided and non-zero. the end_time may be any time, past or future, but shoshould not be less than the begin time. if recording is enabled and a database-transaction is currently active, then the record method inherited from uvm_object is called, which records the final property values. the transaction is then ended. if free_handle is set, the transaction is released and can no longer be linked to (if supported by the implementation ). the do_end_tr method is called to allow for any post-end action in Derived classes. the transaction's internal end event is triggered. any processes waiting on this event will resume in the next Delta cycle.




From Weizhi note (wiz)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.