用VHDL编写的计数器,能通过语法检测,但不可以综合,哪里出错了?
收藏:
0
点赞数:
0
评论数:
0
1个回答

oh my god!你连用了三个时钟上升沿,难怪会说你bad synchronous description.

程序改正如下:

Library ieee;

Use ieee.std_logic_1164.all;

USE IEEE.STD_LOGIC_UNSIGNED.ALL;

use IEEE.STD_LOGIC_ARITH.ALL;

Entity counter is

port(clk ,cw,increment,reset:in std_logic;

led :out std_logic_vector (7 downto 0) );

End counter;

Architecture art of counter is注意这里结构体名最好不要与实体名一致

Begin

Process(clk ,cw,increment,reset)

Variable i :std_logic_vector (7 downto 0);

Begin

If reset='1' then --复位不能用其上升沿,直接=1就可以了

i := "00000000";

elsIf(clk'event and clk = '1') then

If(increment = '1') then--这个使能位也一样,

If(cw = '1') then

i := i + 1;

elsIf(cw = '0') then

i := i - 1;

End if;

Else null;

End if;

End if;

led

点赞数:
0
评论数:
0
关注公众号
一起学习,一起涨知识