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 32

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