- J. Henkel, M. Shafique, KIT, WS1011
http://ces.itec.kit.edu 1 ESII: Specification & Modeling
Design and Architectures for Embedded Systems (ESII)
- Prof. Dr. J. Henkel, M. Shafique
- Prof. Dr. J. Henkel, M. Shafique
Design and Architectures for Embedded Systems (ESII) Prof. Dr. J. - - PowerPoint PPT Presentation
1 ESII: Specification & Modeling Design and Architectures for Embedded Systems (ESII) Prof. Dr. J. Henkel, M. Shafique Prof. Dr. J. Henkel, M. Shafique CES CES - Chair for Embedded Systems Chair for Embedded Systems Karlsruhe Institute
http://ces.itec.kit.edu 1 ESII: Specification & Modeling
http://ces.itec.kit.edu 2 ESII: Specification & Modeling
Embedded Processor Design & Architectures
embedded IP:
IC technology
Optimization
area, reliability, peak temp. …
Design Space Exploration Design Space Exploration
Processors Embedded Embedded Software Optimize for
Special Instructions
Generation for Embedded Systems Middleware, Middleware, RTOS 13 & 14. 13 & 14. Scheduling
10 & 11. Reconfigurable 10 & 11. Reconfigurable Processors SYSTEM PARTITIONING SYSTEM PARTITIONING Hardware Hardware Design
2, 3, 4, 5 SYSTEM SPECIFICATION 2, 3, 4, 5 SYSTEM SPECIFICATION
refine
Estimation&Simulation
area, reliability, peak temp. …
http://ces.itec.kit.edu 3 ESII: Specification & Modeling
FSM/FSMD FSM/FSMD HCFSM and HCFSM and Statecharts Statecharts Language Language Program Program-State Machine (PSM) Model State Machine (PSM) Model
http://ces.itec.kit.edu 4 ESII: Specification & Modeling
Operate on inputs; produce outputs and stop Operate on inputs; produce outputs and stop
Do not typically terminate Do not typically terminate Continuous interaction with environment Continuous interaction with environment Interactive system act at their own speed Interactive system act at their own speed Example: OS Example: OS
Like interactive systems Like interactive systems But: the pace is imposed by the environment But: the pace is imposed by the environment Embedded Systems belong to this group Embedded Systems belong to this group
http://ces.itec.kit.edu 5 ESII: Specification & Modeling
(src: A. Jantsch)
http://ces.itec.kit.edu 6 ESII: Specification & Modeling
Difficulty Difficulty Due to High Due to High Complexity Complexity radically growing radically growing
Software complexity ~ Increasing IC Software complexity ~ Increasing IC capactiy capactiy Software Complexity Software Complexity thousands to millions of LOC thousands to millions of LOC >10 >109 LOC LOC Think about Digital Washing Machines or Ovens Think about Digital Washing Machines or Ovens Now think Now think
Digital Camera Digital Camera Multimedia TV, Multimedia TV, Mobile Phones (Video Coding, Audio Coding, GPS, 4G Mobile Phones (Video Coding, Audio Coding, GPS, 4G communication, …) communication, …)
Desired behavior often not fully understood in beginning Desired behavior often not fully understood in beginning
Many implementation bugs due to description mistakes/omissions Many implementation bugs due to description mistakes/omissions
English (or other natural language) common starting point English (or other natural language) common starting point Precision Precision hard to describe clearly hard to describe clearly difficult to impossible difficult to impossible
Level of Ambiguity Level of Ambiguity
(src: Vahid02)
http://ces.itec.kit.edu 7 ESII: Specification & Modeling
5
Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis
– We may think of languages (C, C++), but computation model is the key
– Sequential program model
– Communicating process model
– State machine model
– Dataflow model
– Object-oriented model
ESII: Spec & Modeling
http://ces.itec.kit.edu 8 ESII: Specification & Modeling
6
Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis
– Conceptual notion, e.g., recipe, sequential program
– Concrete form, e.g., English, C
– E.g., sequential program model C,C++, Java
– E.g., C++ ? sequential program model, object-oriented model, state machine model
Models Languages
Recipe Spanish English Japanese Poetry Story Sequent. program C++ C Java State machine Data- flow
Recipes vs. English Sequential programs vs. C
ESII: Spec & Modeling
http://ces.itec.kit.edu 9 ESII: Specification & Modeling
Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis
12
– S is a set of all states {s0, s1, …, sl} – I is a set of inputs {i0, i1, …, im} – O is a set of outputs {o0, o1, …, on} – F is a next-state function (S x I → S) – H is an output function (S → O) – s0 is an initial state
– Associates outputs with states (as given above, H maps S → O)
– Associates outputs with transitions (H maps S x I → O)
– Implicitly assign 0 to all unassigned outputs in a state – Implicitly AND every transition condition with clock edge (FSM is synchronous)
→ → → →
ESII: Spec & Modeling
http://ces.itec.kit.edu 10 ESII: Specification & Modeling
15
Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis
– Encourages designer to think of all possible states and transitions among states based on all possible input conditions
– Designed to transform data through series of instructions that may be iterated and conditionally executed
– More natural means of computing in those cases – Not due to graphical representation (state diagram)
ESII: Spec & Modeling
http://ces.itec.kit.edu 11 ESII: Specification & Modeling
17
Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis
sequential programming language
– C, C++, Java, Ada, VHDL, Verilog, etc. – Development tools are complex and expensive, therefore not easy to adapt or replace
language
– Front-end tool approach
– Graphical and/or textual state machine languages – May support graphical simulation – Automatically generate code in sequential programming language that is input to main development tool
– Language subset approach
ESII: Spec & Modeling
http://ces.itec.kit.edu 12 ESII: Specification & Modeling
20
Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis
(HCFSM)
– Extension to state machine model to support hierarchy and concurrency – States can be decomposed into another state machine
hierarchy, but has one less transition (z)
– States can execute concurrently
– Graphical language to capture HCFSM – timeout: transition with time limit as condition – history: remember last substate OR-decomposed state A was in before transitioning to another state B
instead of initial state
A1
z
B A2 z x
y w Without hierarchy
A1
z
B A2 x y A
w With hierarchy
C1 C2 x y C B D1 D2 u v D
Concurrency
ESII: Spec & Modeling
http://ces.itec.kit.edu 13 ESII: Specification & Modeling
Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis
22
– Designer can choose most appropriate
– transition between sibling states only, single entry – Program-state may “complete”
– Transition-immediately (TI): taken regardless of source program-state – Transition-on-completion (TOC): taken only if condition is true AND source program-state is complete
– SpecCharts: extension of VHDL to capture PSM model – SpecC: extension of C to capture PSM model
ESII: Spec & Modeling
http://ces.itec.kit.edu 14 ESII: Specification & Modeling
24
Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis
concurrently executing subtasks
because inherently multitasking
– Read two numbers X and Y – Display “Hello world.” every X seconds – Display “How are you?” every Y seconds
machine model
Subroutine execution over time
time ReadX ReadY PrintHelloWorld PrintHowAreYou
Simple concurrent process example
ConcurrentProcessExample() { x = ReadX() y = ReadY() Call concurrently: PrintHelloWorld(x) and PrintHowAreYou(y) } PrintHelloWorld(x) { while( 1 ) { print "Hello world." delay(x); } } PrintHowAreYou(x) { while( 1 ) { print "How are you?" delay(y); } }
Sample input and output
Enter X: 1 Enter Y: 2 Hello world. (Time = 1 s) Hello world. (Time = 2 s) How are you? (Time = 2 s) Hello world. (Time = 3 s) How are you? (Time = 4 s) Hello world. (Time = 4 s) ...
ESII: Spec & Modeling
http://ces.itec.kit.edu 15 ESII: Specification & Modeling
25
Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis
– May execute concurrently
– May or may not have token at any given time
fire
transformation and generates output token
– Can automatically translate to concurrent process model for implementation – Each node becomes a process
modulate convolve transform A B C D Z
Nodes with more complex transformations
t1 t2 + – * A B C D Z
Nodes with arithmetic transformations
t1 t2
Z = (A + B) * (C - D)
ESII: Spec & Modeling
http://ces.itec.kit.edu 16 ESII: Specification & Modeling
26
Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis
– Each edge labeled with number of tokens consumed/produced each firing – Can statically schedule nodes, so can easily use sequential program model
language? Try it...
appearance” schedules
– Only one statement needed to call each node’s associated procedure
modulate convolve transform A B C D Z
Synchronous dataflow
mt1 ct2 mA mB mC mD tZ tt1 tt2 t1 t2
ESII: Spec & Modeling
http://ces.itec.kit.edu 17 ESII: Specification & Modeling
(src: A. Jantsch)
http://ces.itec.kit.edu 18 ESII: Specification & Modeling
(src: A. Jantsch)
http://ces.itec.kit.edu 19 ESII: Specification & Modeling
(src: A. Jantsch)
http://ces.itec.kit.edu 20 ESII: Specification & Modeling
(src: A. Jantsch)
http://ces.itec.kit.edu 21 ESII: Specification & Modeling
(src: A. Jantsch)
http://ces.itec.kit.edu 22 ESII: Specification & Modeling
(src: A. Jantsch)
http://ces.itec.kit.edu 23 ESII: Specification & Modeling
(src: A. Jantsch)
http://ces.itec.kit.edu 24 ESII: Specification & Modeling
(src: A. Jantsch)
http://ces.itec.kit.edu 25 ESII: Specification & Modeling
(src: A. Jantsch)
http://ces.itec.kit.edu 26 ESII: Specification & Modeling
(src: A. Jantsch)
http://ces.itec.kit.edu 27 ESII: Specification & Modeling
(src: A. Jantsch)
http://ces.itec.kit.edu 28 ESII: Specification & Modeling
(src: A. Jantsch)
http://ces.itec.kit.edu 29 ESII: Specification & Modeling
(src: A. Jantsch)
(i.e. differential equation; g - state function)
http://ces.itec.kit.edu 30 ESII: Specification & Modeling
(src: A. Jantsch)
http://ces.itec.kit.edu 31 ESII: Specification & Modeling
(src: A. Jantsch)
http://ces.itec.kit.edu 32 ESII: Specification & Modeling
(src: A. Jantsch)
http://ces.itec.kit.edu 33 ESII: Specification & Modeling
(src: A. Jantsch)
http://ces.itec.kit.edu 34 ESII: Specification & Modeling
(src: A. Jantsch)
http://ces.itec.kit.edu 35 ESII: Specification & Modeling
(src: A. Jantsch)
http://ces.itec.kit.edu 36 ESII: Specification & Modeling
(src: A. Jantsch)
http://ces.itec.kit.edu 37 ESII: Specification & Modeling
[Vahid02] F. Vahid, T. Givargis, Embedded System Design, John Wiley&Sons, 2002. [BLee00] B. Lee, Specification and Design of Reactive Systems, PhD Dissertation, UC Berkeley, Spring 2000. [A. Jantsch] A. Jantsch, “Modeling Embedded Systems and SoCs”, Morgan Kaufmann Publishers, 2004.
http://ces.itec.kit.edu 38 ESII: Specification & Modeling
http://ces.itec.kit.edu 39 ESII: Specification & Modeling
http://ces.itec.kit.edu 40 ESII: Specification & Modeling
18
Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis
state machine constructs in equivalent sequential language constructs
hardware languages (e.g.,VHDL)
in C
– Enumerate all states (#define) – Declare state variable initialized to initial state (IDLE) – Single switch statement branches to current state’s case – Each case has actions
– Each case checks transition conditions to determine next state
#define IDLE0 #define GOINGUP1 #define GOINGDN2 #define DOOROPEN3 void UnitControl() { int state = IDLE; while (1) { switch (state) { IDLE: up=0; down=0; open=1; timer_start=0; if (req==floor) {state = IDLE;} if (req > floor) {state = GOINGUP;} if (req < floor) {state = GOINGDN;} break; GOINGUP: up=1; down=0; open=0; timer_start=0; if (req > floor) {state = GOINGUP;} if (!(req>floor)) {state = DOOROPEN;} break; GOINGDN: up=1; down=0; open=0; timer_start=0; if (req < floor) {state = GOINGDN;} if (!(req<floor)) {state = DOOROPEN;} break; DOOROPEN: up=0; down=0; open=1; timer_start=1; if (timer < 10) {state = DOOROPEN;} if (!(timer<10)){state = IDLE;} break; } } }
UnitControl state machine in sequential programming language
ESII: Spec & Modeling