Given below code is design code for Traffic Light Controller using Finite State Machine(FSM). In this clk and rst_a are two input signal and n_lights, s_lights, e_lights and w_lights are 3 bit output signal. In output signal, "001" represents Green light, "010" represents Yellow light and "100" represents Red light. On the reset signal, design will enter into north state and start giving output after reset will go low. Design will turn on Green light for eight clock cycles and Yellow light for four clock cycles. Design will start with north, then goes into south, then east and finally into west and by this it will keep going.
Sr. No.
|
Name of the Pin
|
Direction
|
Width
|
Description
|
1
|
n_lights
|
Output
|
3
|
North Lights
(001 = Green, 010 = Yellow, 100 = Red) |
2
|
s_lights
|
Output
|
3
|
South Lights
(001 = Green, 010 = Yellow, 100 = Red) |
3
|
e_lights
|
Output
|
3
|
Eight Lights
(001 = Green, 010 = Yellow, 100 = Red) |
4
|
w_lights
|
Output
|
3
|
West Lights
(001 = Green, 010 = Yellow, 100 = Red) |
5 | clk | Input | 1 | Clock Signal |
6
|
Rst_a
|
Input
|
1
|
Reset Signal
|