E21 Digital System Design Lab #3

Due 1 November, 1998

Overall Comments

The purpose of this lab is to introduce you to state machine design using a programmable logic chip. You will be working on a real-world problem: traffic light control.

You should do this lab individually, however you may collaborate on extensions if you wish.

Setup for this lab involves getting a 7160ELC84-15 chip from Dr. Maxwell. Don't worry about this until the second week of the lab; get things working in simulation first.

Tasks

For this lab you will design and implement a state machine to run a traffic light. For part I you will have the traffic light run through a fixed sequence of states. For part two, you will add a pressure sensor input to the state machine that can vary the timing of the light sequence.

For all of the tasks you will be hooking together various components to make the complete circuit. You can do this using either VHDL and port map statements or using the graphical design editor.

The circuits you design for this lab should all have reset inputs that set the circuit to a known state, preferably a Red-Red state.

  1. For the static design, the traffic light should follow the sequence below.
  2. Traffic light specification with static times

    State

    Time

    NS Red

    EW Red

    2 clock cycles

    NS Green

    EW Red

    15 seconds

    NS Yellow

    EW Red

    4 seconds

    NS Red

    EW Red

    2 clock cycles

    NS Red

    EW Green

    15 seconds

    NS Red

    EW Yellow

    4 seconds

    To implement a static process, you can design a timer and then make the outputs--traffic light signals--a function of the timer outputs. This separates the problem into a sequential task--the timer--and a combinational task--the output generation.

    As an alternative overall design, you can make the timer generate signals that specify when the traffic light is to change state. Then design a state machine that runs the traffic light itself. This is a more general design method that may be easier to generalize for task II.

    The outputs to the traffic lights are active low (low = on), so design your circuit appropriately. There are six outputs, one for each light.

    For sequential tasks, be sure to follow the appropriate design steps:

    If you are doing the design using basic gates, then you need to select a flip-flop type, determine the output equations and develop the appropriate logic diagrams. Using VHDL, however, you can write the state transition table as a case statement within a process to implement the circuit. In either case, you need to follow at least these four steps.

    For combinational circuits, follow the appropriate design steps, including a truth table and Karnaugh map in order to optimize the circuit.

  3. For the dynamic design you will create a sequential circuit that incorporates the pressure sensor and flexible programming for the traffic light. The traffic light should follow this sequence:

    Traffic light specification with pressure sensor

    State

    Time

    NS Red

    EW Red

    2 clock cycles

    NS Green

    EW Red

    At least L1 seconds, but not more than L2 seconds.

    NS Yellow

    EW Red

    4 seconds

    NS Red

    EW Red

    2 clock cycles

    NS Red

    EW Green

    At least L1 seconds, but not more than L2 seconds.

    NS Red

    EW Yellow

    4 seconds

    L1 and L2 should be macros in your VHDL code to make them easy to modify. They should be in the range of 10 to 25, and L1 < L2. For demonstration purposes, use 10 and 15 as the defaults for L1 and L2, respectively.

    For this second task, you will find that either developing it as a single state machine, or viewing the timer as the clock to a second state machine will make the design more tractable.

  4. Extensions:

If you follow the above steps, you will have the majority of your writeup for this lab completed. Clarity in your writeups is essential. Convey what you have done in a clear and concise manner, and in sufficient detail that someone else could replicate your work.

In addition to the design steps mentioned above, your lab writeup should include the following: