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

📄 traffic_light.vhd

📁 一个交通灯的vhdl语言实现 用 VC的  1.在指定的文件夹内查找某个文件      2.获取系统文件夹的路径
💻 VHD
字号:
library ieee;
use ieee.std_logic_1164.all;

entity traffic_light is
port(x,y,clk: in std_logic;
     z:out  std_logic);
end traffic_light;

architecture arc of traffic_light is 
type state_type is(a,b,c,d);
signal present_state,next_state:state_type;
signal comb: std_logic_vector(1 downto 0);
begin 
  nextstate_logic: 
process(present_state,x,y)
  begin 
    comb<=x&y;
    case present_state is
      when a => if(comb="00")then
                 next_state<=a;
               elsif(comb="01" or comb="10") then
                 next_state<=b;
               end if;
      when b => if(comb="00")then
                 next_state<=c;
               elsif(comb="01" or comb="10") then
                 next_state<=b;
               end if;
      when c => if(comb="00")then
                 next_state<=c;
               elsif(comb="01" or comb="10") then
                 next_state<=d;
               end if;
      when d => if(comb="00")then
                 next_state<=a;
               elsif(comb="01" or comb="10") then
                 next_state<=d;
               end if;
   end case;
 end process;
 
state_register:
process(clk)
  begin
    if(clk'event and clk='1')then
       present_state<=next_state;
    end if;
end process;

output_logic:
process(present_state)
begin
  case present_state is 
    when a=> z<='0';
    when others => z<='1';
  end case;
end process;
end arc;

⌨️ 快捷键说明

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