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

📄 counter3.vhd

📁 CPLDFPGA嵌入式应用开发技术白金手册
💻 VHD
字号:
--counter3 
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;
entity counter3 is
 port(clk,clr:in std_logic;
      bcd:out std_logic_vector(1 downto 0));
end counter3;

architecture rtl of counter3 is
 signal bcdn:std_logic_vector(1 downto 0):="01";--the initial value
  begin
 bcd<=bcdn;
   process(clk)
    begin
  if(clr='0') then
    bcdn<="01";
    else 
      if(clk'event and clk='0') then
       if(bcdn="11") then
        bcdn<="01";
        else
        bcdn<=bcdn+1;
        end if;
       end if;
  end if;
   end process;
 end rtl;

⌨️ 快捷键说明

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