SlideShare a Scribd company logo
1 of 20
Download to read offline
EXPERIMENT-1
Aim : Write a VHDL program to implement a multiplexer.
(i) 4:1 Multiplexer :
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity mux4to1 is
Port ( s : in STD_LOGIC_VECTOR (1 downto 0);
a : in STD_LOGIC_VECTOR (3 downto 0);
z : out STD_LOGIC);
end mux4to1;
architecture Behavioral of mux4to1 is
begin
process(s,a)
begin
if(s="00") then
z<= a(0);
elsif(s="01") then
z<= a(1);
elsif(s="10") then
z<= a(2);
else
z<= a(3);
end if;
end process;
end Behavioral;
OUTPUT :
(ii) 8:1 Multiplexer :
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity mux8to1 is
Port ( s : in STD_LOGIC_VECTOR (2 downto 0);
a : in STD_LOGIC_VECTOR (7 downto 0);
z : out STD_LOGIC);
end mux8to1;
architecture Behavioral of mux8to1 is
begin
process(s,a)
begin
if(s="000") then
z<= a(0);
elsif(s="001") then
z<= a(1);
elsif(s="010") then
z<= a(2);
elsif(s="011") then
z<= a(3);
elsif(s="100") then
z<= a(4);
elsif(s="101") then
z<= a(5);
elsif(s="110") then
z<= a(6);
else
z<= a(7);
end if;
end process;
end Behavioral;
OUTPUT :
EXPERIMENT-2
Aim : Write a VHDL program to implement a demultiplexer.
(i) 1:4 Demultiplexer :
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity demux1to4 is
Port ( s : in STD_LOGIC_VECTOR (1 downto 0);
i : in STD_LOGIC;
a : out STD_LOGIC_VECTOR (3 downto 0));
end demux1to4;
architecture Behavioral of demux1to4 is
begin
process(i,s)
begin
if(i='1') then
if(s="00") then
a<= "0001";
elsif(s="01") then
a<= "0010";
elsif(s="10") then
a<= "0100";
elsif(s="11") then
a<= "1000";
end if;
else
a<= "0000";
end if;
end process;
end Behavioral;
OUTPUT :
(ii) 1:8 Demultiplexer :
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity demux1to8 is
Port ( s : in STD_LOGIC_VECTOR (2 downto 0);
i : in STD_LOGIC;
a : out STD_LOGIC_VECTOR (7 downto 0));
end demux1to8;
architecture Behavioral of demux1to8 is
begin
process(i,s)
begin
if(i='1') then
if(s="000") then
a<= "00000001";
elsif(s="001") then
a<= "00000010";
elsif(s="010") then
a<= "00000100";
elsif(s="011") then
a<= "00001000";
elsif(s="100") then
a<= "00010000";
elsif(s="101") then
a<= "00100000";
elsif(s="110") then
a<= "01000000";
elsif(s="111") then
a<= "10000000";
end if;
else
a<= "00000000";
end if;
end process;
end Behavioral;
OUTPUT :
EXPERIMENT-3
Aim : Write a VHDL program to implement a 3:8 decoder.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity decoder3to8 is
Port ( i : in STD_LOGIC_VECTOR (2 downto 0);
en : in STD_LOGIC;
a : out STD_LOGIC_VECTOR (7 downto 0));
end decoder3to8;
architecture Behavioral of decoder3to8 is
begin
process(i,en)
begin
if(en='1') then
if(i="000") then
a<= "00000001";
elsif(i="001") then
a<= "00000010";
elsif(i="010") then
a<= "00000100";
elsif(i="011") then
a<= "00001000";
elsif(i="100") then
a<= "00010000";
elsif(i="101") then
a<= "00100000";
elsif(i="110") then
a<= "01000000";
elsif(i="111") then
a<= "10000000";
end if;
else
a<= "00000000";
end if;
end process;
end Behavioral;
OUTPUT :
EXPERIMENT-4
Aim: Write a VHDL program to implement a 4 bit adder.
--program for 1 bit full adder.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity fa is
Port ( x : in STD_LOGIC;
y : in STD_LOGIC;
c : in STD_LOGIC;
s : out STD_LOGIC;
co : out STD_LOGIC);
end fa;
architecture Behavioral of fa is
begin
s<= x xor y xor c;
co<= (x and y)or(y and c)or(c and x);
end Behavioral;
--program for 4 bit full adder.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity fa_4bit is
Port ( a : in STD_LOGIC_VECTOR (3 downto 0);
b : in STD_LOGIC_VECTOR (3 downto 0);
cin : in STD_LOGIC;
sum : out STD_LOGIC_VECTOR (3 downto 0);
cout : out STD_LOGIC);
end fa_4bit;
architecture Structural of fa_4bit is
signal cs : std_logic_vector (2 downto 0);
component fa
port (x : in STD_LOGIC;
y : in STD_LOGIC;
c : in STD_LOGIC;
s : out STD_LOGIC;
co : out STD_LOGIC);
end component;
begin
f1 : fa port map(a(0),b(0),cin,sum(0),cs(0));
f2 : fa port map(a(1),b(1),cs(0),sum(1),cs(1));
f3 : fa port map(a(2),b(2),cs(1),sum(2),cs(2));
f4 : fa port map(a(3),b(3),cs(2),sum(3),cout);
end Structural;
OUTPUT :
EXPERIMENT-5
Aim: Write a VHDL program to implement a 4 bit comparator.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity comprator_4bit is
Port ( a : in STD_LOGIC_VECTOR (3 downto 0);
b : in STD_LOGIC_VECTOR (3 downto 0);
less : out STD_LOGIC;
equal : out STD_LOGIC;
greater : out STD_LOGIC);
end comprator_4bit;
architecture Behavioral of comprator_4bit is
begin
process(a,b)
begin
if (a>b) then
greater <= '1';
equal <= '0';
less <= '0';
elsif (a<b) then
greater <= '0';
equal <= '0';
less <= '1';
else
greater <= '0';
equal <= '1';
less <= '0';
end if;
end process;
end Behavioral;
OUTPUT :
EXPERIMENT-6
Aim: Write a VHDL program to design a 2 bit ALU containing 4
arithmetic and 4 logical operations.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity alu_2bit is
Port ( a : in STD_LOGIC_VECTOR (1 downto 0);
b : in STD_LOGIC_VECTOR (1 downto 0);
sel : in STD_LOGIC_VECTOR (2 downto 0);
cin : in STD_LOGIC;
y : out STD_LOGIC_VECTOR (1 downto 0));
end alu_2bit;
architecture Behavioral of alu_2bit is
signal arith,logic : STD_LOGIC_VECTOR (1 downto 0);
begin
with sel(1 downto 0) select
arith <= a + 1 when "00",
a + b + cin when "01",
a - b when "10",
b + 1 when others;
with sel(1 downto 0) select
logic <= not a when "00",
a and b when "01",
a or b when "10",
a xor b when others;
with sel(2) select
y <= arith when '0',
logic when others;
end Behavioral;
OUTPUT :
EXPERIMENT-7
Aim: Write a VHDL program to design a D Flip Flop.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity dff is
Port ( d,clk, reset: in std_logic;
q : out std_logic);
end dff;
architecture Behavioral of dff is
begin
process (clk, d)
begin
if ( (d'event or clk'event) and clk='1') then
if RESET ='1' then
q <= '0' ;
else
q <= d after 1 us;
end if;
end if;
end process;
end Behavioral;
OUTPUT :
EXPERIMENT-8
Aim: Write a VHDL program to design a D Flip Flop.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity dff is
Port ( d,clk, reset: in std_logic;
q : out std_logic);
end dff;
architecture Behavioral of dff is
begin
process (clk, d)
begin
if ( (d'event or clk'event) and clk='1') then
if RESET ='1' then
q <= '0' ;
else
q <= d after 1 us;
end if;
end if;
end process;
end Behavioral;
OUTPUT :

More Related Content

What's hot

PIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTESPIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTESDr.YNM
 
Bcd to 7 segment display
Bcd to 7 segment displayBcd to 7 segment display
Bcd to 7 segment displayMaulik Sanchela
 
ASIP (Application-specific instruction-set processor)
ASIP (Application-specific instruction-set processor)ASIP (Application-specific instruction-set processor)
ASIP (Application-specific instruction-set processor)Hamid Reza
 
Full custom digital ic design of priority encoder
Full custom digital ic design of priority encoderFull custom digital ic design of priority encoder
Full custom digital ic design of priority encoderVishesh Thakur
 
MASTER SLAVE JK FLIP FLOP & T FLIP FLOP
MASTER SLAVE JK FLIP FLOP & T FLIP FLOPMASTER SLAVE JK FLIP FLOP & T FLIP FLOP
MASTER SLAVE JK FLIP FLOP & T FLIP FLOPSmit Shah
 
Verilog coding of demux 8 x1
Verilog coding of demux  8 x1Verilog coding of demux  8 x1
Verilog coding of demux 8 x1Rakesh kumar jha
 
Digital System Design Basics
Digital System Design BasicsDigital System Design Basics
Digital System Design Basicsanishgoel
 
Verilog data types -For beginners
Verilog data types -For beginnersVerilog data types -For beginners
Verilog data types -For beginnersDr.YNM
 
Verilog VHDL code Decoder and Encoder
Verilog VHDL code Decoder and EncoderVerilog VHDL code Decoder and Encoder
Verilog VHDL code Decoder and EncoderBharti Airtel Ltd.
 
Introduction to VLSI Design
Introduction to VLSI DesignIntroduction to VLSI Design
Introduction to VLSI DesignKalyan Acharjya
 
Verilog coding of mux 8 x1
Verilog coding of mux  8 x1Verilog coding of mux  8 x1
Verilog coding of mux 8 x1Rakesh kumar jha
 
Data flow model -Lecture-4
Data flow model -Lecture-4Data flow model -Lecture-4
Data flow model -Lecture-4Dr.YNM
 
INTERFACING ANALAOG TO DIGITAL CONVERTER (ADC0808/09) TO 8051 MICROCONTROLLER
 INTERFACING ANALAOG TO DIGITAL CONVERTER (ADC0808/09) TO 8051 MICROCONTROLLER   INTERFACING ANALAOG TO DIGITAL CONVERTER (ADC0808/09) TO 8051 MICROCONTROLLER
INTERFACING ANALAOG TO DIGITAL CONVERTER (ADC0808/09) TO 8051 MICROCONTROLLER SIRILsam
 
ANALOG TO DIGITAL CONVERTOR
ANALOG TO DIGITAL CONVERTORANALOG TO DIGITAL CONVERTOR
ANALOG TO DIGITAL CONVERTORAnil Yadav
 

What's hot (20)

PIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTESPIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTES
 
Bcd to 7 segment display
Bcd to 7 segment displayBcd to 7 segment display
Bcd to 7 segment display
 
ASIP (Application-specific instruction-set processor)
ASIP (Application-specific instruction-set processor)ASIP (Application-specific instruction-set processor)
ASIP (Application-specific instruction-set processor)
 
Full custom digital ic design of priority encoder
Full custom digital ic design of priority encoderFull custom digital ic design of priority encoder
Full custom digital ic design of priority encoder
 
MASTER SLAVE JK FLIP FLOP & T FLIP FLOP
MASTER SLAVE JK FLIP FLOP & T FLIP FLOPMASTER SLAVE JK FLIP FLOP & T FLIP FLOP
MASTER SLAVE JK FLIP FLOP & T FLIP FLOP
 
Verilog coding of demux 8 x1
Verilog coding of demux  8 x1Verilog coding of demux  8 x1
Verilog coding of demux 8 x1
 
Digital System Design Basics
Digital System Design BasicsDigital System Design Basics
Digital System Design Basics
 
Decimal adder
Decimal adderDecimal adder
Decimal adder
 
Behavioral modelling in VHDL
Behavioral modelling in VHDLBehavioral modelling in VHDL
Behavioral modelling in VHDL
 
VHDL CODES
VHDL CODES VHDL CODES
VHDL CODES
 
Verilog data types -For beginners
Verilog data types -For beginnersVerilog data types -For beginners
Verilog data types -For beginners
 
VERILOG CODE FOR Adder
VERILOG CODE FOR AdderVERILOG CODE FOR Adder
VERILOG CODE FOR Adder
 
Verilog VHDL code Decoder and Encoder
Verilog VHDL code Decoder and EncoderVerilog VHDL code Decoder and Encoder
Verilog VHDL code Decoder and Encoder
 
PIC Microcontrollers
PIC MicrocontrollersPIC Microcontrollers
PIC Microcontrollers
 
Introduction to VLSI Design
Introduction to VLSI DesignIntroduction to VLSI Design
Introduction to VLSI Design
 
Verilog coding of mux 8 x1
Verilog coding of mux  8 x1Verilog coding of mux  8 x1
Verilog coding of mux 8 x1
 
Data flow model -Lecture-4
Data flow model -Lecture-4Data flow model -Lecture-4
Data flow model -Lecture-4
 
INTERFACING ANALAOG TO DIGITAL CONVERTER (ADC0808/09) TO 8051 MICROCONTROLLER
 INTERFACING ANALAOG TO DIGITAL CONVERTER (ADC0808/09) TO 8051 MICROCONTROLLER   INTERFACING ANALAOG TO DIGITAL CONVERTER (ADC0808/09) TO 8051 MICROCONTROLLER
INTERFACING ANALAOG TO DIGITAL CONVERTER (ADC0808/09) TO 8051 MICROCONTROLLER
 
ANALOG TO DIGITAL CONVERTOR
ANALOG TO DIGITAL CONVERTORANALOG TO DIGITAL CONVERTOR
ANALOG TO DIGITAL CONVERTOR
 
Verilog lab manual (ECAD and VLSI Lab)
Verilog lab manual (ECAD and VLSI Lab)Verilog lab manual (ECAD and VLSI Lab)
Verilog lab manual (ECAD and VLSI Lab)
 

Viewers also liked

Katelyn Jennings Personal Resume
Katelyn Jennings Personal ResumeKatelyn Jennings Personal Resume
Katelyn Jennings Personal ResumeKatelyn Jennings
 
Lauren Buchholz BIS Tech Talk
Lauren Buchholz BIS Tech TalkLauren Buchholz BIS Tech Talk
Lauren Buchholz BIS Tech TalkLauren Buchholz
 
Katelyn Jennings Virtual Resume
Katelyn Jennings Virtual ResumeKatelyn Jennings Virtual Resume
Katelyn Jennings Virtual ResumeKatelyn Jennings
 
Caja automatica en español
Caja automatica  en españolCaja automatica  en español
Caja automatica en españolWilly Nina
 
Spring Staff Retreat 2015
Spring Staff Retreat 2015Spring Staff Retreat 2015
Spring Staff Retreat 2015uscsowk
 
Financial Crisis Informative Speech
Financial Crisis Informative SpeechFinancial Crisis Informative Speech
Financial Crisis Informative SpeechLauren Buchholz
 
The role of gingipains in the pathogenesis of periodontal diseases
The role of gingipains in the pathogenesis of periodontal diseasesThe role of gingipains in the pathogenesis of periodontal diseases
The role of gingipains in the pathogenesis of periodontal diseasesAnkita Jain
 
Bases Moleculares de la Nefrotoxicidad Inducida por Farmacos
Bases Moleculares de la Nefrotoxicidad Inducida por FarmacosBases Moleculares de la Nefrotoxicidad Inducida por Farmacos
Bases Moleculares de la Nefrotoxicidad Inducida por FarmacosJulio Albarran
 
The Netherland 2014
The Netherland 2014The Netherland 2014
The Netherland 2014syzwnrhms
 
Project report on dtmf based door opening system
Project report on  dtmf based door opening systemProject report on  dtmf based door opening system
Project report on dtmf based door opening systemMukul Mohal
 
Surgical anatomy of periodontal structures,
Surgical anatomy of periodontal structures,Surgical anatomy of periodontal structures,
Surgical anatomy of periodontal structures,Ankita Jain
 

Viewers also liked (20)

Katelyn Jennings Personal Resume
Katelyn Jennings Personal ResumeKatelyn Jennings Personal Resume
Katelyn Jennings Personal Resume
 
Ramirez ventura
Ramirez venturaRamirez ventura
Ramirez ventura
 
Lauren Buchholz BIS Tech Talk
Lauren Buchholz BIS Tech TalkLauren Buchholz BIS Tech Talk
Lauren Buchholz BIS Tech Talk
 
Katelyn Jennings Virtual Resume
Katelyn Jennings Virtual ResumeKatelyn Jennings Virtual Resume
Katelyn Jennings Virtual Resume
 
Caja automatica en español
Caja automatica  en españolCaja automatica  en español
Caja automatica en español
 
Lauren Buchholz T
Lauren Buchholz TLauren Buchholz T
Lauren Buchholz T
 
The verb time
The verb timeThe verb time
The verb time
 
Spring Staff Retreat 2015
Spring Staff Retreat 2015Spring Staff Retreat 2015
Spring Staff Retreat 2015
 
NEUMATON
NEUMATONNEUMATON
NEUMATON
 
Compare!
Compare!Compare!
Compare!
 
Financial Crisis Informative Speech
Financial Crisis Informative SpeechFinancial Crisis Informative Speech
Financial Crisis Informative Speech
 
Katelyn Jennings Resume
Katelyn Jennings ResumeKatelyn Jennings Resume
Katelyn Jennings Resume
 
Food piramid
Food piramidFood piramid
Food piramid
 
Practice english
Practice englishPractice english
Practice english
 
The role of gingipains in the pathogenesis of periodontal diseases
The role of gingipains in the pathogenesis of periodontal diseasesThe role of gingipains in the pathogenesis of periodontal diseases
The role of gingipains in the pathogenesis of periodontal diseases
 
Bases Moleculares de la Nefrotoxicidad Inducida por Farmacos
Bases Moleculares de la Nefrotoxicidad Inducida por FarmacosBases Moleculares de la Nefrotoxicidad Inducida por Farmacos
Bases Moleculares de la Nefrotoxicidad Inducida por Farmacos
 
Dsp lab manual
Dsp lab manualDsp lab manual
Dsp lab manual
 
The Netherland 2014
The Netherland 2014The Netherland 2014
The Netherland 2014
 
Project report on dtmf based door opening system
Project report on  dtmf based door opening systemProject report on  dtmf based door opening system
Project report on dtmf based door opening system
 
Surgical anatomy of periodontal structures,
Surgical anatomy of periodontal structures,Surgical anatomy of periodontal structures,
Surgical anatomy of periodontal structures,
 

Similar to Vhdl lab manual (20)

VHDL PROGRAMS FEW EXAMPLES
VHDL PROGRAMS FEW EXAMPLESVHDL PROGRAMS FEW EXAMPLES
VHDL PROGRAMS FEW EXAMPLES
 
Vhdlbputspdas
VhdlbputspdasVhdlbputspdas
Vhdlbputspdas
 
Programs of VHDL
Programs of VHDLPrograms of VHDL
Programs of VHDL
 
correctionTD-1-vhdl2947.pptx
correctionTD-1-vhdl2947.pptxcorrectionTD-1-vhdl2947.pptx
correctionTD-1-vhdl2947.pptx
 
vhdll.docx
vhdll.docxvhdll.docx
vhdll.docx
 
Vhdl programming
Vhdl programmingVhdl programming
Vhdl programming
 
correctionTD-2-vhdl2949.pptx
correctionTD-2-vhdl2949.pptxcorrectionTD-2-vhdl2949.pptx
correctionTD-2-vhdl2949.pptx
 
Vhdl
VhdlVhdl
Vhdl
 
Digital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECEDigital System Design Lab Report - VHDL ECE
Digital System Design Lab Report - VHDL ECE
 
Basic-VHDL-Constructs1.ppt
Basic-VHDL-Constructs1.pptBasic-VHDL-Constructs1.ppt
Basic-VHDL-Constructs1.ppt
 
Digital to analog -Sqaure waveform generator in VHDL
Digital to analog -Sqaure waveform generator in VHDLDigital to analog -Sqaure waveform generator in VHDL
Digital to analog -Sqaure waveform generator in VHDL
 
Vhdl
VhdlVhdl
Vhdl
 
Digital system design lab manual
Digital system design lab manualDigital system design lab manual
Digital system design lab manual
 
Reporte vhdl9
Reporte vhdl9Reporte vhdl9
Reporte vhdl9
 
Verilogforlab
VerilogforlabVerilogforlab
Verilogforlab
 
Vhdl
VhdlVhdl
Vhdl
 
Fpga creating counter with internal clock
Fpga   creating counter with internal clockFpga   creating counter with internal clock
Fpga creating counter with internal clock
 
hdl timer ppt.pptx
hdl timer ppt.pptxhdl timer ppt.pptx
hdl timer ppt.pptx
 
Reporte vhd10
Reporte vhd10Reporte vhd10
Reporte vhd10
 
Arithmatic logic unit using VHDL (gates)
Arithmatic logic unit using VHDL (gates)Arithmatic logic unit using VHDL (gates)
Arithmatic logic unit using VHDL (gates)
 

Recently uploaded

Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfrs7054576148
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxJuliansyahHarahap1
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...tanu pandey
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 

Recently uploaded (20)

Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 

Vhdl lab manual

  • 1. EXPERIMENT-1 Aim : Write a VHDL program to implement a multiplexer. (i) 4:1 Multiplexer : library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity mux4to1 is Port ( s : in STD_LOGIC_VECTOR (1 downto 0); a : in STD_LOGIC_VECTOR (3 downto 0); z : out STD_LOGIC); end mux4to1; architecture Behavioral of mux4to1 is begin process(s,a) begin if(s="00") then z<= a(0); elsif(s="01") then z<= a(1); elsif(s="10") then z<= a(2);
  • 2. else z<= a(3); end if; end process; end Behavioral; OUTPUT :
  • 3. (ii) 8:1 Multiplexer : library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity mux8to1 is Port ( s : in STD_LOGIC_VECTOR (2 downto 0); a : in STD_LOGIC_VECTOR (7 downto 0); z : out STD_LOGIC); end mux8to1; architecture Behavioral of mux8to1 is begin process(s,a) begin if(s="000") then z<= a(0); elsif(s="001") then z<= a(1); elsif(s="010") then z<= a(2); elsif(s="011") then z<= a(3); elsif(s="100") then
  • 4. z<= a(4); elsif(s="101") then z<= a(5); elsif(s="110") then z<= a(6); else z<= a(7); end if; end process; end Behavioral; OUTPUT :
  • 5. EXPERIMENT-2 Aim : Write a VHDL program to implement a demultiplexer. (i) 1:4 Demultiplexer : library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity demux1to4 is Port ( s : in STD_LOGIC_VECTOR (1 downto 0); i : in STD_LOGIC; a : out STD_LOGIC_VECTOR (3 downto 0)); end demux1to4; architecture Behavioral of demux1to4 is begin process(i,s) begin if(i='1') then if(s="00") then a<= "0001"; elsif(s="01") then a<= "0010"; elsif(s="10") then
  • 6. a<= "0100"; elsif(s="11") then a<= "1000"; end if; else a<= "0000"; end if; end process; end Behavioral; OUTPUT :
  • 7. (ii) 1:8 Demultiplexer : library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity demux1to8 is Port ( s : in STD_LOGIC_VECTOR (2 downto 0); i : in STD_LOGIC; a : out STD_LOGIC_VECTOR (7 downto 0)); end demux1to8; architecture Behavioral of demux1to8 is begin process(i,s) begin if(i='1') then if(s="000") then a<= "00000001"; elsif(s="001") then a<= "00000010"; elsif(s="010") then a<= "00000100"; elsif(s="011") then a<= "00001000";
  • 8. elsif(s="100") then a<= "00010000"; elsif(s="101") then a<= "00100000"; elsif(s="110") then a<= "01000000"; elsif(s="111") then a<= "10000000"; end if; else a<= "00000000"; end if; end process; end Behavioral; OUTPUT :
  • 9. EXPERIMENT-3 Aim : Write a VHDL program to implement a 3:8 decoder. library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity decoder3to8 is Port ( i : in STD_LOGIC_VECTOR (2 downto 0); en : in STD_LOGIC; a : out STD_LOGIC_VECTOR (7 downto 0)); end decoder3to8; architecture Behavioral of decoder3to8 is begin process(i,en) begin if(en='1') then if(i="000") then a<= "00000001"; elsif(i="001") then a<= "00000010"; elsif(i="010") then a<= "00000100"; elsif(i="011") then a<= "00001000";
  • 10. elsif(i="100") then a<= "00010000"; elsif(i="101") then a<= "00100000"; elsif(i="110") then a<= "01000000"; elsif(i="111") then a<= "10000000"; end if; else a<= "00000000"; end if; end process; end Behavioral; OUTPUT :
  • 11. EXPERIMENT-4 Aim: Write a VHDL program to implement a 4 bit adder. --program for 1 bit full adder. library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity fa is Port ( x : in STD_LOGIC; y : in STD_LOGIC; c : in STD_LOGIC; s : out STD_LOGIC; co : out STD_LOGIC); end fa; architecture Behavioral of fa is begin s<= x xor y xor c; co<= (x and y)or(y and c)or(c and x); end Behavioral; --program for 4 bit full adder. library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity fa_4bit is Port ( a : in STD_LOGIC_VECTOR (3 downto 0); b : in STD_LOGIC_VECTOR (3 downto 0); cin : in STD_LOGIC;
  • 12. sum : out STD_LOGIC_VECTOR (3 downto 0); cout : out STD_LOGIC); end fa_4bit; architecture Structural of fa_4bit is signal cs : std_logic_vector (2 downto 0); component fa port (x : in STD_LOGIC; y : in STD_LOGIC; c : in STD_LOGIC; s : out STD_LOGIC; co : out STD_LOGIC); end component; begin f1 : fa port map(a(0),b(0),cin,sum(0),cs(0)); f2 : fa port map(a(1),b(1),cs(0),sum(1),cs(1)); f3 : fa port map(a(2),b(2),cs(1),sum(2),cs(2)); f4 : fa port map(a(3),b(3),cs(2),sum(3),cout); end Structural; OUTPUT :
  • 13. EXPERIMENT-5 Aim: Write a VHDL program to implement a 4 bit comparator. library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity comprator_4bit is Port ( a : in STD_LOGIC_VECTOR (3 downto 0); b : in STD_LOGIC_VECTOR (3 downto 0); less : out STD_LOGIC; equal : out STD_LOGIC; greater : out STD_LOGIC); end comprator_4bit; architecture Behavioral of comprator_4bit is begin process(a,b) begin if (a>b) then greater <= '1'; equal <= '0'; less <= '0'; elsif (a<b) then greater <= '0'; equal <= '0'; less <= '1';
  • 14. else greater <= '0'; equal <= '1'; less <= '0'; end if; end process; end Behavioral; OUTPUT :
  • 15. EXPERIMENT-6 Aim: Write a VHDL program to design a 2 bit ALU containing 4 arithmetic and 4 logical operations. library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity alu_2bit is Port ( a : in STD_LOGIC_VECTOR (1 downto 0); b : in STD_LOGIC_VECTOR (1 downto 0); sel : in STD_LOGIC_VECTOR (2 downto 0); cin : in STD_LOGIC; y : out STD_LOGIC_VECTOR (1 downto 0)); end alu_2bit; architecture Behavioral of alu_2bit is signal arith,logic : STD_LOGIC_VECTOR (1 downto 0); begin with sel(1 downto 0) select arith <= a + 1 when "00", a + b + cin when "01", a - b when "10", b + 1 when others; with sel(1 downto 0) select logic <= not a when "00",
  • 16. a and b when "01", a or b when "10", a xor b when others; with sel(2) select y <= arith when '0', logic when others; end Behavioral; OUTPUT :
  • 17. EXPERIMENT-7 Aim: Write a VHDL program to design a D Flip Flop. library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity dff is Port ( d,clk, reset: in std_logic; q : out std_logic); end dff; architecture Behavioral of dff is begin process (clk, d) begin if ( (d'event or clk'event) and clk='1') then if RESET ='1' then q <= '0' ; else q <= d after 1 us; end if; end if; end process; end Behavioral;
  • 19. EXPERIMENT-8 Aim: Write a VHDL program to design a D Flip Flop. library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity dff is Port ( d,clk, reset: in std_logic; q : out std_logic); end dff; architecture Behavioral of dff is begin process (clk, d) begin if ( (d'event or clk'event) and clk='1') then if RESET ='1' then q <= '0' ; else q <= d after 1 us; end if; end if; end process; end Behavioral;