www.久久久久|狼友网站av天堂|精品国产无码a片|一级av色欲av|91在线播放视频|亚洲无码主播在线|国产精品草久在线|明星AV网站在线|污污内射久久一区|婷婷综合视频网站

當(dāng)前位置:首頁 > > OpenFPGA

可編程邏輯系統(tǒng)通常部署在可能存在噪聲的應(yīng)用中。這種噪聲會(huì)影響可編程邏輯設(shè)計(jì)接收的信號(hào)。例如,它可能會(huì)導(dǎo)致信號(hào)故障或跳動(dòng),如果處理不當(dāng),可能會(huì)導(dǎo)致設(shè)計(jì)和操作出現(xiàn)問題。

毛刺的持續(xù)時(shí)間是隨機(jī)的,并且與時(shí)鐘沿不同步。因此,它們可能會(huì)導(dǎo)致下游信息損壞。

處理此問題的最常見方法是使用毛刺濾波器來濾除毛刺和反彈。

毛刺濾波器核心是使用長度可變的移位寄存器,噪聲信號(hào)被放到寄存器中,直到移位寄存器的所有值都一致。此時(shí),信號(hào)可以視為穩(wěn)定。當(dāng)然,我們必須確定潛在毛刺和反彈可能持續(xù)多長時(shí)間,以確保時(shí)鐘周期的寄存器大小正確。這就是為什么我們的毛刺濾波器需要非常靈活,并且需要確保其大小能夠適合每個(gè)應(yīng)用程序的要求。

濾波器應(yīng)該能夠接收噪聲輸入并濾除持續(xù)時(shí)間為多個(gè)時(shí)鐘脈沖的毛刺。

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity glitch_filter is
 generic(
 G_FILER_LEN     : integer := 8 
 );
 port(
 i_clk                 : in std_ulogic; 
 i_noisy               : in std_ulogic; 
 o_clean               : out std_ulogic 
 );
end glitch_filter;

architecture behaviour of glitch_filter is

 signal s_delay_line   : std_ulogic_vector(G_FILER_LEN - 1 downto 0);
 signal s_delay_and    : std_ulogic;
 signal s_delay_nor    : std_ulogic;
 signal s_output_clean : std_ulogic;

begin

 o_clean <= s_output_clean;

 --Delay disctete using delay line
 synchroniser_process : process (i_clk) begin if rising_edge(i_clk) then s_delay_line <= s_delay_line(G_FILER_LEN - 2 downto 0) & 
 i_noisy;
 end if;
 end process;

 --Generate AND and NOR of delay line bits
 s_delay_and <= '1' when to_01(s_delay_line) = 
 (s_delay_line'range => '1') else '0';
 s_delay_nor <= '1' when to_01(s_delay_line) = 
 (s_delay_line'range => '0') else '0';

 --Set discrete based on delay line
 output_process : process (i_clk) begin if rising_edge(i_clk) then if s_delay_nor = '1' then s_output_clean <= '0';
 elsif s_delay_and = '1' then s_output_clean <= '1';
 end if;
 end if;
 end process;

end behaviour;

為了測試這個(gè)模塊,創(chuàng)建一個(gè)簡單的測試文件,它將隨機(jī)數(shù)量的毛刺注入信號(hào)中。在信號(hào)改變狀態(tài)后,許多隨機(jī)毛刺被輸入到信號(hào)中。如果濾波器運(yùn)行正常,則這些毛刺將在毛刺濾波器輸出干凈的信號(hào)。

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.math_real.all;

entity glitch_filter_tb is
end;

architecture bench of glitch_filter_tb is

 component glitch_filter
 generic (
 G_FILER_LEN : integer );
 port (
 i_clk : in std_ulogic;
 i_noisy : in std_ulogic;
 o_clean : out std_ulogic
 );
 end component;

 -- Clock period
 constant clk_period : time := 10 ns;
 -- Generics
 constant G_FILER_LEN : integer := 8;

 -- Ports
 signal i_clk : std_ulogic :='0';
 signal i_noisy : std_ulogic;
 signal o_clean : std_ulogic;

begin

 i_clk <= not i_clk after (clk_period/2);

 glitch_filter_inst : glitch_filter
 generic map (
 G_FILER_LEN => G_FILER_LEN
 )
 port map (
 i_clk => i_clk,
 i_noisy => i_noisy,
 o_clean => o_clean
 );

uut : process

 variable glitch_duration : integer;
 variable seed1 : positive := 1;
 variable seed2 : positive := 283647823;

 impure function integer_random(min, max : integer) return integer is
 variable random : real;
 begin
 uniform(seed1, seed2, random); return integer(round(random * real(max - min) + real(min)));
 end function;

begin
 i_noisy <= '0'; wait until rising_edge(i_clk); wait for G_FILER_LEN * clk_period; test: for i in 0 to 1 loop
 i_noisy <= '1'; wait until rising_edge(i_clk);
 glitch_duration := integer_random(1,5); for x in 0 to glitch_duration loop
 i_noisy <= not i_noisy; wait until rising_edge(i_clk);
 end loop;
 i_noisy <= '1'; wait for 20 * clk_period;
 report "loop high completed" severity note;
 i_noisy <= '0'; wait until rising_edge(i_clk);
 glitch_duration := integer_random(1,5); for x in 0 to glitch_duration loop
 i_noisy <= not i_noisy; wait until rising_edge(i_clk);
 end loop;
 i_noisy <= '0'; wait for 20 * clk_period;
 report "loop low completed" severity note;
 end loop;
 report "Simulation complete" severity failure;
 
end process;

end;

運(yùn)行仿真后顯示在信號(hào)狀態(tài)改變后隨機(jī)數(shù)量的脈沖便增加。檢查輸出信號(hào)表明濾波器已正確濾除輸入信號(hào)中可能存在的毛刺。

正如在一開始所說的,這樣的濾波器對于部署在可能存在電噪聲的環(huán)境中非常有用。與 BRAM 上的 EDAC 等其他緩解策略相結(jié)合,這是可用于實(shí)現(xiàn)設(shè)計(jì)彈性的關(guān)鍵方法之一。



本站聲明: 本文章由作者或相關(guān)機(jī)構(gòu)授權(quán)發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點(diǎn),本站亦不保證或承諾內(nèi)容真實(shí)性等。需要轉(zhuǎn)載請聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請及時(shí)聯(lián)系本站刪除。
關(guān)閉