08 Lab
08 Lab
Getting Started
The following subsections describe the basic requirements for
running the tutorial.
Nomenclature
In this tutorial, the following terms are used:
• “XC4000 family” includes XC4000E, XC4000L, XC4000EX,
XC4000XL, and XC4000XV devices.
• “Right-click” means click the right mouse button. Unless
specified, all other mouse operations are performed with the left
mouse button.
Throughout this tutorial, file names, project names, and directory
names (paths) are specified in lower case, and the design is referred
to as Watch.
Required Software
The Xilinx Foundation Series package, Version 1.5, is required to
perform this tutorial. The design requires that you have installed the
XC4000E libraries and device files and are licensed for Foundation
Express or Base Express. These options are selected by default in the
install program for either Express configuration.
Note: A Foundation Express license is required to access the Express
Constraints GUI.
Directory Description
WTUT_VHD Incomplete Watch Tutorial - VHDL
WTUT_VER Incomplete Watch Tutorial - Verilog
WATCHVHD Solution for Watch - VHDL
WATCHVER Solution for Watch - Verilog
VHDL or Verilog?
This tutorial has been prepared for both VHDL and Verilog designs.
This document applies to both designs simultaneously, noting
differences where applicable. You will need to decide which HDL
language you would like to work through the tutorial when you open
the project.
6. The wtch_hdl project will contain two UCF files. If this is the
case, select wtut_vhd.ucf or wtut_ver.ucf. Select Document →
Remove or press Del to remove the file (wtut_ver.ucf or
wtut_vhd.ucf). Click Yes to confirm the removal of the file.
This does not delete the file from the disk. It merely removes it
from the project so that it is not used during compilation. The file
still exists in the project directory on the disk. If you mistakenly
remove a file from a project, select Document → Add to add it
back.
Design Description
The design used in this tutorial is a hierarchical, HDL-based design,
meaning that the top-level design file is an HDL file that references
several other lower-level macros. The lower-level macros are either
HDL modules or LogiBLOX modules.
The design begins as an unfinished design. Throughout the tutorial,
you complete the design by generating some of the modules from
scratch and by completing some others from existing files. When the
design is complete, you simulate it to verify the design’s
functionality.
Watch is a simple runner’s stopwatch. There are two external inputs,
and three external output buses in the completed design. The system
clock is an internally generated signal produced by the OSC4, the
internal oscillator in the XC4000 devices. The following list summa-
rizes the input lines and output buses.
Inputs:
• STRTSTOP —Starts and stops the stopwatch. This is an active
low signal which acts like the start/stop button on a runner’s
stopwatch.
• RESET—Resets the stopwatch to 00.0 after it has been stopped.
Outputs:
• TENSOUT[6:0]—7-bit bus which represents the Ten’s digit of the
stopwatch value. This bus is in 7-segment display format
viewable on the 7-segment LED display on the Xilinx
demonstration board.
Hierarchy Browser
In the Files tab of the Hierarchy Browser, design source files and
libraries are displayed. Next to each filename is an icon which tells
you the file type (HDL file, state machine, schematic, library, text file,
for example). If a file contains lower levels of hierarchy, the icon has a
+ to the left of the name. HDL files have this + to show the entities
(VHDL) or modules (Verilog) within the file. You can expand the tree
by clicking this icon. You can open a file to edit by double clicking the
filename in the browser.
A Versions tab is also available behind the Files tab. Since this is a
new design which has not yet been implemented, the Versions tab is
empty. This tab is discussed in more detail later in the tutorial during
design implementation.
Design Entry
In this hierarchical design, you will examine HDL files, correct syntax
errors, create an HDL macro, and add a LogiBLOX module. This
tutorial gives you experience with creating and using each type of
design macro so that you can apply these procedures to your own
design.
• A red X means errors have been found. Select this file and
examine the errors under the HDL Errors tab. Errors are also
given in the HDL Editor.
or,
• Double click an HDL file in the Files tab.
or,
• Right-click an HDL file in the Files tab and select Edit.
If you need to stop the tutorial at any time, save your work by
selecting File → Save from the menus.
6. Repeat the previous step for the LED[6:0] output bus. Be sure that
the direction is set to Output.
7. Click Finish to complete the Wizard session. A “skeleton” HDL
file now displays in the HDL Editor.
8. You now have complete and functional HDL code and can check
the syntax using Synthesis → Check Syntax.
9. After you successfully complete the syntax check, save the file by
selecting File → Save from the HDL Editor.
10. Add this HDL file to your current project by selecting Project
→ Add to Project.
11. Exit the HDL Editor.
VHDL Flow
1. If you have closed the HDL Editor, open STOPWATCH.VHD.
2. Place your cursor after the line that states:
“-- Place the LogiBLOX Component Declaration for Tenths here”
Select Edit → Insert File and choose Tenths.vhi. The VHDL
template file for the LogiBLOX instantiation is inserted.
The Component Declaration does not need to be modified.
3. Highlight the inserted code from “--Component Instantiation” to
“TERM_CNT=>);”. Select Edit → Cut.
Verilog Flow
1. If you have closed the HDL Editor, open STOPWATCH.V
2. Place your cursor after the line that states:
“-- Place the LogiBLOX Module Declaration for Tenths here”
This line is at the end of the file.
Select Edit → Insert File and choose Tenths.vei. The Verilog
template file for the LogiBLOX instantiation is inserted.
The Component Declaration does not need to be modified.
Note: Alternatively, the remaining module declaration can be placed
in a new Verilog file (name it TENTHS.V) and added to the project. Be
careful not to overwrite the Verilog simulation model, also named
TENTHS.V, if one has been created. This module declaration is
required to define the port directions of the ports of the LogiBLOX
module.
This step can also be done by clicking the Synthesis button under
the flow tab. Select the stopwatch entity or module by using the
pulldown in the Top Level field. Be sure that the Version Name
field has an entry.
4. Complete the Target Device fields with this information:
• Family: XC4000E
• Device: 4003EPC84
• Speed Grade: -3
5. Check the boxes labeled Edit Synthesis/Implementation
Constraints and View Estimated Performance after Optimization.
Selecting the Edit Synthesis/Implementation Constraints box
automatically opens the Express Constraints Editor after
synthesis is complete.
Selecting the View Estimated Performance after Optimization
box automatically opens the Optimized dialog box which
displays the results of the synthesis and optimization.
6. Click Run. Express synthesizes the design and opens the Express
Constraints Editor.
Note: The Express Constraints Editor is not available to non-
registered users or with Base Express licenses. All the functionality
covered by the Express Constraints Editor can be achieved by
component instantiation (Pullups, Pulldowns, Clock Buffers, I/O Flip
Flops), UCF file (timing constraints, pin location constraints), or MAP
options (merging flip flops into IOBs). If you are a Base Express
customer, skip to the “In-Depth Tutorial — Functional Simulation”
chapter.
• Ports
With the Ports tab, you set input and out delay requirements,
assign clock buffers, insert pullup or pulldown resistors in the I/
O, set delay properties for input registers, set slew rate, disable
the use of I/O registers, and assign pin locations. For all but the
pin locations, click in the box to use the pulldown menu. For pin
locations, type the pin number in the box.
• Modules
With the Modules tab, you to keep or eliminate hierarchy and
disable resource sharing. You can also override the default
settings for effort and area versus speed at the module level.
• Xilinx Options
The Ignore unlinked cells during GSR mapping option directs
Express to infer a global reset signal (and, therefore, insert the
STARTUP module), even if black boxes have been instantiated.
Express cannot know the reset characteristics of any logic in black
boxes, so it will not insert STARTUP unless you check this option.
4. Under the Modules tab, you can examine the elements used to
synthesize this design. Click the box in the second row under
Area and select Details. This section summarizes all the design
elements used in the Stopwatch design that Express knows
about.
Since the Tenths module is a LogiBLOX component and has not
been synthesized by Express, it is UNLINKED and no summary
information is available.
Note: Black boxes (modules not read into the Express design
environment) are always noted as UNLINKED in the Express reports.
As long as the underlying netlist (.xnf, .ngo, .ngc or EDIF) for a black
box exists in the project directory, the Implementation tools merge the
netlist in during the Translate phase. Since the Tenths module was
built using LogiBLOX called from the project, the tenths NGC file will
be found.
5. Click OK to complete the Synthesis phase.
At this point, an XNF file exists for the Stopwatch design. See the “In-
Depth Tutorial — Functional Simulation” chapter to perform a post-
synthesis simulation of this design or refer to the “In-Depth Tutorial
— Design Implementation” chapter to place and route the design.