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

📄 4位10进制计数器vhdl程序.txt

📁 这是老师给但计数器程序
💻 TXT
字号:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity counter is
   Port ( clk : in std_logic;
          reset : in std_logic;
          updn : in std_logic;
          q0,q1,q2,q3: out std_logic;
          q : out std_logic_vector(3 downto 0)
         );
end counter;
architecture Behavioral of counter is
   signal qn : std_logic_vector(3 downto 0);
begin
q0 <= qn(0);
q1 <= qn(1);
q2 <= qn(2);
q3 <= qn(3);
process(clk,reset,updn)
begin
if (reset='1') then
qn <= (others=>'0');
 elsif (clk'event and clk='1')then
  if (updn='1') then
     if (qn=9) then
        qn<="0000";
     else
        qn <= qn+1;
     end if;
  else
     if (qn=0) then
       qn<="1001";
     else
        qn <= qn-1;
     end if;
  end if;
end if;
end process;
q<=qn;
end Behavioral;

⌨️ 快捷键说明

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