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 2

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

Line No. Rev Author Line
1 2 arif_endro
-- $Id: fm.vhdl,v 1.1.1.1 2005-01-04 02:05:58 arif_endro Exp $
2
-------------------------------------------------------------------------------
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
-- Simulators  : Modelsim 6.0
11
-- Synthesizers: 
12
-- Target      : 
13
-------------------------------------------------------------------------------
14
-- Description : FM core component to connect all other component
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 fm is
26
 port (
27
  CLK                     : in  bit;
28
  RESET                   : in  bit;
29
  FMIN                    : in  bit_vector (07 downto 0);
30
  DMOUT                   : out bit_vector (11 downto 0)
31
  );
32
end fm;
33
 
34
architecture structural of fm is
35
 component nco
36
  port (
37
       clock              : in  bit;
38
       clear              : in  bit;
39
       input_nco          : in  bit_vector (17 downto 0);
40
       offset             : in  bit_vector (17 downto 0);
41
       output_nco         : out bit_vector (07 downto 0)
42
       );
43
 end component;
44
 component loop_filter
45
  port (
46
       input_loop         : in  bit_vector (07 downto 0);
47
       clock              : in  bit;
48
       output_loop        : out bit_vector (11 downto 0);
49
       clear              : in  bit
50
       );
51
 end component;
52
 component phase_detector
53
  port (
54
       clock              : in  bit;
55
       signal_input       : in  bit_vector (07 downto 0);
56
       signal_nco         : in  bit_vector (07 downto 0);
57
       phase_output       : out bit_vector (07 downto 0)
58
       );
59
 end component;
60
 component fir
61
  port (
62
       clock              : in  bit;
63
       clear              : in  bit;
64
       fir_in             : in  bit_vector (11 downto 0);
65
       dmout              : out bit_vector (11 downto 0)
66
       );
67
 end component;
68
-- internal signal
69
signal loop_out           : bit_vector (11 downto 0);
70
signal input_nco          : bit_vector (17 downto 0);
71
signal offset             : bit_vector (17 downto 0);
72
signal output_nco         : bit_vector (07 downto 0);
73
signal phase_output       : bit_vector (07 downto 0);
74
 
75
begin
76
-- offset values 1/16 equ B"000100000000000000" <18,0,u>
77
offset (17) <= '0' ;
78
offset (16) <= '0' ;
79
offset (15) <= '0' ;
80
offset (14) <= '1' ;
81
offset (13) <= '0' ;
82
offset (12) <= '0' ;
83
offset (11) <= '0' ;
84
offset (10) <= '0' ;
85
offset (9)  <= '0' ;
86
offset (8)  <= '0' ;
87
offset (7)  <= '0' ;
88
offset (6)  <= '0' ;
89
offset (5)  <= '0' ;
90
offset (4)  <= '0' ;
91
offset (3)  <= '0' ;
92
offset (2)  <= '0' ;
93
offset (1)  <= '0' ;
94
offset (0)  <= '0' ;
95
 
96
-- The constant that have great effect on the loop
97
-- it's a 1/16 divider it's has 5 step to change the output state with little
98
-- oscillation. it's can be make good shape by reducing the constant e.g 1/32
99
-- but it's has slower response time than 1/16 about 2 times e.g approx 10 step
100
-- to change the output state. if it's too big e.g (1) then there is no output
101
-- only oscilation if it's is to small e.g (1/1024) then output never return to
102
-- zero, so it's didn't change the output state.
103
 
104
input_nco (17) <= loop_out(11); -- 1
105
input_nco (16) <= loop_out(11); -- 1/2
106
input_nco (15) <= loop_out(11); -- 1/4
107
input_nco (14) <= loop_out(11); -- 1/8
108
input_nco (13) <= loop_out(11); -- 1/16
109
input_nco (12) <= loop_out(10); -- 1/32
110
input_nco (11) <= loop_out(09); -- 1/64
111
input_nco (10) <= loop_out(08); -- 1/128
112
input_nco (09) <= loop_out(07); -- 1/256
113
input_nco (08) <= loop_out(06); -- 1/512
114
input_nco (07) <= loop_out(05); -- 1/1024
115
input_nco (06) <= loop_out(04);
116
input_nco (05) <= loop_out(03);
117
input_nco (04) <= loop_out(02);
118
input_nco (03) <= loop_out(01);
119
input_nco (02) <= loop_out(00);
120
input_nco (01) <= loop_out(11);
121
input_nco (00) <= loop_out(11);
122
 
123
-- end divider 
124
mynco : nco
125
    port map (
126
    clock                      => CLK,
127
    clear                      => RESET,
128
    input_nco                  => input_nco,
129
    offset                     => offset,
130
    output_nco ( 7 downto 0)   => output_nco
131
    );
132
myfir : fir
133
    port map (
134
    clock                      => CLK,
135
    clear                      => RESET,
136
    fir_in                     => loop_out,
137
    dmout (11 downto 0)        => DMOUT
138
    );
139
myphase : phase_detector
140
    port map (
141
    clock                      => CLK,
142
    signal_input               => FMIN,
143
    signal_nco                 => output_nco,
144
    phase_output ( 7 downto 0) => phase_output
145
    );
146
myloop : loop_filter
147
    port map (
148
    input_loop                 => phase_output,
149
    clock                      => CLK,
150
    output_loop (11 downto 0)  => loop_out,
151
    clear                      => RESET
152
    );
153
end structural;

powered by: WebSVN 2.1.0

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