TLM 2.0 LRM & 用法建议

本文深入介绍了Transaction Level Modeling (TLM) 2.0的关键概念,包括initiator、target、interconnect component和transaction object的角色。讲解了事务对象的生命周期,强调了socket在前向和后向路径中的作用。并提供了使用TLM-2.0的最佳实践,如建模总线桥时的选择以及为何推荐使用TLM-2.0套接字以实现更好的互操作性和一致性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

概述 

        本文介绍TLM的一些特性 以及 使用TLM的建议用法。

        主要内容结合Chap 10.4 of IEEE Std 1666-2011 IEEE Standard for Standard SystemC® LRM。

        TLM-1.0到TLM2.0的演进如下。

概念

initiator、target、interconnect component

An initiator is a module that can initiate transactions, that is, create new transaction objects and pass them on by calling a method of one of the core interfaces. 
一个发起者,是一个可以初始化事务的模块,也就是说,能够创建新的事务对象并且通过调用TLM2核心接口中的一个方法把这些事务对象传递出去。


A target is a module that acts as the final destination for a transaction.
一个目标,是一个扮演一个事务的最终目的地的模块。

In the case of a write transaction, an initiator (such as a processor) writes data to a target (such as a memory).
在一个写事务的情景中,一个发起者(例如一个处理器)写数据到一个目标(例如一个存储器)。


In the case of a read transaction, an initiator reads data from a target. 
在一个读事务的情境中,一个发起者从目标读数据。

An interconnect component is a module that accesses a transaction but does not act as an initiator or a target for that transaction, typical examples being arbiters and routers. 
一个互联组件,是一个要访问一个事务的的模块,但它既不充当发起者也不充当目标,典型的例子是仲裁器和路由器。


The roles of initiator, interconnect, and target can change dynamically. 
发起者、互联组件和目标,能够动态改变。

For example, a given component may act as an interconnect for some transactions but as a target for other transactions.
例如,一个给定的组件,对于某些事务它可以充当一个互联组件,而对于其他事务它会充当一个目标。

transaction object

The transaction object is created by an initiator and passed as an argument of a method of the transport interface (blocking or non-blocking). 
这个事务对象被发起者创建,并且作为阻塞或非阻塞传输接口的一个方法的参数被传递出去。

To illustrate the idea, this paragraph will describe the lifetime of a typical transaction object (Figure 19). 
为了举例说明这个想法,本段将会描述一个典型的事务对象的生命周期(图19)。

That method is implemented by an interconnect component such as an arbiter, which may read attributes of the transaction object before passing it on to a further transport call. 
这个方法被一个例如像仲裁器一样的互联组件实现,在通过进一步的方法调用把事务传输下去之前,传输这个事务对象的互联组件实现的方法有可能会读取事务对象的属性值


That second transport method is implemented by a second interconnect component, such as a router, which in turn passes on the transaction through a third transport call to a target such as a memory, the final destination for the transaction object. 
第二个传输方法在第二个互联组件中实现,例如一个路由器,然后轮到它通过第三个传输调用把事务传递到一个目标,例如一个存储器,也就是这个事务对象的最后目的地。


The actual number of interconnect components will vary from transaction to transaction. There may be none.
实际的互联组件的个数将会随事务的不同而不同,这里也可能没有互联组件。


This sequence of method calls is known as the forward path. 
这个方法调用的顺序就是众所周知的前向路径。

The transaction is executed in the target, and the transaction object may be returned to the initiator in one of two ways, either carried with the return from the transport method calls as they unwind, known as the return path, or passed by making explicit transport method calls on the opposite path from target back to initiator, known as the backward path. 
这个事务会在目标中被执行,而且这个事务对象可能通过两条路劲之一返回给发起者;
要么是从传输方法返回这个事务,也就是众所周知的返回路径,要么是通过从目标到发起者这个相反的路径上显示地调用传输方法来传递这个事务对象,也就是众所周知的后向路径。


This choice is determined by the return value from the non-blocking transport method. 
这个选择是由从非阻塞传输方法中返回的值决定的。   


(Strictly speaking there are two return paths corresponding to the forward and backward paths, 
but the meaning is usually clear from the context.)
严格地讲,这里有两条返回路径,分别对应着前向路径和后向路径,但是这些意义通常可以从上下文弄清楚。

The forward path is the calling path by which an initiator or interconnect component makes interface method calls forward 
in the direction of another interconnect component or the target. 
前向路径是这样一个调用路径,通过它,一个发起者或者一个互联组件进行接口方法的向前调用,向着另一个互联组件或目标的方向。

The backward path is the calling path by which a target or interconnect component makes interface 
method calls back in the direction of another interconnect component or the initiator. 
后向路径是这样一个调用路径,通过它,一个目标或者一个互联组件进行接口方法的向后调用,向着另一个互联组件或发起者的方向。

The entire path between an initiator and a target consists of a number of hops, each hop connecting two adjacent components. 
在发起者到接收者之间的整条路经,由好几跳构成,每一跳连接2个相邻的组件。

socket

A hop consists of one initiator socket bound to one target socket. 
一跳由一个绑定在目标套接字上的发起者套接字构成。
The number of hops from initiator to target is one greater than the number of interconnect components on that path. 
从发起者到目标的跳数,比这条路径上的互联组件个数多一。

When using the generic payload, the forward and backward paths should each pass through the same set of components and sockets in opposing directions.
当时用净核的时候,无论是前向路径还是后向路径,应该各自在相反的方向上通过同一组的组件和套接字。
In order to support both forward and backward paths, each connection between components requires a port and an export, both of which have to be bound. 
为了支持前向和后向路径,组件之间的任一连接必须要有一个port和一个export,而且这两者都是被绑定了的。
This is facilitated by the initiator socket and the target socket. 
这个要求,由系统开发的发起者套接字和目标套接字提供辅助。
An initiator socket provides a port for interface method calls on the forward path, and an export for interface method calls on the backward path. 
一个发起者套接字提供一个port,支持前向路径的接口方法调用,同时提供一个export支持后向路径的接口方法调用。
A target socket provides the opposite. (More specifically, an initiator socket is derived from class sc_port and has an sc_export,
 and vice versa for a target socket.) 
 一个目标套接字,则提供了相反的port和export。更确切地说,一个initiator_socket派生于一个sc_port类,并且拥有一个sc_export成员。
而一个目标套接字,则派生于一个sc_export ,并且拥有一个sc_port成员。

 The initiator and target socket classes overload the SystemC port binding operator to bind implicitly both forward and backward paths.
发起者和目标套接字类都重载了SystemC port的绑定操作符,以便隐式地绑定前向和后向路径。
 As well as the transport interfaces, the sockets also encapsulate the DMI and debug transport interfaces (see below).
 如同这些传输接口,套接字也封装了DMI和debug传输接口(见后文)。

 When using sockets, an initiator component will have at least one initiator socket, a target component at least one target socket, 
and an interconnect component at least one of each. 
当使用套接字时,一个发起者组件将至少拥有一个发起者套接字,一个目标组件将至少拥有一个目标套接字,而对于一个互联组件而言,每种套接字都至少拥有一个。

使用举例

The TLM-2.0 core interfaces pass transactions between initiators and targets (Figure 18).
TLM-2 的核心接口函数,在发起者与目标之间传递事务(图18)

A component may have several sockets transporting different transaction types, 
in which case a single component may act as an initiator or as a target for multiple independent transactions.
一个组件可能由几个套接字,分别用来传输不同的事务类型,在这种情况下,对于多个独立的不同事务,单个组件可能充当一个发起者,也可能充当一个目标。

建议做法 & Code styles

In order to model a bus bridge, there are two alternatives. 
为了给总线桥建模,这里有两个选择。

Either model the bus bridge as an interconnect component or model the bus bridge as a transaction bridge between 
two separate TLM-2.0 transactions. 
要么,把这个总线桥建模成一个互联组件,要么,把这个总线桥建模成两个独立的TLM-2.0事务之间的一个事务桥。

An interconnect component would pass on a pointer to a single transaction object, which is the best approach for simulation speed. 
一个发起者组件,应该传递一个指向单个事务对象的指针,这样子,是提高仿真速度的最好方法。

A transaction bridge would require the transaction object to be copied, which gives much
more flexibility because the two transactions could have different attributes.
一个事务桥,将会要求拷贝事务对象,这将给与更多的灵活性,因为这两个事务可以拥有不同的属性。

The use of TLM-2.0 sockets is recommended for maximal interoperability, convenience, and a consistent coding style. 
为了获得最大的互操作性、便利和一致的编码风格,我们隆重推荐使用TLM-2.0 套接字。

Although it is possible for components to use SystemC ports and exports directly with the TLM-2.0 core interfaces, this is not recommended.
虽然对于组件来说,直接使用使用SystemC的ports和exports 以及TLM-2.0核心接口是可能的,但是我们并不推荐。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

IC验证大表哥

你的鼓励将是我创作的最大动力~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值