README.md

Caravel User Project

License UPRJ_CI Caravel Build

:exclamation: Important Note

Project - Traffic Signal Controller

Team Members:

Andrew Mitchell - amitch27@nd.edu

Zach Vincent - zvincent@nd.edu

Daniel Yu - dyu4@nd.edu

CSE 30342 - Digital Integrated Circuits - University of Notre Dame

Description

This project lays out a processor that acts as a traffic controller, deciding the traffic signals at a 4-way intersection. It takes in 4 1-bit inputs (named the cardinal directions n, e, s, w) representing the presence of a car at each of the four streets. It then determines what color the street lights should be, and outputs an 8-bit number representing the state of the lights with 2 bits for each direction. 00 represents a red light, 01 represents a yellow light, and 10 represents a green light. For example, the output 00100010 would represent green lights in the east and west directions. The chip is programmed only to change the lights when there are cars waiting at the cross street. If there are no cars with a red light at the intersection, the light will stay green in the current direction. When signals need to switch, the green and yellow lights employ a minimum wait time so that the lights are guaranteed to stay the same for a certain number of clock cycles before allowing input changes to affect the state.

Inputs

Inputs are 4 single bit inputs representing cars at a four-way intersection in the order NESW.

1001: cars at north and west entrances.

0101: cars at east and west entrances.

Outputs

The output is an 8-bit string representing the intersection lights, with 2 bits representing the state of each light in the same NESW order.

00: red light

01: yellow light

10: green light

Example output of 00100010 means that the east and west lights are green.

Internal function

The chip models a six-state FSM. The states are START, SET_NS, SET_EW, RED, YELLOW, and GREEN.

START: goes to SET_NS or SET_EW depending on car presence at each entrance of the intersection.

SET_NS: sets the north-south lights to green. Moves to GREEN state.

SET_EW: sets the east-west lights to green. Moves to GREEN state.

GREEN: sets output to represent green lights at appropriate locations. Loops back on itself if its associated timer has not run out or if there are no cars at other intersection entrances. Goes to YELLOW.

YELLOW: sets lights to yellow and waits for a set number of clock cycles. Goes to RED.

RED: sets lights to red and waits for a set number of clock cycles. Goes to SET_NS or SET_EW depending on presence of cars at intersection locations.