Resources
Slides
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.
Slides
Project resources
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 Example Basic Building Blocks
- Mux (schematic,
project) - A multiplexor which selects between 8, 16-bit busses.
- Register
(schematic,
project) - A 16-bit register.
- Register file (
schematic,
project) - A register file containing 8, 16-bit registers. Register 0 is
hardwired to zero. Two registers can be read and a third written
simultaneously.
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 BitVector trait to the desired width.
- Constant (
schematic,
project) - A 16-bit constant with the value of 0x0001.
Note: the value is built using gnd and vcc to 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.
- Memory -
- 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 notepad to edit the path in the .xco file (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.
- 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).
- Interrupt register (
schematic,
project ) - A
16-bit register which supports 4 levels of interrupt.
15 10 9 8 7 6 5 4 3 2 1 0 unused IL IE IM3 IM2 IM1 IM0 I3 I2 I1 I0 IL is 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. IE is 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.
4 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.
- Barebones LCD display (
schematic,
project ) -
this design demonstrates the lcd display, switches and leds.
- Rotary counter and LCD display ( schematic,
project
) - this design counts up and down when the rotary switch is turned.
Push the rotary switch to change digits. The value is displayed on
the LCD.
- Switch debouncer (
schematic,
project ) -
this design demonstrates a debouncer suitable for the switches (push
button and slide) on the Spartan boards.
- Rotary switch debouncer (
schematic,
project )
- this design demonstrates a debouncer suitable for the rotary
switch on the Spartan boards.
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. .asy, .mif, .ngc, .v).
5 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.
6 Tips
- 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.
- The user constraint file (.ucf) contains the mapping between
physical pins and input/output net names. ``aluIO.ucf'' in
the aluIO project is a good example.
- 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.
- Extraneous source files in the project can cause problems.
- 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. ``input''
``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.
- If your project fails to build for no apparent reason, try
ProjectCleanup Project Files and then
rebuild.
- 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.
- If you get an error because of a coregen lock file and no
coregen process is running, you can simply delete the lock.
- The paths to memory initialization files are frequently stored
with absolute paths in .xco files. If you are unable to
regenerate a core because of the path, simply edit the path.
- When generating a memory, a coe file is used as input. The
generator then builds the memory and the memory contents are compiled
to a mif file. You can edit this file to change the initial
memory contents without regenerating the core. However, the
mif is a compiled output and may be overwritten during
normal project use.
- Xilinx won't open project files created with newer versions of
Xilinx. Each .xise project 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
.xise file 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 select the size of a schematic, 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.
- 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
- 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.
- 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.