Exercise 2.1 : Consider a modified version of the Delay component, called
OddDelay, that has a Boolean input variable in, a Boolean output variable out,
and two Boolean state variables x and y. Both the state variables are initialized
to 0, and the reaction description is given by:
if y then out := x else out := 0;
x := in;
y := ¬y.
Describe in words the behavior of the component OddDelay. List a possible
execution
of the component if it is supplied with the sequence of inputs 0, 1, 1, 0, 1, 1
for the first six rounds.
If y is true, output the value of x. Otherwise, the output is zero.
After each execution, the value of x is assigned the input, and the value of y is
reversed.
Sequence 1: Input = 0
Output = 0
X = 0;
Y=1
Sequence 2: input = 1
Output = 0
X= 1;
Y = 0;
Sequence 3: input = 1
Output 0;
X=1;
Y=1;
Sequence 4: input = 0
Output 1
X = 0;
Y=0;
Sequence 5: input =1
Output 0
X = 1
Y= 1
Sequence 6: input =1
Output = 1
X= 1
Y= 0

IT specialist Veteran