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

📄 cont60.vhd

📁 用 VHDL语言实现闹钟功能
💻 VHD
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity cont60 is
  port(ci     :in   std_logic;
       nreset :in   std_logic;
       load   :in   std_logic;
       d      :in   std_logic_vector(7 downto 0);
       clk    :in   std_logic;
       co     :out  std_logic;
       ql     :buffer  std_logic_vector(3 downto 0);
       qh     :buffer  std_logic_vector(3 downto 0));
end cont60;

architecture behave of cont60 is
begin
  co<='1'when(qh="0101" and ql="1001" and ci='1') else '0';

    process(clk,nreset)
          begin 
              if(nreset='0') then
                            qh<="0000";
                            ql<="0000";
                 elsif(clk'event and clk='1') then
                    if(load='1') then
                        qh<=d(7 downto 4);
                        ql<=d(3 downto 0);
                      elsif(ci='1') then
                       if(ql=9)  then
                          ql<="0000";
                          if(qh=5) then
                            qh<="0000";
                          else qh<=qh+1;
                          end if;
                        else
                            ql<=ql+1;
                       end if;
                     end if;
               end if;
       end process;
end behave;
             

⌨️ 快捷键说明

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