Name: ________________________________ PID: ________________________________
1. (14 pts) Compute for the following addition and subtraction problems.
(a) (8pts) Fill out the following table for the circuit diagram below.
A3A2A1A0
B3B2B1B0
0010
1001
1001
0100
S3S2S1S0
1010
1100
→ 4pts
1110
→
4pts
t.pt per
(b) (6pts) Fill out the blanks for the computation of (-20) + (-15) by converting to the 2’s
complement 6-bit binary numbers with the first digit being the sign of the number.
Indicate whether overflow occurs for the computation.
I
I
20 :O
,
15
:
! ? !??
001111
1
°
1
→
00
1
1
00
0
1
1
→ Zpts
I
0
2pts
10
I
y
/
29
→
→
Ipt
Ipt
101011
101100
C- w )
110000
I / 0001
C- 15)
Page 2 of 7
digit
Name: ________________________________ PID: ________________________________
2. (8 pts) Compute the timing diagram the following sequential logic diagram. Assume
initial value is Q1 = 0 and Q2 = 1.
1¥
lP↑ᵗ
hit
I
Ipt
¥
↑
Ipt
↑ ;
#
t
1¥
i
Page 3 of 7
Name: ________________________________ PID: ________________________________
3. (22pts) A sequential circuit with two flip-slops, an inputs X and an output Y is shown in
the following diagram.
(a) (6pts) Write out the expressions for DA, DB and Y.
Da
Y
=
=
AB + ✗
Drs
Btx
=
=
zpt each eq
B- ✗
A ⊕✗
(b) (8pts) Fill out the state table.
for next states
4 pts
Next state (DA, DB)
:
4 pts for
Y
Output (Y)
Present state
(A, B)
X=0
X=1
X=0
X=1
00
00
I /
0
I
01
00
10
0
I
10
00
I 1
I
0
11
I 0
to
I
0
(c) (8pts) Complete the state diagram.
0
/
Of
"'
<
↓
010
M
°
"
↓
' "
I pt
per path
Page 4 of 7
.
Name: ________________________________ PID: ________________________________
4. (22pts) Below is the state diagram of a three-state, two-input (X2 X1), two-output(Y2 Y1)
state machine.
(a) (12pts) Fill out the one-hot transition table based on the diagram.
Next state
Present State
Condition
Y2
Y1
A
A
XI
O
O
A
B
XD
I
0
A
C
I
0
I
B
B
XIX ,
I
✗
B
A
Xa
0
1
C
B
O
O
,
✗* +1T¥
0rXI⊕X ,
Or 1120-1×-1
(b) (10pts) Determine the minimized expressions for the flip-flop inputs (DA, DB, Dc) and the
outputs (Y2, Y1).
-
2pts pet equation
DA __AXItB✗I, -1C
DB=BXIX , + Axe
D. =B( Xox
,
-1×-2×-1 )=B( ☒ × )
'
Ot
B. (112+0×-1)
?qed
not
Ya -_B( XD , -1×-2×17=131×20-1×1 )
Y
,
=c+AXz
Page 5 of 7
Name: ________________________________ PID: ________________________________
5. (20pts) Consider the following state diagram with the given state encoding.
State
S1
S2
S3
S4
(a) (8pts) Fill out the state table.
Present state AB
AB
00
01
10
11
Q5pt per block
Next state AB
Outputs YZ
X=0
X=1
X=0
X=1
00
00
11
00
10
01
00
10
11
11
10
01
11
00
01
11
11
10
10
11
(b) (12pts) Derive the minimized (optimized) expression for the flip-flop inputs (DA, DB) and
the outputs (Y, Z).
:¥
it
¥-8b
+1€
•
◦
"
,
% 'E☐
%
DFX-IABDEAI-iB-XY-B-AXZ-A-B-AX-2.pt
pts
3
each
K
variable
_
Ipt
-
map
equation
Page 6 of 7
Name: ________________________________ PID: ________________________________
6. (18 pts) Two prisoners, A and B, are playing a game with the following rules:
●
●
●
●
In each round, they can either cooperate or defect.
If both cooperate: Both receive a reward.
If both defect: Neither receives anything.
If one defects while the other cooperates: The defector receives the reward, and the
cooperator receives nothing.
Prisoner B decides to deploy a strategy: B will defect after seeing A defect in both of the
previous two rounds. Otherwise, B will always cooperate.
Design a sequential circuit that models the behavior of the game. Assume one input 𝑋 and two
outputs 𝑂𝐴 𝑂𝐵 . Prisoner A can press either the input button 𝑋 = 1 to defect, or 𝑋 = 0 to
cooperate. The circuit outputs 𝑂𝐴 = 1 when A receives the reward, and 𝑂𝐵 = 1 when B
receives the reward.
(a) (10 pts) Complete the Mealy state diagram with arrows and labels. Indicate the meaning of
each state you choose to model the game. (Hint: Consider Prisoner B as a sequence
recognizer.)
S0 A does not defect in either of the previous rounds
S1 A cooperates and defects in the previous two rounds
S2 A defects in both of the previous two rounds
(a) 1pt for correct format of mealy state diagram; 6pts for the 6 correct transitions with correct
inputs; 3pts for the meaning of the 3 states
(b) 1pt for correct Moore state diagram; 1pt for identifying the correct number of necessary
states; up to 6pts for the correctness of the diagram
-0.5pt for each incorrect output of the state
-0.5pt for each incorrect transition path
Page 8 of 9
Name: ________________________________ PID: ________________________________
(b) (8 pts) Draw the Moore state diagram with necessary number of states. Assume that the
output of the initial state are don’t-cares (XX).
S0 Initial state (Both A and B cooperates)
S1 Both A and B cooperates AND A cooperates in both previous two rounds
S2 A defects and B cooperates AND A first cooperates and then defects in the previous two rounds
S3 A defects and B cooperates AND A defects in both previous two rounds
S4 Both A and B defects AND A defects in both previous two rounds
S5 A cooperates and B defects AND A first defects and then cooperates in the previous two rounds
Page 9 of 9