July 20, 2006
In this work, we develop an alternative approach to XUPV2P system development. Our framework consists of a simple UART for communicating with a PC through the RS-232 serial port. It is the user's responsibility to develop a finite state machine to control communication between the FPGA and the host machine. The user must also develop a C++ program that is run on the host machine to communicate with the FPGA.
Using this approach, we do not use the Virtex II-Pro's PowerPCs. The disadvantage of doing this is that we do not have access to the rich set of drivers and resources that the Base System Builder provides, but this does allows us to gain considerable reconfigurable space, since we no longer need busses to connect the PowerPC to other system components. Furthermore, this system provides a simpler interface that may be more intuitive for students new to digital design. Also, few resources are consumed by the platform, therefore introductory designs typically take much less time to synthesize, place, route, and debug.
Our hope is that this will provide a simple mechanism for allowing students to develop introductory designs on the XUP system.
Read a byte from the serial port. If the byte = "00000000" turn LED0 off If the byte = "00000001" turn LED0 on If the byte = "00000010" turn LED1 off If the byte = "00000011" turn LED1 on If the byte = "00000100" turn LED2 off If the byte = "00000101" turn LED2 on If the byte = "00000110" turn LED3 off If the byte = "00000111" turn LED3 on If the byte = "00001000" send "00000000" to the PC if SW0 is on send "00000001" to the PC if SW0 is off If the byte = "00001001" send "00000000" to the PC if SW1 is on send "00000001" to the PC if SW1 is off If the byte = "00001010" send "00000000" to the PC if SW2 is on send "00000001" to the PC if SW2 is off If the byte = "00001011" send "00000000" to the PC if SW3 is on send "00000001" to the PC if SW3 is offTo accomplish this, we write the following vhdl code which is stored in this zip file tutorial.zip. Download this file into your home directory and type "unzip tutorial.zip". This will create a directory called tutorial/ where all of your files will be stored.
Let's go through these files in detail.
src/clkdiv.vhd - This vhdl code divides the clock in half. We use this to divide the clock down to the rate of the input and output RS232 system.
src/uart.vhd - This vhdl code is the RS232 Transmitter and Receiver.
src/main.vhd - This vhdl code is the main file that connects the clkdiv and uart to our hardware design. This is also where our custom hardware design is implemented.
src/xup.ucf - This file assigns names to pin numbers, so that when you say LED_0 it corresponds to the proper pin on the FPGA.
src/xup.xcf - This tells the synthesis tools that the SYSTEM_CLOCK should be at least 100 MHz.
synth - This is the script that synthesizes your design.
Go through each of these files and make sure that you understand what each of them is doing.
To compile these files, first type "xilinx_tools" to get your paths configured properly. Then type "sh synth" to run the synthesis script. After several minutes (if there are no errors), the script creates a XUP programming file called "test.bit" in the "route_dir" directory.
2. Go to File -> New -> Project.
3. Select Visual C++ Projects and Win32 Console Project and enter a name for your project.
4. Click "Finish".
5. Enter the following into your cpp file - mike1.cpp
Notice that this file has the following function:
- init() - This initializes communication with COM2.
- read() - This reads a single 8-bit data value from COM2.
- write() - This writes a single 8-bit data value to COM2.
- close() - This closes the com port.
In our main function, we read a number from the user using "cin" to tell us what command we want to send to the XUP board. Each case is handled by the different if statements. Read this code and make sure that you understand what each function does.
6. Now click Build -> Build Solution. This creates a file with an "exe" extension in the "Debug" directory of your project.
2. Connect the USB cable to the front USB port of a computer in the Ferris Hall 425 Lab.
3. Connect the serial cable to COM2.
4. Power up the XUP Board.
5. Start iMPACT, which is in the Start -> Program Files -> Xilinx ISE -> Accessories folder.
6. Click "Cancel"
7. Right Click and select "Initialize Chain"
8. Click OK.
9. Click Bypass.
10. Click Bypass.
11. Select the Bit File you generated in Step 1. You may have to connect to the vlsi machines and ftp this file to your computer.
12. Click OK.
13. If everything worked properly, your iMPACT window should now look like the following:
14. Now right click the xc2vp30 icon and select "Program" then click "Ok".
15. Your bit file is now loaded into the hardware.
16. Now you can run your "exe" program that you generated in Step 2 to send commands to the hardware. Here is a screen shot of the commands I was able to run successfully.
1. Using the same hardware design, write a C++ program that checks the status of all of the switches and prints their status to the screen.
2. Modify the VHDL code so that when a 0 is sent to the FPGA, all of the lights go out. When 1 is sent, 1 LED is lit. When 2, 2 LEDs are lit. When 3, 3 LEDs are lit. When 4, all of the LEDs are lit.
3. Create a hardware and software design where the software sends lower case letters to the hardware and the hardware capitalizes them and sends the back to the software.
1. Make a C++ program that reads in an image file, sends each byte to the FPGA, performs an image function on the data (blur, invert, grayscale, etc.) and returns the picture to the computer where it is displayed.
2. Make a C++ program that reads data and sends the data to the FPGA. Make the FPGA performs a function on the data like an autocorrelation function or FFT, then return the result to the software, where it is displayed.