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 46

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 46 arif_endro
-- ------------------------------------------------------------------------
2 39 arif_endro
-- Copyright (C) 2004 Arif Endro Nugroho
3 46 arif_endro
-- All rights reserved.
4 11 arif_endro
-- 
5 46 arif_endro
-- Redistribution and use in source and binary forms, with or without
6
-- modification, are permitted provided that the following conditions
7
-- are met:
8 11 arif_endro
-- 
9 46 arif_endro
-- 1. Redistributions of source code must retain the above copyright
10
--    notice, this list of conditions and the following disclaimer.
11
-- 2. Redistributions in binary form must reproduce the above copyright
12
--    notice, this list of conditions and the following disclaimer in the
13
--    documentation and/or other materials provided with the distribution.
14 11 arif_endro
-- 
15 46 arif_endro
-- THIS SOFTWARE IS PROVIDED BY ARIF ENDRO NUGROHO "AS IS" AND ANY EXPRESS
16
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
-- DISCLAIMED. IN NO EVENT SHALL ARIF ENDRO NUGROHO BE LIABLE FOR ANY
19
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21
-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22
-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23
-- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
24
-- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
-- POSSIBILITY OF SUCH DAMAGE.
26 11 arif_endro
-- 
27 46 arif_endro
-- End Of License.
28
-- ------------------------------------------------------------------------
29 2 arif_endro
 
30
library IEEE;
31
use IEEE.STD_LOGIC_1164.all;
32
 
33
entity nco is
34
      port (
35
           clock       : in  bit;
36
           clear       : in  bit;
37
           input_nco   : in  bit_vector (17 downto 0);
38
           offset      : in  bit_vector (17 downto 0);
39
           output_nco  : out bit_vector (07 downto 0)
40
           );
41
end nco;
42
 
43
architecture structural of nco is
44
   component addacc
45
     port (
46
           clock       : in  bit;
47
           acc         : in  bit_vector (17 downto 0);
48
           result      : out bit_vector (17 downto 0);
49
           offset      : in  bit_vector (17 downto 0)
50
           );
51
   end component;
52
 
53
   component rom
54
     port (
55
           address     : in  bit_vector (09 downto 0);
56
           data        : out bit_vector (07 downto 0)
57
           );
58
   end component;
59
 
60
   signal adder_output : bit_vector (17 downto 0);
61
   signal address_in   : bit_vector (09 downto 0);
62
   signal output_rom   : bit_vector (07 downto 0);
63
 
64
begin
65
 
66
 myaddacc  : addacc
67
     port map (
68
              clock                 => clock,
69
              acc                   => input_nco,
70
              result (17 downto 0)  => adder_output,
71
              offset                => offset
72
              );
73
 myrom     : rom
74
     port map (
75
              address (09 downto 0) => address_in,
76
              data    (07 downto 0) => output_rom
77
              );
78
 
79 11 arif_endro
   address_in (09) <= (adder_output(17));
80
   address_in (08) <= (adder_output(16));
81
   address_in (07) <= (adder_output(15));
82
   address_in (06) <= (adder_output(14));
83
   address_in (05) <= (adder_output(13));
84
   address_in (04) <= (adder_output(12));
85
   address_in (03) <= (adder_output(11));
86
   address_in (02) <= (adder_output(10));
87
   address_in (01) <= (adder_output(09));
88
   address_in (00) <= (adder_output(08));
89
 
90 23 arif_endro
--   process (clock, clear)
91
   process (clock)
92 11 arif_endro
 
93
   begin
94
 
95 23 arif_endro
-- 20080625
96
-- fixme
97
-- how to enable clear signal in here... :(
98 11 arif_endro
 
99 23 arif_endro
--   if    (clear = '1') then
100
   if ((clock = '1') and clock'event) then
101 11 arif_endro
 
102 23 arif_endro
--      output_nco      <= (others => '0');
103 11 arif_endro
 
104 23 arif_endro
--   elsif (((clock = '1') and (not(clear) = '1')) and clock'event) then
105
 
106 11 arif_endro
        output_nco (07) <= (output_rom(07));
107
        output_nco (06) <= (output_rom(06));
108
        output_nco (05) <= (output_rom(05));
109
        output_nco (04) <= (output_rom(04));
110
        output_nco (03) <= (output_rom(03));
111
        output_nco (02) <= (output_rom(02));
112
        output_nco (01) <= (output_rom(01));
113
        output_nco (00) <= (output_rom(00));
114
 
115
   end if;
116
 
117
   end process;
118
 
119 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.