Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

vhdl code for MUX(1-16)

Status
Not open for further replies.

arunapai

Junior Member level 2
Joined
Apr 13, 2007
Messages
21
Helped
8
Reputation
16
Reaction score
5
Trophy points
1,283
Activity points
1,429
vhdl code for mux

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

lordsathish

Full Member level 5
Joined
Feb 11, 2006
Messages
247
Helped
33
Reputation
66
Reaction score
3
Trophy points
1,298
Location
Asia
Activity points
2,698
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;
 

gck

Full Member level 3
Joined
Oct 17, 2006
Messages
173
Helped
26
Reputation
52
Reaction score
19
Trophy points
1,298
Activity points
2,220
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
 

vizard356

Newbie level 6
Joined
Aug 10, 2007
Messages
14
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,370
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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top