Experiment 1: Aim: WAP in VHDL To Implement Basic Gates

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

Experiment 1

Aim : WAP in VHDL to Implement basic gates



AND Gate:
Source Code:
library ieee;
use ieee.std_logic_1164.all;
entity and1 is
port(x,y: in std_logic; z: out std_logic);
end and1;
architecture data_and1 of and1 is
begin
z <= x and y;
end data_and1;


Output :




OR Gate:
Source Code:
library ieee;
use ieee.std_logic_1164.all;
entity or1 is
port(x,y: in std_logic; z: out std_logic);
end or1;
architecture data_or1 of or1 is
begin
z <= x or y;
end data_or1;


Output :







NOR Gate:
Source Code:
library ieee;
use ieee.std_logic_1164.all;
entity nor1 is
port(x,y: in std_logic; z: out std_logic);
end nor1;
architecture data_nor1 of nor1 is
begin
z <= x nor y;
end data_nor1;


Output :







NOT Gate:
Source Code:
library ieee;
use ieee.std_logic_1164.all;
entity not1 is
port(x: in std_logic; z: out std_logic);
end not1;
architecture data_not1 of not1 is
begin
z <= not x;
end data_not1;


Output :








XNOR Gate:
Source Code:
library ieee;
use ieee.std_logic_1164.all;
entity xnor1 is
port(x,y: in std_logic; z: out std_logic);
end xnor1;
architecture data_xnor1 of xnor1 is
begin
z <= x xnor y;
end data_xnor1;


Output :








XOR Gate:
Source Code:
library ieee;
use ieee.std_logic_1164.all;
entity xor1 is
port(x,y: in std_logic; z: out std_logic);
end xor1;
architecture data_xor1 of xor1 is
begin
z <= x xor y;
end data_xor1;


Output :








NAND Gate:
Source Code:
library ieee;
use ieee.std_logic_1164.all;
entity nand1 is
port(x,y: in std_logic; z: out std_logic);
end nand1;
architecture data_nand1 of nand1 is
begin
z <= x nand y;
end data_nand1;


Output :








Experiment 2
Aim : WAP in VHDL to Implement Half Adder

Source Code:
library ieee;
use ieee.std_logic_1164.all;
entity hf1 is
port(x,y: in std_logic; sum,carry: out std_logic);
end hf1;
architecture data_hf1 of hf1 is
begin
sum <= x xor y;
carry <= x and y;
end data_hf1;


Output :





Experiment 3
Aim : WAP in VHDL to Implement Full Adder

Source Code:
library ieee;
use ieee.std_logic_1164.all;
entity fa1 is
port(x,y,z: in std_logic; sum,carry: out std_logic);
end fa1;
architecture data_fa1 of fa1 is
begin
sum <= x xor y xor z;
carry <= (x and y) or (y and z) or (x and z);
end data_fa1;


Output :

You might also like