21.12.2013 Views

TLM Modeling Techniques

TLM Modeling Techniques

TLM Modeling Techniques

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>TLM</strong> modeling techniques<br />

Acknowledgments:<br />

•F. Ghenassia (Ed.). ”Transaction-level <strong>Modeling</strong> with SystemC”,<br />

Springer, 2005<br />

•Transaction Level <strong>Modeling</strong> in SystemC (white paper)<br />

• Updated <strong>TLM</strong> Proposal (March 2004)<br />

• <strong>TLM</strong> WG Update (June, 2007)<br />

• www.doulos.com


Communication via sc_port


sc_export<br />

It is a new type of port introduced with SytemC 2.1<br />

Like sc_port, its declaration is defined on an interface<br />

It is different from sc_port<br />

– sc_export is used to implement the channel inside a module and<br />

still make it accessible from the outside


Communication via sc_export<br />

<strong>TLM</strong> relies both on sc_port and sc_export


2005 2006 2007<br />

2008<br />

- <strong>TLM</strong> 1.0 provides some low-level interfaces for transaction-level<br />

communication<br />

- put, get, nb_put, nb_get, transport<br />

- such interfaces are included in <strong>TLM</strong>-2.0<br />

- <strong>TLM</strong> 2.0-draft1 and <strong>TLM</strong>2.0-draft2 extend <strong>TLM</strong>1.0 by introducing<br />

- the nb_transport<br />

- a generic payload + extensions (for memory-mapped bus<br />

modeling)


Key concepts in <strong>TLM</strong><br />

<strong>TLM</strong> focuses on proposing a communication standard<br />

and is based on SystemC<br />

Particular emphasis on<br />

– Blocking vs. non blocking<br />

– Bidirectional vs. unidirectional<br />

– Interfaces. They are the real key to <strong>TLM</strong>: the goal is to define a<br />

small set of generic, reusable interfaces


Blocking vs. non blocking<br />

Contains wait(.) –<br />

OSCI Terminology process is Can be called from<br />

suspended<br />

Blocking Possibly SC_THREAD only<br />

Non Blocking No<br />

SC_METHOD or<br />

SC_THREAD


Unidirectional vs. bidirectional<br />

Unidirectional interfaces send data in only a single<br />

direction<br />

Bidirectional interfaces send data in both directions<br />

Examples:<br />

– A complete read transaction across the bus is bidirectional<br />

– Send IP packet is unidirectional<br />

Any complex protocol can be broken down into a set of<br />

unidirectional and bidirectional accesses that use the<br />

<strong>TLM</strong> API (Application Programming Interface)


Unidirectional interfaces<br />

Based on the sc_fifo interfaces as in SystemC 2.1<br />

Further split into:<br />

– Unidirectional blocking interfaces<br />

– Unidirectional non blocking interfaces<br />

A transaction from initiator to target is called put<br />

A transaction from target to initiator is called get<br />

A non consuming interface that reads the most recent<br />

valid value is peek<br />

These interfaces can be implemented in a fifo, some<br />

other channel, or directly in the target by using sc_export


Unidirectional blocking interfaces<br />

They never fail<br />

because they<br />

are blocking


- <strong>TLM</strong> 2.0 does not support either of these coding styles


Unidirectional non blocking interfaces<br />

They may fail<br />

because they are<br />

non blocking


Bidirectional blocking interface<br />

It models transactions with a tight one-to-one binding<br />

between request going in and response coming out<br />

Typically used in PV<br />

– A read can be seen as an address going in and the read data<br />

coming out<br />

It can be considered a merger between the blocking get<br />

and put functions


Summary for core <strong>TLM</strong> interfaces


Core <strong>TLM</strong> channels<br />

tlm_fifo<br />

– It implements all the unidirectional interfaces mentioned before<br />

– It is based on sc_fifo<br />

– a transaction put into the tlm_fifo is not available for getting until<br />

the next delta cycle (request-update / update scheme)<br />

– It can be zero or infinite sized


Core <strong>TLM</strong> channels (cont’ed)<br />

tlm_req_rsp_channel<br />

– It consists of two fifos<br />

one for the request going from initiator to target<br />

one for the response being moved from target to initiator<br />

– Direct access to these fifos is provided as follows:<br />

the put request and get response interfaces are exported to the initiator<br />

the get request and put response interfaces are exported to the target<br />

– This has been all grouped into master & slave interfaces


Core <strong>TLM</strong> channels (cont’ed)<br />

tlm_transport_channel<br />

– used to model situations in which each request is tightly bound to<br />

one response<br />

– Because of this tight one to one binding, the request and<br />

response fifos must be of size one<br />

– It directly exports the same interfaces exported by<br />

tlm_req_rsp_channel


<strong>Modeling</strong> API<br />

API (Application Programming Interface)<br />

– It is a set of procedures available to the programmer and able to<br />

provide an abstraction that hides the underlying hardware<br />

When modeling API, 3 levels are distinguished<br />

– Core <strong>TLM</strong> interface layer<br />

It is the layer upon which <strong>TLM</strong> protocols and IPs can be developed<br />

These are the interfaces provided by the <strong>TLM</strong> Library<br />

– Protocol layer<br />

– IP layer


<strong>TLM</strong> layered approach for API


API: <strong>TLM</strong> Protocol layer - overview<br />

Various communication protocols can be defined on the<br />

top of the <strong>TLM</strong> interface layer<br />

These protocols rely fully on the core <strong>TLM</strong> interface to<br />

transfer a transaction between two different points<br />

For each <strong>TLM</strong> protocol, a set of methods is defined<br />

(convenience functions)


API: defining a <strong>TLM</strong> protocol<br />

To create a new protocol, the following is needed:<br />

1. A suitable <strong>TLM</strong> interface must be chosen<br />

2. The protocol between initiator and target is defined for:<br />

Exchanged information<br />

Protocol interface


Choosing the right interface for a <strong>TLM</strong> protocol<br />

It depends on the protocol to be implemented<br />

In a design, more than one protocol can be implemented<br />

Each protocol can either be uni- or bidirectional<br />

– Bidirectional: it uses blocking bidirectional interface<br />

Request is a parameter of the function call<br />

Response is the return value of the function call<br />

– Unidirectional: it uses either blocking or non blocking<br />

unidirectional interface<br />

Examples:<br />

Initiators send requests and get responses<br />

Targets get requests and send responses<br />

– Untimed <strong>TLM</strong> protocol can be<br />

Bidirectional: if it is based on the read/write<br />

Unidirectional: if it broadcasts a transaction without waiting for any response<br />

– Timed <strong>TLM</strong> protocol is usually unidirectional, as it implements<br />

timing notions


API: IP layer<br />

<strong>TLM</strong> IPs are modeled on top of a <strong>TLM</strong> protocol layer as<br />

functional modules<br />

Communication between <strong>TLM</strong> IPs are done through the<br />

communication API defined in the protocol interface


Initiator port<br />

An initiator is a <strong>TLM</strong> module implementing one or more<br />

processes, which can generate transactions to the<br />

channel module<br />

An initiator is always modeled as a SystemC module:<br />

– It declares processes to model its behavior<br />

– It instantiates one or more ports to be bound to the<br />

communication channel<br />

A process inside an initiator starts communication by:<br />

– Employing the convenient functions of the protocol interface in<br />

the initiator port


Target modeling<br />

A target is a <strong>TLM</strong> module modeled by implementing a<br />

SystemC module that takes charge of the IP behavior<br />

– Model IP behavior at the functional level without any microarchitectural<br />

details<br />

– Implement the <strong>TLM</strong> interface

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!