Tuesday, December 15, 2020

Program for 4:1 Multiplexer using VHDL behavioral modelling.

--Program for 4 to 1 Multiplexer using VHDL behavioral modelling.

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity behav_MUX_4_1 is
Port ( S : in STD_LOGIC_VECTOR (1 downto 0);
I : in STD_LOGIC_VECTOR (3 downto 0);
Y : out STD_LOGIC);
end behav_MUX_4_1;
architecture Behavioral of behav_MUX_4_1 is
begin
process (S,I)
begin
if (S <= "00") then
Y <= I(0);
elsif (S <= "01") then
Y <= I(1);
elsif (S <= "10") then
Y <= I(2);
else
Y <= I(3);
end if;
end process;
end Behavioral;


For Safe Downloading of ModelSim (32/64 bit) please visit :-

For Safe Downloading of this program file please visit :-

Labels: , , , ,

Saturday, December 12, 2020

VHDL Program to implement 4:1 Multiplexer using Case statement.

--VHDL Program to implement 4 to 1 Multiplexer using Case statement.

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity MUX4_1 is
port(i:in STD_LOGIC_VECTOR(3 downto 0);
s:in STD_LOGIC_VECTOR(1 downto 0);
y: out STD_LOGIC);
end MUX4_1;
architecture dataflow of MUX4_1 is
begin
with s select
y<= i(0) when"00",
i(1) when"11",
i(2) when"10",
i(3) when others;
end dataflow;


For Safe Downloading of ModelSim (32/64 bit) please visit :-

For Safe Downloading of this program file please visit :-

Labels: , , , , ,

VHDL Program to implement 4:1 Multiplexer using If-Else statement

--VHDL Program to implement 4 to 1 Multiplexer using If-Else statement

library IEEE; 
use IEEE.STD_LOGIC_1164.all; 
entity multiplexer_4_1 is port( din : in STD_LOGIC_VECTOR(3 downto 0);
sel : in STD_LOGIC_VECTOR(1 downto 0); 
dout : out STD_LOGIC ); 
end multiplexer_4_1; 
architecture multiplexer4_1_arc of multiplexer_4_1 is begin mux : 
process (din,sel) is begin if (sel="00") then dout <= din(3); 
elsif (sel="01") then dout <= din(2); 
elsif (sel="10") then dout <= din(1); 
else dout <= din(0); 
end if; 
end process mux;
end multiplexer4_1_arc;


For Safe Downloading of ModelSim (32/64 bit) please visit :-

For Safe Downloading of this program file please visit :-

Labels: , , , , ,