Meta-Modelling the SystemC Standard for Component-based ...

8 downloads 429 Views 1015KB Size Report
Advantages of introducing a SystemC DSL instead of .... From: Black, Donovan: „ SystemC: From the Ground Up“, Kluwer Academic Publishers, 2004, page 147.
Meta-Modelling the SystemC Standard for Component-based Embedded System Design

1

FZI Forschungszentrum Informatik, 2 University of Tübingen

1st International Workshop on Metamodelling and Code Generation for Embedded Systems Tampere, Finland, Oct 7, 2012

FZI FORSCHUNGSZENTRUM INFORMATIK

Martin Küster1, Alexander Viehl1, Andreas Burger1, Oliver Bringmann1,2, Wolfgang Rosenstiel1,2

MDA1 focuses on a “full generation“ strategy. We try to generate only necessary artifacts. 1)

MDA = OMG Model-Driven Architecture

 Requirements for a model-driven approach: 

Compositional, made for reuse  Separation (but integration) of HW and SW view  Integration into UML tool chain  But: Use Eclipse-based technology for M2M (based on EMF)

 What we need: 

Semantically rich metamodel of SystemC  Mapping to code  Model-to-model transformations for connection to UML Introduction Tampere, Oct 07, 2012

Metamodel

ReverseEngineering

Arch. Design • Software • Hardware

• Refactoring

Existing Code

Code Generation

• No models!

SystemC model • Simulation • Performance Prediction

Application

Andreas Burger: Meta-Modelling the SystemC Standard for Component-based Embedded System Design

Related Work / Conclusion 2

Advantages of introducing a SystemC DSL instead of UML-based profile mechanism  Efficiency and clear semantics: 

Composition vs. reference  Polymorphism (inheritance of modules, overwriting of methods, etc.)

 MDA: „generate all“ simply does not scale 

Legacy code (e.g. existing libraries, non-SystemC, non-UML)

 Instead: focus on relevant artifacts:    

Architecture: Components and interactions SC_Modules, SC_Interfaces, SC_Ports, etc. Behavior: Processes, Methods, Threads, Events Deployment: Mapping of software and hardware components

Introduction Tampere, Oct 07, 2012

Metamodel

Application

Andreas Burger: Meta-Modelling the SystemC Standard for Component-based Embedded System Design

Related Work / Conclusion 3

SystemC Metamodel is language-independent and models all core elements of the language.

New Classes for encapsulation of common features

Introduction Tampere, Oct 07, 2012

Metamodel

Application

Andreas Burger: Meta-Modelling the SystemC Standard for Component-based Embedded System Design

Related Work / Conclusion 4

The SystemC-Assembly-Metamodel separates type- from instance level and introduces Bindings.

Three binding types for different use cases

Module instances are called „AssemblyContexts“

Introduction Tampere, Oct 07, 2012

Metamodel

Application

Andreas Burger: Meta-Modelling the SystemC Standard for Component-based Embedded System Design

Related Work / Conclusion 5

Code generation: The EMF-based model can be used for code generation with QVT-O  „Code is a model, too.“ core

SystemC layer

:SC_Event :SC_Module

Refactoring

QVT-R M2M :SC_Fifo_in_out

Editor support

:SC_Interface

QVT-O M2M

Eclipse CDT Abstract Syntax Tree

Code layer (model)

Code as text

SC_MODULE (foo) { sc_event e1; ... }

Editing

class B : Bar { int i1; ... }

Legacy Code Introduction Tampere, Oct 07, 2012

Metamodel

Application

Andreas Burger: Meta-Modelling the SystemC Standard for Component-based Embedded System Design

Related Work / Conclusion 6

Code generation strategies for module hierarchies and binding concepts (excerpt, 1/2) SystemC MM element

Code Generation Example

Comment

(Inner)Assembly / Module Hierarchy

SC_MODULE(Top) { Sub* sub; SC_CTOR(Top) { sub = new Sub("Sub_Module"); // other initialization } };

Indirect Sub-Module HeaderOnly Implementation

ExportBinding (binding from export to port)

exp_A(port_B);

There must be a local channel behind exp_A (not depicted here)

PortBinding

port_A(cX); port_B(cY);

Direct connection or connection via channel (named connectivity)

Within SC_CTOR of parent module.

Introduction Tampere, Oct 07, 2012

Metamodel

Application

Andreas Burger: Meta-Modelling the SystemC Standard for Component-based Embedded System Design

Related Work / Conclusion 7

Code generation strategies for module hierarchies and binding concepts (excerpt, 2/2) SystemC MM element

Code Generation Example

Comment

DelegationBinding (1)

SC_CTOR(Top), A(“a”) { port_A(port_top); // other initialization }

Order of connection is important!

DelegationBinding (2)

SC_CTOR(Top), B(“b”) { exp_top(B.expB); // other initialization }

Same as above, but different order of bindings

Introduction Tampere, Oct 07, 2012

Metamodel

Application

Andreas Burger: Meta-Modelling the SystemC Standard for Component-based Embedded System Design

Related Work / Conclusion 8

Example shows separation of SW and HW design

«allocate»

«allocate»

«allocate»

Generation of SystemC Wrappers see: [Zimmermann2012] Introduction Tampere, Oct 07, 2012

Metamodel

Application

Andreas Burger: Meta-Modelling the SystemC Standard for Component-based Embedded System Design

Related Work / Conclusion 9

Related and Future Work  UML-based approaches (profiles) Riccobene et. al (2005): “A SoC Design Methodology Involving a UML 2.0 Profile for SystemC” or  Riccobene et al. (2005): “A UML 2.0 Profile for SystemC: Toward High Level SoC Design”  Mueller et al., "The SATURN Approach to SysML-Based HW/SW Codesign“, pp.506-511, 2010 IEEE Annual Symposium on VLSI, 2010 

Introduction Tampere, Oct 07, 2012

Metamodel

Application

Andreas Burger: Meta-Modelling the SystemC Standard for Component-based Embedded System Design

Related Work / Conclusion 10

Summary and Conclusion  Main contribution of this paper 

SystemC metamodel including explicit notion of instances / assembly  Separation of software and hardware architecture with allocation modeled in UML  Instructions for code generation (written in QVT-O)

 Future Work: 

Integration of legacy code is now based on simple source file / path inclusion  more comprehensive support needed  Refactoring of SystemC models: What happens to generated and handwritten code?

Introduction Tampere, Oct 07, 2012

Metamodel

Application

Andreas Burger: Meta-Modelling the SystemC Standard for Component-based Embedded System Design

Related Work / Conclusion 11

Backup: Options for module hierarchy

From: Black, Donovan: „SystemC: From the Ground Up“, Kluwer Academic Publishers, 2004, page 147

Tampere, Oct 07, 2012

Andreas Burger: Meta-Modelling the SystemC Standard for Component-based Embedded System Design

12