Traffic light controller (1/4)
Circuit Description
A very simple traffic light controller,
realized as a Moore-type state-machine with two flipflops
and a few gates.
(Click the clock and nreset switches, or type the 'c' and 'r' bindkeys).
The state table looks like follows:
state encoding next state
z1 z0 z1* z0*
---------------------------------
red 0 0 0 1
red+ylw 0 1 1 0
green 1 0 1 1
yellow 1 1 0 0
This results in the following logic equations:
z1* = (z1 & |z0) | (!z1 & z0)
z0* = !z0
led_red = !z1
led_yellow = z0
led_green = (z1 & !z0)
(Note that the schematics above uses the (z1 & !z0) AND gates twice
for better clarity.)
|