21.01.2015 Views

Introduction to Transaction Level Modeling in SystemC

Introduction to Transaction Level Modeling in SystemC

Introduction to Transaction Level Modeling in SystemC

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Introduction</strong> <strong>to</strong> <strong>Transaction</strong> <strong>Level</strong><br />

<strong>Model<strong>in</strong>g</strong> <strong>in</strong> <strong>SystemC</strong><br />

Stuart Swan<br />

Cadence Design Systems, Inc<br />

September 2005<br />

1 Copyright 2005 CADENCE DESIGN SYSTEMS, INC.


<strong>SystemC</strong> <strong>Transaction</strong> <strong>Level</strong> <strong>Model<strong>in</strong>g</strong><br />

• What is TLM<br />

– Communication uses function calls<br />

burst_read(char* buf, <strong>in</strong>t addr, <strong>in</strong>t len);<br />

• Why is TLM <strong>in</strong>terest<strong>in</strong>g<br />

master router slaves<br />

– Fast and compact<br />

– Integrate HW and SW models<br />

– Early platform for SW development, easy <strong>to</strong> distribute<br />

– Early system exploration and verification<br />

– Verification reuse<br />

2 Copyright 2005 Cadence Design Systems, Inc.


<strong>SystemC</strong> <strong>Transaction</strong> <strong>Level</strong> <strong>Model<strong>in</strong>g</strong><br />

• How is TLM be<strong>in</strong>g adopted<br />

– Widely used for verification<br />

– TLM for design is start<strong>in</strong>g at major electronics companies<br />

• Is it really worth the effort<br />

– Yes, particularly for platform-based design and verification<br />

• What will help proliferate TLM<br />

– Standard TLM APIs and guidel<strong>in</strong>es<br />

– Availability of TLM platform IP<br />

– Tool support<br />

‣<strong>SystemC</strong> TLM Standard<br />

3 Copyright 2005 Cadence Design Systems, Inc.


May 2005: OSCI Releases <strong>SystemC</strong> TLM<br />

Standard<br />

• TLM Standard API provides the foundation layer <strong>to</strong> develop<br />

<strong>in</strong>teroperable <strong>SystemC</strong> TLM IP<br />

• Full press release available at www.systemc.org<br />

• Companies endors<strong>in</strong>g TLM standard with<strong>in</strong> press release:<br />

– Cadence, CoWare, Forte, Men<strong>to</strong>r, Philips, ST, Synopsys<br />

– Atrenta, Calyp<strong>to</strong>, Celoxica, Chip Vision, ESLX, Summit, Synfora<br />

– OCP-IP<br />

• TLM kit, whitepaper, and examples publicly available at<br />

www.systemc.org<br />

• See also June 6 onl<strong>in</strong>e articles <strong>in</strong> EETimes and EDN<br />

• TLM standard is already <strong>in</strong> use <strong>in</strong> <strong>in</strong>dustry<br />

• IEEE standardization process <strong>to</strong> beg<strong>in</strong> soon<br />

4 Copyright 2005 Cadence Design Systems, Inc.


TLM API Goals<br />

• Common API foundation for transaction level model<strong>in</strong>g <strong>in</strong><br />

<strong>SystemC</strong><br />

• Support design & verification IP reuse<br />

• Provide common TLM recipe<br />

• Ease of use, Safety, Speed<br />

• Generality<br />

– Abstraction <strong>Level</strong>s<br />

– HW / SW<br />

– Different communication architectures (bus, packet, NOC, ...)<br />

– Different pro<strong>to</strong>cols<br />

5 Copyright 2005 Cadence Design Systems, Inc.


Key Concepts<br />

• Focus on <strong>SystemC</strong> <strong>in</strong>terface classes<br />

– Def<strong>in</strong>e small set of generic, reusable TLM <strong>in</strong>terfaces<br />

– Different components implement same <strong>in</strong>terfaces<br />

– Same <strong>in</strong>terface can be implemented<br />

– directly with<strong>in</strong> a C/C++ function, or<br />

– via communication with other modules/channels <strong>in</strong> system<br />

• Object pass<strong>in</strong>g semantics<br />

– Similar <strong>to</strong> sc_fifo, effectively pass-by-value<br />

– Avoids problems with raw C/C++ po<strong>in</strong>ters<br />

– Leverage C++ smart po<strong>in</strong>ters and conta<strong>in</strong>ers where needed<br />

6 Copyright 2005 Cadence Design Systems, Inc.


Key TLM Terms<br />

• Nonblock<strong>in</strong>g: Means function implementations can never call wait().<br />

• Block<strong>in</strong>g: Means function implementations might call wait().<br />

• Unidirectional: data transferred <strong>in</strong> one direction<br />

• Bidirectional: data transferred <strong>in</strong> two directions<br />

• Poke/Peek: Poke overwrites data and can never block. Peek reads<br />

most recent valid value. Poke/Peek are similar <strong>to</strong> write/read <strong>to</strong> a<br />

variable or signal.<br />

• Put/Get: Put queues data. Get consumes data. Put/Get are similar <strong>to</strong><br />

writ<strong>in</strong>g/read<strong>in</strong>g from a FIFO.<br />

• Pop: A pop is equivalent <strong>to</strong> a get <strong>in</strong> which the data returned is simply<br />

ignored.<br />

• Master/Slave: A master <strong>in</strong>itiates activity by issu<strong>in</strong>g a request. A slave<br />

passively waits for requests and returns a response.<br />

7 Copyright 2005 Cadence Design Systems, Inc.


Unidirectional versus Bidirectional<br />

• Unidirectional <strong>in</strong>terfaces send data <strong>in</strong> only a s<strong>in</strong>gle direction, and<br />

flow of control is <strong>in</strong> either or both directions.<br />

• Bidirectional <strong>in</strong>terfaces send data <strong>in</strong> both directions, and flow of<br />

control is <strong>in</strong> either or both directions.<br />

• Examples:<br />

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

– “Place read address on bus” is unidirectional<br />

– Burst write with a completion status returned is bidirectional<br />

– Send IP packet is unidirectional<br />

• Any complex pro<strong>to</strong>col can be broken down <strong>in</strong><strong>to</strong> a set of<br />

unidirectional and bidirectional accesses that use the TLM API<br />

8 Copyright 2005 Cadence Design Systems, Inc.


Primary TLM Interfaces<br />

• Primary Unidirectional Interfaces<br />

– tlm_poke_if / tlm_peek_if<br />

– tlm_put_if / tlm_get_if<br />

• Primary Bidirectional Interfaces<br />

– tlm_master_if<br />

– tlm_slave_if<br />

– tlm_transport_if<br />

• Note: tlm_poke_if not yet <strong>in</strong> OSCI TLM kit, should be added soon<br />

9 Copyright 2005 Cadence Design Systems, Inc.


Hardware Implied by TLM Interfaces<br />

tlm_poke_if*<br />

valid<br />

data<br />

valid<br />

data<br />

tlm_peek_if<br />

The TLM <strong>in</strong>terfaces can be easily mapped<br />

<strong>to</strong> HW. Understand<strong>in</strong>g this mapp<strong>in</strong>g helps<br />

you <strong>to</strong> understand how <strong>to</strong> use the TLM<br />

<strong>in</strong>terfaces.<br />

tlm_put_if<br />

ready<br />

valid<br />

data<br />

ready<br />

valid<br />

data<br />

tlm_get_if<br />

Note that the TLM <strong>in</strong>terfaces are also<br />

useful <strong>in</strong> non-HW parts of your system<br />

(e.g. testbenches, SW model<strong>in</strong>g).<br />

Poke/peek have overwrite semantics<br />

similar <strong>to</strong> writ<strong>in</strong>g <strong>to</strong> a variable or signal<br />

tlm_master_if<br />

req_ready<br />

req_valid<br />

req_data<br />

rsp_ready<br />

rsp_valid<br />

req_ready<br />

req_valid<br />

req_data<br />

rsp_ready<br />

rsp_valid<br />

tlm_slave_if<br />

Put/get have queu<strong>in</strong>g semantics similar <strong>to</strong><br />

writ<strong>in</strong>g <strong>to</strong> a FIFO<br />

When values propagate asynchronously,<br />

comb<strong>in</strong>ational logic is implied.<br />

rsp_data<br />

rsp_data<br />

When values are held across clock edges,<br />

hardware registers are implied.<br />

tlm_transport_if implies same HW as tlm_master_if, but also requests and responses are tightly coupled.<br />

tlm_poke_if is not yet <strong>in</strong> OSCI TLM standard, should be added soon.<br />

10 Copyright 2005 Cadence Design Systems, Inc.


TLM Unidirectional Interfaces<br />

Inheritance Diagram<br />

Pure Block<strong>in</strong>g<br />

and<br />

Nonblock<strong>in</strong>g<br />

Interfaces<br />

tlm_block<strong>in</strong>g_get_if tlm_nonblock<strong>in</strong>g_get_if tlm_block<strong>in</strong>g_peek_if tlm_nonblock<strong>in</strong>g_peek_if<br />

tlm_block<strong>in</strong>g_put_if tlm_nonblock<strong>in</strong>g_put_if<br />

tlm_block<strong>in</strong>g_get_peek_if<br />

tlm_nonblock<strong>in</strong>g_get_peek_if<br />

Primary<br />

Unidirectional<br />

Interfaces<br />

tlm_put_if<br />

tlm_get_if<br />

tlm_peek_if<br />

tlm_poke_if<br />

tlm_get_peek_if<br />

tlm_fifo_debug_if<br />

tlm_fifo specific <strong>in</strong>terfaces<br />

tlm_fifo_put_if<br />

tlm_fifo_get_if<br />

11 Copyright 2005 Cadence Design Systems, Inc.


Th<strong>in</strong>k<strong>in</strong>g of Interfaces as Contracts<br />

– Provides versus Requires<br />

Requires Provides Requires<br />

Requires subset of provided <strong>in</strong>terface, still plug-compatible<br />

12 Copyright 2005 Cadence Design Systems, Inc.


Importance of sc_export <strong>in</strong> <strong>SystemC</strong> 2.1<br />

• sc_ports facilitate modular design by precisely declar<strong>in</strong>g<br />

<strong>in</strong>terfaces required at a module boundary<br />

• sc_exports facilitate modular design by precisely declar<strong>in</strong>g<br />

<strong>in</strong>terfaces provided at a module boundary<br />

• sc_ports and sc_exports allow <strong>in</strong>terfaces <strong>to</strong> be passed through<br />

each level of the hierarchy<br />

• Use of sc_port and sc_export improves modularity by avoid<strong>in</strong>g<br />

reliance on explicit multilevel paths<br />

• sc_export permits direct function call <strong>in</strong>terfaces for TLM without<br />

<strong>in</strong>troduction of extra process switches<br />

13 Copyright 2005 Cadence Design Systems, Inc.


<strong>Transaction</strong> <strong>Level</strong> <strong>Model<strong>in</strong>g</strong> with the TLM API<br />

Router Example<br />

master calls transport()<br />

<strong>in</strong> router<br />

router calls transport() <strong>in</strong><br />

slave through 1 of 2 ports<br />

master router slaves<br />

slave implementation of<br />

transport() does the work<br />

Arbitration Example<br />

Symbols<br />

an sc_port<br />

an sc_export<br />

masters FIFOs arbiter slave<br />

port b<strong>in</strong>ds <strong>to</strong><br />

channel<br />

a thread<br />

14 Copyright 2005 Cadence Design Systems, Inc.


<strong>Transaction</strong> <strong>Level</strong> <strong>Model<strong>in</strong>g</strong> – Cross Bar<br />

• Uses the same components on the previous slide connected <strong>in</strong><br />

different ways<br />

masters routers FIFOs arbiters slaves<br />

Cross Bar Switch<br />

Note: This example and previous examples are <strong>in</strong>cluded <strong>in</strong> the OSCI TLM kit.<br />

15 Copyright 2005 Cadence Design Systems, Inc.


TLM Abstraction <strong>Level</strong>s<br />

Smaller,<br />

faster,<br />

less<br />

accurate<br />

Larger,<br />

slower,<br />

more<br />

accurate<br />

Algorithmic <strong>Level</strong> (AL)<br />

Functional<br />

Foundation: No Implementation Aspects<br />

Programmer’s View (PV) Bus generic<br />

Foundation: Memory Map Masters/Slaves<br />

Programmer’s View + Tim<strong>in</strong>g (PVT) Bus architecture<br />

Foundation: Timed Pro<strong>to</strong>col Tim<strong>in</strong>g approx.<br />

Cycle Accurate <strong>Level</strong> (CA) Word transfers<br />

Foundation: Clock Edge Cycle-accurate<br />

RT <strong>Level</strong> (RT)<br />

Signal/P<strong>in</strong>/Bit<br />

Foundation: Registers, logic Cycle-accurate<br />

Model at a few levels that target the “pa<strong>in</strong>” and risk <strong>in</strong> your D&V flow<br />

16 Copyright 2005 Cadence Design Systems, Inc.


Example TLM Application #1<br />

Wireless Picture Frame based on ARM920T<br />

Control and<br />

JPEG software<br />

Data<br />

cache<br />

AMBA<br />

AHB<br />

Inst<br />

cache<br />

ARM920T<br />

ROM and<br />

DRAM<br />

Memory<br />

controller<br />

DES<br />

FIFO memory<br />

8KB<br />

<strong>SystemC</strong><br />

TLM<br />

<strong>SystemC</strong> TLM Model<br />

• Full address map<br />

• Models all AHB transactions<br />

• ARM920 ISS master<br />

• Multiple slaves<br />

• Complete SW on ISS<br />

• PV provides ~1M cps<br />

• CA provides ~50kcps<br />

FIFO memory<br />

8KB<br />

DMA<br />

FIFO memory<br />

8KB<br />

MAC 1 MAC 2<br />

AHB/Wishbone<br />

wrapper<br />

Analog<br />

LCD/VGA<br />

Interrupt<br />

controller<br />

MII MII VGA VMI<br />

17 Copyright 2005 Cadence Design Systems, Inc.


Example TLM Application #2<br />

PV TLM Model reused <strong>to</strong> drive RTL block<br />

ROM and<br />

DRAM<br />

DES<br />

<strong>SystemC</strong> TLM<br />

AMBA<br />

AHB<br />

Memory<br />

controller<br />

FIFO memory<br />

8KB<br />

Memory<br />

test<br />

ITC<br />

test<br />

HDL RTL block<br />

replacement<br />

FIFO memory<br />

8KB<br />

DMA<br />

FIFO memory<br />

8KB<br />

MAC 1 MAC 2<br />

AHB/Wishbone<br />

wrapper<br />

Analog<br />

LCD/VGA<br />

ITC RTL<br />

FIQ<br />

IRQ<br />

MII MII VGA VMI<br />

18 Copyright 2005 Cadence Design Systems, Inc.


Us<strong>in</strong>g TLM <strong>to</strong> Compare Across Abstraction <strong>Level</strong>s<br />

Constra<strong>in</strong>ed<br />

Random<br />

Generation of<br />

<strong>Transaction</strong>s<br />

Reference Model<br />

of Design<br />

(abstract or TLM)<br />

Response<br />

Checker<br />

= <strong>Transaction</strong><br />

moni<strong>to</strong>r<strong>in</strong>g /<br />

record<strong>in</strong>g<br />

High->Low<br />

Transac<strong>to</strong>r<br />

Design:<br />

TLM or<br />

RTL HDL<br />

Low->High<br />

Transac<strong>to</strong>r<br />

• Use a smart verification strategy that au<strong>to</strong>matically<br />

compares more abstract models vs. more detailed<br />

models<br />

– Insures consistency and accuracy across abstraction levels<br />

– Leverages abstract models as testbench for detailed models<br />

– Reduces communication problems between SW & HW<br />

eng<strong>in</strong>eers, SOC architects, design and verification eng<strong>in</strong>eers<br />

19 Copyright 2005 Cadence Design Systems, Inc.


Us<strong>in</strong>g Incisive for Mixed <strong>SystemC</strong> / HDL<br />

Simulations<br />

• S<strong>in</strong>gle source debugger<br />

and s<strong>in</strong>gle design hierarchy<br />

lets different types of<br />

eng<strong>in</strong>eers jo<strong>in</strong>tly debug<br />

problems<br />

• Parameter pass<strong>in</strong>g between<br />

languages<br />

• Uniform assertions,<br />

randomization,<br />

and coverage<br />

• Eng<strong>in</strong>eers use the best<br />

languages and<br />

technologies for the job at<br />

hand, while still leverag<strong>in</strong>g<br />

each other’s work<br />

NC or GDB command l<strong>in</strong>e<br />

HDL and <strong>SystemC</strong> hierarchy<br />

<strong>SystemC</strong> Breakpo<strong>in</strong>t<br />

<strong>SystemC</strong> callstack<br />

Verilog Breakpo<strong>in</strong>t<br />

20 Copyright 2005 Cadence Design Systems, Inc.


Incisive Unified <strong>Transaction</strong> and Signal View<strong>in</strong>g<br />

Ability <strong>to</strong> visualize transactions alongside signals makes debugg<strong>in</strong>g much easier<br />

21 Copyright 2005 Cadence Design Systems, Inc.


Conclusions<br />

• Benefits of TLM:<br />

– Fast and compact<br />

– Integrate HW and SW models<br />

– Early platform for SW development, easy <strong>to</strong> distribute<br />

– Early system exploration and verification<br />

– Verification reuse<br />

• TLM is the next level of design and verification abstraction <strong>in</strong><br />

EDA, and the shift is now start<strong>in</strong>g.<br />

• The <strong>SystemC</strong> TLM standard is available now and is already <strong>in</strong><br />

use, and should foster the development of a TLM IP ecosystem.<br />

22 Copyright 2005 Cadence Design Systems, Inc.

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

Saved successfully!

Ooh no, something went wrong!