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

Subversion Repositories simple_fm_receiver

[/] [simple_fm_receiver/] [trunk/] [source/] [fir.vhdl] - Blame information for rev 39

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 23 arif_endro
-- $Id: fir.vhdl,v 1.5 2008-06-26 06:16:04 arif_endro Exp $
2 2 arif_endro
-------------------------------------------------------------------------------
3
-- Title       : FIR Low pass filter
4
-- Project     : FM Receiver 
5
-------------------------------------------------------------------------------
6
-- File        : fir.vhdl
7
-- Author      : "Arif E. Nugroho" <arif_endro@yahoo.com>
8
-- Created     : 2004/10/30
9 16 arif_endro
-- Last update : 2005/03/11
10 12 arif_endro
-- Simulators  : 
11 2 arif_endro
-- Synthesizers: 
12
-- Target      : 
13
-------------------------------------------------------------------------------
14
-- Description : FIR low pass filter
15
-------------------------------------------------------------------------------
16 39 arif_endro
-- Copyright (C) 2004 Arif Endro Nugroho
17 2 arif_endro
-------------------------------------------------------------------------------
18 12 arif_endro
-- 
19
--      THIS SOURCE FILE MAY BE USED AND DISTRIBUTED WITHOUT RESTRICTION
20
-- PROVIDED THAT THIS COPYRIGHT STATEMENT IS NOT REMOVED FROM THE FILE AND THAT
21
-- ANY DERIVATIVE WORK CONTAINS THE ORIGINAL COPYRIGHT NOTICE AND THE
22
-- ASSOCIATED DISCLAIMER.
23
-- 
24
-------------------------------------------------------------------------------
25
-- 
26
--      THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
27
-- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28
-- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
29
-- EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31
-- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
32
-- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
33
-- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34
-- OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
35
-- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
-- 
37
-------------------------------------------------------------------------------
38 2 arif_endro
 
39
library IEEE;
40
use IEEE.STD_LOGIC_1164.ALL;
41
 
42
entity fir is
43
  port(
44
  clock  : in  bit;
45
  clear  : in  bit;
46
  fir_in : in  bit_vector (11 downto 0); -- <12,4,t>
47
  dmout  : out bit_vector (11 downto 0)  -- <12,4,t>
48
  );
49
end fir;
50
 
51
architecture structural of fir is
52
  component adder_15bit
53
  port (
54
  addend_15bit   : in  bit_vector (14 downto 0);
55
  augend_15bit   : in  bit_vector (14 downto 0);
56
  adder15_output : out bit_vector (15 downto 0)
57
  );
58
  end component;
59
  component adder_14bit
60
  port (
61
  addend_14bit   : in  bit_vector (13 downto 0);
62
  augend_14bit   : in  bit_vector (13 downto 0);
63
  adder14_output : out bit_vector (14 downto 0)
64
  );
65
  end component;
66
  component adder_13bit
67
  port (
68
  addend_13bit   : in  bit_vector (12 downto 0);
69
  augend_13bit   : in  bit_vector (12 downto 0);
70
  adder13_output : out bit_vector (13 downto 0)
71
  );
72
  end component;
73
  component adder_12bit
74
  port (
75
  addend_12bit   : in  bit_vector (11 downto 0);
76
  augend_12bit   : in  bit_vector (11 downto 0);
77
  adder12_output : out bit_vector (12 downto 0)
78
  );
79
  end component;
80
 
81
  signal  fir_out        : bit_vector (11 downto 0);
82
  signal  fir_in_01      : bit_vector (11 downto 0);
83
  signal  fir_in_02      : bit_vector (11 downto 0);
84
  signal  fir_in_03      : bit_vector (11 downto 0);
85
  signal  fir_in_04      : bit_vector (11 downto 0);
86
  signal  fir_in_05      : bit_vector (11 downto 0);
87
  signal  fir_in_06      : bit_vector (11 downto 0);
88
  signal  fir_in_07      : bit_vector (11 downto 0);
89
  signal  fir_in_08      : bit_vector (11 downto 0);
90
  signal  fir_in_09      : bit_vector (11 downto 0);
91
  signal  fir_in_10      : bit_vector (11 downto 0);
92
  signal  fir_in_11      : bit_vector (11 downto 0);
93
  signal  fir_in_12      : bit_vector (11 downto 0);
94
  signal  fir_in_13      : bit_vector (11 downto 0);
95
  signal  fir_in_14      : bit_vector (11 downto 0);
96
  signal  fir_in_15      : bit_vector (11 downto 0);
97
  signal  fir_in_16      : bit_vector (11 downto 0);
98
  signal  result_adder01 : bit_vector (12 downto 0);
99
  signal  result_adder02 : bit_vector (12 downto 0);
100
  signal  result_adder03 : bit_vector (12 downto 0);
101
  signal  result_adder04 : bit_vector (12 downto 0);
102
  signal  result_adder05 : bit_vector (12 downto 0);
103
  signal  result_adder06 : bit_vector (12 downto 0);
104
  signal  result_adder07 : bit_vector (12 downto 0);
105
  signal  result_adder08 : bit_vector (12 downto 0);
106
  signal  result_adder09 : bit_vector (13 downto 0);
107
  signal  result_adder10 : bit_vector (13 downto 0);
108
  signal  result_adder11 : bit_vector (13 downto 0);
109
  signal  result_adder12 : bit_vector (13 downto 0);
110
  signal  result_adder13 : bit_vector (14 downto 0);
111
  signal  result_adder14 : bit_vector (14 downto 0);
112
  signal  result_adder15 : bit_vector (15 downto 0);
113
 
114
 
115
begin
116
  fir_in_01  <= fir_in;
117
 
118
adder01 : adder_12bit
119
  port map (
120
  addend_12bit(11 downto 0)   => fir_in_01,
121
  augend_12bit(11 downto 0)   => fir_in_02,
122
  adder12_output              => result_adder01
123
  );
124
 
125
adder02 : adder_12bit
126
  port map (
127
  addend_12bit(11 downto 0)   => fir_in_03,
128
  augend_12bit(11 downto 0)   => fir_in_04,
129
  adder12_output              => result_adder02
130
  );
131
 
132
adder03 : adder_12bit
133
  port map (
134
  addend_12bit(11 downto 0)   => fir_in_05,
135
  augend_12bit(11 downto 0)   => fir_in_06,
136
  adder12_output              => result_adder03
137
  );
138
 
139
adder04 : adder_12bit
140
  port map (
141
  addend_12bit(11 downto 0)   => fir_in_07,
142
  augend_12bit(11 downto 0)   => fir_in_08,
143
  adder12_output              => result_adder04
144
  );
145
 
146
adder05 : adder_12bit
147
  port map (
148
  addend_12bit(11 downto 0)   => fir_in_09,
149
  augend_12bit(11 downto 0)   => fir_in_10,
150
  adder12_output              => result_adder05
151
  );
152
 
153
adder06 : adder_12bit
154
  port map (
155
  addend_12bit(11 downto 0)   => fir_in_11,
156
  augend_12bit(11 downto 0)   => fir_in_12,
157
  adder12_output              => result_adder06
158
  );
159
 
160
adder07 : adder_12bit
161
  port map (
162
  addend_12bit(11 downto 0)   => fir_in_13,
163
  augend_12bit(11 downto 0)   => fir_in_14,
164
  adder12_output              => result_adder07
165
  );
166
 
167
adder08 : adder_12bit
168
  port map (
169
  addend_12bit(11 downto 0)   => fir_in_15,
170
  augend_12bit(11 downto 0)   => fir_in_16,
171
  adder12_output              => result_adder08
172
  );
173
 
174
adder09 : adder_13bit
175
  port map (
176
  addend_13bit(12 downto 0)   => result_adder01,
177
  augend_13bit(12 downto 0)   => result_adder02,
178
  adder13_output              => result_adder09
179
  );
180
 
181
adder10 : adder_13bit
182
  port map (
183
  addend_13bit(12 downto 0)   => result_adder03,
184
  augend_13bit(12 downto 0)   => result_adder04,
185
  adder13_output              => result_adder10
186
  );
187
 
188
adder11 : adder_13bit
189
  port map (
190
  addend_13bit(12 downto 0)   => result_adder05,
191
  augend_13bit(12 downto 0)   => result_adder06,
192
  adder13_output              => result_adder11
193
  );
194
 
195
adder12 : adder_13bit
196
  port map (
197
  addend_13bit(12 downto 0)   => result_adder07,
198
  augend_13bit(12 downto 0)   => result_adder08,
199
  adder13_output              => result_adder12
200
  );
201
 
202
adder13 : adder_14bit
203
  port map (
204
  addend_14bit(13 downto 0)   => result_adder09,
205
  augend_14bit(13 downto 0)   => result_adder10,
206
  adder14_output              => result_adder13
207
  );
208
 
209
adder14 : adder_14bit
210
  port map (
211
  addend_14bit(13 downto 0)   => result_adder11,
212
  augend_14bit(13 downto 0)   => result_adder12,
213
  adder14_output              => result_adder14
214
  );
215
 
216
adder15 : adder_15bit
217
  port map (
218
  addend_15bit(14 downto 0)   => result_adder13,
219
  augend_15bit(14 downto 0)   => result_adder14,
220
  adder15_output              => result_adder15
221
  );
222
 
223 16 arif_endro
-- FIR constants that have effect on output trasition.
224
-- This constant if set to low values (e.g x < 1/8 ) will make 
225
-- the transition output more looks like steps, noise will be reduced
226
-- but it's loss of fidelity of output signal.
227
-- for example:
228
-- set values to 1/16 will make the output trasition more look's like step
229
-- than an curve.
230
-- Just try another values to see the result. ^_^
231
 
232 12 arif_endro
fir_out(11)    <= (result_adder15(15)); -- 1
233 16 arif_endro
fir_out(10)    <= (result_adder15(14)); -- 1/2
234
fir_out(09)    <= (result_adder15(13)); -- 1/4
235
fir_out(08)    <= (result_adder15(12)); -- 1/8
236
fir_out(07)    <= (result_adder15(11)); -- 1/16
237
fir_out(06)    <= (result_adder15(10));
238
fir_out(05)    <= (result_adder15(09));
239
fir_out(04)    <= (result_adder15(08));
240
fir_out(03)    <= (result_adder15(07));
241
fir_out(02)    <= (result_adder15(06));
242
fir_out(01)    <= (result_adder15(05));
243
fir_out(00)    <= (result_adder15(04));
244 2 arif_endro
 
245 23 arif_endro
-- 20080625
246
-- fixme
247
-- how to enable clear signal in here... :(
248 2 arif_endro
 
249 23 arif_endro
--   process (clock, clear)
250
   process (clock)
251
 
252 12 arif_endro
   begin
253
 
254 23 arif_endro
--   if    (clear = '1') then
255
   if ((clock = '1') and clock'event) then
256 12 arif_endro
 
257 23 arif_endro
--      dmout     <= (others => '0');
258 12 arif_endro
 
259 23 arif_endro
--   elsif (((clock = '1') and (not(clear) = '1')) and clock'event) then
260 12 arif_endro
 
261 2 arif_endro
        fir_in_02 <= fir_in_01;
262
        fir_in_03 <= fir_in_02;
263
        fir_in_04 <= fir_in_03;
264
        fir_in_05 <= fir_in_04;
265
        fir_in_06 <= fir_in_05;
266
        fir_in_07 <= fir_in_06;
267
        fir_in_08 <= fir_in_07;
268
        fir_in_09 <= fir_in_08;
269
        fir_in_10 <= fir_in_09;
270
        fir_in_11 <= fir_in_10;
271
        fir_in_12 <= fir_in_11;
272
        fir_in_13 <= fir_in_12;
273
        fir_in_14 <= fir_in_13;
274
        fir_in_15 <= fir_in_14;
275
        fir_in_16 <= fir_in_15;
276
 
277
        dmout     <= fir_out;
278
 
279
   end if;
280 12 arif_endro
 
281
   end process;
282
 
283 2 arif_endro
end structural;

powered by: WebSVN 2.1.0

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