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

Subversion Repositories simple_fm_receiver

[/] [simple_fm_receiver/] [trunk/] [source/] [fm.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 13 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 13 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 13 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 13 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 fm is
34
 port (
35
  CLK                     : in  bit;
36
  RESET                   : in  bit;
37
  FMIN                    : in  bit_vector (07 downto 0);
38
  DMOUT                   : out bit_vector (11 downto 0)
39
  );
40
end fm;
41
 
42
architecture structural of fm is
43
 component nco
44
  port (
45
       clock              : in  bit;
46
       clear              : in  bit;
47
       input_nco          : in  bit_vector (17 downto 0);
48
       offset             : in  bit_vector (17 downto 0);
49
       output_nco         : out bit_vector (07 downto 0)
50
       );
51
 end component;
52
 component loop_filter
53
  port (
54
       input_loop         : in  bit_vector (07 downto 0);
55
       clock              : in  bit;
56
       output_loop        : out bit_vector (11 downto 0);
57
       clear              : in  bit
58
       );
59
 end component;
60
 component phase_detector
61
  port (
62
       clock              : in  bit;
63
       signal_input       : in  bit_vector (07 downto 0);
64
       signal_nco         : in  bit_vector (07 downto 0);
65
       phase_output       : out bit_vector (07 downto 0)
66
       );
67
 end component;
68
 component fir
69
  port (
70
       clock              : in  bit;
71
       clear              : in  bit;
72
       fir_in             : in  bit_vector (11 downto 0);
73
       dmout              : out bit_vector (11 downto 0)
74
       );
75
 end component;
76
-- internal signal
77
signal loop_out           : bit_vector (11 downto 0);
78
signal input_nco          : bit_vector (17 downto 0);
79
signal offset             : bit_vector (17 downto 0);
80
signal output_nco         : bit_vector (07 downto 0);
81
signal phase_output       : bit_vector (07 downto 0);
82
 
83
begin
84
-- offset values 1/16 equ B"000100000000000000" <18,0,u>
85
offset (17) <= '0' ;
86
offset (16) <= '0' ;
87
offset (15) <= '0' ;
88
offset (14) <= '1' ;
89
offset (13) <= '0' ;
90
offset (12) <= '0' ;
91
offset (11) <= '0' ;
92
offset (10) <= '0' ;
93
offset (9)  <= '0' ;
94
offset (8)  <= '0' ;
95
offset (7)  <= '0' ;
96
offset (6)  <= '0' ;
97
offset (5)  <= '0' ;
98
offset (4)  <= '0' ;
99
offset (3)  <= '0' ;
100
offset (2)  <= '0' ;
101
offset (1)  <= '0' ;
102
offset (0)  <= '0' ;
103
 
104 16 arif_endro
-- The constant that have big effect on the PLL loop.
105
-- This constant have big effect on system response, high values. (e.g 1/16),
106
-- will make the system have fast response time (e.g. quickly change state).
107
-- Otherwise if low values applied to this (e.g 1/32) will make the system
108
-- little slow response time but have smooth look's. Change it's as you like
109
-- to see the effect's. ^_^
110 2 arif_endro
 
111
input_nco (17) <= loop_out(11); -- 1
112
input_nco (16) <= loop_out(11); -- 1/2
113
input_nco (15) <= loop_out(11); -- 1/4
114
input_nco (14) <= loop_out(11); -- 1/8
115
input_nco (13) <= loop_out(11); -- 1/16
116 16 arif_endro
input_nco (12) <= loop_out(11); -- 1/32
117
input_nco (11) <= loop_out(10); -- 1/64
118
input_nco (10) <= loop_out(09); -- 1/128
119
input_nco (09) <= loop_out(08); -- 1/256
120
input_nco (08) <= loop_out(07); -- 1/512
121
input_nco (07) <= loop_out(06); -- 1/1024
122
input_nco (06) <= loop_out(05);
123
input_nco (05) <= loop_out(04);
124
input_nco (04) <= loop_out(03);
125
input_nco (03) <= loop_out(02);
126
input_nco (02) <= loop_out(01);
127
input_nco (01) <= loop_out(00);
128 2 arif_endro
input_nco (00) <= loop_out(11);
129
 
130
-- end divider 
131
mynco : nco
132
    port map (
133
    clock                      => CLK,
134
    clear                      => RESET,
135
    input_nco                  => input_nco,
136
    offset                     => offset,
137
    output_nco ( 7 downto 0)   => output_nco
138
    );
139
myfir : fir
140
    port map (
141
    clock                      => CLK,
142
    clear                      => RESET,
143
    fir_in                     => loop_out,
144
    dmout (11 downto 0)        => DMOUT
145
    );
146
myphase : phase_detector
147
    port map (
148
    clock                      => CLK,
149
    signal_input               => FMIN,
150
    signal_nco                 => output_nco,
151
    phase_output ( 7 downto 0) => phase_output
152
    );
153
myloop : loop_filter
154
    port map (
155
    input_loop                 => phase_output,
156
    clock                      => CLK,
157
    output_loop (11 downto 0)  => loop_out,
158
    clear                      => RESET
159
    );
160
end structural;

powered by: WebSVN 2.1.0

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