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

📄 led.vhd

📁 以两种结构编写的VHDL驱动LED 已通过调试
💻 VHD
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity led is
port(q:out std_logic_vector(0 to 7);
	clk:in std_logic;
	rest:in std_logic);
end led;
architecture behave of led is
constant n:integer:=1000000;
signal clk1:std_logic;
signal clk2:std_logic;
signal temp:std_logic_vector(7 downto 0);
begin
p0:process(clk)
variable count:integer range 0 to n;
	begin
		if rising_edge(clk) then
			if count=n then
				count:=0;
				clk1<=not clk1;
			else 
				count:=count+1;
			end if;
		end if;			
end process p0;
 clk2<=clk1;

p1:process(clk2,rest)
begin
if(clk2'event and clk2='1')then
    if(rest='0')then 
        temp <="00000001"; 	
    else
        temp<=temp(6 downto 0)&temp(7);
        q<=temp;
    end if;
end if;
end process p1;	
end behave;

⌨️ 快捷键说明

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