微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 嵌入式设计讨论 > FPGA,CPLD和ASIC > 大家帮我看看这个2250进制计数器对不对

大家帮我看看这个2250进制计数器对不对

时间:10-02 整理:3721RD 点击:

仿真时候总是不对。


library ieee;

use ieee.std_logic_unsigned.all;

use ieee.std_logic_1164.all;

use ieee.std_logic_arith.all;

entity cnt2249 is

  port(clk,rst:in std_logic;

      q:out std_logic_vector(15 downto 0);

      );

end cnt2249;

architecture behave of cnt2249 is

signal tho,hun,ten,one:std_logic_vector(3downto 0);

begin

process(clk,rst)

begin

if rst=’1’ then tho<=”0000”;hun<=”0000”,ten<=”0000”;one<=”0000”;

elsif clk’eventand clk=’1’ then

  if tho=2 and hun=2 and ten=4 and one=9 then

tho<=”0000”;hun<=”0000”,ten<=”0000”;one<=”0000”;

elsif hun=9 and ten=9 and one=9 then

hun<=”0000”,ten<=”0000”;one<=”0000”;tho<=tho+1;

elsif ten=9 andone=9 then

      ten<=”0000”;one<=”0000”;hun<=hun+1;

elsif one=9 then

     one<=”0000”;ten<=ten+1;

else one<=one+1;

end if;

end if;

end process;

q<=tho&hun&ten&one;

end behav;

   


Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top