Experiment 1 Use Button KEY1 on Core Board to Control LED 1
Use a real example to understand the basic development flow of
FPGA, and get hands on the basic functions of Quartus II software.
Use the always-on button (KEY1 in experiment board) as input, go
through an inverter to output the LED1 on the core board. When
KEY1 is on(the default case), LED is on. When KEY1 is pressed LED
1. Create a project file
Launch Quatrus II software (called Q2), create project file by
File-> New Project Wizard, as following:
Click “New Project Wizard” and a window will pop up, fill the Diectory,
Name, Top-Level Entity, as following
Click “Next”, and Add Files Dialog will show up:
Do nothing about it for now, and click “Next” to next step to select the
In the “Family”, select “Cyclone”, and in “Available
devices：”Select the FPGA part number shown on the cord board,
please note that click “Show Advanced Devices”in Filters to show all
the available devices.
Next is the EDA tools selection. We will use Q2, and do nothing with
this here by click “Next” to go to the summary dialog.
Click “Finish” to finish.
2． Create top level diagram
Click File->New to pop up a create new file dialog:
Select “Block Diagram Schematic File”and click “OK” to create a
blank top level diagram, the default file name is
“Block1.bdf”，we save it as（File->Save as），accept the default file
name, and click “Add file to current project”option, so that this file can
be added to the project.
3． Add Logical components （Symbol）
Double click the space of the top level diagram, a dialog will pop up to
let us add symbol:
Search for the needed symbol in the Libraries, if you know the name
of the symbol, you can also type in “Name” and search for it. The left
panel is the preview of the symbol. Click “OK” to select this symbol,
and the mouse cursor will have a symbol following it, and left click on
the top level diagram to place the symbol.
Please add not, input, and output three symbols as following:
To connect the symbols, move the cursor to the port of the symbol,
the port of another symbol to connect them.
In this experimented, the three connected symbols are as follows:
Double click pin_name and pin_name1 of input and output symbol,
and change them to Key1，LED1.
When we created the project, we did specify the device. Actually, we
can do it at this step by selecting: Assignments-> Device to pop up
the assignment dialog:
Pop up the settings dialog：
Please select the FPGA device according to the actual device on the
core board. Click “Device & Pin Options”to pop up Device & Pin
Options dialog, and click Configuration as follow:
Use select EPCS4 for H2C8. Please don’t use AUTO as AUTO may
select the wrong one. In the Unused Pins tab, please select reserve
all unused pins: as input tri-stated.
For devices like cycloneII and cycloneIII, please set nCEO in
Dual-Purpose Pins tab as：Use as regular I/O。 The purpose of
nCEO is to generate a low level signal when the configuration is done,
and is used mostly in multi-devices system. It can be used as IO in
single device FPGA system.
Click OK to exit.
5． Pins assignment
We can use “Assignments->Pins”in QuartusII to assign pins, and we
can also use tcl script to assign pins. We recommend to use tcl script
as it’s easy to use.
Under the project directory, create a file named Setup.tcl. Select File-
>New，and select other files,
For different core board, the configuration will be different for our
# Setup pin setting for EP2C5_EP2C8 main board
set_global_assignment -name RESERVE_ALL_UNUSED_PINS “AS
set_global_assignment -name ENABLE_INIT_DONE_OUTPUT OFF
set_location_assignment PIN_6 -to led1
set_location_assignment PIN_99 -to key1
Save the file under the project directory, and click “Add file to current.
Open Tools -> Tcl Scripts, select the tcl file, and Click Run，as
If you can’t open Tcl Scripts, please shut down QII and open it again.
This is a bug of the software.
Click on the compilation button on the toolbar to start compilation.
After compilation, a box will pop up.
7． Download to the board.
（1） Programmer settings： If this is the first time you use
programmer, you need to set up the programmer.
Connect the USB blaster, and click Tools->Programmer as
You will see No Hardware, it means that programmer hasn’t been
Click “Hardware Setup”，“Hardware Setup”will pop up:
Click “Add Hardware”to pop up “Add Hardware”dialog:
Click MasterBlaster in Hardware type, and click OK to return.
(2)Connect programmble cable to JTAG.
(3) Power on FPGA.
(4) If in debug mode, we can program to the SRAM of FPGA using
JTAG, and the configuration information will be lost when power
cycled. To do this, we select JTAG as Mode, and slect .sof file as the
file to be downloaded.Please select
“Program/Configure”, other options like “Verify”、“Blank Check” can
be selected according to needs.
(5) If want to program to the Flash configuration chip (configuration
information will not be lost when power cycled), we need to connect
programmable cable to EPCS, and select “Active Serial Programming”
and “Mode：”. The file to be downloaded need to have pof as file