Overview
A hardware design for a two-way intersection, built from simulation through to a bitstream running on a real board. Each direction's light is shown on an on-board RGB LED, with blue standing in for yellow, and the duration of each color is configurable.
I wrote it to get hands-on with the full FPGA flow: describing logic in HDL, verifying it in simulation, closing timing, and checking the result on hardware.
Resources
How it works
- A six-state Moore FSM sequences the intersection, so each light's output depends only on the current state.
- A counter divides the 100 MHz board clock into one-second pulses, and the FSM advances when a state's configured duration has elapsed.
- A heartbeat LED shows the design is clocking, and
BTN0resets the controller.
Verification and results
- Simulation: a behavioral SystemVerilog testbench in Vivado, with state transitions checked in the waveform.
- Hardware: programmed onto the Arty A7 and checked visually, including the light sequence and the reset button.
| Metric | Result |
|---|---|
| Target clock | 100 MHz |
| LUTs | 22 |
| Flip-flops | 45 |
| Worst setup slack | 5.950 ns |
| Worst hold slack | 0.176 ns |
Building it
- Create a Vivado RTL project for the part
xc7a100tcsg324-1. - Add
src/top.svandsrc/traffic_controller.svas design sources, withtop.svas the top module. - Add
constraints/arty.xdc, and setsim/tb_traffic.svas the simulation top. - Run a behavioral simulation, then synthesize, implement, and generate the bitstream.
- Connect the board over micro-USB and program it from the Hardware Manager.