-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcarry_bypass_block.vhd
68 lines (58 loc) · 1.25 KB
/
carry_bypass_block.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
--Bloque del sumador carry bypass
--Bloque de 4 bits
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity carry_bypass_block is
port (
sigp : in std_logic_vector(3 downto 0);
sigg : in std_logic_vector(3 downto 0);
cin : in std_logic;
cout : out std_logic;
sum : out std_logic_vector(3 downto 0)
);
end carry_bypass_block;
architecture cbb_arch of carry_bypass_block is
COMPONENT FA_m is
port (
g : in std_logic;
p : in std_logic;
ci : in std_logic;
co : out std_logic;
sum : out std_logic
);
end COMPONENT;
signal carry : std_logic_vector (3 downto 0);
signal all_p : std_logic;
begin
fa0 : FA_m
PORT MAP (
g => sigg(0),
p => sigp(0),
ci => cin,
co => carry(0),
sum => sum(0));
fa1 : FA_m
PORT MAP (
g => sigg(1),
p => sigp(1),
ci => carry(0),
co => carry(1),
sum => sum(1));
fa2 : FA_m
PORT MAP (
g => sigg(2),
p => sigp(2),
ci => carry(1),
co => carry(2),
sum => sum(2));
fa3 : FA_m
PORT MAP (
g => sigg(3),
p => sigp(3),
ci => carry(2),
co => carry(3),
sum => sum(3));
all_p <= sigp(0) AND sigp(1) AND sigp(2) AND sigp(3);
cout <= cin when all_p = '1' else carry(3);
end cbb_arch;