CSE467: Advanced Logic Design
Winter 2000
Lab 5
Due by the beginning of Lab 6.
Overall Description
In this Lab assignment you will be displaying an image which has been loaded
into memory, on a monitor using the VGA interface that you have designed.
You will then add a circuit that displays a "cross-hair" on top of the
image on the screen. The position of the crosshair can be moved by
pressing keys on a keypad.
Part I - Test the VGA interface
To use the VGA interface that you have designed, you need to connect it
to the pins connecting to the VGA cable and to the pins connecting to the
memory. First, take a look at the schematic from the XS40 documentation.
The project test.zip (NOT lab5.zip) in ifilesrv1/courses/cse467/winter00
contains a skeleton project for this lab. This project has a top
level schematic and two macros. To get to the schematics for the macros,
use Open Macro under the File menu. You will want to edit the schematic
for the VGA macro to contain the circuit that you designed. The top level
schematic must also be changed to contain the symbols (macros) for these
two schematics. Symbols for these schematics can be found in the project
library.
You will notice that the schematics contain no pin names. Instead, in
this project the pin assignments are made in a UCF file called test.ucf.
Obviously, it is important that the UCF file have the same name as the
project. This file can be found in the project manager. Take a look at
this file and you will see that most of the Xilinx chip pins appear along
with a comment saying what pin is connected to it on the board. You should
compare this to the schematic from the documentation to see how the pin
numbers match up. Notice that the names used for the VGA and memory
pins in the schematics appear here along with the appropriate pin numbers.
You can use either the UCF file or pin numbers in the schematic to specify
the pin numbers, but from now on we will use the UCF file.
Please use the circuit that you designed for the VGA interface.
Only use the solution if you had MAJOR problems with your own. For
reference, this solution is in lab5.zip at the same location of test.zip.
Compile your project to produce a BIT file. To try out your project,
you will first have to disconnect the wires from Lab 4, which used the
VGA and memory pins for other things. Next connect the monitor, the
pc and power up the board. Now you will have to do three downloads, one
to load a design into the chip that is capable of filling the memory, one
to get the image into the memory, and the third to download your design:
-
xsload xsramvga.bit
-
xsram mazefile.bin
-
xsload foo.bit
The mazefile.bin, xsramvga.bit and xsram.exe files can be found in the
same directory as the test.zip project. The image should now be visible
on the screen. If you have problems, you can use the logic probe
to check that pins have the right values or the logic analyzer.
Part II - Connect up the keypad
We will be using the keypad as an input device for the project. The
keypad has 16 keys which are connected to the 9 pins as follows.
There are four wires that run vertically, one for each column, and four
wires that run horizontally, one for each row, for a total of 8 wires.
Each of these wires is connected to a pin. When a key is pressed,
the row wire and the column wire for that key are connected to the 9th
pin, which is called a common pin. To use the keypad, you connect
the 8 pins for the row and column wires to Vdd through a 4.7K resistor,
and you connect the common pin to GND. The 8 pins are thus HIGH when
no key is pressed, and one pin in each set of four goes LOW when a key
is pressed, indicating which key has been pressed. Instead of using
8 discrete resistors, it is easier (no wires!) to use a Resistor Pak, which
contains 8 (or 10) resistors, each connecting one pin to a common pin which
is connected to Vdd.
Connecting things up will take a little detective work. You will
have to figure out which pins are which on the keypad, then figure out
which pins are which on the Resistor Pak. When you have finished
connecting things up, you will need to connect the 8 keypad pins to the
FPGA along with the reset button, although you could use one of the keys
on the keypad instead of the pushbutton switch. You may use pins
6, 7, 8, 9, 14, 27, 29, 68 and 75 which are connected to the microprocessor
that we are not using. You will recall from last week that thes kind
of switch tends to bounce. Unfortunately, we cannot use last week's
method to debounce the keys. Instead we will look at the keypad only
once per frame, which will avoid problems with any bouncing in the keys.
In the next part, you will have to add the input pads and buffers for these
signals and add the appropriate entries to your UCF file. You can
look at the way the other pads are connected to see how this is done.
Part III - Adding a Crosshair
We're now going to add a crosshair to the display that will be on top of
the image displayed from memory. We will use registers to keep track
of the row and column location of the crosshair, which will be displayed
as a horizontal and vertical line. That is, we will display two white
lines, one on the row and one on the column position of the crosshair.
You will have to design a circuit that displays the crosshair on the screen
at this location, which can be changed using the keypad. This circuit should
not be added to the VGA interface. Instead, it should be added to
the top-level schematic, as a symbol representing either a Verilog module
or a schematic. The crosshair will be controlled using the keypad.
Pick four keys that you can use to change the location of the crosshair
(up, down, left, right). Design a circuit that will check the keypad
once per frame, and increment/decrement the row or column according to
which key is pressed.
Extras!
If you would like to try more, here are some ideas (for small amounts of
extra credit - I want you to do this because you have the time and it's
fun, not because you need the points).
-
Display something more interesting than two lines at the crosshair location.
-
Use more keys so that you can move the crosshair diagonally.
-
Have the crosshair move slowly at first, and then faster if the key is
held down.
-
Display a larger image using fewer bits per pixel than 8. (Talk to
us about the image file format.)
-
Your own idea (but talk to us first!)
Hand In:
-
Schematics and Verilog (documented of course!) of your design, signed by
either Steve, Dan, Carl or Chris attesting to the fact that your project
works.
ebeling@cs.washington.edu