-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRCA.vhd
43 lines (36 loc) · 930 Bytes
/
RCA.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
library ieee;
use ieee.std_logic_1164.ALL;
entity RCA is
generic(width: integer);
port(
X : in std_logic_vector (width - 1 downto 0);
Y : in std_logic_vector (width - 1 downto 0);
CIN : in std_logic;
S : out std_logic_vector (width - 1 downto 0);
COUT : out std_logic
);
end RCA;
architecture STRUCT of RCA is
component FA is
port(
X : in std_logic;
Y : in std_logic;
CIN : in std_logic;
S : out std_logic;
COUT : out std_logic
);
end component;
signal C: std_logic_vector(width downto 0);
begin
GEN: for I in 0 to width - 1 generate
U: FA port map(
X => X(I),
Y => Y(I),
CIN => C(I),
S => S(I),
COUT => C(I + 1)
);
end generate;
C(0) <= CIN;
COUT <= C(width);
end STRUCT;