Beruflich Dokumente
Kultur Dokumente
Objective
This tutorial will give you brief information on overall design flow. You will learn to
use
• design entry via a schematic editor,
• functional verification via an HDL Testbench utility (HDL Bencher),
• a simulation tool (Modelsim XE) and
• implementation via a Spartan2 (Xilinx) FPGA prototyping board from Digilent.
In this tutorial, we will implement the following function using schematic entry:
To create a new project, click on the menu File->New Project. This will bring up
a small dialog box with information about the new project. In the "Project Name"
box, type intro, the name we will use for the introductory tutorial. Now, select an
appropriate location for all of the project files to be saved in the "Project Location"
box. Preferably use the location D:\labs.
Set “Device Family" property to Spartan2, (if you are using the Pegasus board)
"Device" property to xc2s50, “Package“ property to pq208 and “Speed Grade“
property to -6. The "Design Flow" should be set to "XST VHDL”.
Now, the project has been created. Next step is to create our schematic design
file. Click on the menu Project->New Source. This will bring up a small dialog
box with several choices for design entry. Select the Schematic choice from the
left box and type intro in the "Source Name" box. Be sure that the file location is
in your project directory and that the "Add to Project" checkbox is selected.
Click on "Next" and then "Finish" to add the schematic source and start
schematic editor.
Repeat this procedure to place the or2 and inv symbols (also located in the
Logic category) on the screen as shown by Figure 7.
I/O access for the FPGA can only be achieved by running the external nets (or
stimulus) through I/O buffers. Since all of the logic has been placed, but not
wired, the next step involves placing the I/O buffers onto the sheet. This is done
in the same manner as with the logic, only the category is IO. Select this
category and place the component ibuf (Input Buffer) in front of the input
terminals of the and2 and inv components. Select the obuf (Output Buffer)
component and place it at the output of the or2 component. This should look like
something similar to Figure 8.
After all of the components are placed, the components should be wired using
nets. To draw the nets, click on the menu Add->Wire. Left-click on the terminals
of components to be wired respectively (there appears a square marker when
you point the mouse on the terminal). If you did correctly, a blue wire should be
observed between two terminals of the components (Figure 9).
Finish wiring and add extra wires to the input terminals of the ibuf components
and to the output terminal of the obuf component. Select the extra wire of ibuf
input terminal, and click on the menu Add->Net Name to assign the name of the
input net. Repeat this step for all ibuf inputs (A, B, C for this circuit) and obuf
output (D for this circuit) (Figure 10).
The last step in the design is to add the I/O markers. Click on the menu Add->I/O
Marker. From the “Add I/O Marker Options”, select the marker type (input for
A,B and C, output for D) and click on the corresponding named net. The
completed schematic should look similar to Figure 12.
Figure 12- I/O Markers Placed (Complete Circuit Design)
You can check to be sure that your design does not have any errors by clicking
on the menu Tools->Check Schematic. If you have no errors reported, you
should see a popup window as shown in Figure 13. If there is an error, use the
information in this window as a guide to help solve the error.
Once you are done, save the changes to the schematic, close the Schematic
editor, and return to the Project Navigator.
HDL Bencher is used for both functional and timing simulation purposes. For this
tutorial, we are only going to perform a functional simulation, and our simulation
should cover all truth table for this example.
To start the HDL Bencher tool, add a new source of type "Testbench
Waveform" with the name intro_tb. When the "Associate with source" window
appears, select your schematic design file (intro) (it should be the only available
selection). Click on "Next" and then "Finish". An initial window called "Initialize
Timing" will appear (Figure 14). This is used to obtain the desired timing
scheme used for the Testbench. The default is ok so click "OK" and continue.
The HDL Bencher tool will then open and look similar to Figure 15.
In order to generate the Testbench for this circuit, we will have to apply stimulus
to the inputs and give the expected output value. The truth table for this circuit is
as follows:
C B A D
0 0 0 1
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 1
Table 1- Truth Table for the Given Boolean Equation
By looking at the truth table, the easiest way to stimulate this circuit is to apply a
toggling waveform to each input with specific duration and length. In the case of
the input A, we need to repeat a toggling waveform four times with a length of
one. For input B, we need to repeat the sequence twice with a length of each
pulse width two. Finally, for input C, the sequence only happens once but the
length of each pulse is four. By applying this stimulus, and checking it against the
desired output, the circuit will be correctly tested.
At 0 ns, double-click on the “0” in the light-blue section of the input A. A button
named "Pattern" will occur next to the “0”. Clicking on this button will display
"Pattern Wizard". Select “Toggle” for "Choose Pattern", “4” for "Repeat
Pattern # times:" (number of times we need to repeat this pattern) and “1” for
“Toggle Every” (number of cycles to toggle). The "Pattern Wizard" should look
like Figure 16.
Click "OK" to accept the pattern. The stimulus for input A should look like Figure
17.
Figure 17- Stimulus Waveform for Input A
For input B, display the "Pattern Wizard". Repeat the pattern twice and set
"Toggle Every" to “2”. For input C, repeat once and set "Toggle Every" to “4”.
HDL Bencher should now look like Figure 18.
In order to complete the testbench, we assign the correct output waveform. Click
on the first yellow box to toggle from unassigned to '1' (correct output value at
this time instance). HDL Bencher should now look like Figure 19.
Pay attention to the half red column next to letter C in the waveform editor. This
partial red column indicates that the input C is not fully covered or has not been
fully tested. Click on the "Coverage Statistics" button on the toolbar. ( )
The statistics show that the inputs have not been fully toggled and we know that
the input C has a coverage problem. C goes from '0' to '1' but never come back
to '0' state, which is the problem. Assigning A, B and C to ‘0’ after 800 ns and
setting the output to ‘1’ solve the problem. Check the coverage statistics to
ensure that the coverage is full. The final testbench waveform is shown in Figure
22.
Save the waveform by clicking on the menu File->Save Waveform. Exit HDL
Bencher and return to the Project Manager.
Step 5 - Functional Simulation of the Design
Verify that the Testbench completed successfully. If there is an error during the
simulation process, check your original source file and Testbench file to correct.
If there is an error in the simulation results, that will be probably due to the
original source file.
Implementing the design involves taking the netlist files from design entry and
creating an optimized structure for a specific FPGA in a specific configuration.
The steps of implementation are the following:
For xc2s50-pq208
A: P89
B: P88
C: P87
D: P46
Once this is completed, the tool should look like Figure 24.
Conclusion
During this tutorial you learned the basics on the ISE tools including schematic
design entry, Testbench generation, functional simulation, implementation, and
downloading to the Spartan2 boards.