loveff 发表于 2012-10-26 13:27:24

求大神指正!!!!

大家请看一下我的对时钟信号clkc和输入c的判断,判断c放置于判断clkc之前,这样将程序烧入芯片中会有什么问题么?
ps:在modelsim中仿真波形都没问题

--****************************************************************************
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity filter is
        port(        delayc,c,clkc: in std_logic;
                           fc : out std_logic);
end entity;
architecture behav of filteris
    constant N:integer:=79;
                signal countb1,countb2: integer range 0 to N+1;
                signal fc1:std_logic;
begin
        process(delayc,clkc,c)
                begin
                        if(delayc ='0')then
                                countb1<=0;       
                        elsif(c='1') then
                                        if(rising_edge(clkc))then
                                                if(countb1<=N) then
                                                  countb1<=countb1+1;
                                                else
                                                  countb1<=countb1;
                                                end if;
                                        end if;
                   else
                countb1<=0;               
                        end if;
                end process;
       

        process(delayc,clkc,c)
                begin
                        if(delayc ='0')then
                                countb2<=0;       
                        elsif(c='0') then
                                        if(rising_edge(clkc))then
                                                if(countb2<=N) then
                                                  countb2<=countb2+1;
                                                else
                                                  countb2<=countb2;
                                                end if;
                                        end if;
                   else
                countb2<=0;               
                        end if;
        end process;
               
        process(delayc,clkc)
                begin
                        if(delayc ='0')then       
                                fc1<='0';
                                fc<='0';
                        elsif (rising_edge(clkc)) then
                                if(countb1>=N) then
                                        fc1<='1';
                                elsif(countb2>=N) then
                                        fc1<='0';
                                else
                                        fc1<=fc1;
                                end if;
                        end if;
                                fc<=fc1;       
        end process;

end behav;

--****************************************************************************

NJ8888 发表于 2012-10-27 07:45:53

相当门控时钟,当CLK不用作其他与本模块相关联模块,没有问题。不过为何要别出心裁?本来CLK是来自全局,你现在串入逻辑。

loveff 发表于 2012-11-6 17:14:56

NJ8888 发表于 2012-10-27 07:45 static/image/common/back.gif
相当门控时钟,当CLK不用作其他与本模块相关联模块,没有问题。不过为何要别出心裁?本来CLK是来自全局,你 ...

之所以这样是因为在modelsim中仿真修改前的程序时,总会出现这样的情况:输入跳变与clk的上升沿很靠近时会引起输出发生红色的未知。所以迫不得已这样做了
页: [1]
查看完整版本: 求大神指正!!!!