SlideShare a Scribd company logo
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

PDF
Programs of VHDL
PDF
Vhdl lab manual
PDF
VHdl lab report
PDF
VHDL CODE
PDF
Digital system design practical file
PPTX
Vhdl programming
PDF
Dsd lab Practical File
PDF
Experiment write-vhdl-code-for-realize-all-logic-gates
Programs of VHDL
Vhdl lab manual
VHdl lab report
VHDL CODE
Digital system design practical file
Vhdl programming
Dsd lab Practical File
Experiment write-vhdl-code-for-realize-all-logic-gates

What's hot (20)

DOCX
PPSX
Vhd lhigh2003
DOCX
VHDL CODES
PDF
Verilog lab manual (ECAD and VLSI Lab)
PPT
Fpga 04-verilog-programming
DOCX
VLSI & E-CAD Lab Manual
PPT
Verilog Lecture3 hust 2014
PPT
Verilog Lecture5 hust 2014
PDF
Digital system design lab manual
PDF
Appsec obfuscator reloaded
PPTX
Reverse Engineering automation
PPT
Fpga 06-data-types-system-tasks-compiler-directives
PDF
Practical file
DOCX
Programme en C: Additionneur complet 4 bits ac4
PDF
VLSI Lab manual PDF
PDF
Digital System Design Lab Report - VHDL ECE
PPT
Verilog Lecture4 2014
PPT
Fpga 05-verilog-programming
DOC
VLSI Anna University Practical Examination
PPT
Eecs 317 20010209
Vhd lhigh2003
VHDL CODES
Verilog lab manual (ECAD and VLSI Lab)
Fpga 04-verilog-programming
VLSI & E-CAD Lab Manual
Verilog Lecture3 hust 2014
Verilog Lecture5 hust 2014
Digital system design lab manual
Appsec obfuscator reloaded
Reverse Engineering automation
Fpga 06-data-types-system-tasks-compiler-directives
Practical file
Programme en C: Additionneur complet 4 bits ac4
VLSI Lab manual PDF
Digital System Design Lab Report - VHDL ECE
Verilog Lecture4 2014
Fpga 05-verilog-programming
VLSI Anna University Practical Examination
Eecs 317 20010209
Ad

Similar to Dsd prac1 (20)

PPTX
Vhdl basic unit-2
PDF
Presentation1.pdf
PPTX
Very high speed HDL Presentation FOR KIET.pptx
PDF
VHDL Programs
PPT
Spdas2 vlsibput
PDF
Vhdl introduction
PDF
Introduction to VHDL
PPTX
Verilog HDL
PPT
VAC Course VHDL.ppt value added course b. Tech
PPTX
Arithmatic logic unit using VHDL (gates)
PPT
VHDL Entity
PDF
Short Notes on Verilog and SystemVerilog
PPTX
Building Hierarchy
PDF
Verilog Cheat sheet-2 (1).pdf
PDF
Verilog_Cheat_sheet_1672542963.pdf
PDF
Verilog_Cheat_sheet_1672542963.pdf
PPTX
Da3_on_FPGA_education_program_by_DIAT.pptx
PDF
verilog ppt .pdf
PPTX
Session1
PDF
dokumen.tips_verilog-basic-ppt.pdf
Vhdl basic unit-2
Presentation1.pdf
Very high speed HDL Presentation FOR KIET.pptx
VHDL Programs
Spdas2 vlsibput
Vhdl introduction
Introduction to VHDL
Verilog HDL
VAC Course VHDL.ppt value added course b. Tech
Arithmatic logic unit using VHDL (gates)
VHDL Entity
Short Notes on Verilog and SystemVerilog
Building Hierarchy
Verilog Cheat sheet-2 (1).pdf
Verilog_Cheat_sheet_1672542963.pdf
Verilog_Cheat_sheet_1672542963.pdf
Da3_on_FPGA_education_program_by_DIAT.pptx
verilog ppt .pdf
Session1
dokumen.tips_verilog-basic-ppt.pdf
Ad

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