可編程邏輯系統(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)致下游信息損壞。
處理此問題的最常見方法是使用毛刺濾波器來濾除毛刺和反彈。
毛刺濾波器核心是使用長(zhǎng)度可變的移位寄存器,噪聲信號(hào)被放到寄存器中,直到移位寄存器的所有值都一致。此時(shí),信號(hào)可以視為穩(wěn)定。當(dāng)然,我們必須確定潛在毛刺和反彈可能持續(xù)多長(zhǎng)時(shí)間,以確保時(shí)鐘周期的寄存器大小正確。這就是為什么我們的毛刺濾波器需要非常靈活,并且需要確保其大小能夠適合每個(gè)應(yīng)用程序的要求。
濾波器應(yīng)該能夠接收噪聲輸入并濾除持續(xù)時(shí)間為多個(gè)時(shí)鐘脈沖的毛刺。
libraryieee; useieee.std_logic_1164.all; useieee.numeric_std.all; entityglitch_filteris generic( G_FILER_LEN:integer:=8 ); port( i_clk:instd_ulogic; i_noisy:instd_ulogic; o_clean:outstd_ulogic ); endglitch_filter; architecturebehaviourofglitch_filteris signals_delay_line:std_ulogic_vector(G_FILER_LEN-1downto0); signals_delay_and:std_ulogic; signals_delay_nor:std_ulogic; signals_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'; --Setdiscretebasedondelayline output_process:process(i_clk)begin ifrising_edge(i_clk)then ifs_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;
為了測(cè)試這個(gè)模塊,創(chuàng)建一個(gè)簡(jiǎn)單的測(cè)試文件,它將隨機(jī)數(shù)量的毛刺注入信號(hào)中。在信號(hào)改變狀態(tài)后,許多隨機(jī)毛刺被輸入到信號(hào)中。如果濾波器運(yùn)行正常,則這些毛刺將在毛刺濾波器輸出干凈的信號(hào)。
libraryieee; useieee.std_logic_1164.all; useieee.numeric_std.all; useieee.math_real.all; entityglitch_filter_tbis end; architecturebenchofglitch_filter_tbis componentglitch_filter generic( G_FILER_LEN:integer ); port( i_clk:instd_ulogic; i_noisy:instd_ulogic; o_clean:outstd_ulogic ); endcomponent; --Clockperiod constantclk_period:time:=10ns; --Generics constantG_FILER_LEN:integer:=8; --Ports signali_clk:std_ulogic:='0'; signali_noisy:std_ulogic; signalo_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 ) portmap( i_clk=>i_clk, i_noisy=>i_noisy, o_clean=>o_clean ); uut:process variableglitch_duration:integer; variableseed1:positive:=1; variableseed2:positive:=283647823; impurefunctioninteger_random(min,max:integer)returnintegeris variablerandom:real; begin uniform(seed1,seed2,random); returninteger(round(random*real(max-min)+real(min))); endfunction; 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)中可能存在的毛刺。
正如在一開始所說的,這樣的濾波器對(duì)于部署在可能存在電噪聲的環(huán)境中非常有用。與 BRAM 上的 EDAC 等其他緩解策略相結(jié)合,這是可用于實(shí)現(xiàn)設(shè)計(jì)彈性的關(guān)鍵方法之一。
審核編輯:劉清
-
濾波器
+關(guān)注
關(guān)注
162文章
8126瀏覽量
181748 -
寄存器
+關(guān)注
關(guān)注
31文章
5432瀏覽量
124134 -
狀態(tài)機(jī)
+關(guān)注
關(guān)注
2文章
493瀏覽量
28189 -
BRAM
+關(guān)注
關(guān)注
0文章
41瀏覽量
11287 -
時(shí)鐘脈沖
+關(guān)注
關(guān)注
0文章
19瀏覽量
12950
原文標(biāo)題:【數(shù)字實(shí)驗(yàn)室】消除毛刺
文章出處:【微信號(hào):Open_FPGA,微信公眾號(hào):OpenFPGA】歡迎添加關(guān)注!文章轉(zhuǎn)載請(qǐng)注明出處。
發(fā)布評(píng)論請(qǐng)先 登錄
TPA3110D2無信號(hào)輸入時(shí),輸出336kHZ的正弦波信號(hào)有明顯的毛刺,如何濾除毛刺?
引入輸入濾波器來濾除噪聲設(shè)計(jì)
毛刺的濾波方法
怎樣去設(shè)計(jì)一個(gè)使用時(shí)序邏輯對(duì)單bit信號(hào)進(jìn)行毛刺濾除操作的電路
FPGA | 競(jìng)爭(zhēng)冒險(xiǎn)和毛刺問題
電路從SDA和SCL線路中濾除毛刺的解決方法及過程
FPGA中的冒險(xiǎn)現(xiàn)象和如何處理毛刺

電感的毛刺現(xiàn)象是什么意思?如何解決感應(yīng)毛刺?

在 FlexIO上進(jìn)行毛刺濾波的方法
什么是毛刺?毛刺的大小和方向 如何測(cè)量毛刺的尺寸?
如何最小化毛刺尺寸?如何控制毛刺方向?
PCB鉆孔毛刺產(chǎn)生的原因及毛刺的危害
雙面無毛刺沖裁如何實(shí)現(xiàn)(一種消除毛刺的加工方法)

評(píng)論