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

📄 counter104.vhd

📁 采用VHDL语言设计了一个打铃系统。该系统已经调试
💻 VHD
字号:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity counter104 is
    Port ( set,rd : in std_logic;
           clk : in std_logic;
           x : in std_logic_vector(3 downto 0);
           y : out std_logic_vector(3 downto 0);
           c,k : out std_logic);
end counter104;

architecture Behavioral of counter104 is

 begin
  process(set,clk,x,rd)
   variable cnt:std_logic_vector(3 downto 0);
 begin
    if rd='1' then cnt:="0000";y<="0000";c<='0';k<='0';
    elsif set='0' then 
            cnt:=x;
            y<=cnt;c<='0';k<='0';

    elsif clk'event and clk='1' then

           if cnt="1001" then
            cnt:="0000";y<=cnt;c<='1';k<='0';
           elsif cnt="0011" then cnt:=cnt+1;y<=cnt;c<='0';k<='1';
           else cnt:=cnt+1;y<=cnt;c<='0';k<='0';
           end if;
    end if;
 end process;
end Behavioral;

⌨️ 快捷键说明

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