集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 959|回复: 0

quartus VHDL语言仿真问题

[复制链接]
wdoos 发表于 2012-11-3 16:26:11 | 显示全部楼层 |阅读模式
library ieee;


use ieee.std_logic_1164.all;

use ieee.std_logic_arith.all;

use ieee.std_logic_unsigned.all;



entity vhdlfinal is


  port(clk,en:in std_logic;

       con:buffer std_logic);

end vhdlfinal;



architecture one of vhdlfinal issignal q:std_logic_vector(5 downto 0);

begin


process(clk,en)

begin

if en='1' then

  if clk'event and clk='1' then q<=q+1;

  end if;

elsif en='0' then

  if (q<5 or q>7) then q<=(others=>'0');

  elsif q=6 then con<=not con;

                      q<=(others=>'0');

  elsif q=7 then con<=not con;

                      q<=(others=>'0');

  else q<=(others=>'0');

  end if;

end if;

end process;

end one;







仿真结果如图所示,我想实现的功能是,在en为1时对时钟进行计数,当en为0时结束并判断计数值决定con是否反转,图中第一段脉冲为6,第二段为7,第三段为9,con在第一段结束时发生反转,功能正常,但是在第二段为7时,con却反转多次,请问这是为什么?还有,我还尝试过(q<8 and q>5)这样的条件,结果相同

本帖子中包含更多资源

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

x
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

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

QQ|小黑屋|手机版|Archiver|fpga论坛|fpga设计论坛 ( 京ICP备20003123号-1 )

GMT+8, 2025-6-26 16:35 , Processed in 0.160410 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表