1 |
14 |
arif_endro |
-- $Id: addacc.vhdl,v 1.3 2005-03-04 08:06:10 arif_endro Exp $
|
2 |
2 |
arif_endro |
-------------------------------------------------------------------------------
|
3 |
|
|
-- Title : Accumulator and Adder
|
4 |
|
|
-- Project : FM Receiver
|
5 |
|
|
-------------------------------------------------------------------------------
|
6 |
|
|
-- File : addacc.vhdl
|
7 |
|
|
-- Author : "Arif E. Nugroho" <arif_endro@yahoo.com>
|
8 |
|
|
-- Created : 2004/10/25
|
9 |
13 |
arif_endro |
-- Last update :
|
10 |
|
|
-- Simulators :
|
11 |
2 |
arif_endro |
-- Synthesizers:
|
12 |
|
|
-- Target :
|
13 |
|
|
-------------------------------------------------------------------------------
|
14 |
|
|
-- Description : Accumulator used in NCO of PLL in FM Receiver
|
15 |
|
|
-------------------------------------------------------------------------------
|
16 |
13 |
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 |
13 |
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 addacc is
|
46 |
|
|
port (
|
47 |
|
|
clock : in bit;
|
48 |
|
|
acc : in bit_vector (17 downto 0);
|
49 |
|
|
result : out bit_vector (17 downto 0);
|
50 |
|
|
offset : in bit_vector (17 downto 0)
|
51 |
|
|
);
|
52 |
|
|
end addacc;
|
53 |
|
|
|
54 |
|
|
architecture structural of addacc is
|
55 |
|
|
component adder_18bit
|
56 |
|
|
port (
|
57 |
|
|
addend_18bit : in bit_vector (17 downto 0);
|
58 |
|
|
augend_18bit : in bit_vector (17 downto 0);
|
59 |
|
|
adder18_output : out bit_vector (17 downto 0)
|
60 |
|
|
);
|
61 |
|
|
end component;
|
62 |
|
|
|
63 |
|
|
signal result_adder01 : bit_vector (17 downto 0);
|
64 |
|
|
signal result_adder02 : bit_vector (17 downto 0);
|
65 |
|
|
signal result_adder02_reg : bit_vector (17 downto 0);
|
66 |
|
|
|
67 |
|
|
begin
|
68 |
|
|
adder01 : adder_18bit
|
69 |
|
|
port map (
|
70 |
|
|
addend_18bit => offset,
|
71 |
|
|
augend_18bit => acc,
|
72 |
|
|
adder18_output => result_adder01
|
73 |
|
|
);
|
74 |
|
|
adder02 : adder_18bit
|
75 |
|
|
port map (
|
76 |
|
|
addend_18bit => result_adder01,
|
77 |
|
|
augend_18bit => result_adder02_reg,
|
78 |
|
|
adder18_output => result_adder02
|
79 |
|
|
);
|
80 |
|
|
process (clock)
|
81 |
|
|
begin
|
82 |
|
|
if ((clock = '1') and clock'event) then
|
83 |
|
|
result_adder02_reg <= result_adder02;
|
84 |
|
|
result <= result_adder02;
|
85 |
|
|
end if;
|
86 |
|
|
end process;
|
87 |
|
|
end structural;
|