Experiment No:-1 (A) : AIM: - To Write A Program in VHDL To Implement XOR Gate
Experiment No:-1 (A) : AIM: - To Write A Program in VHDL To Implement XOR Gate
Experiment No:-1 (A) : AIM: - To Write A Program in VHDL To Implement XOR Gate
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity xorgate is
Port ( x,y : in BIT;
z : out BIT);
end xorgate;
X Y Z
0 0 0
0 1 1
1 0 1
1 1 0
WAVEFORM:
EXPERIMENT NO:-1(B)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity orGATE is
Port ( x,y : in BIT;
z : out BIT);
end orGATE;
x y z
0 0 0
0 1 1
1 0 1
1 1 1
WAVEFORM:
EXPERIMENT NO:-1(C)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity norgate is
Port ( x,y : in BIT;
z : out BIT);
end norgate;
x y z
0 0 1
0 1 0
1 0 0
1 1 0
WAVEFORM:
EXPERIMENT NO:-1(D)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity nandgate is
Port ( x,y : in BIT;
z : out BIT);
end nandgate;
;
architecture Behavioral of nandgate is
begin
z <= x nand y;
end Behavioral;
TRUTH TABLE
x y z
0 0 1
0 1 1
1 0 1
1 1 0
WAVEFORM:
EXPERIMENT NO:-1(E)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity notgate is
Port ( x : in BIT;
z : out BIT);
end notgate;
begin
z<= not x;
end Behavioral;
TRUTH TABLE
x z
0 1
1 0
WAVEFORM:
EXPERIMENT NO:-1(F)
entity and23 is
Port ( x,y : in BIT;
z : out BIT);
end and23;
x y z
0 0 0
0 1 0
1 0 0
1 1 1
WAVEFORM:
EXPERIMENT NO:-2(A)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity ha1 is
Port ( i : in STD_LOGIC;
j : in STD_LOGIC;
k : out STD_LOGIC;
l : out STD_LOGIC);
end ha1;
i j k l
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
WAVEFORM
EXPERIMENT NO:-2(B)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity fa5 is
Port ( i : in STD_LOGIC;
j : in STD_LOGIC;
k : in STD_LOGIC;
l : out STD_LOGIC;
m : out STD_LOGIC);
end fa5;
i j k l m
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
WAVEFORM
EXPERIMENT NO:-3(A)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity mux is
Port ( k : in STD_LOGIC;
b : in STD_LOGIC;
c : in STD_LOGIC;
d : in STD_LOGIC;
s : in STD_LOGIC_VECTOR (0 to 1);
z : out STD_LOGIC);
end mux;
WAVEFORM:
EXPERIMENT NO:-3(B)
AIM:-To Write a Program in VHDL to Implement DEMULTIPLEXER
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity demux is
Port ( X0 : in STD_LOGIC;
X1 : in STD_LOGIC;
W0 : in STD_LOGIC;
S0 : out STD_LOGIC;
S1 : out STD_LOGIC;
S2 : out STD_LOGIC;
S3 : out STD_LOGIC);
end demux;
TRUTH TABLE
X0 X1 W0 S3 S2 S1 S0
(o/p) (o/p) (o/p) (o/p)
0 0 1 0 0 0 1
0 1 1 0 0 1 0
1 0 1 0 1 0 0
1 1 1 1 0 0 0
WAVEFORM:
EXPERIMENT NO:-4(A)
AIM:-To Write a Program in VHDL to Implement Encoder
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity ENCODE is
Port ( p : in STD_LOGIC_VECTOR (7 downto 0);
q : out STD_LOGIC_VECTOR (2 downto 0));
end ENCODE;
p(7) p(6) p(5) p(4) p(3) p(2) p(1) p(0) q(2) q(1) q(0)
0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 1 0 0 0 1
0 0 0 0 0 1 0 0 0 1 0
0 0 0 0 1 0 0 0 0 1 1
0 0 0 1 0 0 0 0 1 0 0
0 0 1 0 0 0 0 0 1 0 1
0 1 0 0 0 0 0 0 1 1 0
1 0 0 0 0 0 0 0 1 1 1
WAVEFORM:-
EXPERIMENT NO:-4(B)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity DECODE is
Port (m: in bit_vector (2 downto 0);
n: out bit_vector (7 downto 0));
end DECODE;
m(2) m(1) m(0) n(7) n(6) n(5) n(4) n(3) n(2) n(1) n(0)
0 0 0 0 0 0 0 0 0 0 1
0 0 1 0 0 0 0 0 0 1 0
0 1 0 0 0 0 0 0 1 0 0
0 1 1 0 0 0 0 1 0 0 0
1 0 0 0 0 0 1 0 0 0 0
1 0 1 0 0 1 0 0 0 0 0
1 1 0 0 1 0 0 0 0 0 0
1 1 1 1 0 0 0 0 0 0 0
WAVEFORM:
EXPERIMENT NO:-5
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity comp1 is
port(x,y:in bit;
p:out bit_vector(2 downto 0));
end comp1;
TRUTH TABLE
0 0 0 1 0
0 1 0 0 1
1 0 1 0 0
1 1 0 1 0
WAVEFORM:
EXPERIMENT NO:-6
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity seg is
Port ( lmn : in BIT_VECTOR (0 to 3);
abc : out BIT_VECTOR (0 to 6));
end seg;
TRUTH TABLE
lmn lmn lmn abc abc abc abc abc abc abc
(0) (1) (2) (0) (1) (2) (3) (4) (5) (6)
0 0 0 1 1 1 1 1 1 0
0 0 1 0 1 1 0 0 0 0
0 1 0 1 1 0 1 1 0 1
0 1 1 1 1 1 1 0 0 1
1 0 0 0 1 1 0 0 1 1
1 0 1 1 0 1 1 0 1 1
1 1 0 1 0 1 1 1 1 0
1 1 1 1 1 1 0 0 0 0
WAVEFORM
EXPERIMENT NO:-7
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity dff is
Port ( d,clk,rst : in bit;
q : inout bit);
end dff;
TRUTH TABLE
Q D Q[T+1]
0 0 0
0 1 1
1 0 0
1 1 1
WAVEFORM:
EXPERIMENT NO:-8
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity SISO is
Port ( e,p,c,clk : in bit;
z : out bit);
end SISO;
architecture structural of SISO is
component dff
port(in1, in2, in3, in4 : in bit; out1 : out bit);
end component;
signal q : bit_vector( 2 downto 0);
begin
d0 : dff port map (e,p,c,clk,q(0));
d1 : dff port map (q(0),p,c,clk,q(1));
d2 : dff port map (q(1),p,c,clk,q(2));
d3 : dff port map (q(2),p,c,clk,z);
end structural;
WAVEFORM:
EXPERIMENT NO:-9(A)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity HS is
Port ( u,v : in bit;
d,b : out bit);
end HS;
architecture dataflow of HS is
begin
d <= u xor v;
b <= not u and v;
end dataflow;
TRUTH TABLE
u v d b
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0
WAVEFORM:
EXPERIMENT NO:-9(B)
TRUTH TABLE
x y z diff borr
0 0 0 0 0
0 0 1 1 1
0 1 0 1 1
0 1 1 0 1
1 0 0 1 0
1 0 1 0 0
1 1 0 0 0
1 1 1 1 1
WAVEFORM: