-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnbitTwoInputMux_VHDL.vhd
36 lines (28 loc) · 985 Bytes
/
nbitTwoInputMux_VHDL.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
-- Engineer: Stavros Kalapothas
-- Create Date: 4/1/2020
-- Project Name: ask2
-- based on: https://github.com/pjbal
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
--define ports
entity nbitTwoInputMux_VHDL is
generic (n: positive := 4);
Port ( InA : in STD_LOGIC_VECTOR (n-1 downto 0);
InB : in STD_LOGIC_VECTOR (n-1 downto 0);
Control : in STD_LOGIC;
Output : out STD_LOGIC_VECTOR (n-1 downto 0));
end nbitTwoInputMux_VHDL;
architecture Behavioral of nbitTwoInputMux_VHDL is
--define two input muliplexors I/O ports
component TwoInputMultiplexor_VHDL is
Port ( a : in STD_LOGIC;
b : in STD_LOGIC;
Con : in STD_LOGIC;
d : out STD_LOGIC);
end component;
begin
--loop through all n muliplexors
init: for i in (n-1) downto 0 generate
initTwoInMux: TwoInputMultiplexor_VHDL port map (InA(i), InB(i), Control, Output(i));--add port relationship of two input mux
end generate;
end Behavioral;