تجارب مختبر الالكترونيك
تجارب مختبر الالكترونيك
There are several different types of FPGA chips available and many
different types of technologies for those chips. The historical roots of FPGAs
are in Complex Programmable Logic Devices (CPLDs) of the early to mid
1980s. Ross Freeman, Xilinx cofounder, invented the field programmable gate
array in 1984- CPLDs and FPGAs include a relatively large number of
programmable logic elements.
General Procedure
Procedure
.To start ISE, double - click the desktop icon as shown in Figure (1)
1
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
a) Select File > New Project …the new project wizard appears.
2
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
Family : Spartan 3
Device: XC3S200
Package : FT256
Speed grade : - 4
3
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
Leave the default values in the remaining fields. When the table is complete,
.your project will look like Figure(3)
g) Click Next to proceed and create new source window in the new project
.wizard, at the end of the next section, your new project will be completed
4
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
5
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
.b) Create a new test bench source by selecting, Project New source
c) In the new source wizard select Test Bench Waveform as the source type,
.AND-tbw in the file name field
d) Click Next
e) The associated source page shows that you are associating the test bench
waveform with the source file and Click Next.
f) The summary page shows that the source will be added to the project and it
displays the source directory, type and name click Finish.
g) You need to test the clock frequency, setup time, and output delay times in
the initialize timing dialog box before the test bench waveform editing window
opens. The design requirements correspond with the values below: Fill in the
fields in the initialize timing dialog box with the following information:
6
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
Leave the remaining values in the remaining fields as shown in Figure (6).
.h) Click Finish to complete the timing initializing as shown in Figure (7)
7
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
L) In the source window, select the Behavioral Simulation view to see that the
.test bench waveform file is automatically added to your project
Verify that the counter design functions as you expect to perform behavior
:simulation as follows
1- Verify the Behavioral Simulation AND-tbw is selected in the source
window.
2- In the Processes tab, click the "+" to expand the Xilinx ISE simulator
process and double click the Simulate Behavioral Model process. The
ISE simulator opens and runs the simulation to the end of the test bench.
3- To view your simulation results, select the Simulation tab and zoom in on
the transitions. The simulation waveform results will look like Figure (8).
You have now completed simulation of your design using ISE simulator.
8
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
OBJECT
To understand how can draw the logic gates and get simulation by using
Xilinx ISE 9.2i software FPGA to create FPGA designs for the XESS XSA
.boards
THEORY
We will study the various types of logic gates and the applications of
Exclusive-OR that make up a typical digital system. The emphasis is on the
logical operation of the circuits and the limitation and considerations involved
in their operation. It is very important to know that the output of a gate is for
various combinations of inputs and to understand how the electrical
characteristics affect its operation so that we can predict and analyze how a
circuit will perform in a given system.
The AND gate performs the basic operation of logic multiplication more
commonly known as the AND function as shown in Figure (1-1). The operation
of the AND gate is such that the output is HIGH only when all of the inputs are
HIGH. When any of the inputs is LOW, the output is LOW as shown in
Table (1-1).
9
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
A B C
0 0 0
0 1 0
1 0 0
1 1 1
THE OR GATE
A B C
0 0 0
0 1 1
1 0 1
1 1 1
10
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
THE INVERTOR
A C
0 1
1 0
Figure (1-4) show the symbol of NAND gate, which is a logic circuit
whose output is LOW when all inputs are HIGH as illustrated in table (1-4).
A C
B
Fig. (1-4) The two inputs NAND gate symbol.
A B C
0 0 1
0 1 1
1 0 1
1 1 0
11
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
Figure (1-5) show the symbol of NOR gate, which is a logic circuit whose
output is LOW when at least one of its input is HIGH as illustrated in table(1-5).
A C
B
A B C
0 0 1
0 1 0
1 0 0
1 1 0
Figure (1-6) show the symbol of EX-OR gate, which is a logic circuit
whose output is HIGH when one input ( but not both) is HIGH as illustrated in
table(1-6).
A B C
0 0 0
0 1 1
1 0 1
1 1 0
12
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
Figure (1-7) show the symbol of EX-NOR gate, which is a logic circuit
whose output is the complement of an exclusive – OR gate as illustrated in table
(1-7).
A C
B
Fig. (1- 7) the EX – NOR gate symbol
A B C
0 0 1
0 I 0
1 0 0
1 1 1
1- Parity Checker
Errors can occur as digital codes are being transferred from one point to
another within a digital system or while codes are being transmitted from one
system to another. The errors like the form of understanding change in the bits
that make up of coded information that is a 1 can be changed to 0 or a 0 to 1,
due to component many functions or electrical noise. If we have three bit word,
to detect the occurrence of an odd number of errors in this word, a single bit
will be added to the word that makes the number of ones in the word either even
number (even parity) or odd number (odd parity), so if an odd number of errors
occurred in the word, then, the total number of ones will not remain the same, it
will change from odd to even or from even to odd. The EX – OR gate is the
most suitable circuit to provide parity checker. Figure (1-8) gives the circuit of
three bit even parity checker.
13
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
A
B
C X
2. Control Inverter
A = X, B = Y, C = Z.
A = X, B = Y, C = Z.
A B C
Control signal
x y z
14
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
and the EX – OR gate is the most suitable gate for this purpose as shown in
Figure (1-10).
(a) (b)
Fig. (1-10) (a) Binary to gray code inverter. (b) Gray to binary code inverter.
4. Digital comparator
B A>B
A<B
A=B
15
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
:APPARATUS
1- FPGA on the XSA Board.
2- Xilinx ISE 9.2i software FPGA
PROCEDURE
1- Connect the circuit shown in Figure (1-1), draw the input, and output
waveforms.
2- Connect the three inputs OR gate and draw the input and output
waveform.
3- Repeat step (2) for 3-input NAND gate and NOR gate.
4- Repeat step (1) for EX-OR gate and EX-NOR gate.
5- Connect the circuit shown in Figure (1-8) and draw the input and
output waveform and find its truth table..
6- Repeat step (5) for Figure (1- 9), Figure (1-10), and Figure (1- 11).
7- Implement all steps illustrated above using FPGA on the XSA Board.
DISCUSSION
Implement EX–OR gate using NOR gate only and find the simulation .1
.result
B A
B
C Y
D
Figure (1-12)
16
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
OBJECT
ENCODERS:
BCD DECODER:
The BCD decoder converts each BCD code word (8421) into one of ten
possible decimal digit indications. It is typically referred to as a 1–of –10 or 4–
line – to 10-line decoder. The method of implementation is essentially the same
as for the 1-of-16 decoder, except that only ten decimal digits 0 through 9.
17
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
This type of decoder accepts the BCD code on its inputs provides outputs
to energize seven – segment display devices in order to produce a digital
readout. Figure(2 -1 ) shows a common display format composed of seven light
– emitting elements or segments. By lighting certain combinations of these
segments, each of the ten decimal digits can be produced.
a
f b
g
e c
d
APPARATUS:
18
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
DISCUSSION
B Y
Fig. (2-2)
2) Draw and simulate the logic diagram of (2*4) decoder using NOR gates
only.
3) Implement and find simulation result of the following function using
decoder F= A B C + A B.
4) Draw and simulate the logic diagrams of (8*3) encoder using NAND
gates only.
5) BCD numbers are applied sequentially to the BCD – to – decimal in
Figure (2-3) draw using software the ten output waveforms, showing each
in the relation ship to the other and to the input D is the MSB.
19
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
0
A 1
2
B 3
4
C 5
6
D 7
8
9
20
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
OBJECT
THEORY
21
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
D0
D1
Data Input Data Output
D2
D3
S1 S0
Data Select
APPARATUS:
PROCEDURE
DISCUSSION
22
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
1 D0
0 D1
Output
1 D2
0 D3
S1 S0
Fig. (3-3)
S1
S0
Fig. (3-4)
2- Implement and simulate the following function using multiplexer
F=AC+BC+ABC
23
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
OBJECT
Design various types of flip – flops and get simulation by using Xilinx
.ISE 9.2i software FPGA to create FPGA designs for the XESS XSA boards
THEORY
S - R FLIP – FLOP
24
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
D FLIP – FLOP
The D flip – flop is very useful in cases where a single data bit (1 or 0) is
to be stored. The simple addition of an inverter to an S – R flip – flop creates a
basic D flip – flop, as shown in Figure (4-2) which a positive edge – triggered
type.
J - K FLIP – FLOP
The J – K flip – flop is very versatile and perhaps the most widely used
type of flip – flop as shown in Figure (4-3).
25
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
Figure (4-4) shows a J – K flip – flop with preset and clear inputs, this
illustrate how these inputs work.
Fig. (4-4) J – K flip – flop with active LOW preset and clear
APPARATUS:
1-Connect the circuit shown in Figure (4-1). Find the simulation and truth
table.
9- Implement all steps illustrated above using FPGA on the XSA Board.
26
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
DISCUSSION
1- For the Figure(4-5) simulate the output result, assume initial Reset
J1 = 0 1 00 1 0 1 1 J2 = 1 0 0 0 1 0 0 1 K1 = 0 1 1 10 1 1 0
K2 = 0 1 0 1 0 0 1 0 K3 = 0 1 1 1 1 0 1 1
J1
K1 J Q
CLK
K1
K2 K Q
K3
Fig. (4-5)
2- For the edge – triggered J – K flip – flop with PRESET and CLEAR in Figure
(4-6), Determine the simulation output for the inputs shown in the timing diagram,
Q is initially LOW.
PR
HIGH
J Q
CLK
K Q
CLR
CLK
PR
CLR
Fig. (4-6)
27
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
PR
J Q
CLK
K Q
CLR
CLK
PR
CLR
Fig.(4-7)
A B
J Q J Q
K Q K Q
CLK
Fig. (4-8)
28
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
OBJECT
THEORY
A digital counter is a logic circuit that can progress through a sequence
of numbers or states when activated by a clock pulse input. The outputs of
counters indicate the binary number contained within the counter at any given
time.
1) Asynchronous Binary Counter
Figure (5-1) shows a two –stage counter connected for asynchronous
operation each flip-flop in counter commonly referred to a stage of the counter.
29
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
30
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
APPARATUS:
1- FPGA on the XSA Board.
2- Xilinx ISE 9.2i software FPGA.
PROCEDURE
1- Connect the circuit shown in Figure (5-1). Find the table and its timing
diagram by using software.
2- Repeat step 1 for circuit shown in Figure (5-2) and Figure (5-3).
4- Connect the circuit shown in Figure (5-4). Find the table and its timing
diagram by using software.
5- Repeat step 1 for circuit shown in Figure (5-5) and Figure (5-6).
7- Implement all steps illustrated above using FPGA on the XSA Board.
31
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
DISCUSSION
1. Design and simulation a counter that has the following repeated sequence
(0, 3, 8, 5, 12) using J –K flip – flop.
2. Design and simulation a counter that has the following repeated sequence
(1, 2, 3, 4, and 5) using T flip – flop.
4. The state diagram for a positive edge – triggered counter shown in the
Figure (5-7). Sketch the corresponding timing diagram.
Fig. (5-7)
5. Draw the complete timing diagram for the five-stage synchronous binary
counter shown in Figure (5-8) below verify that the waveform of the Q
outputs represent the proper binary number after each clock pulse.
Fig.(5-8)
32
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
OBJECT
Design various types of shift register and get simulation by using Xilinx
.ISE 9.2i software FPGA to create FPGA designs for the XESS XSA boards
THEORY
The shift register is very important in applications involving the storage
and transfer of data in a digital system the basic difference between a register
and a counter is that a register has no specified sequence of states except in
certain very specialized applications a register in general is used to delay for the
purpose of storing and shifting data (1s and 0s) entered into it form an external
source and possesses no characteristic internal sequence of states.
Serial in Serial out Shift Register
Figure (6-1) shows a four- bit Serial in – serial out shift register
Data SA QA SB QB SC QC SD QD Data output
input
CLK CLK CLK CLK
RA RB RC RD Data output
RA QA RB QB RC QC RD QD
Clock
QA QB QC QD
33
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
DA DB DC DD
PE
SA QA SB QB SC QC QD
SD
CLK CLK
CLK CLK
RA RB RC RD
Clock
DA DB DC DD
SA QA SB QB SC QC SD QD
RA RB RC RD
Clock
QA QB QC QD
APPARATUS:
1- FPGA on the XSA Board.
2- Xilinx ISE 9.2i software FPGA.
34
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
PROCEDURE
1) Connect the circuit shown in Figure (6-1) and find its timing using software.
2) Repeat step (1) for Figure (6-2), Figure (6-3) and Figure (6-4).
3) Find the simulation of Figure (6-1), Figure (6-2), Figure (6-3) and Figure (6-
4) by using block.
4) Implement all steps illustrated above using FPGA on the XSA Board.
DISCUSSION
1) For the data input and clock timing diagram in Figure (6-5), determine the
state of each flip-flop in the Figure (6-1), Assume the register contains all one
initially.
CLK
Data in
Fig. (6-5)
2) What is the state of the register shown in Figure (6-6) after each clock pulse
if it starts in the 100101 state?
Dat i Dat ou
a n a t
CLK 6- bit register
Data in
Fig. (6-6)
35
University of Technology Digital Laboratory
Department of Electrical and Electronic Engineering Third Year
3) Show using simulation the state of the five bit Serial in parallel out shift
register for the data input and clock waveform shown in Figure(6-7). The
register initially contains all 1s.
CLK
Data in
Fig. (6-7)
4) Show using simulation the output wave form for a five –bit Parallel in serial
out shift register with the input data PE , and clock wave form as shown in
Figure(6-8). The register is initially cleared.
CLK
PE
Fig. (6-8)
5) Determine using simulation the count sequence of feed back shift register
shown in Figure (6-9) assume the initial state is (10101).
CK
A QA Q B QC QD
Fig. (6-9)
36