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

Subversion Repositories simple_fm_receiver

[/] [simple_fm_receiver/] [trunk/] [source/] [loop_filter.vhdl] - Blame information for rev 46

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 46 arif_endro
-- ------------------------------------------------------------------------
2 39 arif_endro
-- Copyright (C) 2004 Arif Endro Nugroho
3 46 arif_endro
-- All rights reserved.
4 11 arif_endro
-- 
5 46 arif_endro
-- Redistribution and use in source and binary forms, with or without
6
-- modification, are permitted provided that the following conditions
7
-- are met:
8 11 arif_endro
-- 
9 46 arif_endro
-- 1. Redistributions of source code must retain the above copyright
10
--    notice, this list of conditions and the following disclaimer.
11
-- 2. Redistributions in binary form must reproduce the above copyright
12
--    notice, this list of conditions and the following disclaimer in the
13
--    documentation and/or other materials provided with the distribution.
14 11 arif_endro
-- 
15 46 arif_endro
-- THIS SOFTWARE IS PROVIDED BY ARIF ENDRO NUGROHO "AS IS" AND ANY EXPRESS
16
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
-- DISCLAIMED. IN NO EVENT SHALL ARIF ENDRO NUGROHO BE LIABLE FOR ANY
19
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21
-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22
-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23
-- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
24
-- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
-- POSSIBILITY OF SUCH DAMAGE.
26 11 arif_endro
-- 
27 46 arif_endro
-- End Of License.
28
-- ------------------------------------------------------------------------
29 2 arif_endro
 
30
library IEEE;
31
use IEEE.STD_LOGIC_1164.ALL;
32
 
33
entity loop_filter is
34
  port (
35
     input_loop   : in  bit_vector (07 downto 0);
36
     clock        : in  bit;
37
     output_loop  : out bit_vector (11 downto 0);
38
     clear        : in  bit
39
     );
40
end loop_filter;
41
 
42
architecture structural of loop_filter is
43
 
44
  component adder_12bit
45
     port (
46
     addend_12bit   : in  bit_vector (11 downto 0);
47
     augend_12bit   : in  bit_vector (11 downto 0);
48
     adder12_output : out bit_vector (12 downto 0)
49
     );
50
  end component;
51
 
52
  component sub_12bit
53
     port (
54
     addend_12bit        : in  bit_vector (11 downto 0);
55
     subtrahend_12bit    : in  bit_vector (11 downto 0);
56
     subtractor12_output : out bit_vector (11 downto 0)
57
     );
58
  end component;
59
 
60
  signal input_recv        : bit_vector (11 downto 0);
61
  signal loop_out          : bit_vector (11 downto 0);
62
  signal loop_out_div      : bit_vector (11 downto 0);
63
  signal loop_out_back1    : bit_vector (11 downto 0);
64
  signal multiply_output01 : bit_vector (11 downto 0);
65
  signal adder_output01    : bit_vector (12 downto 0);
66
 
67
  begin
68
 
69
  input_recv (11) <= input_loop (07); -- 1
70
  input_recv (10) <= input_loop (07); -- 1/2
71
  input_recv (09) <= input_loop (07); -- 1/4
72
  input_recv (08) <= input_loop (07); -- 1/8
73
  input_recv (07) <= input_loop (07); -- 1/16
74
  input_recv (06) <= input_loop (06);
75
  input_recv (05) <= input_loop (05);
76
  input_recv (04) <= input_loop (04);
77
  input_recv (03) <= input_loop (03);
78
  input_recv (02) <= input_loop (02);
79
  input_recv (01) <= input_loop (01);
80
  input_recv (00) <= input_loop (00);
81
 
82
adder01 : adder_12bit
83
  port map (
84
          addend_12bit    => loop_out_div,
85
          augend_12bit    => input_recv,
86
          adder12_output  => adder_output01
87
          );
88
 
89
  loop_out_back1(11)  <= loop_out(11); -- 1
90
  loop_out_back1(10)  <= loop_out(11); -- 1/2
91
  loop_out_back1(09)  <= loop_out(11); -- 1/4
92
  loop_out_back1(08)  <= loop_out(11); -- 1/8
93
  loop_out_back1(07)  <= loop_out(11); -- 1/16
94
  loop_out_back1(06)  <= loop_out(10);
95
  loop_out_back1(05)  <= loop_out(09);
96
  loop_out_back1(04)  <= loop_out(08);
97
  loop_out_back1(03)  <= loop_out(07);
98
  loop_out_back1(02)  <= loop_out(06);
99
  loop_out_back1(01)  <= loop_out(05);
100
  loop_out_back1(00)  <= loop_out(04);
101
 
102
multiply01 : sub_12bit
103
  port map (
104
          addend_12bit               => loop_out,
105
          subtrahend_12bit           => loop_out_back1,
106
          subtractor12_output        => multiply_output01
107
          );
108
 
109
  loop_out_div <= multiply_output01;
110
 
111 23 arif_endro
-- 20080625
112
-- fixme
113
-- how to enable clear signal in here... :(
114 2 arif_endro
 
115 23 arif_endro
--  process (clock, clear)
116
  process (clock)
117
 
118 2 arif_endro
  begin
119
 
120 23 arif_endro
--  if    (clear = '1') then
121
  if ((clock = '1') and clock'event) then
122 2 arif_endro
 
123 23 arif_endro
--      loop_out      <= (others => '0');
124 2 arif_endro
 
125 23 arif_endro
--  elsif (((clock = '1') and (not(clear) = '1')) and clock'event) then
126 2 arif_endro
 
127 11 arif_endro
        -- loop_out (11) <= adder_output01 (12);
128
        loop_out (11) <= adder_output01 (11);
129
        loop_out (10) <= adder_output01 (10);
130
        loop_out (09) <= adder_output01 (09);
131
        loop_out (08) <= adder_output01 (08);
132
        loop_out (07) <= adder_output01 (07);
133
        loop_out (06) <= adder_output01 (06);
134
        loop_out (05) <= adder_output01 (05);
135
        loop_out (04) <= adder_output01 (04);
136
        loop_out (03) <= adder_output01 (03);
137
        loop_out (02) <= adder_output01 (02);
138
        loop_out (01) <= adder_output01 (01);
139
        loop_out (00) <= adder_output01 (00);
140
 
141 2 arif_endro
  end if;
142 11 arif_endro
 
143 2 arif_endro
  end process;
144
 
145 11 arif_endro
  output_loop    <= loop_out;
146 2 arif_endro
 
147
end structural;

powered by: WebSVN 2.1.0

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