Professional Documents
Culture Documents
By Mike Chen
Input
Input1
Inputn
Curren
t State
State0
State1
.
Staten
.
.
.
.
.
.
.
.
.
State0
State1
Input / Output
Example 1:
A Modulo-4 Synchronous Counter
Counts from 0 to 3 and then repeats.
It has a clock input (CLK) and a RESET input.
Outputs appear as a sequence of values (q1 and
q0) at time steps corresponding to the clock.
As the outputs are generated, a new state (s1s0) is
generated which takes on values of 00, 01, 10,
and 11 and are fed back to the input.
A = 00
B = 01
C = 10
D = 11
Example 2:
A Sequence Detector
Design a sequence detector using D flip-flops
and 8-to-1 multiplexers.
The sequence detector outputs a 1 when
exactly two of the last three inputs are 1.
An input of 011011100 produces
the output of 001111010
Example 3:
A Vending Machine Controller
Design a vending machine controller using D-flip
flops and a Programmable Logic Array (PLA).
The vending machine accepts three types of
inputs: a nickel (5), a dime (10), or a quarter
(25).
When the value of the total inserted coins equals
or exceeds 20, the machine dispenses the
merchandise, returns any excess change, and
waits for the next transaction.
C (10) = 10
D (11) = 15
Input /
Output2Output1Output0
Present State =
sn
Input = xn
Output = zn
s1 s2 x1 x0 s1 s0 z2 z1 z0
0 0
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 1
9 1
10 1
11 1
12 1
13 1
14 1
15 1
z2
x0
z1
5x5
PLA
z0
D
s0
CLK
D
s1