Traffic Light Controller FSM
📖 Scenario: You are designing a simple traffic light controller for a crossroad. The traffic light cycles through green, yellow, and red lights in a fixed order to control the traffic flow safely.
🎯 Goal: Build a Verilog module that implements a traffic light controller using a finite state machine (FSM). The FSM will cycle through three states: green, yellow, and red. Each state will last for a fixed number of clock cycles.
📋 What You'll Learn
Create a Verilog module named
traffic_light_controller with inputs clk and reset.Define three states:
GREEN, YELLOW, and RED using an enum.Use a state register to hold the current state and a counter to count clock cycles for timing.
Cycle through the states in order: GREEN → YELLOW → RED → GREEN.
Output signals
green_light, yellow_light, and red_light should be high only in their respective states.💡 Why This Matters
🌍 Real World
Traffic light controllers are used in real intersections to manage vehicle and pedestrian traffic safely and efficiently.
💼 Career
Understanding FSM design in Verilog is essential for hardware engineers working on embedded systems, digital design, and FPGA programming.
Progress0 / 4 steps