⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 traffic_mux.vhd

📁 VHDL源代码下载
💻 VHD
字号:
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;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -