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

📄 jishuqi.vhd

📁 CPLD器件中常用编程
💻 VHD
字号:
library ieee;
use ieee.std_logic_1164.all;
use  ieee.std_logic_unsigned.all;
  entity jishuqi is
    port (
            clk : in std_logic;
             en : in std_logic;
             clr: in std_logic;  
              q :out std_logic_vector(7 downto 0);
              c : out std_logic
           );
  end jishuqi; 

architecture a of jishuqi is
    signal qa:std_logic_vector(3 downto 0);
    signal qb:std_logic_vector(3 downto 0);
    signal cy:std_logic;
 begin 
  process(clk,en,clr)
    begin
      if clr='0' then
        qa<="0000";    
      elsif ( clk'event and clk='1') then
       if en='1' then
        if (qa=9) or (qa=5 and qb=1) then
          qa<="0000";
          cy<='0';
         elsif qa=8 then
          qa<=qa+1;
          cy<='1';
         else
          qa<=qa+1;
          cy<='0';
         end if;
        end if;
      end if;
    end process;
   
  process(en,clk,cy,clr)
     begin
       if clr='0' then
        qb<="0000";   
       elsif ( clk'event and clk='1') then
         if en='1' then
           if (qa=5 and qb=1) then
             qb<="0000";
              c<='1';
         elsif cy='1' then
           qb<=qb+1;
           c<='0';
         else 
           c<='0';
         end if;
      end if;
     end if;
 end process;

 q(7 downto 4)<=qb;
 q(3 downto 0)<=qa;

end a;

/*******************************************************************************************************************************************************************************************************************************************************************************************************************************************************
CPLD器件中常用编程,对于多进程做了很好的处理,能实现0到59计数,还可自己根据需要调整,实现多种计数功能,从而实现时分秒计时器的功能
********************************************************************************************************************************************************************************************************************************************************************************************************************************************************
*/

⌨️ 快捷键说明

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