N+D
S10
N’·D’
Vending – Contoh Input
Clk
D
N
Z
S0 S0 S10 S10 S15 S0 S0
Clk
Z
S0 S0 S10 S10 S15 S0 S0
Assign variables: Vending
S Q1 Q0
S0 00 State/output table:
N,D
S5 01
S10 1 0 S 00 01 10 11 z
S15 1 1 N’·D’ S0 S0 S10 S5 d 0
S5 S5 S15 S10 d 0
S0 S10 S10 S15 S15 d 0
N S15 S0 S0 S0 d 1
D S*
1
S15 D
S5 N’·D’ Transition/output table:
(z=1)
N N,D
Q1 Q0 00 01 10 11 z
00 00 10 01 dd 0
N+D 01 01 11 10 dd 0
S10 10 10 11 11 dd 0
11 00 00 00 dd 1
N’·D’ Q1* Q0*
Vending – Excitation Eqns
Excitation/output table:
N,D Assume D flip-flops, then D = Q*
Q1 Q0 00 01 10 11 z
00 00 10 01 dd 0
01 01 11 10 dd 0
10 10 11 11 dd 0
11 00 00 00 dd 1
D1 D0
Vending - Rangkaian
Contoh - Counter
• Buat counter untuk menghitung 0..7
• Counter memiliki sinyal enable w
• State diagram:
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
Counter – Transition table
State table Transition table
01 0 1 1 0 01 0 0 1 1 01 1 1 1 1
11 1 0 0 1 11 0 1 0 1 11 1 1 0 1
10 1 0 0 1 10 0 1 0 1 10 0 0 1 0
Y1
D Q y1
Y2
D Q y2
Clock
Resetn
Lampu Sein
• Design FSM untuk mengontrol
lampu sein belakang Left turn sequence Right turn sequence
mobilyang akan menyala jika LC LB LA RA RB RC
akan belok
LC LB LA RA RB RC
LC LB LA RA RB RC
LC LB LA RA RB RC
LC LB LA RA RB RC
LC LB LA RA RB RC
• Assume inputs for
LEFT, RIGHT, HAZ LC LB LA RA RB RC
Lampu Sein
State diagram
LA
LEFT
LB
RIGHT State
machine LC
HAZ
RA
RB
Clk
RC
Mealy State Diagram
Mealy State Diagram
• Untuk pemodelan Mealy, output tidak lagi
bergantung hanya pada current state.
– Output juga bergantung dengan transisi antar state
(tergantung dari input)
• Contoh pemodelan Mealy state diagram
– Mendeteksi input berurutan w=11
Mealy State Table
• State table untuk model Mealy FSM berbeda
dengan model Moore FSM, yaitu dari evaluasi
outputnya
State-assigned Table
Contoh Lain Mealy FSM
• Buatlah Mealy state diagram untuk mendeteksi
input yang memiliki urutan w=101