UVM中accept_tr, begin_tr, end_tr的理解

begin_tr、accept_tr和end_tr是属于uvm_componet组件的recording interface的内建方法,这些方法组成了基于组件的事务记录接口。此方法可以用来帮助组件记录事务的产生或消耗。

 

 

 下文为verificationacademy.com中对于上述三个方法的提问和回答

Q:

Hi, I'm quite curious about the purpose of these recording interfaces - accept_tr, begin_tr, and end_tr.
I've read that the purpose of these is to "mark the acceptance of transaction, the beginning of transaction, and end of transaction."
Now, what I'm confuse about is, if the purpose of it is just to mark, then why not just use `uvm_info to report that a transaction has been accepted, started, or ended?

Is there any special on the recording interfaces I mentioned?

从UVM官方使用手册中可以发现,三个记录接口(accept_tr, begin_tr, and end_tr.)主要目的标记接收、启动处理、结束处理数据包的行为,既然是标记,为什么不用`uvm_info来报告数据包(transaction)被接收、启动和结束呢?亦或是记录接口具有什么特殊性?

A:

I have captured more details from the UVM Class Reference manual.

For accept_tr:

Calling accept_tr indicates that the transaction item has been received by a consumer component. Typically a would call uvm_component::accept_tr, which calls this method-- upon return from a get_next_item(), get(), or peek() call on its sequencer port, .

调用accept_tr方法意味着发送的数据包被consumer组件接收到了。它通常在sequencer port 中的get_next_item(), get()或 peek()被自动调用;

With some protocols, the received 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 for a bus grant before begining to execute the request.

在一些协议中,刚接收的数据包(item)可能不会立即启动处理。例如,在接收到发送的数据包后,总线驱动器需要等待启动授权后才启动处理发送数据。
This function performs the following actions

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.
The transaction’s internal accept event is triggered. Any processes waiting on the this event will resume in the next delta cycle.
The do_accept_tr method is called to allow for any post-accept action in derived classes.

accept_tr函数将会有以下行为:

transaction的内部接收时间设置为当前仿真时间;当accept_time存在且未非零值,内部接收时间设置为accept_time。accept_time可以是未来、过去的任一时间。当transaction内部的accept事件触发,任何等待此事件的进程将在下个周期恢复进程。accept_tr方法的调用允许子类进行post_accept的函数。

For begin_tr :

This function indicates that the transaction has been started and is not the child of another transaction. Generally, a consumer component begins execution of a transactions it receives.

begin_tr函数表明transaction已经启动并且不是其他transaction的子事务。consumer组件开始处理它接收的transaction。

Typically a would call uvm_component::begin_tr, which calls this method, before actual execution of a sequence item transaction. Sequence items received 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.

在实际执行sequence的事务之前,uvm组件会自动调用begin_tr方法。

See accept_tr for more information on how the begin-time might differ from when the transaction item was received.
This function performs the following actions

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 should not be less than the accept time.
If recording is enabled, then a new database-transaction is started with the same begin time as above.
The do_begin_tr method is called to allow for any post-begin action in derived classes.
The transaction’s internal begin event is triggered. Any processes waiting on this event will resume in the next delta cycle.

The return value is a transaction handle, which is valid (non-zero) only if recording is enabled. The meaning of the handle is implementation specific.

For end_tr :
This function indicates that the transaction execution has ended. Generally, a consumer component ends execution of the transactions it receives.

You must have previously called begin_tr or begin_child_tr for this call to be successful.

Typically a would call uvm_component::end_tr, which calls this method, upon completion of a sequence item transaction. Sequence items received 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 should 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.

  • 3
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值