-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrca_generic.vhd
More file actions
38 lines (29 loc) · 850 Bytes
/
rca_generic.vhd
File metadata and controls
38 lines (29 loc) · 850 Bytes
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
library ieee;
use ieee.std_logic_1164.all;
use WORK.constants.all;
entity rca_generic is --Ripple Carry Adder
generic (NBIT: integer:=NumBit);
Port( a: in std_logic_vector(NBIT-1 downto 0);
b: in std_logic_vector(NBIT-1 downto 0);
ci: in std_logic;
s: out std_logic_vector(NBIT-1 downto 0);
co: out std_logic);
end rca_generic;
architecture structural of rca_generic is
component FA
Port( a: in std_logic;
b: in std_logic;
ci: in std_logic;
s: out std_logic;
co: out std_logic);
end component;
signal s_tmp : std_logic_vector(NBIT-1 downto 0);
signal c_tmp : std_logic_vector(NBIT downto 0);
begin
c_tmp(0) <= ci;
ADDER1: for i in 1 to NBIT generate
FAI : FA Port Map (a(i-1), b(i-1), c_tmp(i-1), s_tmp(i-1), c_tmp(i));
end generate;
s <= s_tmp;
co <= c_tmp(NBIT);
end structural;