Build a timer-driven traffic light controller with three states: Red, Green, and Yellow. Each state holds for a fixed number of clock cycles before advancing to the next state, then wraps back to Red.
Interface
| Signal | Direction | Width | Description |
|---|---|---|---|
clk |
input | 1 | Clock, rising-edge triggered |
reset |
input | 1 | Synchronous reset to the Red state |
light |
output | 2 | 00 = Red, 01 = Green, 10 = Yellow |
Timing
| State | Encoding | Duration (clock cycles) |
|---|---|---|
| Red | 00 |
4 |
| Green | 01 |
3 |
| Yellow | 10 |
2 |
After reset, the controller starts in Red with a fresh timer. The sequence then repeats forever: Red (4 cycles) -> Green (3 cycles) -> Yellow (2 cycles) -> Red (4 cycles) -> …