Professional Documents
Culture Documents
CPE-421
Integrated Circuit Design
LAB MANUAL
Student name:-
ID Number:- Serial Number:-..
Group Number: - (..)
Prepared by
Syed Asif Basha
1436-1437 1st Semester
CPE 421-Integrated Circuit Design Lab Manual- Syllabus and Course Outline KKU-CS-CE
Week Experiment
Name of the experiment Date
Number Number
1 Start of classes and Manual Registration 23-27/8/2015
2 Experiment 1 Introduction to VHDL language & Xilinx ISE environment. 30-3/8,9/2015
Program to simulate a Half Adder using 1.Data flow Model. 2. Behavioral
3 Experiment 2 6-10/9/2015
Model. Generate a synthesis report and generate bit file (bit stream).
Program to simulate a Full Adder using 1.Data flow Model. 2. Behavioral 13-17/9/2015
4 Experiment 3
Model and generate a synthesis report.
5 Mid Semester Vacation 18-28/9/2015
Program to simulate a 8x1 Multiplexer using Behavioral model and generate 29-1/9,10/2015
6 Experiment 4
a synthesis report
Program to simulate a 1x8 De-multiplexer using data flow model and 4-8/10/2015
7 Experiment 5
generate a synthesis report
Program to simulate a 8x3 Encoder using data flow model and generate a
8 Experiment 6 11-15/10/2015
synthesis report
9 18-22/10/2015
Midterm Practical Examination
Program to simulate a 3x8 Decoder using data flow model and generate a
10 Experiment 7 25-29/10/2015
synthesis report
Program to simulate a J-K Flip-flops using data flow model and generate a
11 Experiment 8 1-5/11/2015
synthesis report
Program to simulate a Up-down Counter using data flow model and generate
12 Experiment 9 8-12/11/2015
a synthesis report
Program to simulate a BCD to 7-Seg Decoder using data flow model and
13 Experiment 10 14-19/11/2015
generate a synthesis report
Program to simulate a Mealy state machine using Behavioral model and
14 Experiment 11 29-3/11,12/2015
generate a synthesis report
15 Home Work 6-10/12/2015
16 Final Practical Examination 13-19/12/2015
Grades:
MID Term Exam 7 marks
Final Exams 10 marks
Lab Record 3 marks
Home Work 5 marks
Lab Policy:
Attendance is Mandatory.
Copying in labs will get a ZERO grade.
There are exercises at the end of each lab experiment, students should solve this and submit it in the next session.
Lab reports are due at the beginning of the next lab session. LATE lab reports will have a 20% penalty, if they are given
within one week of the due date.
Report Format:
The report should consist of the following sections:
Cover Page: Include your name, student id number, lab number, topic of the experiment, experiment number
my name as a teacher assistant (the cover page uploaded in the Black Board)
Report Body: consist of the following sections
Experiment #1
Introduction to VHDL Programming Language and Xilinx ISE environment
Aim: To study the Basics of VHDL Programming Language and Xilinx ISE environment.
Objective: Write a VHDL Program for 2-input AND gate using dataflow modelling and generate
a synthesis report.
Software Used: Xilinx ISE 8.2i
Theory:
HDLs: Hardware description Languages are used to describe any Hardware such as AND gate, OR gate,
Multiplexer, Decoder, Counter and Registers
2 types:
1. VHDL: In VHDL V stands for VHSIC (Very High Speed Integrated Circuit) Hardware description
language.
2. Verilog
Logic Circuits: All digital logic circuits are classified into 2 types
1. Combinational Logic circuits
2. Sequential Logic Circuits
1. Combinational Logic circuits: In these Circuits the output at any time only depends on present value of
input.
Examples. All logic gates such as and ,or, not and xor gates, multiplexer, de-multiplexer, decoder, encoder,
half adder and full adder
2. Sequential Logic Circuits: In these Circuits the output at any time not only depends on present value of
input but also on the past value of output.
Examples. All Flip Flops such as S-R,J-K,T and D flip Flops, counters, shift registers and state machines
Entity: A VHDL entity specifies the name of the entity, the ports of the entity and entity-related information.
All designs are created using one or more entities.
Architecture: Architecture describes the behavior of the entity. A single entity can have multiple
architectures. One architecture might be behavioral while another might be a structural description of the
design.
Types of modelling: 1. Data flow modelling
2. Behavioral Modelling
3. Structural Modelling
Report. Program:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity AND2 is
Port ( a,b : in STD_LOGIC;
y : out STD_LOGIC);
end AND2;
architecture Behavioral of AND2 is
begin
y<= a and b;
end Behavioral;
Timing Diagram: it a plot of time both input and output signals of a system with time on x-axis and
logic value on the y-axis
Example: Timing diagram of a 2-input AND gate is as follows.
Lab Exercise:
1.Program to simulate a 3-input xor gate using data flow Model and generate and generate generate a
synthesis report.
Experiment #2
Half Adder
Aim: To Implement a Half Adder using Xilinx ISE 8.2
Objective: Write a VHDL program to simulate a Half Adder using behavioural modelling and generate a
synthesis report.
Software Used: Xilinx ISE 8.2i
Theory: A Half Adder is a combinational logic circuit, it has 2 inputs and 2 outputs
Procedure:
1. Double click on Xilinx ISE 8.2i Design Suit icon on the Desktop.
2. Click on file New project Enter the project name & Location, Select top level source type as HDL. Click
NextNext click on New Source select VHDL Module write Module Name Next write input and
output ports and Finish.
3. Click Next Next Next Finish.
4. Type program in the work space window and save the program.
5. In the sources window choose behavioral simulation.
6. In the process window expand the + symbol on Xilinx ISE Simulator Double click on check syntax.
7. After successful verification of syntax double click on simulate behavioural model.
8. Add an appropriate test bench waveform from the project new source choose test bench Waveform name
the test bench waveform next Finish.
9. select appropriate test bench input waveform save.
10. In the process window expand the + symbol on Xilinx ISE Simulator Double click on Generate expected
Simulation results yes yes.
11. To view synthesis report chooses synthesis in the sources window.
12. In process window expand the implement design expand synthesis XST double click on view synthesis
Report.
Timing Diagram:
Lab Exercises:
1. Write a VHDL Program for Half Substractor shown below using dataflow modeling and generate a
synthesis report.
2. Write a VHDL Program for Full Adder shown below using dataflow modeling and generate a synthesis
report.
Experiment #3
Full Adder
Aim: To Implement a Full Adder using Xilinx ISE
Objective: Write a VHDL program to simulate a Full Adder using behavioral modelling and generate a
synthesis report.
Software Used: Xilinx ISE 8.2i
Theory: A Full Adder is a combinational logic circuit, it has 3 inputs and 2 outputs
Procedure:
1. Double click on Xilinx ISE 8.2i Design Suit icon on the Desktop.
2. Click on file New project Enter the project name & Location, Select top level source type as HDL. Click
NextNext click on New Source select VHDL Module write Module Name Next write input and
output ports and Finish.
3. Click Next Next Next Finish.
4. Type program in the work space window and save the program.
5. In the sources window choose behavioral simulation.
6. In the process window expand the + symbol on Xilinx ISE Simulator Double click on check syntax.
7. After successful verification of syntax double click on simulate behavioural model.
8. Add an appropriate test bench waveform from the project new source choose test bench Waveform name
the test bench waveform next Finish.
9. select appropriate test bench input waveform save.
10. In the process window expand the + symbol on Xilinx ISE Simulator Double click on Generate expected
Simulation results yes yes.
11. To view synthesis report chooses synthesis in the sources window.
12. In process window expand the implement design expand synthesis XST double click on view synthesis
Report.
Program:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity fulladder is
port(a, b, c:in std_logic;
sum, carry: out std_logic);
Timing Diagram:
Lab Exercise:
1. Write a VHDL Program for Half adder shown below using behavioral modelling and generate a
synthesis report.
2. Write a VHDL Program for a 2 input Nand gate using behavioral modelling and generate a
synthesis report.
Experiment #4
Multiplexer
Aim: To Implement a 2nx1 Multiplexer using Xilinx ISE
Objective: Write a VHDL program to simulate a 8x1 Multiplexer using dataflow modelling and
Theory: A 2nx1 Multiplexer is a combinational circuit that selects information from 2n input lines to one
output line based on the select lines.
For n=3(select lines) it becomes a 8x1 Multiplexer it has 8 input lines and 1 output line
For n=2(select lines) it becomes a 4x1 Multiplexer it has 4 input lines and 1 output line
For n=1(select lines) it becomes a 2x1 Multiplexer it has 2 input lines and 1 output line
Procedure:
1. Double click on Xilinx ISE 8.2i Design Suit icon on the Desktop.
2. Click on file New project Enter the project name & Location, Select top level source type as HDL. Click
NextNext click on New Source select VHDL Module write Module Name Next write input and
output ports and Finish.
3. Click Next Next Next Finish.
4. Type program in the work space window and save the program.
5. In the sources window choose behavioral simulation.
6. In the process window expand the + symbol on Xilinx ISE Simulator Double click on check syntax.
7. After successful verification of syntax double click on simulate behavioural model.
8. Add an appropriate test bench waveform from the project new source choose test bench Waveform name
the test bench waveform next Finish.
9. select appropriate test bench input waveform save.
10. In the process window expand the + symbol on Xilinx ISE Simulator Double click on Generate expected
Simulation results yes yes.
11. To view synthesis report chooses synthesis in the sources window.
12. In process window expand the implement design expand synthesis XST double click on view synthesis
Report.
Lab Exercise:
1. Write a VHDL Program for 4x1Multiplexer shown below using dataflow modeling and generate a
synthesis report.
Experiment #5
Demultiplexer
Aim: To Implement a 1x2n Demultiplexer using Xilinx ISE
Objective: Write a VHDL program to simulate a 1x8 Demultiplexer using dataflow modelling and
Theory: A 1x2n Demultiplexer is a combinational circuit that passes information from 1 input line to one
2n output line based on the select lines.
For n=3(select lines) it becomes a 1x8 Demultiplexer it has 1 input line and 8 output lines
For n=2(select lines) it becomes a 1x4 Demultiplexer it has 1 input line and 4 output lines
For n=1(select lines) it becomes a 1x2 Demultiplexer it has 1 input line and 2 output lines
Procedure:
1. Double click on Xilinx ISE 8.2i Design Suit icon on the Desktop.
2. Click on file New project Enter the project name & Location, Select top level source type as HDL. Click
NextNext click on New Source select VHDL Module write Module Name Next write input and
output ports and Finish.
3. Click Next Next Next Finish.
4. Type program in the work space window and save the program.
5. In the sources window choose behavioral simulation.
6. In the process window expand the + symbol on Xilinx ISE Simulator Double click on check syntax.
7. After successful verification of syntax double click on simulate behavioural model.
8. Add an appropriate test bench waveform from the project new source choose test bench Waveform name
the test bench waveform next Finish.
9. select appropriate test bench input waveform save.
10. In the process window expand the + symbol on Xilinx ISE Simulator Double click on Generate expected
Simulation results yes yes.
11. To view synthesis report chooses synthesis in the sources window.
12. In process window expand the implement design expand synthesis XST double click on view synthesis
Report.
Timing Diagram:
Lab Exercise:
1. Write a VHDL Program for 1x4 Demultiplexer using dataflow modeling and generate a synthesis report.
y(0)
1x4 y(1)
f
Demultiplexer y(2)
y(3)
S(1) S(0)
Experiment #6
Encoder
Aim: To Implement a 2nxn Encoder using Xilinx ISE
Objective: Write a VHDL program to simulate a 8x3 Encoder using dataflow modelling and generate
synthesis report.
Software Used: Xilinx ISE 8.2i
Theory: An encoder is a circuit that converts information from one format to another, A 2nxn Encoder
converts information from 2n input lines to n output lines.
For n=3 8x3 Encoder it has 8 input lines and 3 output lines
For n=2 4x2 Encoder it has 4 input lines and 2 output lines
For n=1 2x1 Encoder it has 2 input lines and 1 output line
Procedure:
1. Double click on Xilinx ISE 8.2i Design Suit icon on the Desktop.
2. Click on file New project Enter the project name & Location, Select top level source type as HDL. Click
NextNext click on New Source select VHDL Module write Module Name Next write input and
output ports and Finish.
3. Click Next Next Next Finish.
4. Type program in the work space window and save the program.
5. In the sources window choose behavioral simulation.
6. In the process window expand the + symbol on Xilinx ISE Simulator Double click on check syntax.
7. After successful verification of syntax double click on simulate behavioural model.
8. Add an appropriate test bench waveform from the project new source choose test bench Waveform name
the test bench waveform next Finish.
9. select appropriate test bench input waveform save.
10. In the process window expand the + symbol on Xilinx ISE Simulator Double click on Generate expected
Simulation results yes yes.
11. To view synthesis report chooses synthesis in the sources window.
12. In process window expand the implement design expand synthesis XST double click on view synthesis
Report.
Lab Exercise:
1.Write a VHDL Program for 4x2 Encoder shown below using dataflow modelling and generate synthesis
report.
Experiment #7
Decoder
Aim: To Implement a nx2n Decoder using Xilinx ISE
Objective: Write a VHDL program to simulate a 3x8 Decoder using dataflow modelling and generate a
synthesis Report.
Software Used: Xilinx ISE 8.2i
Theory: A Decoder is a circuit that converts information from one format to another, A nx2n Decoder
converts information from n input lines to 2n output lines.
For n=3 3x8 Decoder it has 3 input lines and 8 output lines
For n=2 2x4 Decoder it has 2 input lines and 4 output lines
For n=1 1x2 Decoder it has 1 input lines and 2 output line
Procedure:
1. Double click on Xilinx ISE 8.2i Design Suit icon on the Desktop.
2. Click on file New project Enter the project name & Location, Select top level source type as HDL. Click
NextNext click on New Source select VHDL Module write Module Name Next write input and
output ports and Finish.
3. Click Next Next Next Finish.
4. Type program in the work space window and save the program.
5. In the sources window choose behavioral simulation.
6. In the process window expand the + symbol on Xilinx ISE Simulator Double click on check syntax.
7. After successful verification of syntax double click on simulate behavioural model.
8. Add an appropriate test bench waveform from the project new source choose test bench Waveform name
the test bench waveform next Finish.
9. select appropriate test bench input waveform save.
10. In the process window expand the + symbol on Xilinx ISE Simulator Double click on Generate expected
Simulation results yes yes.
11. To view synthesis report chooses synthesis in the sources window.
12. In process window expand the implement design expand synthesis XST double click on view synthesis
Report.
Lab Exercise:
1.Write a VHDL Program for 2x4 Decoder shown below using dataflow modeling and generate a synthesis
Report.
Experiment #8
Flip-Flops
Aim: To Implement a Flip-Flop using Xilinx ISE
Objective: Write a VHDL program to simulate a J-K Flip-Flop using behavioral modeling and generate a
synthesis Report.
Software Used: Xilinx ISE 8.2i
Theory: A Flip-Flop is a sequential logic circuit, in which the output not only depends on present input
but also on the past output. The symbol & truth table of a J-K flip-flop is shown below.
Where Q(n+1) next state (the value after the clock is applied)
Q(n) present state (the value before the clock is applied)
X dont care
Procedure:
1. Double click on Xilinx ISE 8.2i Design Suit icon on the Desktop.
2. Click on file New project Enter the project name & Location, Select top level source type as HDL. Click
NextNext click on New Source select VHDL Module write Module Name Next write input and
output ports and Finish.
3. Click Next Next Next Finish.
4. Type program in the work space window and save the program.
5. In the sources window choose behavioral simulation.
6. In the process window expand the + symbol on Xilinx ISE Simulator Double click on check syntax.
7. After successful verification of syntax double click on simulate behavioural model.
8. Add an appropriate test bench waveform from the project new source choose test bench Waveform name
the test bench waveform next Finish.
9. select appropriate test bench input waveform save.
10. In the process window expand the + symbol on Xilinx ISE Simulator Double click on Generate expected
Simulation results yes yes.
11. To view synthesis report chooses synthesis in the sources window.
12. In process window expand the implement design expand synthesis XST double click on view synthesis
Report.
Program:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity jkff is
Port ( clk,j,k,reset : in std_logic;
q,qb : out std_logic);
end jkff;
architecture Behavioral of jkff is
signal state: std_logic;
signal input: std_logic_vector (1 downto 0);
begin
input <= j&k;
process(clk,reset) is
begin
if reset = '1' then
state <= '0';
elsif (rising_edge(clk)) then
case (input) is
when"11" => state <= not state;
when"10" => state <= '1';
when"01" => state <= '0';
when others =>null;
end case;
end if;
end process;
q <= state;
qb<=not(state);
end Behavioral;
Timing Diagram:
Lab Exercise:
1. Write a VHDL program to simulate a T-Flip-Flop using behavioral modeling and generate a synthesis
Report.
T q
qb
2. Write a VHDL program to simulate a D-Flip-Flop using behavioral modeling and generate a synthesis
Report.
D q
reset qb
Experiment #9
Up-down counter
Aim: To implement a up down counter using Xilinx ISE
Objective: Write a VHDL program to simulate a 3-bit up-down counter using behavioral modelling and
generate a synthesis Report.
Software Used: Xilinx ISE 8.2i
Theory: A 3bit-up down counter is a sequential logic circuit, in which the output is incremented by 1 if
The direction input is1 and the output is decremented by 1 if the direction input is 0. The symbol &
truth table of a 3bit-up down counter is shown below.
direction
Cout[2]
clk
3-bit up-down Cout[1]
counter
Cout[0]
Procedure:
1. Double click on Xilinx ISE 8.2i Design Suit icon on the Desktop.
2. Click on file New project Enter the project name & Location, Select top level source type as HDL. Click
NextNext click on New Source select VHDL Module write Module Name Next write input and
output ports and Finish.
3. Click Next Next Next Finish.
4. Type program in the work space window and save the program.
5. In the sources window choose behavioral simulation.
6. In the process window expand the + symbol on Xilinx ISE Simulator Double click on check syntax.
7. After successful verification of syntax double click on simulate behavioural model.
8. Add an appropriate test bench waveform from the project new source choose test bench Waveform name
the test bench waveform next Finish.
9. select appropriate test bench input waveform save.
10. In the process window expand the + symbol on Xilinx ISE Simulator Double click on Generate expected
Simulation results yes yes.
11. To view synthesis report chooses synthesis in the sources window.
12. In process window expand the implement design expand synthesis XST double click on view synthesis
Report.
Program:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity updowncounter is
Port ( clk, direction: in STD_LOGIC;
cout: out STD_LOGIC_VECTOR (2 downto 0));
end updowncounter;
architecture Behavioral of updowncounter is
signal cin : std_logic_vector(2 downto 0) := "000";
begin
process(clk)
begin
if clk='1' and clk'event then
if direction='1' then
cin<= cin + 1;
else
cin <= cin - 1;
end if;
end if;
end process;
cout<= cin;
end Behavioral;
Timing Diagram:
Lab Exercise:
1. Write a VHDL program to simulate a decade counter using behavioral modeling and generate a synthesis
Report.
Cout[3]
clk
decade Cout[2]
counter Cout[1]
Cout[0]
Hint: The counter counts binary number from (0-9) in ascending order.
Experiment #10
BCD to 7-Segment Decoder
Aim: To Implement a bcd to 7-segment decoder using Xilinx ISE
Objective: Write a VHDL program to simulate a bcd to 7-segment decoder using behavioral modelling
and generate a synthesis Report.
Software Used: Xilinx ISE 8.2i
Theory: A bcd to 7segment display is a combinational logic circuit, in which the input is a bcd number
from 0-9 and the output is a 7segment code to display the corresponding number on a 7segment display as
shown below.
Procedure:
1. Double click on Xilinx ISE 8.2i Design Suit icon on the Desktop.
2. Click on file New project Enter the project name & Location, Select top level source type as HDL. Click
NextNext click on New Source select VHDL Module write Module Name Next write input and
output ports and Finish.
3. Click Next Next Next Finish.
4. Type program in the work space window and save the program.
5. In the sources window choose behavioral simulation.
6. In the process window expand the + symbol on Xilinx ISE Simulator Double click on check syntax.
7. After successful verification of syntax double click on simulate behavioural model.
8. Add an appropriate test bench waveform from the project new source choose test bench Waveform name
the test bench waveform next Finish.
9. select appropriate test bench input waveform save.
10. In the process window expand the + symbol on Xilinx ISE Simulator Double click on Generate expected
Simulation results yes yes.
11. To view synthesis report chooses synthesis in the sources window.
12. In process window expand the implement design expand synthesis XST double click on view synthesis
Report.
Experiment #11
Finite State Machine
Aim: To Implement a finite state machine using behavioral modeling in Xilinx ISE
Objective: Write a VHDL program to simulate the mealy state machine described by the following state
diagram using behavioral modeling and generate a synthesis Report.
Procedure:
1. Double click on Xilinx ISE 8.2i Design Suit icon on the Desktop.
2. Click on file New project Enter the project name & Location, Select top level source type as HDL. Click
NextNext click on New Source select VHDL Module write Module Name Next write input and
output ports and Finish.
3. Click Next Next Next Finish.
4. Type program in the work space window and save the program.
5. In the sources window choose behavioral simulation.
6. In the process window expand the + symbol on Xilinx ISE Simulator Double click on check syntax.
7. After successful verification of syntax double click on simulate behavioural model.
8. Add an appropriate test bench waveform from the project new source choose test bench Waveform name
the test bench waveform next Finish.
9. select appropriate test bench input waveform save.
10. In the process window expand the + symbol on Xilinx ISE Simulator Double click on simulate behavioral model
yes yes.
11. To view synthesis report chooses synthesis in the sources window.
12. In process window expand the implement design expand synthesis XST double click on view synthesis
Report.
Lab Excercise: Write a VHDL program to simulate the mealy state machine described by the following
state diagram using behavioral modeling and generate a synthesis Report.
References