part 2 tlm2.0 overview
DESCRIPTION
Transaction level modeling 2.0 OverviewTRANSCRIPT
-
DVCon 2009
TLM-2.0 in Action: An Example-based Approach to Transaction-level Modeling and the New World of Model Interoperability
John Aynsley, Doulos
-
TLM Introduction
CONTENTS
What is TLM and SystemC?
Creating a virtual platform model
The OSCI TLM-2.0 standard
Achieving speed and interoperability
Copyright 2007-2009 by Doulos. All rights reserved.
-
Transaction Level Modeling
3
RTL
Pin Accurate
Simulate every event!
RTL
Functional Model
Functional Model
100-10,000 X faster simulation!
Function Call
write(address,data)
Copyright 2007-2009 by Doulos. All rights reserved.
-
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.
-
Multiple Languages
Mixed language environments Firmware / software
Test bench
RTL VHDL, Verilog, SystemVerilog
TLM SystemC used as golden reference
Home grown C++ / SystemC
VHDL, Verilog for design
5 Copyright 2007-2009 by Doulos. All rights reserved.
-
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
Copyright 2007-2009 by Doulos. All rights reserved.
-
TLM Introduction
What is TLM and SystemC?
Creating a virtual platform model
The OSCI TLM-2.0 standard
Achieving speed and interoperability
CONTENTS
Copyright 2007-2009 by Doulos. All rights reserved.
-
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.
-
Typical Use Case: Virtual Platform
CPU ROM DMA RAM
Interrupt Timer Bridge
Bridge
DSP ROM RAM
A/D Interrupt Timer I/O
Memory interface I/O DMA RAM
Custom peripheral
Software
D/A
Software
9
Multiple software stacks
Digital and analog hardware IP blocks
Multiple buses and bridges
Copyright 2007-2009 by Doulos. All rights reserved.
-
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.
-
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
11 Copyright 2007-2009 by Doulos. All rights reserved.
-
Transaction-Level Modeling
Simple functional models, e.g. C programs
Transaction + timing
Concurrent simulation environment
12 Copyright 2007-2009 by Doulos. All rights reserved.
-
SystemC / TLM is the Glue!
13
VHDL Verilog
Transaction-level modeling is communication-centric
ISS
Copyright 2007-2009 by Doulos. All rights reserved.
-
TLM Introduction
What is TLM and SystemC?
Creating a virtual platform model
The OSCI TLM-2.0 standard
Achieving speed and interoperability
CONTENTS
Copyright 2007-2009 by Doulos. All rights reserved.
-
OSCI TLM-2.0 Standard
15
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
Copyright 2007-2009 by Open SystemC Initiative and Doulos. All rights reserved.
-
Coding Styles and Mechanisms
Blocking transport
Non-blocking transport DMI Sockets Quantum
Generic payload
Mechanisms (definitive API for TLM-2.0 enabling interoperability)
Use cases
Software development
Architectural analysis
Hardware verification
Software performance
Loosely-timed
Approximately-timed
TLM-2 Coding styles (just guidelines)
Phases
16 Copyright 2007-2009 by Open SystemC Initiative and Doulos. All rights reserved.
-
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 Each transaction has 4 timing points (extensible)
17 Copyright 2007-2009 by Open SystemC Initiative and Doulos. All rights reserved.
-
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
Copyright 2007-2009 by Open SystemC Initiative and Doulos. All rights reserved.
-
Example Initiator & Target Sockets
19
struct Initiator: sc_module { tlm_utils::simple_initiator_socket socket; SC_CTOR(Initiator) : socket("socket") { SC_THREAD(thread_process); } ... }; struct Target: sc_module { tlm_utils::simple_target_socket 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 transport Sockets
Copyright 2007-2009 by Doulos. All rights reserved.
-
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
Copyright 2007-2009 by Doulos. All rights reserved.
-
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() get_response_string().c_str()); trans->release(); ... }
Get transaction object from pool
8 attributes you must set
Blocking transport
Generic payload
Copyright 2007-2009 by Doulos. All rights reserved.
-
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
Copyright 2007-2009 by Doulos. All rights reserved.
-
Interconnect component
0, 1 or many
Initiators, Targets and Interconnect
Initiator Target
Initiator socket
Target socket
Initiator socket
Target socket
Forward path
Backward path
Forward path
Backward path
Transaction object
23
Sockets Generic payload
Single transaction object
Copyright 2007-2009 by Open SystemC Initiative and Doulos. All rights reserved.
-
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.
-
TLM Introduction
What is TLM and SystemC?
Creating a virtual platform model
The OSCI TLM-2.0 standard
Achieving speed and interoperability
CONTENTS
Copyright 2007-2009 by Doulos. All rights reserved.
-
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)
Copyright 2007-2009 by Doulos. All rights reserved.
-
Loosely-timed
Cycle-accurate simulation
Initiators
Ticks
Quantum
Temporally decoupled simulation
Quantum
Process scheduling and context switching
27 Copyright 2007-2009 by Doulos. All rights reserved.
Each initiator runs ahead to quantum boundary before context switching Limited synchronization between initiators Used with DMI to bypass interconnect DMI Quantum Blocking transport
-
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
Copyright 2007-2009 by Open SystemC Initiative and Doulos. All rights reserved.
-
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
29
Non-blocking transport
Blocking transport Sockets
nb_/b_transport adaptor
Models should be performance-matched
Copyright 2007-2009 by Doulos. All rights reserved.
-
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
-
Extensions
Target
Base Protocol Router
Initiator
Initiator Target
Generic Payload
Extension
Interconnect
Generic Payload
Extension
Generic Payload
Extension
Generic Payload
Extension
Generic Payload
Extension
31 Copyright 2007-2009 by Doulos. All rights reserved.
Private extension
-
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.
-
Initiator Interconnect Target
Kinds of Interoperability
33
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 Initiator
-
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
-
Slide Number 1TLM IntroductionTransaction Level ModelingReasons for using TLMMultiple LanguagesReasons for using SystemCTLM IntroductionUse CasesTypical Use Case: Virtual PlatformVirtual Platform Characteristics 1Virtual Platform Characteristics 2Transaction-Level ModelingSystemC / TLM is the Glue!TLM IntroductionOSCI TLM-2.0 StandardCoding Styles and MechanismsCoding StylesInteroperability LayerExample Initiator & Target SocketsExample Socket BindingExample - InitiatorExample - TargetInitiators, Targets and InterconnectCore InterfacesTLM IntroductionInteroperability versus InternalsLoosely-timedApproximately-timedb/nb ConversionThe Generic PayloadExtensionsKinds of ExtensionKinds of InteroperabilityLevels of UseSlide Number 35