library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; Entity D_FILTER is port( CLK,NRST: in std_logic; S_IN: in std_logic_vector(1 downto 0); DFIR: in std_logic; S_OUT: out std_logic_vector(1 downto 0) ); end D_FILTER; architecture D_FILTER_ARCH of D_FILTER is signal countA: std_logic_vector(1 downto 0); signal countB: std_logic_vector(1 downto 0); signal DS_OUT: std_logic_vector(1 downto 0); begin process(CLK, NRST) begin if NRST='0' then countA <= (others=>'0'); elsif CLK='1' and CLK'event then if S_IN(0) ='1' and countA /= 2 then countA <= countA + 1; elsif S_IN(0) ='0' and countA /= 0 then countA <= countA - 1; end if; end if; end process; process(CLK) begin --if DFIR = '1' then -- S_OUT <= S_IN; --else if CLK='1' and CLK'event then if countA=2 then DS_OUT(0) <= '1'; elsif countA = 0 then DS_OUT(0) <= '0'; end if; end if; --end if; end process; process(DFIR, S_IN, DS_OUT) begin if DFIR = '1' then S_OUT(0) <= S_IN(0); else S_OUT(0) <= DS_OUT(0); end if; end process; process(CLK, NRST) begin if NRST='0' then countB <= (others=>'0'); elsif CLK='1' and CLK'event then if S_IN(1) ='1' and countB /= 2 then countB <= countB + 1; elsif S_IN(1) ='0' and countB /= 0 then countB <= countB - 1; end if; end if; end process; process(CLK) begin --if DFIR = '1' then -- S_OUT <= S_IN; --else if CLK='1' and CLK'event then if countB=2 then DS_OUT(1) <= '1'; elsif countB = 0 then DS_OUT(1) <= '0'; end if; end if; --end if; end process; process(DFIR, S_IN, DS_OUT) begin if DFIR = '1' then S_OUT(1) <= S_IN(1); else S_OUT(1) <= DS_OUT(1); end if; end process; end D_FILTER_ARCH;
file: /Techref/logic/dsp/filter/majority.htm, 2KB, , updated: 2000/11/29 10:44, local time: 2024/10/8 11:56,
35.170.81.33:LOG IN ©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://www.sxlist.com/Techref/logic/dsp/filter/majority.htm"> Digital Signal Processing Logic - Majority Filter</A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Welcome to www.sxlist.com! |
.