|TAMS / Java / Hades / applets: contents | previous | next|
basic SR fli...
SR flipflop ...
clocked SR f...
c-gate (3 in...
adders and arithm...
LFSR and selftest
I/O and displays
CMOS circuits (sw...
Mips R3000 cosimu...
Intel MCS4 (i4004)
image processing ...
[Sch04] RALU, Min...
|Traffic light controller (3/4, one-hot encoding)
Another traffic light controller
based on a state machine with one-hot encoding.
(Click the clock and nreset switches, or type the 'c' and 'r' bindkeys).
In a one-hot encoding,
the number of flipflops is the same as the
number of states of the automaton, only one of which is active.
One advantage of this design style is that the design is straightforward
and can be easily automated by design tools.
It is also well matched to many programmable devices like FPGAs,
which often include a flipflop in each of their basic blocks.
Second, exactly two flipflops change state during a state transition,
which often translates into high clock rates and low power consumption.
A third advantage is that the output circuits are often very simple;
for example, only two additional gates are required to drive
the output LEDs of the traffic light controller.
The obvious drawback of the one-hot encoding is the required number
of flipflops, which limits this design style to automata with a few
Note that the one-hot state-machine used here is actually
realized as a simple shift-register.
In order to initialize the circuit to a one-hot state after a reset,
special care has to be taken for one of the flipflops.
In the example circuit, the first flipflop
(corresponding to the 'red' state) includes a preset input (DFFRS),
while all other flipflops only have a reset input (DFFR).
This ensures that only the first flipflop is set after a reset inpulse.
Alternatively, we could have used the negative (NQ) output for the
Naturally, for a traffic light controller, the all-red state is
chosen as the reset state.
state encoding next state z3 z2 z1 z0 z3* z2* z1* z0* ----------------------------------------- red 0 0 0 1 0 0 1 0 red+yellow 0 0 1 0 0 1 0 0 green 0 1 0 0 1 0 0 0 yellow 1 0 0 0 0 0 0 1
|Print version | Run this demo in the Hades editor (via Java WebStart)|
|Usage | FAQ | About | License | Feedback | Tutorial (PDF) | Referenzkarte (PDF, in German)|