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

Subversion Repositories hilbert_transformer

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 plutonium
-- Implementation of Filter H_a1(z)
2
-- 
3
-- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License
4
-- as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
5
-- 
6
-- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
7
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
8
-- 
9
-- You should have received a copy of the GNU General Public License along with this program; 
10
-- if not, see <http://www.gnu.org/licenses/>.
11
 
12
-- Package Definition
13
 
14
library ieee;
15
use ieee.std_logic_1164.all;
16
use IEEE.STD_LOGIC_arith.all;
17
 
18
package analytic_filter_h_a1_pkg is
19
component analytic_filter_h_a1
20
        generic(
21
                input_data_width : integer;
22
                output_data_width : integer;
23
                filter_delay_in_clks : integer  --delay of hilbert filter
24
        );
25
        port(
26
    clk_i : in std_logic;
27
    rst_i : in std_logic;
28
    data_str_i : in std_logic;
29
    data_i : in std_logic_vector(input_data_width-1 downto 0);
30
    data_i_o : out std_logic_vector(output_data_width-1 downto 0);
31
    data_q_o : out std_logic_vector(output_data_width-1 downto 0);
32
    data_str_o : out std_logic
33
        );
34
end component;
35
end analytic_filter_h_a1_pkg;
36
 
37
package body analytic_filter_h_a1_pkg is
38
end analytic_filter_h_a1_pkg;
39
 
40
-- Entity Definition
41
 
42
library ieee;
43
use ieee.std_logic_1164.all;
44
use IEEE.STD_LOGIC_arith.all;
45
use work.const_delay_pkg.all;
46
use work.hilbert_filter_pkg.all;
47
 
48
entity analytic_filter_h_a1 is
49
        generic(
50
                input_data_width : integer := 16;
51
                output_data_width : integer := 16;
52
                filter_delay_in_clks : integer  := 7 --delay of hilbert filter (including pipeline delay)
53
        );
54
        port(
55
            clk_i : in std_logic;
56
            rst_i : in std_logic;
57
            data_str_i : in std_logic;
58
            data_i : in std_logic_vector(input_data_width-1 downto 0);
59
            data_i_o : out std_logic_vector(output_data_width-1 downto 0);
60
            data_q_o : out std_logic_vector(output_data_width-1 downto 0);
61
            data_str_o : out std_logic
62
        );
63
end analytic_filter_h_a1;
64
 
65
architecture analytic_filter_h_a1_arch of analytic_filter_h_a1 is
66
 
67
  function maximum_int(
68
    x1 : integer;
69
    x2 : integer
70
    ) return integer is
71
  begin
72
    if x1 > x2 then
73
      return x1;
74
    else
75
      return x2;
76
    end if;
77
  end maximum_int;
78
 
79
constant max_data_width : integer := maximum_int(input_data_width,output_data_width);
80
signal const_delay_data_i, const_delay_data_o : std_logic_vector(max_data_width-1 downto 0);
81
 
82
begin
83
 
84
const_delay_data_i(max_data_width-1 downto max_data_width-input_data_width) <= data_i;
85
 
86
zero_pad: if max_data_width-input_data_width > 0 generate
87
        const_delay_data_i(max_data_width-input_data_width-1 downto 0) <= (others => '0');
88
end generate;
89
 
90
data_i_o <= const_delay_data_o(max_data_width-1 downto max_data_width-output_data_width);
91
 
92
in_phase_channel : const_delay
93
        generic map(
94
                data_width    => max_data_width,
95
                delay_in_clks => filter_delay_in_clks
96
        )
97
        port map(
98
            clk_i => clk_i,
99
            rst_i => rst_i,
100
            data_i => const_delay_data_i,
101
            data_str_i => data_str_i,
102
            data_o => const_delay_data_o,
103
            data_str_o => data_str_o
104
        );
105
 
106
quadrature_phase_channel : hilbert_filter
107
  generic map(
108
    input_data_width    => input_data_width,
109
    output_data_width => output_data_width,
110
    internal_data_width => max_data_width
111
  )
112
   port map(
113
           clk        => clk_i,
114
           clk_enable => data_str_i,
115
           reset      => rst_i,
116
           filter_in  => data_i,
117
           filter_out => data_q_o
118
   );
119
 
120
 
121
end analytic_filter_h_a1_arch;

powered by: WebSVN 2.1.0

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