• No results found

TLM-2.0 in Action: An Example-based Approach to Transaction-level Modeling and the New World of Model Interoperability

N/A
N/A
Protected

Academic year: 2021

Share "TLM-2.0 in Action: An Example-based Approach to Transaction-level Modeling and the New World of Model Interoperability"

Copied!
35
0
0

Loading.... (view fulltext now)

Full text

(1)

DVCon 2009

TLM-2.0 in Action: An

Example-based Approach to

Transaction-level Modeling

and the New World of Model

Interoperability

(2)

TLM Introduction

CONTENTS

What is TLM and SystemC?

Creating a virtual platform model

The OSCI TLM-2.0 standard

Achieving speed and interoperability

(3)

Transaction Level Modeling

RTL

Pin Accurate

Simulate every event!

RTL

Functional

Model

Functional

Model

100-10,000 X faster simulation!

Function Call

write(address,data)

(4)

Reasons for using TLM

Software development

Firmware /

software

Accelerates product release schedule

Test bench

Hardware verification

RTL

TLM = golden model

Performance analysis

TLM

Fast Ready before RTL 4 Copyright © 2007-2009 by Doulos. All rights reserved.

(5)

Multiple Languages

Mixed language environments

Firmware /

software

Test bench

RTL

VHDL, Verilog, SystemVerilog

TLM

SystemC used as golden reference

Home grown C++ / SystemC

(6)

Reasons for using SystemC

Robust open source proof-of-concept C++ simulator

Flexibility re platforms and licensing

Common language across disciplines

Builds bridges between system, s/w and h/w

Easy integration

Tool vendors add value

Only requires a C++ compiler

6

Industry standard IEEE 1666™

(7)

TLM Introduction

What is TLM and SystemC?

Creating a virtual platform model

The OSCI TLM-2.0 standard

Achieving speed and interoperability

CONTENTS

(8)

FUNCTIONAL VIEW

Algorithm developer

PROGRAMMERS VIEW

Software developer

ARCHITECTURE VIEW

Tuning the platform

VERIFICATION VIEW

Functional verification

RTL

Implementation

Untimed

Approximately-timed

Loosely-timed

Untimed through Cycle Accurate

Use Cases

8 Copyright © 2007-2009 by Doulos. All rights reserved.

(9)

Typical Use Case: Virtual Platform

CPU

ROM

RAM

DMA

Interrupt Timer

Bridge

Bridge

DSP

ROM

RAM

A/D

Interrupt Timer

I/O

Memory

interface

I/O

RAM

DMA

peripheral

Custom

Software

D/A

Software

Multiple software stacks

Digital and analog hardware IP blocks Multiple buses and bridges

(10)

Virtual Platform Characteristics 1

Register accurate, functionally complete

No clock, no pins, no implementation detail

Loose or approximate timing only

Fast enough to boot software O/S in seconds

Available months before RTL

Accurate enough to stay in use post-RTL

10 Copyright © 2007-2009 by Open SystemC Initiative and Doulos. All rights reserved.

(11)

Virtual Platform Characteristics 2

Instruction Set

Simulator or software

stubs

Transaction-Level Model RTL

Available early

Available early

Much later

Fast enough to run

applications

Fast enough to run

applications

Too slow to run

applications

Little or no hardware

detail

Register-accurate

Register-accurate and

pin-accurate

No timing information

Some timing information

Cycle-accurate timing

(12)

Transaction-Level Modeling

Simple functional models, e.g. C programs

Transaction

+ timing

Concurrent simulation environment

12 Copyright © 2007-2009 by Doulos. All rights reserved.

(13)

SystemC / TLM is the Glue!

VHDL

Verilog

Transaction-level modeling is communication-centric

(14)

TLM Introduction

What is TLM and SystemC?

Creating a virtual platform model

The OSCI TLM-2.0 standard

Achieving speed and interoperability

CONTENTS

(15)

OSCI TLM-2.0 Standard

Transaction-level memory-mapped bus modeling

Based on SystemC

Released in June 2008

OSCI LRM in 2009

between TLM models of IP blocks

comparable to ISS

(16)

Coding Styles and Mechanisms

Blocking

transport DMI Quantum Sockets Generic payload Non-blocking transport

Mechanisms

(definitive API for TLM-2.0 enabling interoperability)

Use cases

Software

development performance Software Architectural analysis verification Hardware

Loosely-timed

Approximately-timed

TLM-2 Coding styles

(just guidelines)

Phases

16 Copyright © 2007-2009 by Open SystemC Initiative and Doulos. All rights reserved.

(17)

Coding Styles

Loosely-timed

= as fast as possible

Only sufficient timing detail to boot O/S and run multi-core systems

Processes can run ahead of simulation time (temporal decoupling)

Each transaction completes in one function call

Uses direct memory interface (DMI)

Approximately-timed

= just accurate enough for performance modeling

aka cycle-approximate or cycle-count-accurate

Sufficient for architectural exploration

Processes run in lock-step with simulation time

(18)

Interoperability Layer

18

Target

Initiator

1. Core interfaces

and sockets

2. Generic payload

Command Address Data Byte enables Response status Extensions

3. Base protocol

BEGIN_REQ END_REQ BEGIN_RESP END_RESP

Maximal interoperability for memory-mapped bus models

(19)

Example – Initiator & Target Sockets

struct Initiator: sc_module {

tlm_utils::simple_initiator_socket<Initiator> socket;

SC_CTOR(Initiator) : socket("socket") { SC_THREAD(thread_process); } ... };

struct Target: sc_module {

tlm_utils::simple_target_socket<Target> socket;

SC_CTOR(Target) : socket("socket") {

socket.register_b_transport (this, &Target::b_transport); }

virtual void b_transport( tlm::tlm_generic_payload& trans, sc_time& delay );

... };

Default: 32-bits wide, base protocol Construct and name socket

Blocking

(20)

Example – Socket Binding

20

struct Top: sc_module {

Initiator *initiator; Target *target; SC_CTOR(Top) {

initiator = new Initiator ("initiator"); target = new Target ("target");

initiator->socket.bind( target->socket ); }

};

Sockets

(21)

Example - Initiator

21 void thread_process() { tlm::tlm_generic_payload* trans; sc_time delay; ... trans = m_mm.allocate(); trans->acquire(); trans->set_command( tlm::TLM_WRITE_COMMAND ); trans->set_data_length( 4 ); trans->set_streaming_width( 4 ); trans->set_byte_enable_ptr( 0 ); trans->set_address( addr );

trans->set_data_ptr( (unsigned char*)( &word ) ); trans->set_dmi_allowed( false );

trans->set_response_status( tlm::TLM_INCOMPLETE_RESPONSE ); init_socket->b_transport( *trans, delay );

if ( trans->get_response_status() <= 0 )

SC_REPORT_ERROR("TLM-2", trans->get_response_string().c_str()); trans->release();

... }

Get transaction object from pool 8 attributes you must set

Blocking transport Generic

(22)

Example - Target

22

virtual void b_transport(

tlm::tlm_generic_payload& trans, sc_core::sc_time& t ) {

tlm::tlm_command cmd = trans.get_command(); sc_dt::uint64 adr = trans.get_address(); unsigned char* ptr = trans.get_data_ptr(); unsigned int len = trans.get_data_length(); unsigned char* byt = trans.get_byte_enable_ptr(); unsigned int wid = trans.get_streaming_width(); if ( byt != 0 || len > 4 || wid < len ) {

trans.set_response_status( tlm::TLM_GENERIC_ERROR_RESPONSE ); return;

}

if ( cmd == tlm::TLM_WRITE_COMMAND ) memcpy( &m_storage[adr], ptr, len );

else if ( cmd == tlm::TLM_READ_COMMAND ) memcpy( ptr, &m_storage[adr], len );

trans.set_response_status( tlm::TLM_OK_RESPONSE ); }

Execute command Successful completion 6 attributes you must check

Target supports 1-word transfers

Blocking transport Generic

payload

(23)

Interconnect

component

0, 1 or many

Initiators, Targets and Interconnect

Initiator

Target

Initiator

socket socket Target Initiator socket socket Target

Forward path Backward path Forward path Backward path Transaction object Sockets Generic payload

(24)

Core Interfaces

Initiator

Target

Target socket Backward path

nb_transport_bw()

invalidate_direct_mem_ptr()

Initiator

socket Forward path

b_transport ()

nb_transport_fw()

get_direct_mem_ptr()

transport_dbg()

Sockets group interfaces, bind both paths with one call, and are strongly typed

Interface methods

24 Copyright © 2007-2009 by Open SystemC Initiative and Doulos. All rights reserved.

(25)

TLM Introduction

What is TLM and SystemC?

Creating a virtual platform model

The OSCI TLM-2.0 standard

Achieving speed and interoperability

(26)

Core interfaces

Sockets

Generic payload

Base protocol

Interoperability versus Internals

26

Initiator

Interoperability

layer

Target

Coding Style Loosely- or Approximately-timed Utilities Convenience sockets Quantum keeper (LT)

Payload event queues (AT)

Instance-specific extensions (GP)

(27)

Loosely-timed

Cycle-accurate simulation

Initiators

Ticks Quantum Temporally decoupled simulation Quantum

Process scheduling and context switching

Each initiator runs ahead to quantum boundary before context switching

Limited synchronization between initiators

(28)

Approximately-timed

28

Process 1

Process 2

Process 3

0

10

20

30

40

50

Annotated delays

Transactions are annotated with delays

Each process is synchronized using the SystemC scheduler

A transaction has multiple phases

Non-blocking

transport Phases

(29)

b/nb Conversion

LT Initiator

simple_target_socket simple_initiator_socket b_transport

LT Target

b_transport Interconnect

AT Initiator

nb_transport_fw socket.register_b_transport Non-blocking transport Blocking transport Sockets

nb_/b_transport

adaptor

(30)

The Generic Payload

Typical attributes of memory-mapped busses

reads, writes, byte enables, single word transfers, burst transfers, streaming

Off-the-shelf general purpose payload

used with the Base Protocol for abstract bus modeling

ignorable extensions allow full interoperability

Used to model specific bus protocols

mandatory extensions

can only bind sockets with same protocol type (compile-time check)

use the same generic payload machinery

low implementation cost when bridging protocols

30 Copyright © 2007-2009 by Open SystemC Initiative and Doulos. All rights reserved.

Generic payload

(31)

Extensions

Target Base Protocol Router Initiator Initiator Target Generic Payload Extension Interconnect Generic Payload Extension Generic Payload Extension Generic Payload Extension Generic Payload Extension

Private

extension

(32)

Kinds of Extension

Generic payload extensions can be

Ignorable –

compliant to the base protocol

Mandatory –

necessitates a new protocol type

Private –

only used by a single module (hence ignorable)

Instance-specific –

usually private (hard to access elsewhere)

Sticky –

remain when transaction is returned to a pool

Auto –

freed when transaction is returned to a pool

Base protocol phases

BEGIN_REQ, END_REQ, BEGIN_RESP, END_RESP

Extended phases

32 Copyright © 2007-2009 by Doulos. All rights reserved.

(33)

Initiator Interconnect Target

Kinds of Interoperability

Base protocol, generic payload + ignorable extensions

Functional incompatibilities still possible

New protocol, generic payload + extensions

Cannot bind sockets of differing protocols

Generic payload and base protocol still exploited for consistency of coding style

Generic payload extension mechanism exploited for ease-of-adaption

Target Adaptor

(34)

Levels of Use

34

1. Buy models with the TLM-2.0 sticker

2. Write LT components

Beware: nb_transport & endianness

3. Write AT components

4. Support LT/AT switching

(35)

References

Related documents

2003-2004: Linda Loma University and Optivus (San Bernadino CA, US) ask Kineo CAM for an integrated solution in proton therapy. Customized integrated solution:

Background: To evaluate the ef fi cacy of holmium laser enucleation of the prostate (HoLEP) followed by high-intensity focused ultrasound (HIFU) for patients with huge prostate

The introduction of a research based learning approach to an undergraduate coastal engineering elective course was well received by students who indicated it engaged them and

An IMAX release is lucrative for movie theaters, in that the format commands premium ticket prices 30%–40% over and above standard ticket prices. For example, if admission to

Therefore, in the lifetime profile, delete of a const pointer is not permitted except in the body of a destructor and then only if the pointer is a data member (and necessarily

Roche Pharma (Switzerland) Ltd in Reinach is responsible for clinical trials, obtain- ing marketing approval for products in Switzerland, securing reimbursable status for

Task Force members discussed alternative low-cost or reduced auto insurance coverage (as an alternative method for compliance with the compulsory financial security

Os resultados com os testes emp´ıricos, considerando o isolamento da parcela discricion´aria da mensurac¸˜ao do valor justo dos instrumentos fi- nanceiros derivativos, confirmam