24jinzhijiajianjishuqi.txt

来自「包内共有六个源代码」· 文本 代码 · 共 39 行

TXT
39
字号
library ieee;
use ieee.std_logic_1164.all;
entity count_and_cnt24_18 is
port(s:in std_logic;
     cr:out std_logic;
     co:out std_logic;
     clr:in std_logic;
     clk:in std_logic;
     cnt:buffer integer range 23 downto 0);
end count_and_cnt24_18;
architecture jiegou of count_and_cnt24_18 is
begin
process(s,clr,clk)
  begin
   if s='0' then
     if clr='0' then cnt<=0;
     elsif clk'event and clk='1' then
      if(cnt=23)then
       cnt<=0;
       co<='1';
      else
       cnt<=cnt+1;
       co<='0';
      end if;
     end if;
   else 
       if clr='0' then cnt<=23;
       elsif clk'event and clk='1' then
        if(cnt=0)then
          cnt<=23;
          cr<='1';
        else
          cnt<=cnt-1;
          cr<='0';
        end if;
       end if;
   end if;
  end process;
end jiegou;

⌨️ 快捷键说明

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