高分求解简单问题

[复制链接]
2385|2
 楼主| entepino 发表于 2013-2-28 21:13 | 显示全部楼层 |阅读模式
   IF EnPulse = '0'   THEN
                        CntINPulse    <= 0;
                        EnOutput      <= '0';
                        PulseCNTStart <= '0';
          ELSIF (PulseIN 'EVENT AND PulseIN = '1') THEN
             
                    if CntINPulse = 1                 then                           
                       PulseCNTStart <= '1';
                    elsif CntINPulse = 11        then
                   CntINPulse<= 0;
                        PulseCNTStart <= '0';
                   else
                           CntINPulse<=CntINPulse+1;                                                      
                   end if;   
         end if;  
为啥加上  if CntINPulse = 1就不好使?这样就好使了,就出现了在第11个脉冲处出现CntINPulse拉低,在起始处CntINPulse 变高:为何加上if CntINPulse = 1后CntINPulse就变成全高了?
     IF EnPulse = '0'   THEN
                        CntINPulse    <= 0;
                        EnOutput      <= '0';
                        PulseCNTStart <= '0';
          ELSIF (PulseIN 'EVENT AND PulseIN = '1') THEN      
                                      
                       PulseCNTStart <= '1';
                    if CntINPulse = 11        then
                   CntINPulse<= 0;
                        PulseCNTStart <= '0';
                   else
                           CntINPulse<=CntINPulse+1;                                                      
                   end if;   
1003704680 发表于 2013-2-28 22:28 | 显示全部楼层
if CntINPulse = 1                 then                           
                        PulseCNTStart <= '1';
后面再加上
CntINPulse<=CntINPulse+1;  
就好使了;
因为你当CntINPulse= 1之后就一直等于1,不再加了。后面的东西都不再有效了。
ifpga 发表于 2013-2-28 22:39 | 显示全部楼层
对VHDL不熟
但是你这样写代码是不是有问题啊?
if 里是电平触发
elseif 里又变成沿触发
???
您需要登录后才可以回帖 登录 | 注册

本版积分规则

223

主题

675

帖子

2

粉丝
快速回复 在线客服 返回列表 返回顶部
0