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 14

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

Line No. Rev Author Line
1 14 arif_endro
-- $Id: fm.vhdl,v 1.3 2005-03-04 08:06:18 arif_endro Exp $
2 2 arif_endro
-------------------------------------------------------------------------------
3
-- Title       : FM core component
4
-- Project     : FM Receiver 
5
-------------------------------------------------------------------------------
6
-- File        : fm.vhdl
7
-- Author      : "Arif E. Nugroho" <arif_endro@yahoo.com>
8
-- Created     : 2004/12/06
9
-- Last update : 2005/01/03 
10 13 arif_endro
-- Simulators  : 
11 2 arif_endro
-- Synthesizers: 
12
-- Target      : 
13
-------------------------------------------------------------------------------
14
-- Description : FM core component to connect all other component
15
-------------------------------------------------------------------------------
16 13 arif_endro
-- Copyright (C) 2004 Arif E. Nugroho
17 2 arif_endro
-- 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 13 arif_endro
-------------------------------------------------------------------------------
21
-- 
22
--      THIS SOURCE FILE MAY BE USED AND DISTRIBUTED WITHOUT RESTRICTION
23
-- PROVIDED THAT THIS COPYRIGHT STATEMENT IS NOT REMOVED FROM THE FILE AND THAT
24
-- ANY DERIVATIVE WORK CONTAINS THE ORIGINAL COPYRIGHT NOTICE AND THE
25
-- ASSOCIATED DISCLAIMER.
26
-- 
27
-------------------------------------------------------------------------------
28
-- 
29
--      THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
30
-- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
31
-- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
32
-- EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
34
-- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
35
-- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
36
-- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
37
-- OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
38
-- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39
-- 
40
-------------------------------------------------------------------------------
41 2 arif_endro
 
42
library IEEE;
43
use IEEE.STD_LOGIC_1164.ALL;
44
 
45
entity fm is
46
 port (
47
  CLK                     : in  bit;
48
  RESET                   : in  bit;
49
  FMIN                    : in  bit_vector (07 downto 0);
50
  DMOUT                   : out bit_vector (11 downto 0)
51
  );
52
end fm;
53
 
54
architecture structural of fm is
55
 component nco
56
  port (
57
       clock              : in  bit;
58
       clear              : in  bit;
59
       input_nco          : in  bit_vector (17 downto 0);
60
       offset             : in  bit_vector (17 downto 0);
61
       output_nco         : out bit_vector (07 downto 0)
62
       );
63
 end component;
64
 component loop_filter
65
  port (
66
       input_loop         : in  bit_vector (07 downto 0);
67
       clock              : in  bit;
68
       output_loop        : out bit_vector (11 downto 0);
69
       clear              : in  bit
70
       );
71
 end component;
72
 component phase_detector
73
  port (
74
       clock              : in  bit;
75
       signal_input       : in  bit_vector (07 downto 0);
76
       signal_nco         : in  bit_vector (07 downto 0);
77
       phase_output       : out bit_vector (07 downto 0)
78
       );
79
 end component;
80
 component fir
81
  port (
82
       clock              : in  bit;
83
       clear              : in  bit;
84
       fir_in             : in  bit_vector (11 downto 0);
85
       dmout              : out bit_vector (11 downto 0)
86
       );
87
 end component;
88
-- internal signal
89
signal loop_out           : bit_vector (11 downto 0);
90
signal input_nco          : bit_vector (17 downto 0);
91
signal offset             : bit_vector (17 downto 0);
92
signal output_nco         : bit_vector (07 downto 0);
93
signal phase_output       : bit_vector (07 downto 0);
94
 
95
begin
96
-- offset values 1/16 equ B"000100000000000000" <18,0,u>
97
offset (17) <= '0' ;
98
offset (16) <= '0' ;
99
offset (15) <= '0' ;
100
offset (14) <= '1' ;
101
offset (13) <= '0' ;
102
offset (12) <= '0' ;
103
offset (11) <= '0' ;
104
offset (10) <= '0' ;
105
offset (9)  <= '0' ;
106
offset (8)  <= '0' ;
107
offset (7)  <= '0' ;
108
offset (6)  <= '0' ;
109
offset (5)  <= '0' ;
110
offset (4)  <= '0' ;
111
offset (3)  <= '0' ;
112
offset (2)  <= '0' ;
113
offset (1)  <= '0' ;
114
offset (0)  <= '0' ;
115
 
116
-- The constant that have great effect on the loop
117
-- it's a 1/16 divider it's has 5 step to change the output state with little
118
-- oscillation. it's can be make good shape by reducing the constant e.g 1/32
119
-- but it's has slower response time than 1/16 about 2 times e.g approx 10 step
120
-- to change the output state. if it's too big e.g (1) then there is no output
121
-- only oscilation if it's is to small e.g (1/1024) then output never return to
122
-- zero, so it's didn't change the output state.
123
 
124
input_nco (17) <= loop_out(11); -- 1
125
input_nco (16) <= loop_out(11); -- 1/2
126
input_nco (15) <= loop_out(11); -- 1/4
127
input_nco (14) <= loop_out(11); -- 1/8
128
input_nco (13) <= loop_out(11); -- 1/16
129
input_nco (12) <= loop_out(10); -- 1/32
130
input_nco (11) <= loop_out(09); -- 1/64
131
input_nco (10) <= loop_out(08); -- 1/128
132
input_nco (09) <= loop_out(07); -- 1/256
133
input_nco (08) <= loop_out(06); -- 1/512
134
input_nco (07) <= loop_out(05); -- 1/1024
135
input_nco (06) <= loop_out(04);
136
input_nco (05) <= loop_out(03);
137
input_nco (04) <= loop_out(02);
138
input_nco (03) <= loop_out(01);
139
input_nco (02) <= loop_out(00);
140
input_nco (01) <= loop_out(11);
141
input_nco (00) <= loop_out(11);
142
 
143
-- end divider 
144
mynco : nco
145
    port map (
146
    clock                      => CLK,
147
    clear                      => RESET,
148
    input_nco                  => input_nco,
149
    offset                     => offset,
150
    output_nco ( 7 downto 0)   => output_nco
151
    );
152
myfir : fir
153
    port map (
154
    clock                      => CLK,
155
    clear                      => RESET,
156
    fir_in                     => loop_out,
157
    dmout (11 downto 0)        => DMOUT
158
    );
159
myphase : phase_detector
160
    port map (
161
    clock                      => CLK,
162
    signal_input               => FMIN,
163
    signal_nco                 => output_nco,
164
    phase_output ( 7 downto 0) => phase_output
165
    );
166
myloop : loop_filter
167
    port map (
168
    input_loop                 => phase_output,
169
    clock                      => CLK,
170
    output_loop (11 downto 0)  => loop_out,
171
    clear                      => RESET
172
    );
173
end structural;

powered by: WebSVN 2.1.0

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