Answered step by step
Verified Expert Solution
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
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 isemergency 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.
volatile static uintt alerted;
volatile static char display;
void ISRA
if alerted
display "normal";
void ISRB
display "emergency";
alerted ;
void main
alerted ;
set up interrupts...
enable interrupts...
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 uint 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 nonhierarchical 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started