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 11

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

Line No. Rev Author Line
1 11 arif_endro
-- $Id: nco.vhdl,v 1.2 2005-02-21 06:28:20 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 11 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 11 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
use IEEE.STD_LOGIC_arith.all;
45
 
46
entity nco is
47
      port (
48
           clock       : in  bit;
49
           clear       : in  bit;
50
           input_nco   : in  bit_vector (17 downto 0);
51
           offset      : in  bit_vector (17 downto 0);
52
           output_nco  : out bit_vector (07 downto 0)
53
           );
54
end nco;
55
 
56
architecture structural of nco is
57
   component addacc
58
     port (
59
           clock       : in  bit;
60
           acc         : in  bit_vector (17 downto 0);
61
           result      : out bit_vector (17 downto 0);
62
           offset      : in  bit_vector (17 downto 0)
63
           );
64
   end component;
65
 
66
   component rom
67
     port (
68
           address     : in  bit_vector (09 downto 0);
69
           data        : out bit_vector (07 downto 0)
70
           );
71
   end component;
72
 
73
   signal adder_output : bit_vector (17 downto 0);
74
   signal address_in   : bit_vector (09 downto 0);
75
   signal output_rom   : bit_vector (07 downto 0);
76
 
77
begin
78
 
79
 myaddacc  : addacc
80
     port map (
81
              clock                 => clock,
82
              acc                   => input_nco,
83
              result (17 downto 0)  => adder_output,
84
              offset                => offset
85
              );
86
 myrom     : rom
87
     port map (
88
              address (09 downto 0) => address_in,
89
              data    (07 downto 0) => output_rom
90
              );
91
 
92 11 arif_endro
   address_in (09) <= (adder_output(17));
93
   address_in (08) <= (adder_output(16));
94
   address_in (07) <= (adder_output(15));
95
   address_in (06) <= (adder_output(14));
96
   address_in (05) <= (adder_output(13));
97
   address_in (04) <= (adder_output(12));
98
   address_in (03) <= (adder_output(11));
99
   address_in (02) <= (adder_output(10));
100
   address_in (01) <= (adder_output(09));
101
   address_in (00) <= (adder_output(08));
102
 
103
   process (clock, clear)
104
 
105
   begin
106
 
107
   if    (clear = '1') then
108
 
109
        output_nco      <= (others => '0');
110
 
111
   elsif (((clock = '1') and (not(clear) = '1')) and clock'event) then
112
 
113
        output_nco (07) <= (output_rom(07));
114
        output_nco (06) <= (output_rom(06));
115
        output_nco (05) <= (output_rom(05));
116
        output_nco (04) <= (output_rom(04));
117
        output_nco (03) <= (output_rom(03));
118
        output_nco (02) <= (output_rom(02));
119
        output_nco (01) <= (output_rom(01));
120
        output_nco (00) <= (output_rom(00));
121
 
122
   end if;
123
 
124
   end process;
125
 
126 2 arif_endro
end structural;

powered by: WebSVN 2.1.0

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