TRAFFIC_MUX.VHD
上传用户:dgjihui88
上传日期:2013-07-23
资源大小:43k
文件大小:1k
源码类别:
VHDL/FPGA/Verilog
开发平台:
MultiPlatform
- LIBRARY IEEE;
- USE IEEE.std_logic_1164.all;
- USE IEEE.std_logic_unsigned.all;
- USE IEEE.std_logic_arith.all;
- entity traffic_mux is
- port(reset: in std_logic;
- clk:in std_logic;
- ena_scan:in std_logic;
- recount:in std_logic;
- sign_state: in std_logic_vector(1 downto 0);
- load: out std_logic_vector(7 downto 0));
- end;
- --define the signal_structure and flow of the device
- architecture BEHAVIOR of traffic_mux is
- CONSTANT yellow0_time: integer := 5;
- CONSTANT green0_time: integer := 20;
- CONSTANT yellow1_time: integer := 5;
- CONSTANT green1_time : integer := 20;
- begin
- load_time:process(reset,clk)
- begin
- if reset='1' then
- load<="00000000";
- elsif (clk'event and clk='1') then
- if (ena_scan='1' and recount = '1') then
- CASE sign_state IS
- WHEN "00" =>
- load <= CONV_STD_LOGIC_VECTOR(green1_time,8);
- WHEN "01" =>
- load <= CONV_STD_LOGIC_VECTOR(yellow0_time,8);
- WHEN "10" =>
- load <= CONV_STD_LOGIC_VECTOR(green0_time,8);
- WHEN OTHERS =>
- load <= CONV_STD_LOGIC_VECTOR(yellow1_time,8);
- END CASE;
- end if;
- end if;
- end process;
- end BEHAVIOR;