FSM
FSM
State
State State Timing
Assigned Synthesis Circuit
Diagram Table Diagram
Table
Mealy Type
❖ the output z should be equal to 1 in the same clock cycle when the second
occurrence of w = 1 is detected.
Mealy
Moore
Forming State Diagram
Forming State Table
Forming State Assigned Table
Synthesis using K-map
Circuit
Timing Diagram
Verilog Coding
Sequence Detector (1)
❖The output z is equal to 1 when the previous two values of w were 00 or 11.
Otherwise, the value of z is equal to 0.
State Diagram
Solution
Verilog Code
Sequence Detector (2)
❖The output z is equal to 1 when the two values of w were 00 or 11 in the current
cycle. Otherwise, the value of z is equal to 0.
Solution
Verilog Code
3 Consecutive 1’s
❖The output z is equal to 1 if during three immediately preceding clock cycles the
input w was equal to 1. Otherwise, the value of z is equal to 0.
Solution
Parity Generator
❖The output z is equal to 1 when the number of 1’s in all previous cycles is odd and
z is equal to 0 when the number of 1’s in all previous cycles is even.
Solution
Summary
❖ Sequence Detector
❖ Parity Generator
Serial Adder
Mealy Type State Diagram
Solution
Circuit
Moore Type State Diagram
Solution
Circuit
Summary
// Output Logic
assign out=state
endmodule
• Synchronous-Asynchronous
• State Diagram
• Number of States
• General Circuit Complexity
w= 0 w= 0 w= 0 w= 0
w= 1 w= 1 w= 1
A/0 B/1 C/2 D/3
w= 1 w= 1
w= 0 w= 0 w= 0 w= 0
01 0 1 1 0 01 0 0 1 1
11 1 0 0 1 11 0 1 0 1
10 1 0 0 1 10 0 1 0 1
y1y0
wy2
00 01 11 10
00 0 0 0 0
01 1 1 1 1
11 1 1 0 1
10 0 0 1 0
Y1
D Q y1
Y1 = wy1 + y1y0 + wy0y1
Q
Y2
Y2 = wy2 + y0y2 + y1y2 + wy0y1y2 D Q y2
Clock
Resetn
Figure 8.64. Circuit diagram for the counter implemented with D flip-flops.
A counter that counts 0,4,2,6,1,5,3,7,0,4, and so on
D2=Y2=y2 Q
D1=Y1=y1Åy2
D0=Y0=y0Åy1y2
D Q z1
D Q z0
w Q
Idle
0xx 1xx
gnt1 g1 = 1
gnt2 g2 = 1
gnt3 g3 = 1
xx1
FSM OF AN ARBITER CIRCUIT r 1r 2 r 3
Reset
Idle
r1 r1
gnt1 g1 = 1
r2 r1 r 1r 2
gnt2 g2 = 1
r3 r2 r 1r 2 r 3
gnt3 g3 = 1
r3
endmodule