Traffic Light Controller with Pedestrian Request
Design a traffic light controller with a pedestrian crossing request that is honoured at the next safe point rather than immediately.
Constraints
- Main road states: green, yellow, red.
- A pedestrian request latches and is served after the current green expires.
- Green lasts 30 ticks, yellow 5, pedestrian walk 15.
- The request must not extend or shorten the yellow phase.
- Clear the latched request when the walk phase starts.
- Use an enumerated state type.
1library ieee;2use ieee.std_logic_1164.all;3use ieee.numeric_std.all;4 5entity traffic is6 port (7 clk : in std_logic;8 rst : in std_logic;9 ped_req : in std_logic;10 light : out std_logic_vector(2 downto 0);11 walk : out std_logic12 );13end traffic;