transaction level modeling with systemc · 2016. 7. 3. · tlm tlm tlm tlm tlm rtl rtl rtl rtl rtl....

25
Transaction Level Modeling with SystemC Thorsten Grötker Engineering Manager Synopsys, Inc.

Upload: others

Post on 15-Mar-2021

30 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

Transaction Level Modeling with SystemC

Thorsten GrötkerEngineering ManagerSynopsys, Inc.

Page 2: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

2

Outline

Abstraction LevelsSystemC Communication MechanismApplication 1: Generic Transaction Level Communication ChannelApplication 2: Transaction Level Modeling of the AMBA AHB/APB Protocol

Page 3: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

3

Abstraction Levels:Transaction Level– Layer 3: Message Layer

Model (un-)timed functionalityPoint-point communication

– Layer 2: Transaction LayerModel/analyze SoC architecture,start SW developmentEstimated timing

– Layer 1: Transfer LayerCycle true but faster than RTLDetailed analysis, developlow-level SW

Pin Level– Layer 0: Register Transfer Level

UTF UTF UTF

UTF UTF

TLM TLM TLM

TLM TLM

RTL RTL RTL

RTL RTL

Page 4: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

4

SystemC Language Architecture

Methodology-specific channelsElementary Channels

Signal, Timer, Mutex, Semaphore, FIFO, etc.• Time • Concurrency• Modules• Processes• Interfaces• Ports• Channels• Events• Event-driven sim. kernel

Data Types• 4-valued logic (0, 1, X, Z)• 4-valued logic-vectors• Bits and bit-vectors• Arbitrary-precision integers• Fixed-point numbers• C++ user-defined types• C++ built-in types (int, char…)

C++ Language Standard

Page 5: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

5

SystemC Communication Mechanism: How?

Separate Functionality from Communication– Functionality: implemented in Modules– Communication: implemented in Channels

Interface Method Calls (IMC)– The collection of a fixed set of communication

Methods is called an Interface– Channels implement one or more Interfaces– Modules can be connected via their Ports to those

Channels which implement the corresponding Interface ( sc_port<interface> )

Page 6: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

6

Primitive Channel

Channelport

Module2

port process

Module1

processprocess

Module1::process(){port->write(42);

}

Module2::process(){x = port->read();

}

Page 7: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

7

Hierarchical Channel

Channels can be hierarchical, i.e. they can contain processes, ports, modules and channels.

Module1

portprocessprocess

Module2

port

HierarchicalChannel

processprocess

Page 8: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

8

Transaction Level Modeling Example

Master1 Master2

Slave1 Slave2

BUS

clockHeavy use of interfacemethod call scheme.

Bus and slaves areimplemented ashierarchical channels.

Page 9: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

9

Outline

Abstraction LevelsSystemC Communication MechanismApplication 1: Generic Transaction Level Communication ChannelApplication 2: Transaction Level Modeling of the AMBA AHB/APB Protocol

Page 10: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

10

Generic Transaction-Level Channel

Background– Developed by Nokia and Synopsys in cooperation with

TI and Sonics for OCPRequirements– Point-to-point connection

(module ↔ generic channel ↔ module)Data passing and synchronization

– Interface independent of communication protocolProtocol to be implemented by the userCan be used for Layers 1, 2, and 3

Page 11: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

11

Generic Channel Interface (simplified)

Initiator (“Master”)– TdataCl* GetDataCl();– bool MputRequest*();– bool MgetResponse*(bool release);– void Mrelease(time);

Target (“Slave”)– TdataCl* GetDataCl();– bool SgetRequest*(bool release);– bool SputResponse*();– void Srelease(time);

TdataCl:• template parameter• depends on application and

communication protocolbeing used

Page 12: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

12

Flow of Eventsdata = port->GetDataCl(); data = port->GetDataCl();

C SlaveMaster

NB: data type is likely todepend on the protocol.data->input = 42;

MputWriteRequestBlocking();

SgetRequestBlocking(true);int mem = data->input;if (mem != 0)

data->response = true;else

data->response = false;SputResponseBlocking();

MgetResponseBlocking();if (data->response) ...

Page 13: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

13

Bus-based System w/ Generic ChannelsM1

S1

Arbiter BUS

Decoder

M2 M3

S2

C

C

C

CC C

C The bus protocol hasto be implemented bythe user; is it not partof the generic interface.

Page 14: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

14

Transaction-Level Modeling of the AMBA AHB/APB Protocol

Background– implemented in the spirit of “simple_bus”– developed in close cooperation with ARM

Requirements– cycle-accurate (Layer 1)– optimal simulation speed– ease of use (blocking interface)– integration of low-level models

(non-blocking interface)– enable SW debugging (debug interface)

Page 15: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

15

Generic InterfacesM1

S1

Arbiter BUS

Decoder

M2 M3

S2

C

C

C

CC C

C

Page 16: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

16

Dedicated AMBA InterfacesM1

S1

Arbiter

Decoder

M2 M3

S2

BUS

Page 17: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

17

Dedicated AMBA InterfacesM1

S1

Arbiter

Decoder

M2 M3

S2

BUS

Master → Bus Communication:Interface Method Call

Master → Bus Communication:Interface Method Call

Page 18: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

18

Dedicated AMBA InterfacesM1

S1

Arbiter

Decoder

M2 M3

S2

BUS

Bus → {Arbiter, Decoder, Slave}:Interface Method Call

Bus → {Arbiter, Decoder, Slave}:Interface Method Call

Page 19: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

19

AHB Master-Bus Interface

Blocking– bool burst_read(id, data, start_address, burst_length,

burst_mode, num_bytes);– bool burst_write(id, data, start_address, burst_length,

burst_mode, num_bytes);Non-Blocking– void request(id); – bool has_grant(id);– void init_transaction(id, read_mode, address, ...);– void set_data(id, data);– bool response(id, status);– ...

Note that thisinterface is ratherprotocol-specific.

Page 20: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

20

AHB Interfaces (cont’d)

Direct Bus Interface (Debugging)– bool direct_read(address, data, num_bytes);– bool direct_write(address, data, num_bytes);

Bus-Slave Interface– void set_data(data);– void control_info(burst_mode, transfer_type, ...);– void read(address, num_bytes);– void write(address, num_bytes);– bool response(status);– ...

Page 21: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

21

AMBA AHB Components

AHB bus with external arbiter and decoderInterconnection matrix for AMBA multilayer supportAHB bus monitorProcessors (ARM 926, ARM 946)Pin Level adaptorsExample masters and slavesExample AHB platforms

Page 22: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

22

AMBA APB Components

AHB-APB bridge with APB busAPB bus monitorPin Level adaptorsAPB peripherals– Remap and pause controller– Interrupt controller– APB timer

Example AHB/APB platforms

Page 23: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

23

Summary

Two examples out of a continuum of stylesGeneric Transaction-Level Channel– Not limited to bus-based systems– Can be used for layers 1, 2, and 3– Protocol-specific code inlined in connected modules

(or partly hidden in methods of TdataCl)– Protocol reflected in TdataCl and use of generic interface

AMBA Example– Protocol reflected in interface– Optimal simulation speed

No intermediate channel objectsNo process on slave side required (arbiter, address decoder, or simple memories can be accessedvia simple function calls)

Page 24: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

24

Summary (cont’d)

Same functionality can be modeled in both styles port->transaction_A(foo);

port->transaction_B(bar);vs.

data->transaction_type = A;data->input = foo;port->MputRequest();...data->transaction_type = B;data->input = bar;port->MputRequest();…

Communication refinement typically requires code changes or use of adaptors in both casesBoth approaches can be combined

OR:data->transaction_A(port);data->transaction_B(port);(encapsulate functionalityin a method of TdataCl)

“simple_bus style”

“generic style”

Page 25: Transaction Level Modeling with SystemC · 2016. 7. 3. · TLM TLM TLM TLM TLM RTL RTL RTL RTL RTL. 4 SystemC Language Architecture Methodology-specific channels Elementary Channels

25

Further information

SystemC and Transaction-LevelModeling– OSCI website: www.systemc.org– “System Design with SystemC”

Generic Transaction-LevelChannel White Paper– www.ocpip.org/data/systemc.pdf

AMBA models– www.synopsys.com