專注電子技術(shù)學(xué)習(xí)與研究
當(dāng)前位置:單片機(jī)教程網(wǎng) >> MCU設(shè)計(jì)實(shí)例 >> 瀏覽文章

VHDL語(yǔ)言之運(yùn)算方法的74LS290計(jì)數(shù)器

作者:佚名   來(lái)源:本站原創(chuàng)   點(diǎn)擊數(shù):  更新時(shí)間:2013年11月09日   【字體:

運(yùn)算方法編寫(xiě)的74ls290計(jì)數(shù)器:

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity CT290 is
   port(R1,R0,S1,S0,clk:in std_logic;
                 Q:out std_logic_vector(3 downto 0);
                 Co:out std_logic);
end CT290;
architecture cccp of CT290 is
   signal RR,SS:std_logic_vector(1 downto 0);
   signal QI: std_logic_vector(3 downto 0);
   signal C:std_logic;
   begin
     RR<=R1 & R0;SS<=S1 & S0;   
     process(R1,R0,S1,S0,clk,RR,SS)      
        begin
        if clk'event and clk='0' then
           if  QI<9 then  QI<= QI+1;
           else QI<="0000";
           end if;
        end if;
        if    RR="11"     then   QI<="0000";        
        end if;
        if    SS="11"    then    QI<="1001";
        end if;
        if   QI=9   then    C<='1';
        else    C<='0';
        end if;
        if   clk'event   and   clk='0'    then    Co<=C;      
        end if;
      Q<=QI;  
     end process;
end;

關(guān)閉窗口

相關(guān)文章