Models and Tools For Embedded Systems: 1 S. Ramesh / Krithi Ramamritham / Kavi Arya
Models and Tools For Embedded Systems: 1 S. Ramesh / Krithi Ramamritham / Kavi Arya
Embedded Systems
4. Real-time systems
• not only rt. outputs but at rt. time
• imagine a delay of few minutes in pacemaker
system
Analysis
Design
Implementation
Testing
Analysis
Design
Verification
Implementation
Testing
I O
T. S.
R. S.
state = initial_state
loop
case state:
state 1: Action 1
state 2: Action 2
...
end case
end
© S. Ramesh / Krithi Ramamritham / Kavi Arya 35
Code Generation
• FSM models can be refined to different
implementation
– Both HW and SW implementation
– Exploring alternate implementations
– For performance and other considerations
• Automatic code generation
• Preferable over hand generated code
• Quality is high and uniform
© S. Ramesh / Krithi Ramamritham / Kavi Arya 36
States and Transitions
req = read_req();
while (1)
{ switch (cur_floor)
{ case first: if (req == f2)
{up = tt; dest = f2;}
else if (req == f3)
{up = tt; dest = f3;}
else { up == ff; down = ff;};
break;
© S. Ramesh / Krithi Ramamritham / Kavi Arya 44
C- model
case second: if (req == f3)
{up = tt; dest = f3;}
else if (req == f1)
{ up = ff; down = tt; dest = f1;}
else { up == ff; down = ff;};
break;
case third: if (req == f2)
{up = ff; down = tt; dest = f2;}
else if (req == f1)
{ up = ff; down = tt; dest = f1;}
else { up == ff; down = ff;};
break; }; /* end of switch */
req = read_req(); } /* end of while */
© S. Ramesh / Krithi Ramamritham / Kavi Arya 45
Suitability of C
• C not natural for such applications
• Various problems
– Events and states all modeled as variables
– Not natural for even oriented embedded
applications
– States are implicit (control points decide the
states)
– No abstract description possible
– Commitment to details at an early stage
– Too much of work when the design is likely to be
discarded
© S. Ramesh / Krithi Ramamritham / Kavi Arya 46
Exercise
• Is the C model non-deterministic?
T > tmax
off on
T’ = K1 T’ = K2
T < tmin
• Control-dominated designs
– Input events arrive at irregular and
unpredictable times
– Time of arrival and response more crucial
than values
+ - modulate convolve
t1 t2 t1 t2
Transform
*
B
B
A B D