在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 1500|回复: 0

不解?

[复制链接]
发表于 2008-11-5 22:02:48 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
为什么我的不对?为什么小时个位(cp5)是零的时候不能计数,好像是清零信号,把小时位都清零了。请高手指教下!
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity counter1000000 is
    Port ( clk : in  STD_LOGIC;--时钟
           en : in  STD_LOGIC;--使能
           clr : in  STD_LOGIC;--清零
     set:in std_logic_vector(1 downto 0);--置数选择秒分时
     data:in std_logic_vector(6 downto 0);--低4位置个位,高3位置十位
     q1,q2,q3,q4,q5,q6 : out  STD_LOGIC_VECTOR (3 downto 0);--分别是秒的个位和十位、分的个十位、时的个十位
           cout : out  STD_LOGIC);--24小时溢位输出
end counter1000000;
architecture Behavioral of counter1000000 is
signal cq1,cq2,cq3,cq4,cq5,cq6:std_logic_vector(3 downto 0);
begin
process(clk,en,clr,set,cq1,cq2,cq3,cq4,cq5,cq6)
begin
if clk'event and clk='1' then
  if clr='1' then
  cq1<="0000";
  cq2<="0000";
  cq3<="0000";
  cq4<="0000";
  cq5<="0000";
  cq6<="0000";
  elsif set/="00" then
     case set is
    when "01"=>cq1<=data(3 downto 0);cq2(2 downto 0)<=data(6 downto 4);
    when "10"=>cq3<=data(3 downto 0);cq4(2 downto 0)<=data(6 downto 4);
    when "11"=>cq5<=data(3 downto 0);cq6(2 downto 0)<=data(6 downto 4);
    when others=>null;
     end case;
   elsif en='1' then
   if cq1="1001" then cq1<="0000";
    if cq2="0101" then cq2<="0000";
     if cq3="1001" then cq3<="0000";
      if cq4="0101" then cq4<="0000";
       if cq6<="0010" and cq5<="0011" then cq5<="0000";cq6<="0000";cout<='1';--应该是这的问题,但是逻辑上没有问题啊!
       elsif cq5="1001" then cq5<="0000";cq6<=cq6+1;
       else cq5<=cq5+1;
       end if;
      else cq4<=cq4+1;
      end if;
     else cq3<=cq3+1;
     end if;
    else cq2<=cq2+1;
    end if;
   else cq1<=cq1+1;
   end if;
  end if;
end if;
q1<=cq1;
q2<=cq2;
q3<=cq3;
q4<=cq4;
q5<=cq5;
q6<=cq6;
end process;
  
end Behavioral;
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条

×

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-5-7 11:11 , Processed in 0.021307 second(s), 10 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表