These slides are from older offerings of the course, but might still be useful to you. You are still responsible for material discussed in class and assigned in readings.
1 Documentation for the Xilinx ISE Tools
- ISE In-Depth Tutorial - This is somewhat out of date, but still has lots of good info.
- Spartan-3E Libraries Guide for Schematic Designs
- ISim User Guide
- Command Line Tools User Guide
- XST User Guide
- Synthesis and Simulation Design Guide
2 Documentation for the Spartan 3E Starter Board
3 Other links
4 Example Basic Building Blocks
Caution: the constants in the symbol library are 32-bit constants by default and must be edited for different widths using a text editor. Change the
BitVectortrait to the desired width.
Note: the value is built using
vccto get a 0 and 1 respectively. A 16-bit buffer (schematic) is needed as a ``name changer'' so that the output pin can have a reasonable name.
- Distributed memory ( project ) - Distributed memory built with the core generator and initialized with memory.coe. Distributed memory is fast (an address can be presented after the rising edge of the clock and the data at that address available before the next rising edge), but expensive (it consumes a lot of fpga resources).
- Block memory ( project ) - Block memory built with the core generator and initialized with memory.coe. Block memory is synchronous (i.e. once an address is presented the data at that address is not available until after the next rising edge of the clock - this looks like a one cycle delay), but is cheap (it is a dedicated resource on chip and consumes no fpga resources).
Caution: Both the distributed and block memory use a memory initialization file. Xilinx frequently stores an absolute path to this file. If you get an error trying to open the core generated memory indicating that Xilinx can't find something like ``
/home/mellor/ProfessionalArchives/Teaching/Class/.../memory_small.coe''. Then use
notepadto edit the path in the
.xcofile (it's in the
ipcore_dir) to something like ``
../memory_small.coe,'' save it, and try opening it again.
Note: It is feasible to run block memory at twice the clock rate as your processor which will work around the synchronous issue.
15 .. 10 9 8 7 6 5 4 3 2 1 0 unused IL IE IM3 IM2 IM1 IM0 I3 I2 I1 I0
ILis the interrupt level and is a zero when the system is handling an interrupt and a one otherwise. When the interrupt level is a zero interrupts are blocked.
IEis the interrupt enable. Setting the interrupt enable to one turns on interrupts and a zero turns them off.
IM?is the interrupt mask. Setting the interrupt mask for a particular level to zero will block interrupts at that level.
I?is the interrupt request. A one indicates that an interrupt is pending.
The project includes a test schematic which works on the fpga board.
5 Miscellaneous Schematic Designs
ALU and LCD display ( schematic, project ) - this design implements a 16-bit alu and displays the inputs, the operation and the results on the lcd display. The north button resets the lcd display, the south button clears the display, the west button writes the display, the rotary switch increments or decrements the current digit of the display, pushing the rotary switch changes the current digit, switch 0 selects the direction when the rotary button is pushed, switch 1 selects which row is displayed, led 7 indicates that the lcd driver is ready, led 6 is the zero detector, and led 5 is overflow.
Warning: All of these designs use core generated parts from an older core generator. For core generated parts (
.xco), you should include all of the files of the same name with various extensions (e.g.
6 Example Verilog Designs
State machine (verilog) - this design contains a partial implementation of a MIPS multicycle control unit.
Memory (verilog, memory initialization, memory contents) - this design contains a simple memory implementation similar to that produced by the distributed memory generator in the core generator generator.
Caution: this means of implementing memory consumes a large amount of resources.
The following verilog code may be helpful in creating test benches.
// use this if your design contains sequential logic parameter PERIOD = 20; parameter real DUTY_CYCLE = 0.5; parameter OFFSET = 10; initial // Clock process for CLK begin #OFFSET; forever begin CLK = 1'b0; #(PERIOD-(PERIOD*DUTY_CYCLE)) CLK = 1'b1; #(PERIOD*DUTY_CYCLE); end end initial begin // Initialize Inputs // Wait 100ns for simulator to finish initializing #100; // Enter test values end
Caution: The simulator takes 100ns of simulation time to initialize. Other than setting initial values, you should not do any tests in the first 100ns.
To display the simulation time when printing in a test bench, you can use the
$timespecial variable. For example:
$display("At time %t, Q=%d", $time, Q);
- Nets that will be connected to physical pins on the fpga (e.g. connections to the lcd, clock and DCM) must be on the top-level schematic.
- The user constraint file (.ucf) contains the mapping between
physical pins and input/output net names. ``
aluIO.ucf'' in the
aluIOproject is a good example.
General Xilinx Project Tips:
- Extraneous source files in the project can cause problems.
- If your project fails to build for no apparent reason, try Project>Cleanup Project Files and then rebuild.
- If you get an error because of a coregen lock file and no coregen process is running, you can simply delete the lock.
- Xilinx won't open project files created with newer versions
of Xilinx. Each
.xiseproject file is an XML file and contains the Xilinx version number that created the file. You make projects open in older version of Xilinx by editing the
.xisefile in a text editor and adjusting the
xil_pn:ise_version="14.7"tag near the top of the file.
- When you save a schematic or HDL file, the ``undo'' history is cleared.
- To synthesize a module, it must be selected as the ``top module'' in Xilinx Project Navigator. To do so, right-click on the module you’d like to synthesize in the Processes pane in Project navigator and select ``Set as Top Module'' in the pulldown menu. To simulate a subpart of a design, you may need to set the subpart as the top module
- Incorrect project settings (e.g. family, device, package) can cause a number of synthesis and/or simulation issues.
- Paths in Xilinx are limited to 256 characters. If you exceed the path limit, you will need to relocate your project and then manually edit the ``.xise'' file ``Working Directory'' property.
- The paths to memory initialization files are frequently stored with
absolute paths in
.xcofiles. If you are unable to regenerate a core because of the path, simply edit the path.
- When generating a memory, a
coefile is used as input. The generator then builds the memory and the memory contents are compiled to a
miffile. You can edit this file to change the initial memory contents without regenerating the core. However, the
mifis a compiled output and may be overwritten during normal project use.
To create an array
fooof multi-bit registers, declare some
regvariable like this example (which makes an array
foowhich is 8 16-bit registers):
reg [15:0] foo [7:0];
Here, the first set of brackets identifies the width of memory (bits per word), and the second identifies the depth (items in set). This is also done in the example memory verilog design above.
Schematic Capture Tips:
When two wires or busses (nets) are connected, they are given a common name. If you later decide to separate the net, you need to delete at least one of the nets completely and replace it. If you don’t do this, Xilinx will continue to consider them connected because they share a common net name.
You can use ``Find'' to highlight the entire net.
Occasionally it may look as if wires in the schematic disappear. Try refreshing the screen by pressing the F5 key.
Be careful in selecting net names. Capitalization matters. Verilog or VHDL reserved words (e.g. ``
output'') cannot be used. In addition, it appears that ``
FSM'' is also reserved and should not be used. You can combine signals by listing them in the name of a net, e.g. X(15:11),Y(10:0).
Pins must have well formed names and within one schematic or symbol they must be unique. A(15:0) is a valid pin name, but not X(15:11),Y(10:0). If you have a net named X(15:11),Y(10:0) that you want to output to a pin, use a buffer to separate the names.
It is possible to connect two parts directly together without wire between them, however it may not be possible to add wire later.
If there’s a red box at the end of a wire, the wire is not connected to anything.
When drawing multi-segment wires, clicking a second time on the last point will terminate the wire.
Bus taps can be problematic. Appropriately naming the nets always works.
To change the size of a schematic's background, right-click on any empty part of the schematic and select ``Object Properties''. Select the desired paper size from the scroll down menu of ``Schematic Properties'' and click ``OK''. It will then give you a warning that this operation cannot be undone and ask if you want to continue. Click ``Yes''.
To erase just part of a wire (not the entire branch), choose ``Select the line segment'' instead of ``select the entire branch'' under ``Select Options''.
If you have difficulty routing a wire, try manually routing it by clicking on ``Use the Manual method...'' under ``Add Wire Options''. You might also try zooming into the area where you want to place it and then try routing it again (either Autoroute or Manual).
If you edit symbols and change the pin layout, make sure that you move the name, the line segment and port (small box) together. You may also want to save a copy of the edited symbol.
8 Troubleshooting Xilinx
Windows 10 Compatability: If you are experiencing errors opening files or running synthesis on Windows 10, make sure you followed the Windows 10 dll manipulation steps in Lab 0.
Long Paths in Windows: Windows doesn't like file paths longer than 260 characters (this includes all the folders). Xilinx may give weird errors and claim to be unable to find files in your SVN directory if you have deeply-nested files. In windows 10, you can enable longer paths by changing a registry key. Here's a how-to.
Note: you may have to run "regedit.exe" as administrator. To do this, open the windows menu, type "regedit", then right click the regedit program. It will give you a "run as administrator" option.