TAMS / Java / Hades / applets: contents | previous | next | ||||
Hades Applets contents visual index introduction std_logic_1164 gatelevel circuits delay models flipflops basic SR fli... SR flipflop ... clocked SR f... D-latch D-flipflop D-flipflop w... JK-flipflop JK-flipflop JK-flipflop ... 7476 JK-flip... flipflop demo LSSD latch 74273 D-regi... 74166 shift-... c-gate c-gate (3 in... micropipeline traffic ligh... traffic ligh... traffic ligh... traffic ligh... adders and arithm... counters LFSR and selftest memories programmable logic state-machine editor misc. demos I/O and displays DCF-77 clock relays (switch-le... CMOS circuits (sw... RTLIB logic RTLIB registers Prima processor D*CORE MicroJava Pic16 cosimulation Mips R3000 cosimu... Intel MCS4 (i4004) image processing ... [Sch04] Codeumsetzer [Sch04] Addierer [Sch04] Flipflops [Sch04] Schaltwerke [Sch04] RALU, Min... [Fer05] State-Mac... [Fer05] PIC16F84/... [Fer05] Miscellan... [Fer05] Femtojava FreeTTS | Traffic light controller (3/4, one-hot encoding)
Circuit Description
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
dozen states.
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
first flipflop.
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) | ||||
Impressum | http://tams.informatik.uni-hamburg.de/applets/hades/webdemos/18-fsm/10-trafficlight/ampel_44.html |