Top Banner
Transaction-level modeling of bus-based systems with SystemC 2.0 Ric Hilderink, Thorsten Grötker Synopsys, Inc.
40

Simple Bus Slides

Mar 26, 2015

Download

Documents

Giora Sh
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Simple Bus Slides

Transaction-level modeling of bus-based systems with SystemC 2.0Ric Hilderink, Thorsten Grötker

Synopsys, Inc.

Page 2: Simple Bus Slides

2

Efficient platform modeling

�Get to executable platform model ASAP�Simulation speed >> 100k cycles/sec

DSP µC

MEM ASIC

ArbiterBUS

Moving from pin-level to transaction-levelmodels (TLM) is mandatory!

Page 3: Simple Bus Slides

3

Outline

Idea:�Based on an example show how SystemC 2.0

enables efficient platform modeling.� Introduce some key language elements in the

process.

Page 4: Simple Bus Slides

4

Example: Simple bus model

�Cycle-accurate transaction-level model.� “Simple” =

– No pipelining– No split transactions– No master wait states– No request/acknowledge scheme– …NB: Of course, these features can be modeled at the

transaction level

Page 5: Simple Bus Slides

5

Interface Method Calls (IMC)

� Modules communicate via channels.� Channels implement interfaces.� An interface is a set of methods (functions).� Ports

– Modules have ports.– Ports are connected to channels.– Modules access channels through ports....some_port->some_method(some_data);...

Page 6: Simple Bus Slides

6

Interface Methods Calls (cont’d)

modulechannelprocess port

module::process() {...port->some_method(42);...

}

Page 7: Simple Bus Slides

7

Hierarchical channels

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

�A module that implements an interface is a hierarchical channel.

modulechannelprocess port

module

process port

hierarchicalchannel

i/f

Page 8: Simple Bus Slides

8

Example system (napkin view)

M1 M2

S1 S2

ArbiterBUS

M3 masters

slaves

Page 9: Simple Bus Slides

9

SystemC 2.0 transaction-level model

M1 M2

S1 S2

ArbiterBUS

clockM3

Page 10: Simple Bus Slides

10

SystemC 2.0 transaction-level model

M1 M2

S1 S2

ArbiterBUS

clockM3

Page 11: Simple Bus Slides

11

M3

SystemC 2.0 transaction-level model

M1 M2

S1 S2

ArbiterBUS

clock

The bus isimplemented asa hierarchicalchannel!

The bus isimplemented asa hierarchicalchannel!

Page 12: Simple Bus Slides

12

M3

SystemC 2.0 transaction-level model

M1 M2

S1 S2

ArbiterBUS

clockArbiter and slavesare implementedas channels too!

Arbiter and slavesare implementedas channels too!

Page 13: Simple Bus Slides

13

M3

SystemC 2.0 transaction-level model

M1 M2

S1 S2

ArbiterBUS

clock

Arbiter has beenmade a separatemodule to allowfor customization!

Arbiter has beenmade a separatemodule to allowfor customization!

Page 14: Simple Bus Slides

14

M3

SystemC 2.0 transaction-level model

M1 M2

S1 S2

ArbiterBUS

clock

Optionally, portscan be connectedto multiplechannels!

Optionally, portscan be connectedto multiplechannels!

Page 15: Simple Bus Slides

15

M3

SystemC 2.0 transaction-level model

M1 M2

S1 S2

ArbiterBUS

clock

Optionally, portscan be connectedto multiplechannels!

Optionally, portscan be connectedto multiplechannels!

sc_port<class IF, unsigned n_channels = 1>sc_port<class IF, unsigned n_channels = 1>

Page 16: Simple Bus Slides

16

M3

Rising clock edge

M1 M2

S1 S2

ArbiterBUS

clockMasters requestbus access.Masters requestbus access.

Page 17: Simple Bus Slides

17

M3

Falling clock edge

M1 M2

S1 S2

ArbiterBUS

clock

The bus has aprocess that issensitive to thefalling edge.

The bus has aprocess that issensitive to thefalling edge.

Page 18: Simple Bus Slides

18

M3

Falling clock edge

M1 M2

S1 S2

ArbiterBUS

clock

The arbiter is called.It will grant a singlemaster access to the bus.

The arbiter is called.It will grant a singlemaster access to the bus.

Page 19: Simple Bus Slides

19

M3

Falling clock edge

M1 M2

S1 S2

ArbiterBUS

clock

Then, a slaveis accessed afterconsulting thememory map.

Then, a slaveis accessed afterconsulting thememory map.

Page 20: Simple Bus Slides

20

M3

Bus interfaces

M1 M2

S1 S2

ArbiterBUS

clock

Page 21: Simple Bus Slides

21

Master interfaces of the bus

�Blocking:– Complete bursts– Used by high-level models

�Non-blocking:– Cycle-based– Used by processor models

�Direct:– Immediate slave access– Put SW debugger to work

Page 22: Simple Bus Slides

22

Blocking master interface

� status burst_read(unique_priority, data*,start_address, length=1,lock=false);

� status burst_write(unique_priority, data*,start_address, length=1,lock=false);

�“Blocking” because call returns only after complete transmission is finished.

� Master is identified by its unique priority.

Page 23: Simple Bus Slides

23

Dynamic Sensitivity

�SystemC 1.0– Static sensitivity

�Processes are made sensitive to a fixed set of signals during elaboration

�SystemC 2.0– Static sensitivity– Dynamic sensitivity

�The sensitivity (activiation condition) of a process can be altered during simulation (after elaboration)

�Main features: events and extended wait() method

Page 24: Simple Bus Slides

24

Waitingwait(); // as in SystemC 1.0

wait(event); // wait for event

wait(e1 | e2 | e3); // wait for first event

wait(e1 & e2 & e3); // wait for all events

wait(200, SC_NS); // wait for 200ns

// wait with timeout

wait(200, SC_NS, e1 | e2);

wait(200, SC_NS, e1 & e2);

Page 25: Simple Bus Slides

25

Dynamic sensitivity

MASTER

BUS

clock

status bus::burst_write(...) {...wait(transmission_done);...

}

Statically sensitive to clock� activated every cycle

Master won’t beactivated untiltransmission iscompleted!

Master won’t beactivated untiltransmission iscompleted!

Page 26: Simple Bus Slides

26

Dynamic sensitivity

MASTER

BUS

clock

status bus::burst_write(...) {...wait(transmission_done);...

}

Statically sensitive to clock� activated every cycle

Master won’t beactivated untiltransmission iscompleted!

Master won’t beactivated untiltransmission iscompleted!

Advantages:�Easy-to-use interface (blocking interface)�Simulation speed

Page 27: Simple Bus Slides

27

Non-blocking master interface

� status get_status(unique_priority);

� status read(unique_priority, data*,address, lock=false);

� status write(unique_priority, data*,address, lock=false);

� “Non-blocking” because calls return immediately.�Less convenient than blocking API but caller remains

in control (needed e.g. for most processor models).

Page 28: Simple Bus Slides

28

Direct master interface

� status direct_read(data*, address);

� status direct_write(data*, address);

�Provides direct access to slaves (using the bus’ address map).– Immediate access ���� simulated time does not advance– No arbitration

�Use for SW debuggers or decoupling of HW and SW.�Use with care!

Page 29: Simple Bus Slides

29

M3

Slave interface

M1 M2

S1 S2

ArbiterBUS

clock

Page 30: Simple Bus Slides

30

Slave interfaces

� unsigned start_address();

� unsigned end_address();

� status read(data*, address);

� status write(data*, address);

� status direct_read(data*, address);

� status direct_write(data*, address);

address mapping

regularI/O

debuginterface

Page 31: Simple Bus Slides

31

What’s so cool about transaction-level bus models?

They are …� relatively easy to develop and extend�easy to use� fast

– use of IMC ���� function calls instead of HW signals and control FSMs

– use of dynamic sensitivity ���� reduce unnecessary process activations

Page 32: Simple Bus Slides

32

Key language elements used in the example

� Interface method calls (IMC)�Hierarchical channels�Connecting ports to multiple channels�Dynamic sensitivity / waiting

Page 33: Simple Bus Slides

33

Conclusions

SystemC 2.0 enables efficient platform modeling.�Ease of modeling���� get to executable platform model ASAP

�Simulation speed

Still not convinced?

Try it out! (see following slides)

Page 34: Simple Bus Slides

34

How to install

> cd <systemc_installation_directory>/examples/systemc

> gtar zxvf simple_bus_v2.tgz

This will create a directory 'simple_bus'. Go to this directory and

build the executable, e.g.

For gcc-2.95.2 on Solaris:

> gmake -f Makefile.gcc

Now you can run the executable, e.g.

> simple_bus.x

See README.txt for detailed information!

Page 35: Simple Bus Slides

35

The testbench

M1 M2

S1 S2

ArbiterBUS

clockM3

see simple_bus_test.h

Page 36: Simple Bus Slides

36

The testbench

M1 M2

S1 S2

ArbiterBUS

clockM3

Blocking master:uses blocking bus interface to read and write data

Arbiter:Priority-based arbitration, supports bus locking

Page 37: Simple Bus Slides

37

The testbench

M1 M2

S1 S2

ArbiterBUS

clockM3

Non-blocking master:Uses non-blocking bus interface for data I/O

Direct master:uses direct interface of bus to print debug information

Page 38: Simple Bus Slides

38

The testbench

M1 M2

S1 S2

ArbiterBUS

clockM3

Fast memory:zero wait states

Slow memory:configurable number of wait states

Page 39: Simple Bus Slides

39

The testbench (cont’d)

� Most modules are configurable– Masters

�Priority (not direct master)�Delay / timeout�Bus locking on/off (not direct master)

– Slaves�Address ranges�Number of wait-states (only slow memory)

– Bus, arbiter, direct master�Verbosity

� Change parameter settings in simple_bus_test.h� See README.txt for details

Page 40: Simple Bus Slides

That’s it!

Thank you and have fun trying it out!