Complete TLM-2.0 AT Example, Including Initiators, Interconnect and Targets
Complete TLM-2.0 AT Example, Including Initiators, Interconnect and Targets
Introduction
This is a complete working example consisting of multiple approximately-timed (AT) initiators and targets and an AT interconnect. As far as we know, it
is the only publicly available complete AT base protocol implementation of its kind.
This example is intended primarily for advanced TLM-2.0 users. AT components such as this would typically be implemented by model vendors rather
than by end users. However, even if you do not consider yourself an "expert", you may still pick up some useful tips. As an end user, you would typically
obtain components such as this off-the-shelf from a vendor or internal development team; your job would be to integrate the components and possibly to
write some simple (or less simple) target components.
The AT initiators and targets in this example are of interest because they demonstrate the various base protocol options with respect to using the
forward, backward and return paths and early completion. There are two initiators named AT_typeA_initiator and AT_typeB_initiator, and five targets
named AT_typeA_target through AT_typeE_target. The type A and B initiators and type A-E targets each use different cases of the base protocol, that
is, using the forward/backward paths versus the return path, or skipping END_REQ, or completing early.
The AT interconnect component is of interest because it is a complete AT base protocol implementation, having the following features:
It uses multi_passthrough_ sockets
It obeys the base protocol rules, particularly the exclusion rules at initiator and target sockets.
It supports any number of initiators and targets
It handles b_transport, DMI and debug, as well as nb_transport
Every initiator communicates with every target through the same AT interconnect. The initiators and targets are themselves just shells with a trivial
functional core. The main interest is in the AT method calls through the sockets.
The AT coding style supports multiple transctions in-flight at the same time. However, the request and response exclusion rules prevent there being
more than one request or more than one response in progress through any given socket at any given time. In other words, a component is not allowed
to send the next BEGIN_REQ until it has seen the previous END_REQ, or the next BEGIN_RESP until it has seen the previous END_RESP. These
exclusion rules allow any component to put back-pressure on any other component trying to send a request or response.
The nb_transport method is always called with a phase argument. If there is an answering phase, it can be returned in one of two ways; either as part
of the same method call (the return path) or using a second and subsequent method call in the opposite direction. The use of the return path is signalled
to the caller by having nb_transport return the value TLM_UPDATED. It is also possible for a component to jump direct to the end response phase and
shortcut the intervening phases by having nb_transport return TLM_COMPLETED.
AT versus LT
This short video compares the RTL and TLM abstraction levels, and also compares the AT and LT coding styles.
The Architecture
The file at_example.cpp contains the top-level SystemC module, which instantiates the initiators, interconnect and targets. There is a base protocol
checker instantiated for each socket of the interconnect component. The base protocol checkers are included solely for debug and verification.
These definitions may be altered in order to instantiate a different combination of initiator and target types.
Notice that this configuration permits an initiator of any type to communicate with a target of any type.
These two lines could be replaced to implement an alternative arbitration algorithm. All components call the function rand_ps() from
common_header.h to generate the delays used for timing annotation and waits. This ensures that the TLM-2.0 interfaces are thoroughly stressed.
The Interconnect
The interconnect can route incoming transactions from any initiator to any target, and vice versa. However, the interconnect is obliged by the base
protocol to obey the request exclusion rule at the initiator sockets and the response exclusion rule at the target sockets. To do this it maintains queues of
transactions associated with each socket.
Responses returning in the direction of the initiators must be routed back through the correct target socket. To do this, the interconnect uses instance-
specific extensions to attach routing information to each transaction.
Learning More
There is a lot more to learn about the implementation of the TLM-2.0 base protocol and the interconnect component than is explained above. If you
need to know more, you should consider attending a Doulos face-to-face training class. For further details, see www.doulos.com
Click here to download the source code. In exchange, we will ask you to enter some personal details. To read about how we use your details, click
here. On the registration form, you will be asked whether you want us to send you further information concerning other Doulos products and services in
the subject area concerned.
See also: TLM-2.0 Base protocol checker The full list of TLM-2.0 Tutorials
©Copyright 2005-2019 Doulos. All rights reserved.