Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

vhdl code for MUX(1-16)

Status
Not open for further replies.
vhdl code for mux

What is your spec? How do wanna realize the MUX?
 

vhdl code mux

Hi this is a 8x1 mux... you can make 16x1 from it...

LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;

ENTITY mux IS
port(s:in std_logic_vector(2 downto 0);
inp:in std_logic_vector(7 downto 0);
op: out std_logic);
END ENTITY mux;

--
ARCHITECTURE mux OF mux IS
BEGIN
process(s,inp)
begin
case s is
when "000"=>op<=inp(0);
when "001"=>op<=inp(1);
when "010"=>op<=inp(2);
when "011"=>op<=inp(3);
when "100"=>op<=inp(4);
when "101"=>op<=inp(5);
when "110"=>op<=inp(6);
when others=>op<=inp(7);
end case;
end process;
END ARCHITECTURE mux;
 

vhdl code for 4 1 mux

hi,

you will get the idea for ur code from any VHDL book. As it is a basic unit digital system. Every book atleast has this
 

4 1 mux vhdl

lordsathish said:
Hi this is a 8x1 mux... you can make 16x1 from it...

LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;

ENTITY mux IS
port(s:in std_logic_vector(2 downto 0);
inp:in std_logic_vector(7 downto 0);
op: out std_logic);
END ENTITY mux;

--
ARCHITECTURE mux OF mux IS
BEGIN
process(s,inp)
begin
case s is
when "000"=>op<=inp(0);
when "001"=>op<=inp(1);
when "010"=>op<=inp(2);
when "011"=>op<=inp(3);
when "100"=>op<=inp(4);
when "101"=>op<=inp(5);
when "110"=>op<=inp(6);
when others=>op<=inp(7);
end case;
end process;
END ARCHITECTURE mux;

I think there is no need to use ieee.std_logic_arith.all library.
Besides you can also use GENERATE statement instead of case.
or use INTEGER as input so no need of case or generate statement.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top