|
发表于 2012-12-11 18:44:41
|
显示全部楼层
楼至,好像wait不能被综合,你的具体条件是什么?
在ck上升沿检测kz?发现kz变法就让灯闪烁十下?
下面是我写的,不知对不对,以前学过一段时间,现在忘了很多,可能语法不对。
我感觉我把问题复杂化了,写了这么多代码
process(CK,RST)
begin
if (RST =1) then
kz_d0 <= '0';
elsif (CK'event and CK = '1') then
kz_d0 <= kz;
end if;
end process;
process(CK,RST)
begin
if (RST =1) then
s <= '0';
elsif (CK'event and CK = '1') then
if (kz != kz_d0) then --kz变化
s <= '1';
else
s <= '0';
end if;
end if;
end process;
process(CK,RST)
begin
if (RST =1) then
count <= '0'; --定义为0~8的整数信号
elsif (CK'event and CK = '1') then
if (s = '1')
if (count = 8) then
count <= 0;
else
count <= count + '1';
end if;
else
count <= '0';
end if;
end if;
end process;
process(CK,RST)
begin
if (RST =1) then
y <= '0';
elsif (CK'event and CK = '1') then
if (count != 0) then
y <= y + '1'; --y,二进制,01交替变化
else
y <= '0';
end if;
end if;
end process; |
|