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

📄 saomiao.txt

📁 最简便的交通灯控制源代码 适合VHDL初学者 十字路口红绿灯控制
💻 TXT
字号:
library ieee;
use ieee.std_logic_1164.all;

entity saomiao is 
   port(clk:in std_logic;
        d3,d2,d1,d0:in std_logic_vector(3 downto 0);
        q:out std_logic_vector(3 downto 0);
        xuantong:out std_logic_vector(3 downto 0));
end;

architecture a of saomiao is
type st is(st0,st1,st2,st3);
signal m:st;
begin
process(clk)
begin
 if clk'event and clk='1' then
   case m is
       when st0=>q<=d3;xuantong<="0111";m<=st1;
       when st1=>q<=d2;xuantong<="1011";m<=st2;
       when st2=>q<=d1;xuantong<="1101";m<=st3;
       when st3=>q<=d0;xuantong<="1110";m<=st0;
       when others=>null;
    end case;
  end if;
end process;
end;

⌨️ 快捷键说明

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