Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 . Consider a dashboard display that displays normal when brakes in the car operate normally and emergency when there is a failure. The intended

1. Consider a dashboard display that displays normal when brakes in the car operate normally and emergency when there is a failure. The intended behavior is that once emergency has been displayed, normal will not again be displayed. That is,emergency remains on the display until the system is reset.
In the following code, assume that the variable display defines what is displayed. Whatever its value, that is what appears on the dashboard.
1 volatile static uint8_t alerted;
2 volatile static char* display;
3 void ISRA(){
4 if (alerted ==0){
5 display = "normal";
6}
7}
8 void ISRB(){
9 display = "emergency";
10 alerted =1;
11}
12 void main(){
13 alerted =0;
14...set up interrupts...
15...enable interrupts...
16...
17}
Assume that ISRA is an interrupt service routine that is invoked when the brakes are applied by the driver. Assume that ISRB is invoked if a sensor indicates that the brakes are being applied at the same time that the accelerator pedal is depressed. Assume that neither ISR can interrupt itself but that ISRB has higher priority than ISRA, and hence ISRB can interrupt ISRA, but ISRA cannot interrupt ISRB. Assume further (unrealistically) that each line of code is atomic.
(a) Does this program always exhibit the intended behavior? Explain. In the remaining parts of this problem, you will construct various models that will either demonstrate that the behavior is correct or will illustrate how it can be incorrect.
(b) Construct a determinate extended state machine modeling ISRA. Assume that:
alerted is a variable of type {0,1} uint8 t,
there is a pure input A that when present indicates an interrupt request for
ISRA, and
display is an output of type char*.
(c) Give the size of the state space for your solution.
(d) Explain your assumptions about when the state machine in (b) reacts. Is this time triggered, event triggered, or neither?
(e) Construct a determinate extended state machine modeling ISRB. This one has a pure input B that when present indicates an interrupt request for ISRB.
(f) Construct a flat (non-hierarchical) determinate extended state machine de- scribing the joint operation of these two ISRs. Use your model to argue the correctness of your answer to part (a).
(g) Give an equivalent hierarchical state machine. Use your model to argue the correctness of your answer to part (a).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle9i Database Administrator Implementation And Administration

Authors: Carol McCullough-Dieter

1st Edition

0619159006, 978-0619159009

More Books

Students also viewed these Databases questions

Question

2. Why is resilience sometimes described as ordinary magic?

Answered: 1 week ago