| |
[求助]关于在ise(Project Navigator v5.1)中的编程问... |
|
|
| 出处:综合电子论坛 时间: 2005-01-13 |
|
风之子 发布于 2005-1-13 0:30:00
[求助]关于在ise(Project Navigator v5.1)中的编程问题 要求设计一个2.5分频的分频器,我用vhdl编的代码在quartus2 4.0中编译通过,波形正确,但是把程序放到Project Navigator v5.1中运行时,功能仿真就不能通过,请问各位大虾,这是什么原因,原代码如下:
library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity counter is port(clk,reset,en:in std_logic; --输入:clk=100MHz,en 使能信号 clk_out,Q:buffer std_logic); --输出:clk_out=40MHz,Q=20MHz end counter; architecture behavior of counter is signal count:std_logic_vector(1 downto 0); signal clk_in:std_logic; begin clk_in<=clk xor Q; process(clk_in,reset) --三分频器; begin if reset='1' then count<="00"; else if(clk_in 'event and clk_in='1')then if(en='1')then if(count="10")then count<="00"; clk_out<='1'; else count<=count+1; clk_out<='0'; end if; end if; end if; end if; end process; process(clk_out) --D触发器 begin if(clk_out'event and clk_out='1')then Q<=not Q; end if; end process; end behavior;
风之子 发布于 2005-1-13 9:12:00
问的简单一点,好像在ise中做反馈和在QUARTUS中做反馈不一样,但是具体不同在哪里,我不知道,还请各位大虾指点!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 风之子 发布于 2005-1-13 9:55:00
是不是很简单,所以大家不回答呀?? 风之子 发布于 2005-1-13 10:12:00
还是我自己来回答吧,我在很偶然的情况下将代码改成下面的形式,在ise中功能仿真和时序仿真就都对了,不知道为什么要这么改,但是我改对了,贴出来,希望以后的人少走弯路! library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity counter is port(clk,reset,en:in std_logic; --输入:clk=100MHz,en 使能信号 clk_out,Q:inout std_logic); --输出:clk_out=40MHz,Q=20MHz end counter; architecture behavior of counter is signal count:std_logic_vector(1 downto 0); signal clk_in:std_logic; signal i:std_logic; begin process(clk,i) begin if( i='1')then clk_in<=not clk; else clk_in<=clk; end if; end process; process(clk_in,reset) --三分频器; begin if reset='1' then count<="00"; else if(clk_in 'event and clk_in='1')then if(en='1')then if(count="10")then count<="00"; clk_out<='1'; else count<=count+1; clk_out<='0'; end if; end if; end if; end if; end process; process(clk_out) --D触发器 begin if(clk_out'event and clk_out='1')then --Q<=not Q; if Q='1' then Q<='0';i<='0'; else Q<='1';i<='1';end if; end if; end process; end behavior; |
| 【关闭】 【打印】 |
|
|
|
|