ENGR 433 -  Lab 4 2024 Spring

Name: Ian Van Horn
Email: imvanhorn1@gmail.com
Lab 4 Traffic Light Simulator


This lab's goal is to create a traffic light simulation of an FPGA

This lab requires Vivado



Week 1: Simulate traffic lights (50 points).



Figure 1: Logic table for traffic lights



Figure 1: Logic expressions and example cycle
A k map was not used, the expressions can easily be derived from looking at the logic table.


Figure 1-1: Code for traffic light simulation
Every time the clock rises the lights are assigned their state. Each case updates the input values so the next case is selected on the next countmax.



Figure 1-2: Traffic light simulation


Figure 1-3: Code to impliment traffic lights of FPGA

Video 1-1: Traffic Lights on Board
Leftmost lights in each set are red, middle is yellow, right is green.

Week 2: Rush Hour Mode  (50 points).


Figure 2-1: Rush Hour traffic light

I could not find a way to directly change cntmax. The workround is creating a second count max and a select variable. When in rush hour mode start with a normal cycle because select starts at 0. Then change select to 1 so the second cycle using cntmax2 is used.
I also upped the time difference to 4x the original because doubling it was not very clear on video.


Figure 2-1: Rush hour simulation


Conclusion: This lab provided practice in coding programs from scratch and clocked circuts