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 2

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

Line No. Rev Author Line
1 2 arif_endro
-- $Id: fir.vhdl,v 1.1.1.1 2005-01-04 02:05:58 arif_endro Exp $
2
-------------------------------------------------------------------------------
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
-- Last update : 2004/12/31
10
-- Simulators  : Modelsim 6.0
11
-- Synthesizers: 
12
-- Target      : 
13
-------------------------------------------------------------------------------
14
-- Description : FIR low pass filter
15
-------------------------------------------------------------------------------
16
-- Copyright (c) 2004 Arif E. Nugroho
17
-- This VHDL design file is an open design; you can redistribute it and/or
18
-- modify it and/or implement it after contacting the author
19
-------------------------------------------------------------------------------
20
 
21
library IEEE;
22
use IEEE.STD_LOGIC_1164.ALL;
23
use IEEE.STD_LOGIC_arith.ALL;
24
 
25
entity fir is
26
  port(
27
  clock  : in  bit;
28
  clear  : in  bit;
29
  fir_in : in  bit_vector (11 downto 0); -- <12,4,t>
30
  dmout  : out bit_vector (11 downto 0)  -- <12,4,t>
31
  );
32
end fir;
33
 
34
architecture structural of fir is
35
  component adder_15bit
36
  port (
37
  addend_15bit   : in  bit_vector (14 downto 0);
38
  augend_15bit   : in  bit_vector (14 downto 0);
39
  adder15_output : out bit_vector (15 downto 0)
40
  );
41
  end component;
42
  component adder_14bit
43
  port (
44
  addend_14bit   : in  bit_vector (13 downto 0);
45
  augend_14bit   : in  bit_vector (13 downto 0);
46
  adder14_output : out bit_vector (14 downto 0)
47
  );
48
  end component;
49
  component adder_13bit
50
  port (
51
  addend_13bit   : in  bit_vector (12 downto 0);
52
  augend_13bit   : in  bit_vector (12 downto 0);
53
  adder13_output : out bit_vector (13 downto 0)
54
  );
55
  end component;
56
  component adder_12bit
57
  port (
58
  addend_12bit   : in  bit_vector (11 downto 0);
59
  augend_12bit   : in  bit_vector (11 downto 0);
60
  adder12_output : out bit_vector (12 downto 0)
61
  );
62
  end component;
63
 
64
  signal  fir_out        : bit_vector (11 downto 0);
65
  signal  fir_in_01      : bit_vector (11 downto 0);
66
  signal  fir_in_02      : bit_vector (11 downto 0);
67
  signal  fir_in_03      : bit_vector (11 downto 0);
68
  signal  fir_in_04      : bit_vector (11 downto 0);
69
  signal  fir_in_05      : bit_vector (11 downto 0);
70
  signal  fir_in_06      : bit_vector (11 downto 0);
71
  signal  fir_in_07      : bit_vector (11 downto 0);
72
  signal  fir_in_08      : bit_vector (11 downto 0);
73
  signal  fir_in_09      : bit_vector (11 downto 0);
74
  signal  fir_in_10      : bit_vector (11 downto 0);
75
  signal  fir_in_11      : bit_vector (11 downto 0);
76
  signal  fir_in_12      : bit_vector (11 downto 0);
77
  signal  fir_in_13      : bit_vector (11 downto 0);
78
  signal  fir_in_14      : bit_vector (11 downto 0);
79
  signal  fir_in_15      : bit_vector (11 downto 0);
80
  signal  fir_in_16      : bit_vector (11 downto 0);
81
  signal  result_adder01 : bit_vector (12 downto 0);
82
  signal  result_adder02 : bit_vector (12 downto 0);
83
  signal  result_adder03 : bit_vector (12 downto 0);
84
  signal  result_adder04 : bit_vector (12 downto 0);
85
  signal  result_adder05 : bit_vector (12 downto 0);
86
  signal  result_adder06 : bit_vector (12 downto 0);
87
  signal  result_adder07 : bit_vector (12 downto 0);
88
  signal  result_adder08 : bit_vector (12 downto 0);
89
  signal  result_adder09 : bit_vector (13 downto 0);
90
  signal  result_adder10 : bit_vector (13 downto 0);
91
  signal  result_adder11 : bit_vector (13 downto 0);
92
  signal  result_adder12 : bit_vector (13 downto 0);
93
  signal  result_adder13 : bit_vector (14 downto 0);
94
  signal  result_adder14 : bit_vector (14 downto 0);
95
  signal  result_adder15 : bit_vector (15 downto 0);
96
 
97
 
98
begin
99
  fir_in_01  <= fir_in;
100
 
101
adder01 : adder_12bit
102
  port map (
103
  addend_12bit(11 downto 0)   => fir_in_01,
104
  augend_12bit(11 downto 0)   => fir_in_02,
105
  adder12_output              => result_adder01
106
  );
107
 
108
adder02 : adder_12bit
109
  port map (
110
  addend_12bit(11 downto 0)   => fir_in_03,
111
  augend_12bit(11 downto 0)   => fir_in_04,
112
  adder12_output              => result_adder02
113
  );
114
 
115
adder03 : adder_12bit
116
  port map (
117
  addend_12bit(11 downto 0)   => fir_in_05,
118
  augend_12bit(11 downto 0)   => fir_in_06,
119
  adder12_output              => result_adder03
120
  );
121
 
122
adder04 : adder_12bit
123
  port map (
124
  addend_12bit(11 downto 0)   => fir_in_07,
125
  augend_12bit(11 downto 0)   => fir_in_08,
126
  adder12_output              => result_adder04
127
  );
128
 
129
adder05 : adder_12bit
130
  port map (
131
  addend_12bit(11 downto 0)   => fir_in_09,
132
  augend_12bit(11 downto 0)   => fir_in_10,
133
  adder12_output              => result_adder05
134
  );
135
 
136
adder06 : adder_12bit
137
  port map (
138
  addend_12bit(11 downto 0)   => fir_in_11,
139
  augend_12bit(11 downto 0)   => fir_in_12,
140
  adder12_output              => result_adder06
141
  );
142
 
143
adder07 : adder_12bit
144
  port map (
145
  addend_12bit(11 downto 0)   => fir_in_13,
146
  augend_12bit(11 downto 0)   => fir_in_14,
147
  adder12_output              => result_adder07
148
  );
149
 
150
adder08 : adder_12bit
151
  port map (
152
  addend_12bit(11 downto 0)   => fir_in_15,
153
  augend_12bit(11 downto 0)   => fir_in_16,
154
  adder12_output              => result_adder08
155
  );
156
 
157
adder09 : adder_13bit
158
  port map (
159
  addend_13bit(12 downto 0)   => result_adder01,
160
  augend_13bit(12 downto 0)   => result_adder02,
161
  adder13_output              => result_adder09
162
  );
163
 
164
adder10 : adder_13bit
165
  port map (
166
  addend_13bit(12 downto 0)   => result_adder03,
167
  augend_13bit(12 downto 0)   => result_adder04,
168
  adder13_output              => result_adder10
169
  );
170
 
171
adder11 : adder_13bit
172
  port map (
173
  addend_13bit(12 downto 0)   => result_adder05,
174
  augend_13bit(12 downto 0)   => result_adder06,
175
  adder13_output              => result_adder11
176
  );
177
 
178
adder12 : adder_13bit
179
  port map (
180
  addend_13bit(12 downto 0)   => result_adder07,
181
  augend_13bit(12 downto 0)   => result_adder08,
182
  adder13_output              => result_adder12
183
  );
184
 
185
adder13 : adder_14bit
186
  port map (
187
  addend_14bit(13 downto 0)   => result_adder09,
188
  augend_14bit(13 downto 0)   => result_adder10,
189
  adder14_output              => result_adder13
190
  );
191
 
192
adder14 : adder_14bit
193
  port map (
194
  addend_14bit(13 downto 0)   => result_adder11,
195
  augend_14bit(13 downto 0)   => result_adder12,
196
  adder14_output              => result_adder14
197
  );
198
 
199
adder15 : adder_15bit
200
  port map (
201
  addend_15bit(14 downto 0)   => result_adder13,
202
  augend_15bit(14 downto 0)   => result_adder14,
203
  adder15_output              => result_adder15
204
  );
205
 
206
fir_out(11)    <= (result_adder15(15) and not(clear)); -- 1
207
fir_out(10)    <= (result_adder15(15) and not(clear)); -- 1/2
208
fir_out(09)    <= (result_adder15(15) and not(clear)); -- 1/4
209
fir_out(08)    <= (result_adder15(15) and not(clear)); -- 1/8
210
fir_out(07)    <= (result_adder15(15) and not(clear)); -- 1/16
211
fir_out(06)    <= (result_adder15(14) and not(clear));
212
fir_out(05)    <= (result_adder15(13) and not(clear));
213
fir_out(04)    <= (result_adder15(12) and not(clear));
214
fir_out(03)    <= (result_adder15(11) and not(clear));
215
fir_out(02)    <= (result_adder15(10) and not(clear));
216
fir_out(01)    <= (result_adder15(09) and not(clear));
217
fir_out(00)    <= (result_adder15(08) and not(clear));
218
 
219
process (clock)
220
begin
221
-- if (((clock = '1') and (not(clear) = '1')) and clock'event) then
222
   if ((clock = '1') and clock'event) then
223
 
224
        fir_in_02 <= fir_in_01;
225
        fir_in_03 <= fir_in_02;
226
        fir_in_04 <= fir_in_03;
227
        fir_in_05 <= fir_in_04;
228
        fir_in_06 <= fir_in_05;
229
        fir_in_07 <= fir_in_06;
230
        fir_in_08 <= fir_in_07;
231
        fir_in_09 <= fir_in_08;
232
        fir_in_10 <= fir_in_09;
233
        fir_in_11 <= fir_in_10;
234
        fir_in_12 <= fir_in_11;
235
        fir_in_13 <= fir_in_12;
236
        fir_in_14 <= fir_in_13;
237
        fir_in_15 <= fir_in_14;
238
        fir_in_16 <= fir_in_15;
239
 
240
        dmout     <= fir_out;
241
 
242
--   elsif (clear = '1') then -- can't be synthesized in Xilinx
243
--          dmout <= (others => '0');
244
 
245
   end if;
246
end process;
247
end structural;

powered by: WebSVN 2.1.0

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