s10.vhd

来自「VHDL电子抢答器的实现。有多个文件」· VHDL 代码 · 共 43 行

VHD
43
字号
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity s10 is
port
(  en      : in  std_logic;
  eq       : in std_logic;
  clk      : in std_logic;
alarm      : out std_logic;
   h       : out std_logic_vector( 3 downto 0 );
   l       : out std_logic_vector( 3 downto 0 )
);
end s10;
architecture b of s10 is
begin
 process (clk, eq,en)
 variable dw:std_logic_vector(3 downto 0);
begin
 	if clk'event and clk='1' then
		if eq='1'then
			if en='1'then
				if dw=0  then
					alarm<='1';
				else
					dw:=dw-1;
				end if;
			else
				alarm<='0';
				dw:="1001";
			end if;
		else
			alarm<='0';
			dw:="0000";
		end if;
	end if;
	h<="0000";
	l<=dw;
 end process;
end b;



⌨️ 快捷键说明

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