求助,功能仿真是对的,时序仿真是错的
本人用VHDL语言编写任意整数分频器,为什么功能仿真的时候能完全正确而时序仿真的时候却是错的,找不到原因啊! library ieee;use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity clk_d is
generic(N:integer:=5);
port(
clk:in std_logic;
clk_out:buffer std_logic;
count11:out integer;
tem: out std_logic);
end clk_d;
architecture example of clk_d is
signal count1,count2:integer:=0;
signal temp:std_logic;
begin
process(clk)
begin
if clk'event and clk='1' then
if count1=N-1 then
count1<=0;
else
count1<=count1+1;
end if;
end if;
count11<=count1;
end process;
process(clk)
begin
if clk'event and clk='0' then
if count2=N-1 then
count2<=0;
else
count2<=count2+1;
end if;
end if;
end process;
process(count1,count2)
begin
if((N rem 2)=1) then
if count1=1 then
if count2=0 then
temp<='1';
else
temp<='0';
end if;
elsif count1=(N+1)/2 then
if count2=(N+1)/2 then
temp<='1';
else
temp<='0';
end if;
else
temp<='0';
end if;
else
if count1=1 then
temp<='1';
elsif(count1=(N/2+1)) THEN
temp<='1';
else
temp<='0';
end if;
end if;
end process;
process(temp,clk)
begin
if((N/=2)AND(N/=1)) then
if temp'event and temp='1' then
clk_out<=not clk_out;
end if;
elsif(N=2) then
if(clk'event and clk='1')then
clk_out<=not clk_out;
end if;
else clk_out<=clk;
end if;
tem<=temp;
end process;
end example;
这是源程序... 用Quartus II仿真的 我也是初学者哦,刚才运行了一下也不对。后来把模块儿的名字改为clk_d就对了。这里的要求是模块儿名字和什么什么名字要一样,反正改完就可以编译成功了,只是有几个警告。 刚才运行了一下也不对。后来把模块儿的名字改为clk_d就对了。这里的要求是模块儿名字和什么什么名字要一样,反正改完就可以编译成功了,只是有几个警告。
页:
[1]