signal x1_1 : signed(23 downto 0) := (others => '0'); -- x(n-1) signal x2_1 : signed(23 downto 0) := (others => '0'); -- x(n-2) signal y1_1 : signed(23 downto 0) := (others => '0'); -- y(n-1) signal y2_1 : signed(23 downto 0) := (others => '0'); -- y(n-2) signal x1_2 : signed(23 downto 0) := (others => '0'); -- x(n-3) signal x2_2 : signed(23 downto 0) := (others => '0'); -- x(n-4) signal y1_2 : signed(23 downto 0) := (others => '0'); -- y(n-3) signal y2_2 : signed(23 downto 0) := (others => '0'); -- y(n-4) signal x1_3 : signed(23 downto 0) := (others => '0'); -- x(n-5) signal x2_3 : signed(23 downto 0) := (others => '0'); -- x(n-6) signal y1_3 : signed(23 downto 0) := (others => '0'); -- y(n-5) signal y2_3 : signed(23 downto 0) := (others => '0'); -- y(n-6) signal x1_4 : signed(23 downto 0) := (others => '0'); -- x(n-7) signal x2_4 : signed(23 downto 0) := (others => '0'); -- x(n-8) signal y1_4 : signed(23 downto 0) := (others => '0'); -- y(n-7) signal y2_4 : signed(23 downto 0) := (others => '0'); -- y(n-8) signal x1_5 : signed(23 downto 0) := (others => '0'); -- x(n-9) signal x2_5 : signed(23 downto 0) := (others => '0'); -- x(n-10) signal y1_5 : signed(23 downto 0) := (others => '0'); -- y(n-9) signal y2_5 : signed(23 downto 0) := (others => '0'); -- y(n-10) signal x1_6 : signed(23 downto 0) := (others => '0'); -- x(n-11) signal x2_6 : signed(23 downto 0) := (others => '0'); -- x(n-12) signal y1_6 : signed(23 downto 0) := (others => '0'); -- y(n-11) signal y2_6 : signed(23 downto 0) := (others => '0'); -- y(n-12) signal x1_7 : signed(23 downto 0) := (others => '0'); -- x(n-13) signal x2_7 : signed(23 downto 0) := (others => '0'); -- x(n-14) signal y1_7 : signed(23 downto 0) := (others => '0'); -- y(n-13) signal y2_7 : signed(23 downto 0) := (others => '0'); -- y(n-14) signal x1_8 : signed(23 downto 0) := (others => '0'); -- x(n-15) signal x2_8 : signed(23 downto 0) := (others => '0'); -- x(n-16) signal y1_8 : signed(23 downto 0) := (others => '0'); -- y(n-15) signal y2_8 : signed(23 downto 0) := (others => '0'); -- y(n-16) signal x1_9 : signed(23 downto 0) := (others => '0'); -- x(n-17) signal x2_9 : signed(23 downto 0) := (others => '0'); -- x(n-18) signal y1_9 : signed(23 downto 0) := (others => '0'); -- y(n-17) signal y2_9 : signed(23 downto 0) := (others => '0'); -- y(n-18) signal x1_10 : signed(23 downto 0) := (others => '0'); -- x(n-19) signal x2_10 : signed(23 downto 0) := (others => '0'); -- x(n-20) signal y1_10 : signed(23 downto 0) := (others => '0'); -- y(n-19) signal y2_10 : signed(23 downto 0) := (others => '0'); -- y(n-20) signal x1_11 : signed(23 downto 0) := (others => '0'); -- x(n-21) signal x2_11 : signed(23 downto 0) := (others => '0'); -- x(n-22) signal y1_11 : signed(23 downto 0) := (others => '0'); -- y(n-21) signal y2_11 : signed(23 downto 0) := (others => '0'); -- y(n.22) signal x1_12 : signed(23 downto 0) := (others => '0'); -- x(n-23) signal x2_12 : signed(23 downto 0) := (others => '0'); -- x(n-24) signal y1_12 : signed(23 downto 0) := (others => '0'); -- y(n-23) signal y2_12 : signed(23 downto 0) := (others => '0'); -- y(n-24) signal x1_13 : signed(23 downto 0) := (others => '0'); -- x(n-25) signal x2_13 : signed(23 downto 0) := (others => '0'); -- x(n-26) signal y1_13 : signed(23 downto 0) := (others => '0'); -- y(n-25) signal y2_13 : signed(23 downto 0) := (others => '0'); -- y(n-26) signal x1_14 : signed(23 downto 0) := (others => '0'); -- x(n-27) signal x2_14 : signed(23 downto 0) := (others => '0'); -- x(n-28) signal y1_14 : signed(23 downto 0) := (others => '0'); -- y(n-27) signal y2_14 : signed(23 downto 0) := (others => '0'); -- y(n-28) -- Zwischenspeicher der Koeffizienten und -- Signale zur einzelnen Berechnung einer Kaskade, -- sowie von Zwischenergebnissen signal b0 : signed(63 downto 0); signal b1 : signed(63 downto 0); signal b2 : signed(63 downto 0); signal a1 : signed(63 downto 0); signal a2 : signed(63 downto 0); signal x1 : signed(23 downto 0); signal x0 : signed(23 downto 0); signal x2 : signed(23 downto 0); signal y1 : signed(23 downto 0); signal y2 : signed(23 downto 0); signal tmp1 : signed(87 downto 0); signal tmp2 : signed(87 downto 0); signal yn : signed(23 downto 0); signal mul_a_1 : signed(23 downto 0); signal mul_b_1 : signed(63 downto 0); signal mul_r_1 : signed(87 downto 0); signal mul_a_2 : signed(23 downto 0); signal mul_b_2 : signed(63 downto 0); signal mul_r_2 : signed(87 downto 0); -- Multiplizierer Komponente (Megafunctions LPM_MULT) component lpm_mult0 port ( dataa : IN signed (23 DOWNTO 0); datab : IN signed (63 DOWNTO 0); result : OUT signed (87 DOWNTO 0) ); end component; begin -- Multiplizierer Ports zuweisen lpm_mult0_1 : lpm_mult0 port map (mul_a_1, mul_b_1, mul_r_1); lpm_mult0_2 : lpm_mult0 port map (mul_a_2, mul_b_2, mul_r_2); -- Filterprozess process begin -- Warten auf steigende Flanke des 50 MHz Taktes wait until rising_edge(clk_50MHz); -- Bei Freigabeimpuls alle Zähler zurücksetzen if (en = '0') then counter <= (others => '0'); section <= (others => '0'); else case counter is when x"00" => -- Koeffizienten an die entsprechenden Signale übergeben je nach gewählter Kaskade gemäß section case section is when x"0" => a1 <= b1_1; a2 <= a2_1; b0 <= b0_1; b1 <= b1_1; b2 <= b2_1; x0 <= x; x1 <= x1_1; x2 <= x2_1; y1 <= y1_1; y2 <= y2_1; when x"1" => a1 <= b1_2; a2 <= a2_2; b0 <= b0_2; b1 <= b1_2; b2 <= b2_2; x0 <= yn; x1 <= x1_2; x2 <= x2_2; y1 <= y1_2; y2 <= y2_2; when x"2" => a1 <= b1_3; a2 <= a2_3; b0 <= b0_3; b1 <= b1_3; b2 <= b2_3; x0 <= yn; x1 <= x1_3; x2 <= x2_3; y1 <= y1_3; y2 <= y2_3; when x"3" => a1 <= b1_4; a2 <= a2_4; b0 <= b0_4; b1 <= b1_4; b2 <= b2_4; x0 <= yn; x1 <= x1_4; x2 <= x2_4; y1 <= y1_4; y2 <= y2_4; when x"4" => a1 <= b1_5; a2 <= a2_5; b0 <= b0_5; b1 <= b1_5; b2 <= b2_5; x0 <= yn; x1 <= x1_5; x2 <= x2_5; y1 <= y1_5; y2 <= y2_5; when x"5" => a1 <= b1_6; a2 <= a2_6; b0 <= b0_6; b1 <= b1_6; b2 <= b2_6; x0 <= yn; x1 <= x1_6; x2 <= x2_6; y1 <= y1_6; y2 <= y2_6; when x"6" => a1 <= b1_7; a2 <= a2_7; b0 <= b0_7; b1 <= b1_7; b2 <= b2_7; x0 <= yn; x1 <= x1_7; x2 <= x2_7; y1 <= y1_7; y2 <= y2_7; when x"7" => a1 <= b1_8; a2 <= a2_8; b0 <= b0_8; b1 <= b1_8; b2 <= b2_8; x0 <= yn; x1 <= x1_8; x2 <= x2_8; y1 <= y1_8; y2 <= y2_8; when x"8" => a1 <= b1_9; a2 <= a2_9; b0 <= b0_9; b1 <= b1_9; b2 <= b2_9; x0 <= yn; x1 <= x1_9; x2 <= x2_9; y1 <= y1_9; y2 <= y2_9; when x"9" => a1 <= b1_10; a2 <= a2_10; b0 <= b0_10; b1 <= b1_10; b2 <= b2_10; x0 <= yn; x1 <= x1_10; x2 <= x2_10; y1 <= y1_10; y2 <= y2_10; when x"A" => a1 <= b1_11; a2 <= a2_11; b0 <= b0_11; b1 <= b1_11; b2 <= b2_11; x0 <= yn; x1 <= x1_11; x2 <= x2_11; y1 <= y1_11; y2 <= y2_11; when x"B" => a1 <= b1_12; a2 <= a2_12; b0 <= b0_12; b1 <= b1_12; b2 <= b2_12; x0 <= yn; x1 <= x1_12; x2 <= x2_12; y1 <= y1_12; y2 <= y2_12; when x"C" => a1 <= b1_13; a2 <= a2_13; b0 <= b0_13; b1 <= b1_13; b2 <= b2_13; x0 <= yn; x1 <= x1_13; x2 <= x2_13; y1 <= y1_13; y2 <= y2_13; when x"D" => a1 <= b1_14; a2 <= a2_14; b0 <= b0_14; b1 <= b1_14; b2 <= b2_14; x0 <= yn; x1 <= x1_14; x2 <= x2_14; y1 <= y1_14; y2 <= y2_14; when others => null; end case; -- Berechnung zur Filterung mittels einer Kaskade durchführen -- Bei der Berechnung wird folgende Formel angewandt. -- y(n) = b0*x(n) + b1*x(n-1) + b2*x(n-2) - a1*y(n-1) - a2*y(n-2) when x"01" => mul_a_1 <= x0; mul_b_1 <= b0; mul_a_2 <= x1; mul_b_2 <= b1; when x"02" => tmp1 <= mul_r_1 + mul_r_2; when x"03" => mul_a_1 <= x2; mul_b_1 <= b2; mul_a_2 <= y1; mul_b_2 <= a1; when x"04" => tmp2 <= tmp1 + mul_r_1 - mul_r_2; when x"05" => mul_a_1 <= y2; mul_b_1 <= a2; when x"06" => tmp1 <= tmp2 - mul_r_1; when x"07" => yn <= tmp1(82 downto 59); when x"08" => -- Zwischenergebnisse links schieben case section is when x"0" => x2_1 <= x1_1; x1_1 <= x0; y2_1 <= y1_1; y1_1 <= yn; section <= x"1"; counter <= x"00"; when x"1" => x2_2 <= x1_2; x1_2 <= x0; y2_2 <= y1_2; y1_2 <= yn; section <= x"2"; counter <= x"00"; when x"2" => x2_3 <= x1_3; x1_3 <= x0; y2_3 <= y1_3; y1_3 <= yn; section <= x"3"; counter <= x"00"; when x"3" => x2_4 <= x1_4; x1_4 <= x0; y2_4 <= y1_4; y1_4 <= yn; section <= x"4"; counter <= x"00"; when x"4" => x2_5 <= x1_5; x1_5 <= x0; y2_5 <= y1_5; y1_5 <= yn; section <= x"5"; counter <= x"00"; when x"5" => x2_6 <= x1_6; x1_6 <= x0; y2_6 <= y1_6; y1_6 <= yn; section <= x"6"; counter <= x"00"; when x"6" => x2_7 <= x1_7; x1_7 <= x0; y2_7 <= y1_7; y1_7 <= yn; section <= x"7"; counter <= x"00"; when x"7" => x2_8 <= x1_8; x1_8 <= x0; y2_8 <= y1_8; y1_8 <= yn; section <= x"8"; counter <= x"00"; when x"8" => x2_9 <= x1_9; x1_9 <= x0; y2_9 <= y1_9; y1_9 <= yn; section <= x"9"; counter <= x"00"; when x"9" => x2_10 <= x1_10; x1_10 <= x0; y2_10 <= y1_10; y1_10 <= yn; section <= x"A"; counter <= x"00"; when x"A" => x2_11 <= x1_11; x1_11 <= x0; y2_11 <= y1_11; y1_11 <= yn; section <= x"B"; counter <= x"00"; when x"B" => x2_12 <= x1_12; x1_12 <= x0; y2_12 <= y1_12; y1_12 <= yn; section <= x"C"; counter <= x"00"; when x"C" => x2_13 <= x1_13; x1_13 <= x0; y2_13 <= y1_13; y1_13 <= yn; section <= x"D"; counter <= x"00"; when x"D" => x2_14 <= x1_14; x1_14 <= x0; y2_14 <= y1_14; y1_14 <= yn; y <= yn; counter <= x"09"; when others => null; end case; when others => null; end case; if (counter < x"08") then counter <= counter + 1; end if; end if; end process; end behavior;