This project was developed as part of the course IEE2713-1: Digital Systems at Pontificia Universidad Católica de Chile, under the guidance of Prof. Cristian Tejos.
It implements a finite state machine (FSM) combined with a counter to simulate the operation of a traffic light controller for two perpendicular streets: Street A and Street B.
The FSM starts from Street A in green after reset.
clk
) and assert reset (rst_n = 0 → 1
).ui_in[0]
→ TA (car sensor Street A)ui_in[1]
→ TB (car sensor Street B)ui_in[2]
→ P (parade mode button)ui_in[3]
→ R (reset parade mode button)uo_out[1:0]
→ LA (traffic light Street A: 00=Red, 01=Yellow, 10=Green)uo_out[3:2]
→ LB (traffic light Street B: 00=Red, 01=Yellow, 10=Green)uo_out[4]
→ on
(counter finished flag, active during yellow phase).You can run the simulation using cocotb and make SIM=icarus
or test directly on FPGA with buttons and LEDs.
---Refer to the image in the img folder to view the state machine diagram.
# | Input | Output | Bidirectional |
---|---|---|---|
0 | clk | LA_0 | |
1 | rst | LA_1 | |
2 | TA | LB_0 | |
3 | TB | LB_1 | |
4 | P | on | |
5 | R | ||
6 | |||
7 |