Escolar Documentos
Profissional Documentos
Cultura Documentos
Caution!
http://www.cis.upenn.edu/~cse372/tutorial/ 1/11
3/30/2012
The boards contain exposed components that are sensitive to static electricity. Before touching the boards, try to remember to discharge any static electricity you may have built up by touching a grounded piece of metal (i.e. part of the desk). Especially remember to do this after you have been walking around the room on the carpeted floor (please keep your shoes on).
Hint If you've having problems with the board, you may want to try the - Xilinx Built-In Self Test
I. Preliminaries
Each Klab station contains a Windows machine on the left and a Linux machine on the right. The software for programming the FPGA (Xilinx ISE Project Navigator) is on the Windows machine. Open ISE from Start -> All Programs -> Xilinx ISE 8.2i -> Project Navigator. On the Windows machine, your eniac account is mounted on the S: drive. Xilinx tools have to access many files. They get incredibly slow when they have to access those files over Samba. It is recommended that you keep copy of your project in your eniac account, copy the project directory to the local drive (C:user is the only writeable directory, so somewhere under there), use the local copy while in the lab, copy the project back to your eniac account when you are done, and delete the local copy making sure to empty the recycling bin.
Warning Make sure to copy your work back to your eniac account before you leave. The Klab machines are not backed-up and any files that you leave on those machines may be lost.
Warning Make sure to delete the local copy of your project and empty the recycling bin before you leave. Otherwise, other people will be able to see (and copy) your work.
http://www.cis.upenn.edu/~cse372/tutorial/
2/11
3/30/2012
4. On the next screen, click the New Source button. Select Verilog Module from the list and give the module the file name "switch", then click Next. A Verilog module is a self-contained hardware unit with an interface of inputs and outputs, which are specified on the next screen. 5. This screen takes your inputs and outputs and automatically generates code for your module.
http://www.cis.upenn.edu/~cse372/tutorial/
3/11
3/30/2012
Note You can have multiple modules per .v file, and you do not have to use this wizard to add a module.
Define two ports: "SWITCHES", an input bus with a MSB of 3 and a LSB of 0, and "LEDS", an output bus with a MSB of 3 and a LSB of 0. MSB and LSB stand for most-significant bit and leastsignificant bit, so these two ports are vectors with four bits/wires.
Click Next and click Finish on the next screen. This will bring you back to the New Project window; click Next twice and then Finish once to generate your module.
3/30/2012
Save your file after entering the code. When saving to a network drive, ISE prompts you for every file you are saving, even if it already exists, so just click Save when the dialog box appears. When you are finished, your module should look like this:
module switch(SWITCHES, LEDS); input [3:0] SWITCHES; output [3:0] LEDS; assign LEDS[3:0] = SWITCHES[3:0]; endmodule
3. To "compile" your Verilog code, make sure the switch.v file is highlighted in the Sources window, expand the Synthesize-XST item in the Processes window and double-click Check Syntax.
http://www.cis.upenn.edu/~cse372/tutorial/
5/11
3/30/2012
The console should not display any errors under the HDL Compilation section, and a should appear next to Check Syntax. If you get compilation errors, resolve them (ask a TA for help if necessary) before continuing.
4. When you are done entering the pin information, click Save. You may be prompted to choose a Bus Delimiter; choose the top option, XST Default: < >, and click OK. You can then close PACE. 5. Go back to the ISE Project Navigator. In the Sources window, expand the hierarchy for the switch module to see the new file, switch.ucf, that has been added to the project. By double-clicking on Edit Constraints (Text) in the Processes window, you can see the format of the UCF file. If you made a mistake in your pin locations or want to change them in the future, you can directly edit the UCF file instead of using PACE.
3/30/2012
will appear next to it. All errors must be resolved before a programming file can be generated. Errors are output to the console, and can be more easily seen by clicking on the Errors tab. Warnings cause a to appear next to the process and can be seen under the Warnings tab.
Note Warnings are usually a sign that something more serious is wrong. It is strongly suggested that you do not ignore warnings and resolve them before generating a programming file.
Note If you receive a warning "WARNING:ProjectMgmt - ... line 0 duplicate design unit: 'Module|switch'", it can safely be ignored. Also, note that after resolving warnings, a successfully run process may still show a next to it, due to a bug in ISE.
2. All processes have run successfully when a appears next to Generate Programming File. You can scroll up in the Processes window and double-click on View Design Summary to see a report of your design and links to more detailed reports.
3/30/2012
If your board has previously been connected to the USB port, or whenever you restart/reset your board, a window should pop up notifying you that Windows recognizes the attached device.
You should see this notification window when you turn on/reset your board. 2. In the ISE Project Navigator, expand the Generate Programming File item in Processes and double-click on Configure Device (iMPACT). iMPACT should open and present the "Welcome to iMPACT" window. Make sure the first choice (Boundary-Scan) is selected and "Automatically connect..." appears in the drop-down box, and click Finish. If iMPACT successfully finds your board, 3 devices will appear in the upper half of the iMPACT window and a dialog box will appear:
http://www.cis.upenn.edu/~cse372/tutorial/
8/11
3/30/2012
If iMPACT fails to find your board, you will see this dialog:
If this happens, click OK, then try again to get Windows to recognize your board by unplugging the USB cable from your board, plugging it back in, then holding down the board's reset button (located on the right side of the board, next to the PS/2 ports) for two seconds. If you cannot get Windows to connect to the board, see a TA. Once you have a connection, click on the Initialize Chain ( ) button on iMPACT's toolbar to scan for your board again.
3. When iMPACT successfully scans your board, it finds three programmable devices. The first, "xcf32p", is the board's non-volatile PROM. The second, "xccace", is the System ACE controller (for compact flash). The third, "xc2vp30", is the actual FPGA. In general, you should only need to program the third device, the FPGA.
http://www.cis.upenn.edu/~cse372/tutorial/
9/11
3/30/2012
You should now see the "Assign New Configuration File" dialog box (if you do not, see the note below). Do not assign configuration files to the first two devices; skip over them by clicking Bypass or Cancel twice. The third device, the FPGA, is programmed with a .bit file. iMPACT should automatically show your project directory and a file, switch.bit. Select this file and click Open, then click OK on the next dialog box to assign the configuration file to the FPGA. Ignore any "clock change" warnings that you may receive.
Note Sometimes, iMPACT may not prompt you to assign configuration files to the three devices. If it does not, you can do it yourself by right-clicking on the FPGA (xc2vp30) and choosing Assign New Configuration File.
4. In the iMPACT main window, right-click on the FPGA (xc2vp30) and select Program. Leave all of the boxes unchecked and click OK. The Executing Command box should appear, followed by a blue "Program Succeeded" message. The red "Done" LED on the board (D4) should light up, indicating that the FPGA has been programmed. Toggle the user switches, and the corresponding user LEDs should turn on and off. Close iMPACT and choose No when prompted to save your changes. If your design does not work as expected, close iMPACT, go back to the ISE Project Navigator and make changes. Reset the board by holding down the reset button (you do not have to turn the power off), then generate the programming file again. Double-click on Configure Device (iMPACT) and program the board again.
Note It is recommended that you follow this order of turning on/resetting the board before starting iMPACT, and it is also recommended that you close iMPACT and restart it before reprogramming your board. Other ways may work, but may sometimes produce unusual behavior. If you see any strange errors in iMPACT, close it, reset your board/connection and try again.
Helpful hints
http://www.cis.upenn.edu/~cse372/tutorial/
10/11
3/30/2012
Hint The user switches are "active-low", meaning they send a 0 to the FPGA when they are on/up and a 1 when they are off/down. The user LEDs act similarly: they are lit when sent a 0 and off when sent a 1. If you want to experiment and modify your design, keep this in mind. In future assignments, you may be given a controller in which the behavior is reversed to be more intuitive.
Hint Save your work often. You can also use the "snapshots" feature of ISE to make a backup of your project at any time. In the ISE Project Navigator, go to Project -> Take Snapshot, give it a name and a comment (i.e. the date/time) and ISE will save a snapshot to a subdirectory of your project folder. Snapshots can be managed by clicking the Snapshots tab in the Sources window.
References
The following links contain useful documentation and online help: Xilinx Built-In Self Test XUP Virtex-II Pro User Guide Xilinx ISE Online Help Xilinx iMPACT Online Help MIT Xilinx Tools Tutorial Authors: Peter Hornyack, Milo Martin Updaters: Amir Roth Generated on: 2009-01-23 21:29 UTC.
http://www.cis.upenn.edu/~cse372/tutorial/
11/11