EE 576: Laboratory 3

NiosII graphics interface.


In this assignment you will implement a video interface to the NiosII processor, including lines and text, then use it to animate a ball dropping. You will use the SOPC builder to construct a NiosII processor, QuartusII to add a VGA video interface, and the NiosII IDE to write a GCC program to animate the ball.


  1. You must handle the boards only on on the ESD mat. These boards are expensive and you must be careful of them.
  2. Make sure the Altera DE2 board is connected to power and to the PC as specified in the evaluation board description. Turn on the power supply with the red switch on the board. Make sure the toggle switch on the left edge of the board marked (Run/Prog) is in the Run position and leave it there at all times. The FPGA will program in the Run position. Putting the switch in the Prog position writes your design to flash memory, which you do not want to do.
  3. The default top level module for the DE2 defines all of the logical i/o signals.
  4. You can define the mapping from logical signal to FPGA pins (pin assignment in QuartusII) for all the pins at once by importing this file using the menu item Assignments... Import Assignments... and specifying the file name. There is no need to define pins one-by-one.
  5. A hardware VGA interface is shown on the DE2 page. Read VGA example 1 Verilog code.

Setting up a project in the NiosII IDE:

  1. Start the IDE and specify a workspace. When you designed the cpu and top-level module, the design was stored in a folder. In the Workspace selection dialog box, browse for that folder, then add the string \software to the folder path. This new folder will be used to store all of the software projects associated with the specific cpu you built in the SOPC. After you press OK, you may need to click on the workbench icon to do anything useful.
  2. Create a new software project. Select File>New>project. A series of dialog boxes will open.
    1. Choose C/C++ application, then click Next.
    2. Give the project a name, specify the ptf file from SOPC builder, use the default location, and specify a blank project.
      Then click Next.
    3. Select creat new system library then click finish.
  3. Back in the main IDE window, right-click on the syslib entry in the C/C++ Projects pane, then select Properties.
    1. In the dialog box, select system library on the left.
    2. Associate the desired device with stdout, stdin, and stderr. These will usually default to the JTAG UART.
    3. From the pulldown menu, select whether you are going to use single threaded or microC/OS. Note that the web-version of the IDE does not support the operating system.
    4. Select the memory location, usually defaults to SDRAM.
    5. Click OK to proceed.
  4. Back in the main IDE window, right-click on the syslib entry in the C/C++ Projects pane, then select Build Project.
    Wait for it to finish.
  5. Create header files using File>New>headerfile and C files using File>New>file.


Your written lab report should include:

Copyright Cornell University July 2006