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

Subversion Repositories hilbert_transformer

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 plutonium
-- Implementation of Filter H_a3(z)
2
-- using Complex Frequency sampling filer (FSF) as Hilbert transformer
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
library ieee;
14
library ieee;
15
use ieee.std_logic_1164.all;
16
use ieee.numeric_std.all;
17
use ieee.std_logic_signed.all;
18
 
19
package analytic_filter_h_a3_pkg is
20
  component analytic_filter_h_a3
21
        generic(
22
                data_width  : integer
23
        );
24
        port(
25
                        clk_i                                                   :       in  std_logic;
26
                        rst_i                                                   :       in  std_logic;
27
                        data_i                              :   in std_logic_vector(data_width-1 downto 0);
28
                  data_str_i                            :       in std_logic;
29
                        data_i_o                                  :     out std_logic_vector(data_width-1 downto 0);
30
                        data_q_o                                  :     out std_logic_vector(data_width-1 downto 0);
31
                        data_str_o                              :       out std_logic
32
        );
33
  end component;
34
end analytic_filter_h_a3_pkg;
35
 
36
package body analytic_filter_h_a3_pkg is
37
end analytic_filter_h_a3_pkg;
38
 
39
-- Entity Definition
40
 
41
library ieee;
42
use ieee.std_logic_1164.all;
43
use ieee.numeric_std.all;
44
use ieee.math_real.all;
45
 
46
use work.fsf_comb_filter_pkg.all;
47
use work.fsf_pole_filter_pkg.all;
48
use work.fsf_pole_filter_coeff_def_pkg.all;
49
use work.complex_fsf_filter_c_90_pkg.all;
50
use work.complex_fsf_filter_inv_c_m30_m150_pkg.all;
51
use work.resize_tools_pkg.all;
52
 
53
entity analytic_filter_h_a3 is
54
        generic(
55
                data_width  : integer := 16
56
        );
57
        port(
58
                        clk_i                                                   :       in  std_logic;
59
                        rst_i                                                   :       in  std_logic;
60
                        data_i                              :   in std_logic_vector(data_width-1 downto 0);
61
                  data_str_i                            :       in std_logic;
62
                        data_i_o                                  :     out std_logic_vector(data_width-1 downto 0);
63
                        data_q_o                                  :     out std_logic_vector(data_width-1 downto 0);
64
                        data_str_o                              :       out std_logic
65
        );
66
end analytic_filter_h_a3;
67
 
68
architecture analytic_filter_h_a3_arch of analytic_filter_h_a3 is
69
 
70
--signal y                                              : std_logic_vector (data_width-1 downto 0);
71
--signal x                                              : std_logic_vector (data_width-1 downto 0);
72
 
73
signal data_i_res       : std_logic_vector (data_width-1 downto 0);
74
signal t1       : std_logic_vector (data_width-1 downto 0);
75
signal t1_res   : std_logic_vector (data_width-1 downto 0);
76
signal t2       : std_logic_vector (data_width-1 downto 0);
77
signal t3       : std_logic_vector (data_width-1 downto 0);
78
signal t4       : std_logic_vector (data_width-1 downto 0);
79
 
80
signal c1_i     : std_logic_vector (data_width-1 downto 0);
81
signal c1_q     : std_logic_vector (data_width-1 downto 0);
82
signal c2_i     : std_logic_vector (data_width-1 downto 0);
83
signal c2_q     : std_logic_vector (data_width-1 downto 0);
84
signal c2_i_res : std_logic_vector (data_width-1 downto 0);
85
signal c2_q_res : std_logic_vector (data_width-1 downto 0);
86
signal c3_i     : std_logic_vector (data_width-1 downto 0);
87
signal c3_q     : std_logic_vector (data_width-1 downto 0);
88
signal c3_i_res : std_logic_vector (data_width-1 downto 0);
89
signal c3_q_res : std_logic_vector (data_width-1 downto 0);
90
signal c4_i     : std_logic_vector (data_width-1 downto 0);
91
signal c4_q     : std_logic_vector (data_width-1 downto 0);
92
 
93
signal t1_str   : std_logic;
94
signal t2_str   : std_logic;
95
signal t3_str   : std_logic;
96
signal t4_str   : std_logic;
97
signal c1_str   : std_logic;
98
signal c2_str   : std_logic;
99
signal c3_str   : std_logic;
100
signal c4_str   : std_logic;
101
 
102
 
103
begin
104
 
105
  data_i_res <= resize_to_msb_round(std_logic_vector(shift_right(signed(data_i),1)),data_width);
106
 
107
  comb_stage1 : fsf_comb_filter
108
    generic map (
109
        data_width => data_width,
110
        comb_delay => 4
111
    )
112
    port map(
113
                clk_i                           => clk_i,
114
                rst_i                           => rst_i,
115
                data_i                  => data_i_res,
116
          data_str_i    => data_str_i,
117
                data_o                  => t1,
118
                data_str_o      => t1_str
119
    );
120
 
121
  t1_res <= resize_to_msb_round(std_logic_vector(shift_right(signed(t1),1)),data_width);
122
 
123
  comb_stage2 : fsf_comb_filter
124
    generic map (
125
        data_width => data_width,
126
        comb_delay => 4
127
    )
128
    port map(
129
                clk_i                           => clk_i,
130
                rst_i                           => rst_i,
131
                data_i                  => t1_res,
132
          data_str_i    => t1_str,
133
                data_o                  => t2,
134
                data_str_o      => t2_str
135
    );
136
 
137
  c_0_180_filter1 : fsf_pole_filter
138
        generic map (
139
                data_width => data_width,
140
                        coeff     => c_0_180_coeff,
141
                no_of_coefficients => 2
142
        )
143
        port map(
144
                        clk_i                           => clk_i,
145
                        rst_i                           => rst_i,
146
                        data_i                  => t2,
147
                  data_str_i    => t2_str,
148
                        data_o                  => t3,
149
                        data_str_o      => t3_str
150
        );
151
 
152
  c_0_180_filter2 : fsf_pole_filter
153
        generic map (
154
                data_width => data_width,
155
                        coeff     => c_0_180_coeff,
156
                no_of_coefficients => 2
157
        )
158
        port map(
159
                        clk_i                           => clk_i,
160
                        rst_i                           => rst_i,
161
                        data_i                  => t3,
162
                  data_str_i    => t3_str,
163
                        data_o                  => t4,
164
                        data_str_o      => t4_str
165
        );
166
 
167
  complex_fsf_filter_c_90_1 : complex_fsf_filter_c_90
168
    generic map (
169
        data_width => data_width
170
    )
171
    port map(
172
                clk_i                           => clk_i,
173
                rst_i                           => rst_i,
174
                data_i_i                => t4,
175
                data_q_i                => (others => '0'),
176
          data_str_i    => t4_str,
177
                data_i_o                => c1_i,
178
                data_q_o    => c1_q,
179
                data_str_o      => c1_str
180
 
181
    );
182
 
183
  complex_fsf_filter_c_90_2 : complex_fsf_filter_c_90
184
    generic map (
185
        data_width => data_width
186
    )
187
    port map(
188
                clk_i                           => clk_i,
189
                rst_i                           => rst_i,
190
                data_i_i                => c1_i,
191
                data_q_i                => c1_q,
192
          data_str_i    => c1_str,
193
                data_i_o                => c2_i,
194
                data_q_o    => c2_q,
195
                data_str_o      => c2_str
196
 
197
    );
198
 
199
  c2_i_res <= resize_to_msb_round(std_logic_vector(shift_right(signed(c2_i),1)),data_width);
200
  c2_q_res <= resize_to_msb_round(std_logic_vector(shift_right(signed(c2_q),1)),data_width);
201
 
202
  complex_fsf_filter_inv_c_m30_m150_1 : complex_fsf_filter_inv_c_m30_m150
203
    generic map (
204
        data_width => data_width
205
    )
206
    port map(
207
                clk_i                           => clk_i,
208
                rst_i                           => rst_i,
209
                data_i_i                => c2_i_res,
210
                data_q_i                => c2_q_res,
211
          data_str_i    => c2_str,
212
                data_i_o                => c3_i,
213
                data_q_o    => c3_q,
214
                data_str_o      => c3_str
215
    );
216
 
217
  c3_i_res <= resize_to_msb_round(std_logic_vector(shift_right(signed(c3_i),2)),data_width);
218
  c3_q_res <= resize_to_msb_round(std_logic_vector(shift_right(signed(c3_q),2)),data_width);
219
 
220
  complex_fsf_filter_inv_c_m30_m150_2 : complex_fsf_filter_inv_c_m30_m150
221
    generic map (
222
        data_width => data_width
223
    )
224
    port map(
225
                clk_i                           => clk_i,
226
                rst_i                           => rst_i,
227
                data_i_i                => c3_i_res,
228
                data_q_i                => c3_q_res,
229
          data_str_i    => c3_str,
230
                data_i_o                => c4_i,
231
                data_q_o    => c4_q,
232
                data_str_o      => c4_str
233
    );
234
 
235
  data_i_o <= c4_i;
236
  data_q_o <= c4_q;
237
  data_str_o <= c4_str;
238
 
239
end analytic_filter_h_a3_arch;
240
 
241
 

powered by: WebSVN 2.1.0

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