VLSI Lab
VLSI Lab
VLSI Lab
SUBMITTED BY:
Abuzar Shakeel 17BEC058
1
Table of Contents
1. AND gate………………………………………………………….…03
2. NAND gate…………………………………………………………..05
3. XOR gate………………………………………………………….…07
4. Full adder…………………………………………………………....09
5. Multiplexer…………………………………………………………...11
6. 4 bit parallel adder……………………………………………….....13
7. 4 bit parity generator…………………………………………….....15
8. SR Latch………………………………………………………….....16
9. SR flip flop……………………………………………………….…..18
10. 4 bit up counter……………………………………………....….20
2
Experiment 1
VHDL Code:
Library ieee;
use ieee.std_logic_1164.all;
entity and1 is
port(x,y:in bit ; z:out bit);
end and1;
Truth Table:
3
Waveform:
4
Experiment 2
Library ieee;
use ieee.std_logic_1164.all;
entity nand1 is
port(a,b:in bit ; c:out bit);
end nand1;
Truth Table:
5
Waveform:
6
Experiment 3
Library ieee;
use ieee.std_logic_1164.all;
entity xor1 is
port(a,b:in bit; q:out bit);
end xor1;
Truth Table:
7
Waveform:
8
Experiment 4
Library ieee;
use ieee.std_logic_1164.all;
entity full_adder is
port(a,b,c:in bit; sum,carry:out bit);
endfull_adder;
Truth Table:
9
Waveform:
10
Experiment 5
VHDL Code:
Library ieee;
use ieee.std_logic_1164.all;
entity mux is
port(S1,S0,D0,D1,D2,D3:in bit; Y:out bit);
end mux;
Truth Table:
11
Waveform:
12
Experiment 6
VHDL Code:
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity pa is
port(a :in STD_LOGIC_VECTOR(3 downto 0);
b :in STD_LOGIC_VECTOR(3 downto 0);
ca:out STD_LOGIC;
sum :out STD_LOGIC_VECTOR(3 downto 0)
);
end pa;
architecture ABC of pa is
component fa is
port(a :in STD_LOGIC;
b :in STD_LOGIC;
c :in STD_LOGIC;
sum :out STD_LOGIC;
ca:out STD_LOGIC
);
end component;
signal s :std_logic_vector(2 downto 0);
signal temp:std_logic;
begin
temp<='0';
u0 :fa port map (a(0),b(0),temp,sum(0),s(0));
u1 :fa port map (a(1),b(1),s(0),sum(1),s(1));
u2 :fa port map (a(2),b(2),s(1),sum(2),s(2));
ue :fa port map (a(3),b(3),s(2),sum(3),ca);
end ABC;
13
Waveform:
14
Experiment 7
VHDL Code:
Library ieee;
use ieee.std_logic_1164.all;
entity paritygen is
port(a0, a1, a2, a3:in std_logic; p_odd,p_even:out std_logic);
end paritygen;
Waveform:
15
Experiment 8
VHDL Code:
Library ieee;
use ieee.std_logic_1164.all;
entity srl is
port(r,s:in bit; q,qbar:buffer bit);
end srl;
Truth Table:
16
Waveform:
17
Experiment 9
VHDL Code:
Library ieee;
use ieee.std_logic_1164.all;
entity srflip is
port(r,s,clk:in bit;q,qbar:buffer bit);
end srflip;
Truth Table:
18
Waveform:
19
Experiment 10
VHDL Code:
library IEEE;
use ieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entity counter is
port(Clock, CLR :instd_logic;
Q :outstd_logic_vector(3 downto 0)
);
end counter;
begin
if(CLR ='1')then
tmp<="0000";
elsif(Clock'event and Clock = '1') then
tmp <= tmp + 1;
end if;
end process;
Q <= tmp;
end behv;
20
Waveform:
21