-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalu.vhd
68 lines (53 loc) · 1.67 KB
/
alu.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
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 15:12:21 02/22/2009
-- Design Name:
-- Module Name: alu - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity alu is
Port ( avect : in STD_LOGIC_VECTOR(3 downto 0);
bvect : in STD_LOGIC_VECTOR(3 downto 0);
carryin : in STD_LOGIC;
sel : in STD_LOGIC;
carryout : out STD_LOGIC;
sum : out STD_LOGIC_VECTOR(3 downto 0));
end alu;
architecture Behavioral of alu is
component FullAdderVector
Port ( avect : in STD_LOGIC_VECTOR(3 downto 0);
bvect : in STD_LOGIC_VECTOR(3 downto 0);
carryin : in STD_LOGIC;
carryout : out STD_LOGIC;
sumvect : out STD_LOGIC_VECTOR(3 downto 0));
end component;
component submux
Port ( bvect : in STD_LOGIC_VECTOR (3 downto 0);
sel : in STD_LOGIC;
bvectsum : out STD_LOGIC_VECTOR(3 downto 0));
end component;
signal bvectsum : STD_LOGIC_VECTOR(3 downto 0);
begin
SubMux1: submux port map (bvect, sel, bvectsum);
X1: FullAdderVector port map (avect, bvectsum, carryin, carryout, sum);
end Behavioral;