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

Subversion Repositories simple_fm_receiver

[/] [simple_fm_receiver/] [trunk/] [source/] [nco.vhdl] - Blame information for rev 39

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

Line No. Rev Author Line
1 23 arif_endro
-- $Id: nco.vhdl,v 1.4 2008-06-26 06:16:04 arif_endro Exp $
2 2 arif_endro
-------------------------------------------------------------------------------
3
-- Title       : NCO (Numerical Controlled Oscillator)
4
-- Project     : FM Receiver 
5
-------------------------------------------------------------------------------
6
-- File        : nco.vhdl
7
-- Author      : "Arif E. Nugroho" <arif_endro@yahoo.com>
8
-- Created     : 2004/10/27
9 11 arif_endro
-- Last update : 
10
-- Simulators  : 
11 2 arif_endro
-- Synthesizers: 
12
-- Target      : 
13
-------------------------------------------------------------------------------
14
-- Description : Works like VCO in analog PLL
15
-------------------------------------------------------------------------------
16 39 arif_endro
-- Copyright (C) 2004 Arif Endro Nugroho
17 2 arif_endro
-------------------------------------------------------------------------------
18 11 arif_endro
-- 
19
--      THIS SOURCE FILE MAY BE USED AND DISTRIBUTED WITHOUT RESTRICTION
20
-- PROVIDED THAT THIS COPYRIGHT STATEMENT IS NOT REMOVED FROM THE FILE AND THAT
21
-- ANY DERIVATIVE WORK CONTAINS THE ORIGINAL COPYRIGHT NOTICE AND THE
22
-- ASSOCIATED DISCLAIMER.
23
-- 
24
-------------------------------------------------------------------------------
25
-- 
26
--      THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
27
-- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28
-- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
29
-- EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31
-- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
32
-- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
33
-- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34
-- OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
35
-- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
-- 
37
-------------------------------------------------------------------------------
38 2 arif_endro
 
39
library IEEE;
40
use IEEE.STD_LOGIC_1164.all;
41
 
42
entity nco is
43
      port (
44
           clock       : in  bit;
45
           clear       : in  bit;
46
           input_nco   : in  bit_vector (17 downto 0);
47
           offset      : in  bit_vector (17 downto 0);
48
           output_nco  : out bit_vector (07 downto 0)
49
           );
50
end nco;
51
 
52
architecture structural of nco is
53
   component addacc
54
     port (
55
           clock       : in  bit;
56
           acc         : in  bit_vector (17 downto 0);
57
           result      : out bit_vector (17 downto 0);
58
           offset      : in  bit_vector (17 downto 0)
59
           );
60
   end component;
61
 
62
   component rom
63
     port (
64
           address     : in  bit_vector (09 downto 0);
65
           data        : out bit_vector (07 downto 0)
66
           );
67
   end component;
68
 
69
   signal adder_output : bit_vector (17 downto 0);
70
   signal address_in   : bit_vector (09 downto 0);
71
   signal output_rom   : bit_vector (07 downto 0);
72
 
73
begin
74
 
75
 myaddacc  : addacc
76
     port map (
77
              clock                 => clock,
78
              acc                   => input_nco,
79
              result (17 downto 0)  => adder_output,
80
              offset                => offset
81
              );
82
 myrom     : rom
83
     port map (
84
              address (09 downto 0) => address_in,
85
              data    (07 downto 0) => output_rom
86
              );
87
 
88 11 arif_endro
   address_in (09) <= (adder_output(17));
89
   address_in (08) <= (adder_output(16));
90
   address_in (07) <= (adder_output(15));
91
   address_in (06) <= (adder_output(14));
92
   address_in (05) <= (adder_output(13));
93
   address_in (04) <= (adder_output(12));
94
   address_in (03) <= (adder_output(11));
95
   address_in (02) <= (adder_output(10));
96
   address_in (01) <= (adder_output(09));
97
   address_in (00) <= (adder_output(08));
98
 
99 23 arif_endro
--   process (clock, clear)
100
   process (clock)
101 11 arif_endro
 
102
   begin
103
 
104 23 arif_endro
-- 20080625
105
-- fixme
106
-- how to enable clear signal in here... :(
107 11 arif_endro
 
108 23 arif_endro
--   if    (clear = '1') then
109
   if ((clock = '1') and clock'event) then
110 11 arif_endro
 
111 23 arif_endro
--      output_nco      <= (others => '0');
112 11 arif_endro
 
113 23 arif_endro
--   elsif (((clock = '1') and (not(clear) = '1')) and clock'event) then
114
 
115 11 arif_endro
        output_nco (07) <= (output_rom(07));
116
        output_nco (06) <= (output_rom(06));
117
        output_nco (05) <= (output_rom(05));
118
        output_nco (04) <= (output_rom(04));
119
        output_nco (03) <= (output_rom(03));
120
        output_nco (02) <= (output_rom(02));
121
        output_nco (01) <= (output_rom(01));
122
        output_nco (00) <= (output_rom(00));
123
 
124
   end if;
125
 
126
   end process;
127
 
128 2 arif_endro
end structural;

powered by: WebSVN 2.1.0

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