OpenCores
URL https://opencores.org/ocsvn/hilbert_transformer/hilbert_transformer/trunk

Subversion Repositories hilbert_transformer

[/] [hilbert_transformer/] [trunk/] [vhdl/] [fsf_comb_filter.vhd] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 plutonium
-- comb filter implementation for frequency sampling filers (FSF)
2
-- The filter transfer function F(z)=1+z^(-comb_delay)
3
-- 
4
-- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License
5
-- as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
6
-- 
7
-- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
8
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
9
-- 
10
-- You should have received a copy of the GNU General Public License along with this program; 
11
-- if not, see <http://www.gnu.org/licenses/>.
12
 
13
-- Package Definition
14
 
15
library ieee;
16
library ieee;
17
use ieee.std_logic_1164.all;
18
use IEEE.STD_LOGIC_arith.all;
19
use IEEE.STD_LOGIC_signed.all;
20
 
21
package fsf_comb_filter_pkg is
22
  component fsf_comb_filter
23
        generic(
24
                data_width  : integer;
25
                comb_delay  : integer
26
        );
27
        port(
28
                        clk_i                                                   :       in  std_logic;
29
                        rst_i                                                   :       in  std_logic;
30
                        data_i                          :       in std_logic_vector(data_width-1 downto 0);
31
                  data_str_i                            :       in std_logic;
32
                        data_o                          :       out std_logic_vector(data_width-1 downto 0);
33
                        data_str_o                              :       out std_logic
34
        );
35
  end component;
36
end fsf_comb_filter_pkg;
37
 
38
package body fsf_comb_filter_pkg is
39
end fsf_comb_filter_pkg;
40
 
41
-- Entity Definition
42
 
43
library ieee;
44
use ieee.std_logic_1164.all;
45
use IEEE.STD_LOGIC_arith.all;
46
use IEEE.STD_LOGIC_signed.all;
47
 
48
entity fsf_comb_filter is
49
        generic(
50
                data_width  : integer := 16;
51
                comb_delay  : integer := 2
52
        );
53
        port(
54
                        clk_i                                                   :       in  std_logic;
55
                        rst_i                                                   :       in  std_logic;
56
                        data_i                          :       in std_logic_vector(data_width-1 downto 0);
57
          data_str_i                            :       in std_logic;
58
                        data_o                          :       out std_logic_vector(data_width-1 downto 0);
59
                        data_str_o                              :       out std_logic
60
        );
61
end fsf_comb_filter;
62
 
63
architecture fsf_comb_filter_arch of fsf_comb_filter is
64
 
65
signal xc                                               : std_logic_vector (data_width-1 downto 0);
66
signal yc                                               : std_logic_vector (data_width-1 downto 0);
67
 
68
type delay_array_type is array (0 to comb_delay-1) of std_logic_vector (data_width-1 downto 0);
69
signal ycd                                              : delay_array_type;
70
 
71
begin
72
 
73
  xc <= data_i;
74
  yc <= conv_std_logic_vector(conv_integer(xc) - conv_integer(ycd(comb_delay-1)), data_width);
75
 
76
process (clk_i, rst_i)
77
begin
78
        if rst_i = '1' then
79
          for i in 0 to comb_delay-1 loop
80
             ycd(i) <= (others => '0');
81
          end loop;
82
    data_str_o <= '0';
83
    data_o <= (others => '0');
84
        elsif clk_i'EVENT and clk_i = '1' then
85
    data_str_o <= data_str_i;
86
    data_o <= yc;
87
    if data_str_i='1' then
88
      ycd(0) <= xc;
89
      for i in 1 to comb_delay-1 loop
90
        ycd(i) <= ycd(i-1);
91
      end loop;
92
    end if;
93
  end if;
94
end process;
95
 
96
 
97
end fsf_comb_filter_arch;
98
 
99
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.