集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 1686|回复: 4

求助,功能仿真是对的,时序仿真是错的

[复制链接]
windprayer 发表于 2011-1-20 15:50:12 | 显示全部楼层 |阅读模式
本人用VHDL语言编写任意整数分频器,为什么功能仿真的时候能完全正确而时序仿真的时候却是错的,找不到原因啊!
 楼主| windprayer 发表于 2011-1-20 15:52:44 | 显示全部楼层
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;
count11ut 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;
这是源程序...
 楼主| windprayer 发表于 2011-1-20 15:54:04 | 显示全部楼层
用Quartus II仿真的
conganguo 发表于 2011-3-4 16:56:17 | 显示全部楼层
我也是初学者哦,刚才运行了一下也不对。后来把模块儿的名字改为clk_d就对了。这里的要求是模块儿名字和什么什么名字要一样,反正改完就可以编译成功了,只是有几个警告。
Sunlife 发表于 2015-4-8 15:20:14 | 显示全部楼层
刚才运行了一下也不对。后来把模块儿的名字改为clk_d就对了。这里的要求是模块儿名字和什么什么名字要一样,反正改完就可以编译成功了,只是有几个警告。
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

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

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

GMT+8, 2025-5-6 22:02 , Processed in 0.062193 second(s), 20 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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