V22.0436 - Prof. Grishman

Assignment 3 - State Machine

You are to design an improved traffic light controller which adds a yellow light to the example presented in the text. The traffic light in each direction will cycle from green to yellow to red, and then back to green.

The basic sequence is 10 seconds of green, followed by 5 seconds of yellow and 15 seconds of red. In order to discourage car crashes, while the EW (east-west) light is green or yellow, the NS (north-south) light must be red, and vice versa.

Following the example in the book, you should make your traffic light controller "intelligent" by using sensors which detect whether there is a car waiting in either the NS or EW direction. These are the two circuit inputs, and should be labeled NScar and EWcar, as in the text. We will use a 0.2 Hz clock (i.e., a clock with a 5 second clock period), so decisions and possible state transitions occur only once every 5 seconds. After the signal has been green in the NS direction for 10 seconds, the controller sees whether there is a car waiting in the EW direction. If no car is waiting, the light continues green in the NS direction for another 5 seconds before the controller checks again. If there is a car waiting, the controller changes the NS light to yellow. Five seconds later, the controller changes the NS light to red and the EW light to green. The process then repeats (keeping the EW light green for 10 seconds and then checking for a NS car).

The controller should have six binary outputs, for the red, yellow, and green lights for the EW and the NS directions.

a) How many states are required? How many bits are required to hold this state information?

b) Draw a state transition diagram for the controller

c) Convert the diagram to a set of tables --- a next-state function table and an output function table --- following the example in the text (page B-37).

Due February 24. Late assignments are penalized 5% after noon, and 10% for each weekday late.

Spring 1999