count24.vhd

来自「一些很好的FPGA设计实例」· VHDL 代码 · 共 29 行

VHD
29
字号
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
USE IEEE.STD_LOGIC_ARITH.aLL;
ENTITY count24 is
PORT(carry:in std_logic;
     rst:in std_logic;
     times:out integer range 0 to 23;
     full:out std_logic);
END count24;
ARCHITECTURE arch OF count24 IS 
     signal time :integer range 0 to 23;
begin
 process (rst,carry)
 begin
   if rst='1' then time <= 0;full <= '0';
   else if rising_edge(carry)then
          if time= 23 then time<=0;
                          full<='1';
                     else time<=time+1;
                          full<='0';
          end if;
   end if;
 end process;
 times<=time;
END arch;
   

⌨️ 快捷键说明

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