-
Notifications
You must be signed in to change notification settings - Fork 0
/
logic_slice.vhd
88 lines (70 loc) · 2.13 KB
/
logic_slice.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
----------------------------------------------------------------------------------
-- Company:
-- Engineer: Umar Farouk Umar
--
-- Create Date: 22:06:17 10/26/2010
-- Design Name:
-- Module Name: logic_slice - 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;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity logic_slice is
Port ( InA : in STD_LOGIC;
InB : in STD_LOGIC;
InControl : in STD_LOGIC_VECTOR(1 downto 0);
OutC : out STD_LOGIC);
end logic_slice;
architecture Behavioral of logic_slice is
component not_gate
Port ( InA : in STD_LOGIC;
OutB : out STD_LOGIC);
end component;
component and_gate
Port ( InA : in STD_LOGIC;
InB : in STD_LOGIC;
OutC : out STD_LOGIC);
end component;
component xor_gate
Port ( InA : in STD_LOGIC;
InB : in STD_LOGIC;
OutC : out STD_LOGIC);
end component;
component or_gate
Port ( InA : in STD_LOGIC;
InB : in STD_LOGIC;
OutC : out STD_LOGIC);
end component;
component four_input_multiplexer
Port ( InA : in STD_LOGIC;
InB : in STD_LOGIC;
InC : in STD_LOGIC;
InD : in STD_LOGIC;
InControl : in STD_LOGIC_VECTOR(1 downto 0);
OutE : out STD_LOGIC);
end component;
signal Sig1, Sig2, Sig3, Sig4 : STD_LOGIC;
begin
not_gate_i : not_gate port map (InA, Sig1);
and_gate_i : and_gate port map (InA, InB, Sig2);
xor_gate_i : xor_gate port map (InA, InB, Sig3);
or_gate_i : or_gate port map (InA, InB, Sig4);
four_input_multiplexer_i : four_input_multiplexer port map (Sig1, Sig2, Sig3, Sig4, InControl, OutC);
end Behavioral;