赞
踩
2019-01-10 回答
我这个能实现4~64分频只能是偶数!!!要给分哦。。。。
library ieee;
use ieee.std_logic_1164.all;
entity shukong is
port(t:in std_logic_vector(6 downto 0);
clk:in std_logic;
q:out std_logic);
end ;
architecture one of shukong is
signal shu:integer range 0 to 100;
signal k:std_logic;
begin
process(clk)
begin
if clk'event and clk='1' then
shu<=shu+1;
case t is
when "0000100"=>if shu<1 then q<=k;else shu<=0;k<=not k;end if;
when "0000110"=>if shu<2 then q<=k;else shu<=0;k<=not k;end if;
when "0001000"=>if shu<3 then q<=k;else shu<=0;k<=not k;end if;
when "0001010"=>if shu<4 then q<=k;else shu<=0;k<=not k;end if;
when "0001100"=>if shu<5 then q<=k;else shu<=0;k<=not k;end if;
when "0001110"=>if shu<6 then q<=k;else shu<=0;k<=not k;end if;
when "0010000"=>if shu<7 then q<=k;else shu<=0;k<=not k;end if;
when "0010010"=>if shu<8 then q<=k;else shu<=0;k<=not k;end if;
when "0010100"=>if shu<9 then q<=k;else shu<=0;k<=not k;end if;
when "0010110"=>if shu<10 then q<=k;else shu<=0;k<=not k;end if;
when "0011000"=>if shu<11 then q<=k;else shu<=0;k<=not k;end if;
when "0011010"=>if shu<12 then q<=k;else shu<=0;k<=not k;end if;
when "0011100"=>if shu<13 then q<=k;else shu<=0;k<=not k;end if;
when "0011110"=>if shu<14 then q<=k;else shu<=0;k<=not k;end if;
when "0100000"=>if shu<15 then q<=k;else shu<=0;k<=not k;end if;
when "0100010"=>if shu<16 then q<=k;else shu<=0;k<=not k;end if;
when "0100100"=>if shu<17 then q<=k;else shu<=0;k<=not k;end if;
when "0100110"=>if shu<18 then q<=k;else shu<=0;k<=not k;end if;
when "0101000"=>if shu<19 then q<=k;else shu<=0;k<=not k;end if;
when "0101010"=>if shu<20 then q<=k;else shu<=0;k<=not k;end if;
when "0101100"=>if shu<21 then q<=k;else shu<=0;k<=not k;end if;
when "0101110"=>if shu<22 then q<=k;else shu<=0;k<=not k;end if;
when "0110000"=>if shu<23 then q<=k;else shu<=0;k<=not k;end if;
when "0110010"=>if shu<24 then q<=k;else shu<=0;k<=not k;end if;
when "0110100"=>if shu<25 then q<=k;else shu<=0;k<=not k;end if;
when "0110110"=>if shu<16 then q<=k;else shu<=0;k<=not k;end if;
when "0111000"=>if shu<27 then q<=k;else shu<=0;k<=not k;end if;
when "0111010"=>if shu<28 then q<=k;else shu<=0;k<=not k;end if;
when "0111100"=>if shu<29 then q<=k;else shu<=0;k<=not k;end if;
when "0111110"=>if shu<30 then q<=k;else shu<=0;k<=not k;end if;
when "1000000"=>if shu<31 then q<=k;else shu<=0;k<=not k;end if;
when others =>null;
end case;
end if;
end process;
end ;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。