SlideShare a Scribd company logo
1 of 21
Practical No 1
AND GATE (Data flow)
Source code
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entitydatafolwand is
port(A,B : in bit;Z : out bit);
enddatafolwand;
architecturedatafolwand of datafolwand is
begin
Z <= A and B;
enddatafolwand;
Wave form
OR GATE(Data flow)
Source code
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity dataflow-or is
port(A,B : in bit;Z : out bit);
end dataflow-or;
architecture dataflow-or of dataflow-or is
begin
Z<= A or B;
end dataflow-or;
Wave Form
NOT GATE(Data flow)
Source code
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity dataflow not gate is
port(A : in bit;Z : out bit);
end dataflow not gate;
architecture dataflow not gate of dataflow not gate is
begin
Z <= not A;
end dataflow not gate;
Wave Form
XOR GATE(Data flow)
Source code
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity dataflow not gate is
port(A,B : in bit;Z : out bit);
end dataflow not gate;
architecture dataflow not gate of dataflow not gate is
begin
Z <= Axor B;
end dataflow not gate;
Wave Form
XNOR GATE (Data flow)
Source code
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity xnor gate is
port(A,B : in bit;Z : out bit);
end xnor gate;
architecture xnorgate of xnor gate is
begin
Z<= Axnor B;
end xnor gate;
Wave Form
AND GATE (Behavirol)
Source code
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entitybheavand is
port(A,B : in bit;Z : out bit);
endbheavand;
architecture and of bheavand is
begin
process(A,B);
Z <= A and B;
end process;
endbheavand;
Wave Form
OR GATE (Behavirol)
Source code
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity behavirol-or is
port(A,B : in bit;Z : out bit);
end behavirol-or;
architecture behavirol-or of behavirol-or is
begin
process(A,B)
begin
Z<= A or B;
end process;
end dataflow-or;
Wave Form
NOT GATE (Behavirol)
Source code
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity not gate is
port(A : in bit;Z : out bit);
end not gate;
architecture not gate of not gate is
begin
process(A)
begin
Z <= not A;
end process;
end not gate;
Wave Form
XOR GATE (Behavirol)
Source code
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity xor gate is
port(A,B : in bit;Z : out bit);
end xor gate;
architecture xorgate of xor gate is
begin
process(A,B)
begin
Z <= Axor B;
end process;
end xor gate;
Wave Form
XNOR GATE (Behavirol)
Source code
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity xnor gate is
port(A,B : in bit;Z : out bit);
end xnor gate;
architecture xnorgate of xnor gate is
begin
process(A,B)
begin
Z <= Axnor B;
end process;
end xnor gate;
Wave Form
Practical No 2
HALF ADDER (Data flow)
Source code
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity dataflow-half adder is
port(A,B : in bit;S,C : out bit);
end dataflow-half adder;
architecture dataflow-half adder of dataflow-half adder is
begin
S <= A xor B; -- sum
C <= A and B; -- carry
end dataflow-half adder;
Wave form
HALF ADDER (Behavirol)
Source code
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity half adder is
port(A,B : in bit;S,C : out bit);
end half adder;
architecture half adder of half adder is
begin
process(A,B)
begin
S <= A xor B; -- sum
C <= A and B; -- carry
end process;
end half adder;
Wave form
HALF ADDER (Structural)
Source code
half Adder
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity adder is
port(A,B :in bit ;S,C :out bit);
end adder;
architecture adder of adder is
component XOR1
port(ao,bo :in bit ;do :out bit);
end component;
component and1
port(a1,b1 :in bit ;d1 :out bit);
end component;
begin
xo: XOR1 port map(A,B,S);
A3: and1 port map(A,B,C);
end adder;
-- For component xor1
ibrary IEEE;
use IEEE.STD_LOGIC_1164.all;
entity xor1 is
port(ao,bo :in bit ;do :out bit);
end xor1;
architecture xor1 of xor1 is
begin
do<=l aoxorbo;
end xor1;
-- For component and1
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity and1 is
port(a1,b1 :in bit ;d1 :out bit);
end and1;
architecture and1 of and1 is
begin
d1<= a1 and b1;
end and1;
Wave form
Practical No 4
MULTIPLEXER 4:1 (Data flow)
Source code
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity mux is
port(A,B,C,D,S0,S1: in bit; Y: out bit);
end mux;
architecture mux of mux is
begin
Y <= A when S0='0' and S1='0' else
B when S0='0' and S1='1' else
C when S0='1'and S1='0' else
D;
end mux;
Wave Form
MULTIPLEXER 4:1 (Behavirol)
Source code
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity mux is
port(I0,I1,I2,I3,S0,S1 : in bit;Y :out bit);
end mux;
architecturemux_b of mux is
begin
process(I0,I1,I2,I3,S0,S1)
begin
if (S0='0' and S1 ='0') then
y<= I0;
elsif (S0='0' and S1='1') then
y<= I1;
elsif (S0='1' and S1='0') then
y<= I2;
elsif (S0='1' and S1='1') then
y<= I3;
end if;
end process;
endmux_b;
Wave Form
Practical No 3
FULL ADDER(Data flow)
Source code
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity Full_adder1 is
PORT(A,B,E : IN BIT; S,C : OUT BIT);
end Full_adder1;
architecture Full_adder1 of Full_adder1 is
begin
S <= A XOR B XOR E;
C <= ((A AND B) OR (A AND E) OR (B AND E));
end Full_adder1;
Wave Form
FULL ADDER (Behavirol)
Source code
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity Full_adder1 is
PORT(A,B,E : IN BIT; S,C : OUT BIT);
end Full_adder1;
architecture Full_adder1 of Full_adder1 is
begin
process (A,B,E)
begin
S <= A XOR B XOR E;
C <= ((A AND B) OR (A AND E) OR (B AND E));
end PROCESS;
end Full_adder1;
Wave Form
Practical No 5
D-MULIPLEXER (Data flow)
Source code
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entitydemux is
port(so,s1:in bit;A :out bit_vector(0 to 3));
enddemux;
architecturedmux_d of demux is
begin
A<= "1000" when so='0' and s1='0' else
"0100" when so='0' and s1='1' else
"0010" when so='1' and s1='0' else
"0001" when so='1' and s1='1';
enddmux_d;
Wave Form
Practical No 6
1-BIT COMPARATOR (Data flow)
Source code
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity comparator is
port(A,B:inbit;Y: out bit_vector(0 to 2));
end comparator;
architecturecomparator_data of comparator is
begin
Y<= "010" when A=B else
"100" when A<B else
"001" when A>B;
endcomparator_data;
Wave Form
Practical No 7
4-BIT COMPARATOR (Behavioral)
Source code
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity comparator_4 is
port(A,B : in bit_vector(0 to 3);Y : out bit_vector(0 to 2));
end comparator_4;
architecture comp-bhev of comparator_4 is
begin
process(A,B)
begin
if (A>B) then Y<="100";
elsif (A=B) then Y<="010";
elsif (A<B) then Y<="001";
end if;
end process;
end comp-bhev;
Wave Form

More Related Content

What's hot

Vhd lhigh2003
Vhd lhigh2003Vhd lhigh2003
Vhd lhigh2003gkumawat
 
Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014Béo Tú
 
Verilog Lecture5 hust 2014
Verilog Lecture5 hust 2014Verilog Lecture5 hust 2014
Verilog Lecture5 hust 2014Béo Tú
 
Digital system design lab manual
Digital system design lab manualDigital system design lab manual
Digital system design lab manualSanthosh Poralu
 
Reverse Engineering automation
Reverse Engineering automationReverse Engineering automation
Reverse Engineering automationPositive Hack Days
 
Fpga 06-data-types-system-tasks-compiler-directives
Fpga 06-data-types-system-tasks-compiler-directivesFpga 06-data-types-system-tasks-compiler-directives
Fpga 06-data-types-system-tasks-compiler-directivesMalik Tauqir Hasan
 
Practical file
Practical filePractical file
Practical filerajeevkr35
 
Programme en C: Additionneur complet 4 bits ac4
Programme en C: Additionneur  complet 4 bits ac4Programme en C: Additionneur  complet 4 bits ac4
Programme en C: Additionneur complet 4 bits ac4ilham ait hsain
 
VLSI Lab manual PDF
VLSI Lab manual PDFVLSI Lab manual PDF
VLSI Lab manual PDFUR11EC098
 
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 ECERamesh Naik Bhukya
 
Verilog Lecture4 2014
Verilog Lecture4 2014Verilog Lecture4 2014
Verilog Lecture4 2014Béo Tú
 
VLSI Anna University Practical Examination
VLSI Anna University Practical ExaminationVLSI Anna University Practical Examination
VLSI Anna University Practical ExaminationGouthaman V
 

What's hot (20)

Vhdl
VhdlVhdl
Vhdl
 
Vhd lhigh2003
Vhd lhigh2003Vhd lhigh2003
Vhd lhigh2003
 
VHDL CODES
VHDL CODES VHDL CODES
VHDL CODES
 
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)
 
Fpga 04-verilog-programming
Fpga 04-verilog-programmingFpga 04-verilog-programming
Fpga 04-verilog-programming
 
VLSI & E-CAD Lab Manual
VLSI & E-CAD Lab ManualVLSI & E-CAD Lab Manual
VLSI & E-CAD Lab Manual
 
Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014Verilog Lecture3 hust 2014
Verilog Lecture3 hust 2014
 
Verilog Lecture5 hust 2014
Verilog Lecture5 hust 2014Verilog Lecture5 hust 2014
Verilog Lecture5 hust 2014
 
Digital system design lab manual
Digital system design lab manualDigital system design lab manual
Digital system design lab manual
 
Appsec obfuscator reloaded
Appsec obfuscator reloadedAppsec obfuscator reloaded
Appsec obfuscator reloaded
 
Reverse Engineering automation
Reverse Engineering automationReverse Engineering automation
Reverse Engineering automation
 
Fpga 06-data-types-system-tasks-compiler-directives
Fpga 06-data-types-system-tasks-compiler-directivesFpga 06-data-types-system-tasks-compiler-directives
Fpga 06-data-types-system-tasks-compiler-directives
 
Practical file
Practical filePractical file
Practical file
 
Programme en C: Additionneur complet 4 bits ac4
Programme en C: Additionneur  complet 4 bits ac4Programme en C: Additionneur  complet 4 bits ac4
Programme en C: Additionneur complet 4 bits ac4
 
VLSI Lab manual PDF
VLSI Lab manual PDFVLSI Lab manual PDF
VLSI Lab manual PDF
 
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
 
Verilog Lecture4 2014
Verilog Lecture4 2014Verilog Lecture4 2014
Verilog Lecture4 2014
 
Fpga 05-verilog-programming
Fpga 05-verilog-programmingFpga 05-verilog-programming
Fpga 05-verilog-programming
 
VLSI Anna University Practical Examination
VLSI Anna University Practical ExaminationVLSI Anna University Practical Examination
VLSI Anna University Practical Examination
 
Eecs 317 20010209
Eecs 317 20010209Eecs 317 20010209
Eecs 317 20010209
 

Similar to Dsd prac1

Similar to Dsd prac1 (20)

Vhdl basic unit-2
Vhdl basic unit-2Vhdl basic unit-2
Vhdl basic unit-2
 
Presentation1.pdf
Presentation1.pdfPresentation1.pdf
Presentation1.pdf
 
VHDL PROGRAMS FEW EXAMPLES
VHDL PROGRAMS FEW EXAMPLESVHDL PROGRAMS FEW EXAMPLES
VHDL PROGRAMS FEW EXAMPLES
 
VHDL Programs
VHDL ProgramsVHDL Programs
VHDL Programs
 
Spdas2 vlsibput
Spdas2 vlsibputSpdas2 vlsibput
Spdas2 vlsibput
 
Vhdl introduction
Vhdl introductionVhdl introduction
Vhdl introduction
 
Introduction to VHDL
Introduction to VHDLIntroduction to VHDL
Introduction to VHDL
 
Verilog HDL
Verilog HDLVerilog HDL
Verilog HDL
 
Arithmatic logic unit using VHDL (gates)
Arithmatic logic unit using VHDL (gates)Arithmatic logic unit using VHDL (gates)
Arithmatic logic unit using VHDL (gates)
 
VHDL Entity
VHDL EntityVHDL Entity
VHDL Entity
 
Building Hierarchy
Building HierarchyBuilding Hierarchy
Building Hierarchy
 
Verilog Cheat sheet-2 (1).pdf
Verilog Cheat sheet-2 (1).pdfVerilog Cheat sheet-2 (1).pdf
Verilog Cheat sheet-2 (1).pdf
 
Verilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdfVerilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdf
 
Verilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdfVerilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdf
 
verilog ppt .pdf
verilog ppt .pdfverilog ppt .pdf
verilog ppt .pdf
 
Session1
Session1Session1
Session1
 
dokumen.tips_verilog-basic-ppt.pdf
dokumen.tips_verilog-basic-ppt.pdfdokumen.tips_verilog-basic-ppt.pdf
dokumen.tips_verilog-basic-ppt.pdf
 
ECAD lab manual
ECAD lab manualECAD lab manual
ECAD lab manual
 
Fpga 1
Fpga 1Fpga 1
Fpga 1
 
swift-nio のアーキテクチャーと RxHttpClient
swift-nio のアーキテクチャーと RxHttpClientswift-nio のアーキテクチャーと RxHttpClient
swift-nio のアーキテクチャーと RxHttpClient
 

Dsd prac1

  • 1. Practical No 1 AND GATE (Data flow) Source code library IEEE; use IEEE.STD_LOGIC_1164.all; entitydatafolwand is port(A,B : in bit;Z : out bit); enddatafolwand; architecturedatafolwand of datafolwand is begin Z <= A and B; enddatafolwand; Wave form
  • 2. OR GATE(Data flow) Source code library IEEE; use IEEE.STD_LOGIC_1164.all; entity dataflow-or is port(A,B : in bit;Z : out bit); end dataflow-or; architecture dataflow-or of dataflow-or is begin Z<= A or B; end dataflow-or; Wave Form
  • 3. NOT GATE(Data flow) Source code library IEEE; use IEEE.STD_LOGIC_1164.all; entity dataflow not gate is port(A : in bit;Z : out bit); end dataflow not gate; architecture dataflow not gate of dataflow not gate is begin Z <= not A; end dataflow not gate; Wave Form
  • 4. XOR GATE(Data flow) Source code library IEEE; use IEEE.STD_LOGIC_1164.all; entity dataflow not gate is port(A,B : in bit;Z : out bit); end dataflow not gate; architecture dataflow not gate of dataflow not gate is begin Z <= Axor B; end dataflow not gate; Wave Form
  • 5. XNOR GATE (Data flow) Source code library IEEE; use IEEE.STD_LOGIC_1164.all; entity xnor gate is port(A,B : in bit;Z : out bit); end xnor gate; architecture xnorgate of xnor gate is begin Z<= Axnor B; end xnor gate; Wave Form
  • 6. AND GATE (Behavirol) Source code library IEEE; use IEEE.STD_LOGIC_1164.all; entitybheavand is port(A,B : in bit;Z : out bit); endbheavand; architecture and of bheavand is begin process(A,B); Z <= A and B; end process; endbheavand; Wave Form
  • 7. OR GATE (Behavirol) Source code library IEEE; use IEEE.STD_LOGIC_1164.all; entity behavirol-or is port(A,B : in bit;Z : out bit); end behavirol-or; architecture behavirol-or of behavirol-or is begin process(A,B) begin Z<= A or B; end process; end dataflow-or; Wave Form
  • 8. NOT GATE (Behavirol) Source code library IEEE; use IEEE.STD_LOGIC_1164.all; entity not gate is port(A : in bit;Z : out bit); end not gate; architecture not gate of not gate is begin process(A) begin Z <= not A; end process; end not gate; Wave Form
  • 9. XOR GATE (Behavirol) Source code library IEEE; use IEEE.STD_LOGIC_1164.all; entity xor gate is port(A,B : in bit;Z : out bit); end xor gate; architecture xorgate of xor gate is begin process(A,B) begin Z <= Axor B; end process; end xor gate; Wave Form
  • 10. XNOR GATE (Behavirol) Source code library IEEE; use IEEE.STD_LOGIC_1164.all; entity xnor gate is port(A,B : in bit;Z : out bit); end xnor gate; architecture xnorgate of xnor gate is begin process(A,B) begin Z <= Axnor B; end process; end xnor gate; Wave Form
  • 11. Practical No 2 HALF ADDER (Data flow) Source code library IEEE; use IEEE.STD_LOGIC_1164.all; entity dataflow-half adder is port(A,B : in bit;S,C : out bit); end dataflow-half adder; architecture dataflow-half adder of dataflow-half adder is begin S <= A xor B; -- sum C <= A and B; -- carry end dataflow-half adder; Wave form
  • 12. HALF ADDER (Behavirol) Source code library IEEE; use IEEE.STD_LOGIC_1164.all; entity half adder is port(A,B : in bit;S,C : out bit); end half adder; architecture half adder of half adder is begin process(A,B) begin S <= A xor B; -- sum C <= A and B; -- carry end process; end half adder; Wave form
  • 13. HALF ADDER (Structural) Source code half Adder library IEEE; use IEEE.STD_LOGIC_1164.all; entity adder is port(A,B :in bit ;S,C :out bit); end adder; architecture adder of adder is component XOR1 port(ao,bo :in bit ;do :out bit); end component; component and1 port(a1,b1 :in bit ;d1 :out bit); end component; begin xo: XOR1 port map(A,B,S); A3: and1 port map(A,B,C); end adder; -- For component xor1 ibrary IEEE; use IEEE.STD_LOGIC_1164.all; entity xor1 is port(ao,bo :in bit ;do :out bit); end xor1; architecture xor1 of xor1 is begin do<=l aoxorbo; end xor1; -- For component and1 library IEEE; use IEEE.STD_LOGIC_1164.all; entity and1 is port(a1,b1 :in bit ;d1 :out bit); end and1; architecture and1 of and1 is begin d1<= a1 and b1; end and1;
  • 15. Practical No 4 MULTIPLEXER 4:1 (Data flow) Source code library IEEE; use IEEE.STD_LOGIC_1164.all; entity mux is port(A,B,C,D,S0,S1: in bit; Y: out bit); end mux; architecture mux of mux is begin Y <= A when S0='0' and S1='0' else B when S0='0' and S1='1' else C when S0='1'and S1='0' else D; end mux; Wave Form
  • 16. MULTIPLEXER 4:1 (Behavirol) Source code library IEEE; use IEEE.STD_LOGIC_1164.all; entity mux is port(I0,I1,I2,I3,S0,S1 : in bit;Y :out bit); end mux; architecturemux_b of mux is begin process(I0,I1,I2,I3,S0,S1) begin if (S0='0' and S1 ='0') then y<= I0; elsif (S0='0' and S1='1') then y<= I1; elsif (S0='1' and S1='0') then y<= I2; elsif (S0='1' and S1='1') then y<= I3; end if; end process; endmux_b; Wave Form
  • 17. Practical No 3 FULL ADDER(Data flow) Source code library IEEE; use IEEE.STD_LOGIC_1164.all; entity Full_adder1 is PORT(A,B,E : IN BIT; S,C : OUT BIT); end Full_adder1; architecture Full_adder1 of Full_adder1 is begin S <= A XOR B XOR E; C <= ((A AND B) OR (A AND E) OR (B AND E)); end Full_adder1; Wave Form
  • 18. FULL ADDER (Behavirol) Source code library IEEE; use IEEE.STD_LOGIC_1164.all; entity Full_adder1 is PORT(A,B,E : IN BIT; S,C : OUT BIT); end Full_adder1; architecture Full_adder1 of Full_adder1 is begin process (A,B,E) begin S <= A XOR B XOR E; C <= ((A AND B) OR (A AND E) OR (B AND E)); end PROCESS; end Full_adder1; Wave Form
  • 19. Practical No 5 D-MULIPLEXER (Data flow) Source code library IEEE; use IEEE.STD_LOGIC_1164.all; entitydemux is port(so,s1:in bit;A :out bit_vector(0 to 3)); enddemux; architecturedmux_d of demux is begin A<= "1000" when so='0' and s1='0' else "0100" when so='0' and s1='1' else "0010" when so='1' and s1='0' else "0001" when so='1' and s1='1'; enddmux_d; Wave Form
  • 20. Practical No 6 1-BIT COMPARATOR (Data flow) Source code library IEEE; use IEEE.STD_LOGIC_1164.all; entity comparator is port(A,B:inbit;Y: out bit_vector(0 to 2)); end comparator; architecturecomparator_data of comparator is begin Y<= "010" when A=B else "100" when A<B else "001" when A>B; endcomparator_data; Wave Form
  • 21. Practical No 7 4-BIT COMPARATOR (Behavioral) Source code library IEEE; use IEEE.STD_LOGIC_1164.all; entity comparator_4 is port(A,B : in bit_vector(0 to 3);Y : out bit_vector(0 to 2)); end comparator_4; architecture comp-bhev of comparator_4 is begin process(A,B) begin if (A>B) then Y<="100"; elsif (A=B) then Y<="010"; elsif (A<B) then Y<="001"; end if; end process; end comp-bhev; Wave Form