Professional Documents
Culture Documents
Introduction
Verification of the functionality of implemented digital circuits is crucial in order to determine
if the system is functioning according to required specifications. This manual demonstrates to the
user how to write VHDL test benches for digital system verification using Xilinx ISE. It is assumed
that the reader is proficient in the implementation of digital circuits using Xilinx Schematic Editor.
The reader is urged to treat this publication as a mini-laboratory exercise for maximum
understanding of the material. After performing this mini-exercise in the laboratory, the reader is
expected to:
1. Understand how to write VHDL test benches for the verification of an implemented digital
circuit
2. Use Modelsim 6.0SE/SE or any other version to simulate the behaviour of an implemented
digital circuit
3. Restart simulation waveforms using specific icons in the Modelsim environment
4. Run at once, simulation parameters pre-set in the VHDL test bench using specific icons in the
Modelsim environment
Required Equipment
1. 1 Computer
2. 1 copy of this manual
In-Lab Exercise
1. Open the Xilinx ISE environment and create a new project as shown in the diagram below.
2. Give the project a name, prefereably VHDL_Testbenches. Be sure to select the TopLevel Module Type as Schematic.
3. Click Next!
6. Click Finish!
9. Click Next!
10. Click Finish!
10
11
12
13
Inputs
Test Case #
1
2
3
4
Expected Outputs
X
0
1
0
1
0
0
1
1
0
0
0
1
22. Look at the diagram below. Lines 50 to 70 have been inserted into the VHDL Test Bench.
These lines represent every aspect of Table 1 above. See how easy writing the VHDL Test
Bench for the and2 gate is.
23. Whenever you want to invoke a delay of say N microseconds you must use the directive
WAIT FOR followed by the number of microseconds. For example if we want to invoke a
delay of 100 microseconds we write:
A <= 1;
B <= 0;
25. We must finally invoke a delay, say 500 us to allow for the propagation of this test case and
its corresponding output for viewing.
26. Now observe how all four test cases from Table 1 have been represented in the VHDL Test
Bench.
14
15
16
17
18
19
31. A dialog box will appear as shown in the diagram below. Click on the Restart button. This
will restart the waveform.
20
21
22
37. The resulting waveform is shown in the diagram below. Carefully look at the waveform, also
taking into consideration the waveform timing. Can you identify the parts of the waveform
which represents each line of code inserted in the VHDL Test Bench?
23
Mini-Exercise
Add a new schematic file and insert a cb4ce counter. The schematic of this counter is shown
below. Write a new VHDL test Bench for the cb4ce counter. After writing the VHDL Test Bench,
simulate the behaviour of the cb4ce counter. Is it what you expect?
24