+ All Categories
Home > Documents > Universal Scripting Interface for SystemC - DVCon Europe · PDF filen on sc_register...

Universal Scripting Interface for SystemC - DVCon Europe · PDF filen on sc_register...

Date post: 07-Mar-2018
Category:
Upload: phungminh
View: 220 times
Download: 4 times
Share this document with a friend
44
Universal Scripting Interface for SystemC Rolf Meyer, E.I.S., TU Braunschweig © Accellera Systems Initiative 1
Transcript

Universal Scripting Interface for SystemC

Rolf Meyer, E.I.S., TU Braunschweig

© Accellera Systems Initiative 1

SoCRocket TLM ModelsAll models developed with RTL equivalents as blueprint

AHB2SW

AHBCTRL

LEON ISS

mmu-cachei/d cache

mmulocalrams

MCTRL

SRA

M

SDR

AM

IO

PR

OM

SoCWire

GPTimer

SpaceWire

IRQMP AHB2APB

AHBOUT

AHBIN

AHBMEM

APBUART

bus

masters

bus

slavesAHBProf

- Models available in loosely timed (LT), and approximately timed (AT) flavor of TLM2.0.

- ESA Reference TLM Platform

ModelLibraries

(Core)

Models provided by ESA

Models with GRLIB reference

Models without GRLIB reference

© Accellera Systems Initiative 2

SoCRocket - The building blocksSoCRocket is more than a model library

(Terma)

GreenSoCs

GreenSocketsCarbon

AMBAKitGreenSoCs

GreenControlc3e

SignalKit

Base AHBMaster AHBSlave APBSlave …

Models

AHB2SW

AHBCTRL

LEON ISS

mmu-cache

i/d cache

mmu

localrams

MCTRL

SR

AM

SD

RA

M

IO

PR

OM

SoCWire

GPTimer

SpaceWire

IRQMP AHB2APB

AHBOUT

AHBIN

AHBMEM

APBUART

bus masters

bus slaves

AHBProf

IEEE

SystemCIEEE

TLMCadence

sciregGreenSoCs

GreenRegESA

TrapGen

(Media)

WafBuild System

ModelLibraries

(Core)

Foundation

Base

Blo

cks

Roof

Top Virtual

Platforms

DepsMgr.

RepoMgr.

© Accellera Systems Initiative 3

Desired Features

• Automating procedures

• Configuring simulation parameters

• Access runtime simulation information

• Easy testing integration

• Interactive introspection

© Accellera Systems Initiative 4

Desired Features

• Automating procedures

• Configuring simulation parameters

• Access runtime simulation information

• Easy testing integration

• Interactive introspection

© Accellera Systems Initiative 5

Perfect tasks for scripting languages

Scripting Language

• Defining variables/option values

• Recording/executing command sequences

• Capturing output results

• Branching and looping

• Importing and exporting options and

• Bridging the gaps to other abstraction levels

© Accellera Systems Initiative 6

Available simulators

• Accellera SystemC

• ALDEC Riviera-PRO TCL

• Cadence ncsim TCL

• Mentor Graphics QuestaSim TCL

• Synopsys Platform Architect TCL

• …

• The choice depends on the problem/programmer

© Accellera Systems Initiative 7

Scripting in EDA/SystemC

Most common: TCL

• Command oriented (Shell like)

• No native OOP

• Therefore not the best user experience

Scripting support in Accellera SystemC

• No integrated language

• Different approaches available

© Accellera Systems Initiative 8

Scripting languages for SystemC

Existing implementations

• TCL

• SystemLua focused on configuration

• GreenScript focused on abstract modeling

Desired implementation

• depends on the problem/programmer

• we propose Python for its usability

© Accellera Systems Initiative 9

Common SystemC APIs

© Accellera Systems Initiative 10

GreenSoCs

GreenSocketsCarbon

AMBAKitGreenSoCs

GreenControlc3e

SignalKit

Base AHBMaster AHBSlave APBSlave …

Models

IEEE

SystemCIEEE

TLMCadence

sciregGreenSoCs

GreenRegESA

TrapGen

WafBuild System

Virtual Platforms

DepsMgr.

RepoMgr.

For example:

• IEEE 1666-2011

• GreenSoCs

• Cadence

• Carbon

• Own

• …

Additional requirements

• Available in multiple Simulators

• Language independent

• Same/similar APIs as in SystemC/C++

• Addressable via hierarchical module name

top.obj.reg

© Accellera Systems Initiative 11

Interface Delegation

Hardware Platform (SystemC/C++)

Scripting Interface

Environment

© Accellera Systems Initiative 12

Interface Delegation

Hardware Platform (SystemC/C++)

Scripting Interface

Delegation Kernel

sc_object

SystemC hierarchy

Plug-in

(Util) API

C++

Environment

© Accellera Systems Initiative 13

Scripting environment SystemC

© Accellera Systems Initiative 14

sc_register

constructed

obj.reg.ctrl

Scripting environment SystemC

© Accellera Systems Initiative 15

sc_register

constructed

obj.reg.ctrl

Python

Scripting environment SystemC

© Accellera Systems Initiative 16

Initia

liza

tion

Ela

bo

ratio

n

sc_register

constructed

obj.reg.ctrl

Python

Scripting environment SystemC

© Accellera Systems Initiative 17

Initia

liza

tion

Ela

bo

ratio

n

sc_register

constructed

obj.reg.ctrl

Python

ctrl = usi.find

(‘obj.*.ctrl’)

Scripting environment SystemC

© Accellera Systems Initiative 18

Initia

liza

tion

Ela

bo

ratio

n

sc_register

constructed

obj.reg.ctrl

Python USIDelegate

ctrl = usi.find

(‘obj.*.ctrl’)

USIDelegate

(‘obj.reg.ctrl’)

Scripting environment SystemC

© Accellera Systems Initiative 19

Initia

liza

tion

Ela

bo

ratio

n

sc_register

constructed

obj.reg.ctrl

Python USIDelegate

ctrl = usi.find

(‘obj.*.ctrl’)

USIDelegate

(‘obj.reg.ctrl’)

sc_simulation_context

Scripting environment SystemC

© Accellera Systems Initiative 20

Initia

liza

tion

Ela

bo

ratio

n

sc_register

constructed

obj.reg.ctrl

Python USIDelegate

ctrl = usi.find

(‘obj.*.ctrl’)

USIDelegate

(‘obj.reg.ctrl’)

Query sc_sim_context

for ‘obj.reg.ctrl’

sc_simulation_context

Scripting environment SystemC

© Accellera Systems Initiative 21

Initia

liza

tion

Ela

bo

ratio

n

sc_register

constructed

obj.reg.ctrl

Python USIDelegate

ctrl = usi.find

(‘obj.*.ctrl’)

USIDelegate

(‘obj.reg.ctrl’)

Query sc_sim_context

for ‘obj.reg.ctrl’

Try to convert to

registered interfaces

sc_simulation_context

Scripting environment SystemC

© Accellera Systems Initiative 22

Initia

liza

tion

Ela

bo

ratio

n

sc_register

constructed

obj.reg.ctrl

Python USIDelegate

ctrl = usi.find

(‘obj.*.ctrl’)

USIDelegate

(‘obj.reg.ctrl’)

Query sc_sim_context

for ‘obj.reg.ctrl’

Try to convert to

registered interfaces

sc_object scireg AHBDevice

sc_simulation_context

Scripting environment Plug-in (Util) APIsSystemC

© Accellera Systems Initiative 23

Initia

liza

tion

Ela

bo

ratio

n

sc_register

constructed

obj.reg.ctrl

Python USIDelegate

ctrl = usi.find

(‘obj.*.ctrl’)

USIDelegate

(‘obj.reg.ctrl’)

Query sc_sim_context

for ‘obj.reg.ctrl’

Try to convert to

registered interfaces

dynamic_cast to

sc_object

sc_object

PYC++

scireg AHBDevice

sc_simulation_context

Scripting environment Plug-in (Util) APIsSystemC

© Accellera Systems Initiative 24

Initia

liza

tion

Ela

bo

ratio

n

sc_register

constructed

obj.reg.ctrl

Python USIDelegate

ctrl = usi.find

(‘obj.*.ctrl’)

USIDelegate

(‘obj.reg.ctrl’)

Query sc_sim_context

for ‘obj.reg.ctrl’

Try to convert to

registered interfaces

dynamic_cast to

sc_object

sc_object

PYC++

scireg AHBDevice

Create

sc_simulation_context

Scripting environment Plug-in (Util) APIsSystemC

© Accellera Systems Initiative 25

Initia

liza

tion

Ela

bo

ratio

n

sc_register

constructed

obj.reg.ctrl

Python USIDelegate

ctrl = usi.find

(‘obj.*.ctrl’)

USIDelegate

(‘obj.reg.ctrl’)

Query sc_sim_context

for ‘obj.reg.ctrl’

Try to convert to

registered interfaces

dynamic_cast to

sc_object

Lookup on

scireg db for

‘obj.reg.ctrl’

sc_object

PYC++

scireg

PYC++

AHBDevice

Create Create

sc_simulation_context

Scripting environment Plug-in (Util) APIsSystemC

© Accellera Systems Initiative 26

Initia

liza

tion

Ela

bo

ratio

n

sc_register

constructed

obj.reg.ctrl

Python USIDelegate

ctrl = usi.find

(‘obj.*.ctrl’)

USIDelegate

(‘obj.reg.ctrl’)

Query sc_sim_context

for ‘obj.reg.ctrl’

Try to convert to

registered interfaces

dynamic_cast to

sc_object

Lookup on

scireg db for

‘obj.reg.ctrl’

dynamic_cast to

AHBDevice

not possible

sc_object

PYC++

scireg

PYC++

AHBDevice

PYC++

Create Create

sc_simulation_context

Scripting environment Plug-in (Util) APIsSystemC

© Accellera Systems Initiative 27

Initia

liza

tion

Ela

bo

ratio

n

sc_register

constructed

obj.reg.ctrl

Python USIDelegate

ctrl = usi.find

(‘obj.*.ctrl’)

USIDelegate

(‘obj.reg.ctrl’)

Query sc_sim_context

for ‘obj.reg.ctrl’

Try to convert to

registered interfaces

dynamic_cast to

sc_object

Lookup on

scireg db for

‘obj.reg.ctrl’

dynamic_cast to

AHBDevice

not possible

sc_object

PYC++

scireg

PYC++

AHBDevice

PYC++

Create Create None

sc_simulation_context

Scripting environment Plug-in (Util) APIsSystemC

Initia

liza

tion

Ela

bo

ratio

n

sc_register

constructed

obj.reg.ctrl

Python USIDelegate

ctrl = usi.find

(‘obj.*.ctrl’)

USIDelegate

(‘obj.reg.ctrl’)

Query sc_sim_context

for ‘obj.reg.ctrl’

Try to convert to

registered interfaces

dynamic_cast to

sc_object

Lookup on

scireg db for

‘obj.reg.ctrl’

dynamic_cast to

AHBDevice

not possible

sc_object

PYC++

scireg

PYC++

AHBDevice

PYC++

Create Create None

sc_simulation_context

tuple of implemented

interface proxies (SWIG)

Scripting environment Plug-in (Util) APIsSystemC

© Accellera Systems Initiative 29

Sim

ula

tion

sc_registerPython USIDelegatesc_object

C++ PY

Scripting environment Plug-in (Util) APIsSystemC

© Accellera Systems Initiative 30

Plugin function callOr how to access simulation information via interface delegation

Sim

ula

tion

sc_registerPython USIDelegate

ctrl.

basename()

sc_object

C++ PY

Scripting environment Plug-in (Util) APIsSystemC

© Accellera Systems Initiative 31

Plugin function callOr how to access simulation information via interface delegation

Sim

ula

tion

sc_registerPython USIDelegate

ctrl.

basename()

__getattr__()

sc_object

C++ PY

Scripting environment Plug-in (Util) APIsSystemC

© Accellera Systems Initiative 32

Plugin function callOr how to access simulation information via interface delegation

Sim

ula

tion

sc_registerPython USIDelegate

ctrl.

basename()

__getattr__()

Query implemented

interface proxies

(SWIG) for basename()

sc_object

C++ PY

Scripting environment Plug-in (Util) APIsSystemC

© Accellera Systems Initiative 33

Plugin function callOr how to access simulation information via interface delegation

Sim

ula

tion

sc_registerPython USIDelegate

ctrl.

basename()

__getattr__()

Query implemented

interface proxies

(SWIG) for basename()

sc_object

C++ PY

basename()

SWIG Proxy

Scripting environment Plug-in (Util) APIsSystemC

© Accellera Systems Initiative 34

Plugin function callOr how to access simulation information via interface delegation

Sim

ula

tion

sc_registerPython USIDelegate

ctrl.

basename()

__getattr__()

Query implemented

interface proxies

(SWIG) for basename()

Call basename()

sc_object

C++ PY

basename()

SWIG Proxy

Scripting environment Plug-in (Util) APIsSystemC

© Accellera Systems Initiative 35

Plugin function callOr how to access simulation information via interface delegation

Sim

ula

tion

sc_registerPython USIDelegate

ctrl.

basename()

__getattr__()

Query implemented

interface proxies

(SWIG) for basename()

Call basename()

sc_object

C++ PY

basename()

SWIG Proxy

Scripting environment Plug-in (Util) APIsSystemC

Call C++

Function

© Accellera Systems Initiative 36

Plugin function callOr how to access simulation information via interface delegation

Sim

ula

tion

sc_registerPython USIDelegate

ctrl.

basename()

__getattr__()

Query implemented

interface proxies

(SWIG) for basename()

Call basename()

sc_object

C++ PY

basename()

SWIG Proxy

Scripting environment Plug-in (Util) APIsSystemC

Call C++

Function

virtual

basename()

© Accellera Systems Initiative 37

Plugin function callOr how to access simulation information via interface delegation

Sim

ula

tion

sc_registerPython USIDelegate

ctrl.

basename()

__getattr__()

Query implemented

interface proxies

(SWIG) for basename()

Call basename()

sc_object

C++ PY

basename()

SWIG Proxy

Scripting environment Plug-in (Util) APIsSystemC

Call C++

Function

virtual

basename()

basename()

© Accellera Systems Initiative 38

Plugin function callOr how to access simulation information via interface delegation

Simulator agnostic

Accellera SystemC

Mentor Graphics Questasim

– No sc_main

– Introduction of a help macro

– USI_MODEL_EXPORT

– GCC 32 bit

– Debugging problems

– Potential for deeper integration

© Accellera Systems Initiative 39

Language agnostic

TCL

Ruby

Python

o Lua

© Accellera Systems Initiative 40

API agnostic

sc_object, tlm_socket

GreenControl gs_param

Cadence scireg

AHB/APBDevice

© Accellera Systems Initiative 41

Usability vs. Speed

• Easier to write

• Faster prototyping

• Domain Specific

– Statistics

– Text processing

• Slower (Python: 10 to 100 times)

• Fast extensions available (e.g. Python pandas)

• Ideal for pre-/post processing and glue

© Accellera Systems Initiative 42

For more information please contact us!

SoCRocket is available online:https://socrocket.github.io/

© Accellera Systems Initiative 43

Questions

© Accellera Systems Initiative 44


Recommended