25
The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree Dr. (ETH) Josef Templ Department of Computer Science Universität Salzburg cs.uni-salzburg.at MoDECS.cc PREEtec.com

The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

The Timing Definition Language(TDL)

Prof. Dr. Wolfgang PreeDr. (ETH) Josef Templ

Department of Computer ScienceUniversität Salzburg

cs.uni-salzburg.atMoDECS.cc

PREEtec.com

Page 2: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 2 LASER 2005

Overview

TDL programming model for concurrent hard real-time software TDL component model Simple TDL example Tool chain Current state

Page 3: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 3 LASER 2005

What is TDL?

A high-level textual notation for defining the timing behavior of areal-time application.

Conceptually based on Giotto (University of California, Berkeley).

TDL = Giotto + syntax + component architecture + cleanups.

Analogy: IDL (CORBA, MIDL) vs. TDL

IDL defines an interface for a distributed application

=> Separates interface from implementation

TDL defines the timing for a real-time application

=> Separates timing from implementation

Page 4: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 4 LASER 2005

Schematic overview of Giotto/TDL concepts

a

SampleModule

Sensor Actuator

InitMode

Task1 300Hz

Task2 100Hz

OperationMode

Task1 200Hz

Task3 600Hz

mode switch

Giotto programs are multi mode & multi rate systemsfor long running tasks.

Page 5: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 5 LASER 2005

The Giotto/TDL Programming Model (LET)

ET <= WCET <= LET

results are available at 'terminate'

timetask invocation

Logical Execution Time (LET)

Logical

Physical

start stopsuspend resume

release terminate

Page 6: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 6 LASER 2005

Unit Delay

time

LET

task a

task b

1 2 3

1 2 3

o:1 o:2 o:3

Page 7: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 7 LASER 2005

Unit Delay

... but isn't it a waste of time?=> determinism, composition, transparent distribution

time

LET

task a

task b

task c 1 2 3 4

1 2 3

1 2 3

o:1 o:2 o:3

Page 8: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 8 LASER 2005

Summary of Giotto Heritage

Sensor and actuator ports are used to interact with the environment. A program is in one of potentially multiple modes. Every mode consists of periodic activities:

task invocations actuator updates mode switches

A mode has a fixed period. Activities are carried out conditionally. Activities have their individual execution rate. Timing and interaction of activities follows LET semantics.

Page 9: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 9 LASER 2005

TDL Component Model: Motivation

e.g. modern cars have up to 80 control units (ECUs) ECU consolidation is a topic run multiple programs on one ECU leads to TDL component model

ECU1

Program1

ECU2

Program2

ECU3

Program3

Page 10: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 10 LASER 2005

TDL Component Model

ProgramX is called a module modules may be independent modules may also refer to each other (DAG) modules can be used for multiple purposes

ECU

Program1Program2Program3

Page 11: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 11 LASER 2005

Usage of Modules

decomposition of large programs grouping of unrelated modules parallel automatons ECU consolidation client/service relationship

provide common definitions for constants, types, etc. data flow from service to client module

distributed execution

Page 12: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 12 LASER 2005

TDL Syntax by Examplemodule M1 {

sensor boolean s1 uses getS1; actuator int a1 uses setA1;

public task inc [wcet=4ms] { output int o := 10; uses incImpl(o); }

start mode main [period=10ms] { task [freq=1] inc(); actuator [freq=2] a1 := inc.o; mode [freq=1] if exitMain(s1) then freeze; }

mode freeze [period=1000ms] {}}

Page 13: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 13 LASER 2005

Module Import

module M2{

import M1; … task clientTask [wcet=10ms] { input int i1; … } mode main [period=100ms] { task [freq=1] clientTask(M1.inc.o); … }}

Import relationship forms a DAG.

TDL supports structured module names (e.g. com.avl.p1.M1)

import with rename: (e.g. import com.avl.p1.M1 as A1;)

group import: (e.g. import com.avl.p1 {M1, M2, M3};)

Page 14: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 14 LASER 2005

Module Summary

provides a named program component provides a name space allows for exporting sensors, constants, types, task outputs may be imported by other module(s) acts as unit of composition acts as the unit of loading acts as the unit of execution partitions the set of actuators acts as the unit of distribution

TDL supports multi mode & multi rate & multi program systems.

Page 15: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 15 LASER 2005

More Language Constructs

Constantsconst c1 = 100;

const p = 100ms;

TypesBasic types: like Javabyte, short, int, ...

User defined opaque types: defined externallytype T;

Page 16: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 16 LASER 2005

Differences to Giotto

TDL provides a component model (module).

TDL defines a concrete syntax and .ecode file format.

TDL does not need explicit task invocation drivers, mode switchdrivers and actuator update drivers as Giotto does.

Drivers are defined implicitly by the TDL syntax and semantics.

The user needs to implement only guards, sensor getters, actuatorsetters, port initializers, and, of course, task functions.

TDL defines program start as mode switch to start mode.

TDL disallows non-harmonic mode switches.

Mode port assignments differ.

Timing is in us.

Page 17: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 17 LASER 2005

Tool Chain Overview

.tdl Compiler E-machine*.ecode

functionalitycode

*Java, OSEK, InTIME, RTLinux, ...

Page 18: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 18 LASER 2005

Tool Chain Overview

.tdl Compiler

Platformplugin*

platformspecific

AST

platformspecific

.ecode

*Java, OSEK, InTIME, RTLinux, ...

functionalitycode

E-machine*

Page 19: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 19 LASER 2005

Tool Chain Overview

.tdl Compiler

Platformplugin*

platformspecific

AST

platformspecific

.ecode

Decoder .txtVisualTDL

Editor

Matlab/Simulink

*Java, OSEK, InTIME, RTLinux, ...

functionalitycode

E-machine*

Model

Page 20: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 20 LASER 2005

Source Code Organization

emcore (37.775 loc) ast abstract syntax tree (1.180) ecode ecode instructions and reader (613) scheduler node schedulers (1.039) tools (34.829) decode .ecode decoder (222) emachine E-machine (3.323) tdlc TDL compiler (5.248) platform standard platform plugins (2.261) vtdl visual TDL editor (24.198) busch bus scheduler (1.824) util various utility classes (114)

Page 21: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 21 LASER 2005

TDL Compiler

implemented with compiler generator Coco/R for Java.(Mössenböck, JKU Linz)production quality recursive descent compiler in Java.2 phases:

1. parse source text and build AST2. generate .ecode file from AST

plugin interface defined by base class Platform plugin life cycle: open {emitCode} close additionally: setErrorHandler, setDestDir

Page 22: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 22 LASER 2005

Java-based E-machine

used as proof of concept experimentation platform not hard-real time consists of

.ecode loader task scheduler E-code interpreter dispatcher bus controller (for distribution)

Interacts with functionality code via drivers

Page 23: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 23 LASER 2005

State

Ready TDL Compiler for complete TDL Decoder Java-based E-machine for multiple modules Visual TDL Editor InTIME, OSEK, TTA TDK (from MoDECS.cc)

Work in Progress ANSI C back ends for POSIX, RTLinux, OSEK, InTIME… E-machines for distribution Bus Scheduler

Page 24: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 24 LASER 2005

Thank you for your attention!

Page 25: The Timing Definition Language (TDL) - LASER Foundationlaser.inf.ethz.ch/2005/slides/pree/02a_TDL.pdf · 2009-11-27 · The Timing Definition Language (TDL) Prof. Dr. Wolfgang Pree

© W. Pree, J. Templ: TDL 25 LASER 2005

TDK - TDL Development Kit

preconfigured collection of Java-based TDL tools (tdlc, emachine,decoder, Java plugin, JavaDocs, Tutorial)

for learning TDL and for easy experimentation with real timeapplications

batch files for Windows command prompt downloadable from MoDECS home page (MoDECS.cc) TDL Tutorial:

Explains how to use the TDL tools from command line. Uses sequence of examples with increasing complexity:

single rate, multi rate, multi mode, multi module, [multi node]