-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcarry_ripple_adder.vhd
54 lines (40 loc) · 1.2 KB
/
carry_ripple_adder.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
-----------------------------------------
--- Universidad Nacional de Asunción ----
-------- Facultad de Ingeniería ---------
--- Carrera de Ingeniería Electrónica ---
---- Cátedra de Sistemas Digitales 2 ----
-----------------------------------------
-- Autor: Abilio Mancuello Petters
-- Fecha: Jul/2020
library IEEE;
use IEEE.std_logic_1164.all;
entity carry_ripple_adder is
generic (
BITS : integer := 32
);
port (
OP1 : in std_logic_vector((BITS - 1) downto 0);
OP2 : in std_logic_vector((BITS - 1) downto 0);
CIN : in std_logic;
SUM : out std_logic_vector((BITS - 1) downto 0);
COUT : out std_logic
);
end carry_ripple_adder;
architecture struct of carry_ripple_adder is
component full_adder is
port (
OP1 : in std_logic;
OP2 : in std_logic;
CIN : in std_logic;
SUM : out std_logic;
COUT : out std_logic
);
end component;
signal carries : std_logic_vector((BITS) downto 0);
begin
carries(0) <= cin;
FA: for i in 0 to (BITS - 1) generate
FAX : full_adder port map (OP1(i), OP2(i), carries(i), SUM(i), carries(i+1));
end generate FA;
COUT <= carries(BITS);
end struct;