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

📄 updnloen.vhd

📁 VHDL子程序集,包括各种例程资料以及源码.
💻 VHD
字号:
--*************************************
--* 8 Bit UP DOWN LOAD ENABLE Counter *
--*       Filename : UPDNLOEN         *
--*************************************
    
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;

entity updnloen is
    port (
          CLK:      in STD_LOGIC;
          CLEAR:    in STD_LOGIC;
          ENABLE:   in STD_LOGIC; 
          LOAD:     in STD_LOGIC;
          UP_DOWN : in STD_LOGIC;
          DIN:      in STD_LOGIC_VECTOR (7 downto 0); 
          Q:        inout STD_LOGIC_VECTOR (7 downto 0)
         );
end updnloen;

architecture updnloen_arch of updnloen is

begin
process (CLK,CLEAR)
    
begin
    if CLEAR = '0' then
       Q <= "00000000";
    elsif CLK'event and CLK = '1' then
       if LOAD ='1' then
          Q <= DIN;
       else
          if ENABLE = '1' then   
             if UP_DOWN = '1' THEN 
	        Q <= Q + 1;
             else
	        Q <= Q - 1;
             end if;  
          end if;
       end if;  
    end if;  
end process;

end updnloen_arch;

⌨️ 快捷键说明

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