OpenCores
URL https://opencores.org/ocsvn/vhdl-pipeline-mips/vhdl-pipeline-mips/trunk

Subversion Repositories vhdl-pipeline-mips

[/] [vhdl-pipeline-mips/] [trunk/] [shared_components/] [adder.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 elujan
--
2
-- Sumador convencional. Usado en las etapas etapas IF y EX. 
3
--
4
-- Licencia: Copyright 2008 Emmanuel Luján
5
--
6
--      This program is free software; you can redistribute it and/or
7
--      modify it under the terms of the GNU General Public License as
8
--      published by the Free Software Foundation; either version 2 of
9
--      the License, or (at your option) any later version. This program
10
--      is distributed in the hope that it will be useful, but WITHOUT
11
--      ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12
--      or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13
--      License for more details. You should have received a copy of the
14
--      GNU General Public License along with this program; if not, write
15
--      to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
16
--      Boston, MA 02110-1301 USA.
17
-- 
18
-- Autor:       Emmanuel Luján
19
-- Email:       info@emmanuellujan.com.ar
20
-- Versión:    1.0
21
--
22
 
23
library ieee;
24
use ieee.STD_LOGIC_1164.all;
25
use ieee.numeric_std.all;
26
 
27
entity ADDER is
28
        generic (N: natural);
29
        port(
30
                X       : in    STD_LOGIC_VECTOR(N-1 downto 0);
31
                Y       : in    STD_LOGIC_VECTOR(N-1 downto 0);
32
                CIN     : in    STD_LOGIC;
33
                COUT    : out   STD_LOGIC;
34
                R       : out   STD_LOGIC_VECTOR(N-1 downto 0)
35
        );
36
end ADDER;
37
 
38
architecture ADDER_ARC of ADDER is
39
 
40
--Declaración de componentes
41
 
42
        component FULL_ADDER is
43
            port(
44
                        X       : in    STD_LOGIC;
45
                        Y       : in    STD_LOGIC;
46
                        CIN     : in    STD_LOGIC;
47
                        COUT    : out   STD_LOGIC;
48
                        R       : out   STD_LOGIC
49
            );
50
        end component FULL_ADDER;
51
 
52
--Declaración de señales
53
 
54
        signal CAUX :   STD_LOGIC_VECTOR (N-1 downto 0);
55
 
56
begin
57
 
58
        BEGIN_FA:
59
                FULL_ADDER port map (
60
                        X       => X(0),
61
                        Y       => Y(0),
62
                        CIN     => CIN,
63
                        COUT    => CAUX(0),
64
                        R       => R(0)
65
                );
66
        GEN_ADDER:
67
                for i in 1 to N-1 generate
68
                        NEXT_FA:
69
                                FULL_ADDER port map (
70
                                        X       => X(i),
71
                                        Y       => Y(i),
72
                                        CIN     => CAUX(i-1),
73
                                        COUT=> CAUX(i),
74
                                        R       => R(i)
75
                                );
76
                end generate;
77
        COUT <= CAUX(N-1);
78
 
79
end ADDER_ARC;

powered by: WebSVN 2.1.0

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