|
楼主 |
发表于 2010-6-11 13:10:54
|
显示全部楼层
前面帖的代码在网络上很常见,其他人在综合的时候不知道有没出现这个问题。我修改了下程序结构就OK了。折腾了俩礼拜,不过还是有所收获。
===============================================================================
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity deask2 is
port(clk,x:in std_logic;
y:out std_logic);
end deask2;
architecture one of deask2 is
signal q:integer range 0 to 11;
signal xx:std_logic;
signal m:integer range 0 to 8;
begin
xx<=x;
process(clk,q)
begin
if clk'event and clk='1' then
if q=11 then q<=0;
else q<=q+1;
end if;
end if;
end process;
process(clk,xx,q,m)
begin
if clk'event and clk='1' then
if q=10 then
if m<=7 then y<='0';
else
y<='1';
end if;
end if;
end if;
end process;
process(xx,m,q)
begin
if q=11 then m<=0;
elsif xx'event and xx='1' then m<=m+1;
end if;
end process;
end one;
码片长设为12个时钟周期。 |
|