© egon börger: clock and stopwatch asm 1 illustrating the asm function classification a real-time...
TRANSCRIPT
![Page 1: © Egon Börger: Clock and Stopwatch ASM 1 Illustrating the ASM Function Classification A real-time CLOCK: –Monitored: CurrTime: Real (supposed to be increasing](https://reader035.vdocuments.net/reader035/viewer/2022071807/56649dd85503460f94acde43/html5/thumbnails/1.jpg)
© Egon Börger: Clock and Stopwatch ASM 1
Illustrating the ASM Function Classification
• A real-time CLOCK:– Monitored: CurrTime: Real (supposed to be increasing )
– Controlled: DisplayTime: Nat x Nat– Static: Delta: Real (system dependent time granularity), +,
conversion (from Real to Nat),
• The Rule:
If DisplayTime + Delta = CurrTime
Then DisplayTime := conversion(CurrTime)
• Separating guard computation by derived fct, e.g. – ClockTick = 1 iff CurrTime = DisplayTime + Delta
the rule becomes
If ClockTick then DisplayTime := CurrTime
![Page 2: © Egon Börger: Clock and Stopwatch ASM 1 Illustrating the ASM Function Classification A real-time CLOCK: –Monitored: CurrTime: Real (supposed to be increasing](https://reader035.vdocuments.net/reader035/viewer/2022071807/56649dd85503460f94acde43/html5/thumbnails/2.jpg)
© Egon Börger: Clock and Stopwatch ASM 2
Extending CLOCK to a Stopwatchmonitored ClockTick indicating the measured time interval monitored StartStop (e.g. event consumed upon rule firing)
stoppedrunning
Run
Stop
ReStart Extension by ReSet
with Initialization
Run If ClockTick then CountTicks:=CountTicks+1
Emit(CountTicks+1) Stop ReStart If StartStop then Skip
Emit (Time) DisplayTime:= Time
Initially stopped withCountTicks=0Start If StartStop then CountTicks:=0
ReSet If Reset then Skip
start Start
ReSet
Assuming StartStop and Reset as disjoint
![Page 3: © Egon Börger: Clock and Stopwatch ASM 1 Illustrating the ASM Function Classification A real-time CLOCK: –Monitored: CurrTime: Real (supposed to be increasing](https://reader035.vdocuments.net/reader035/viewer/2022071807/56649dd85503460f94acde43/html5/thumbnails/3.jpg)
© Egon Börger: Clock and Stopwatch ASM 3
Exercise– Refine the Stopwatch by intermediate time handling
• Introduce a new input signal Lap to record an intermediate time while continuing to measure the global time.
• An occurrence of Lap freezes the time on the display, while the internal stopwatch time continues to be computed. The next occurrence of Lap puts the stopwatch back to run time display.
![Page 4: © Egon Börger: Clock and Stopwatch ASM 1 Illustrating the ASM Function Classification A real-time CLOCK: –Monitored: CurrTime: Real (supposed to be increasing](https://reader035.vdocuments.net/reader035/viewer/2022071807/56649dd85503460f94acde43/html5/thumbnails/4.jpg)
© Egon Börger: Clock and Stopwatch ASM 4
References
• G. Berry: Programming a digital watch in Esterel v3_2.– In: TR 08/91, Centre de Mathematiques appliquees, Ecole
des Mines de Paris, Sophia-Antipolis 1991
• N. Halbwachs: Synchronous programming of reactive systems– Kluwer 1993
• E. Börger, R. Stärk: Abstract State Machines. A Method for High-Level System Design and Analysis Springer-Verlag 2003, see http://www.di.unipi.it/AsmBook – See Chapter 3