Вы находитесь на странице: 1из 1

INFOOP2R.WIX.

COM/OP2R

MUX VHDL CODE USING BEHAVIOURAL MODELING

Library declaration
library IEEE;
Std_logic_1164; package for std_logic (predefined data type).
use IEEE.STD_LOGIC_1164.ALL;
------------------------------------------------------------------------

Entity declaration.
i :- input port bits.
Sel: select lines for selecting a particular
input in mux.
y: - output port bits.

entity mux_1 is
Port ( i: in std_logic_vector(3 downto 0);
sel: in std_logic_vector (1 downto 0);
y: out STD_LOGIC);
end mux_1;
----------------------------------------------------------------------architecture Behavioral_mux of mux_1 is
begin
-------------------------------------------------------with sel select
y<= i(0) when "00",
i(1) when "01",
i(2) when "10",
i(3) when others;
------------------------------------------------------end Behavioral_mux;

RTL VIEW:-

INFOOP2R.WIX.COM/OP2R

OUT PUT WAVEFORMS

With select statement is used to select a


particular value, based on select line (sel).
In the last statement of with select, we
have to write others. See In last line of
the statement (with select), whatever will
be the value except 00, 01, 10 , the
output will be i(3).