The first Altera FPGA design


2012-04-02Publicerad av Sven-Åke Andersson

Introduction


When one starts to use a new language or environment the first program written is usually the famous ‘Hello World’ example. What is the ‘Hello World’ program in hardware, in an FPGA? The smallest project that produces dynamic output is a blinking LED. We will show the steps for a blinking LED example using Altera’s Quartus and the Cyclone III board. Thanks Martin Schoeberl for providing us with this design example.

The blinking LED design


Here is the VHDL file implementing the blinking LED.



 

Implementing the design
 

We will use the New Project Wizard in the Quartus design tool and create a new project.

quartus &

 


Click the Create New Project button.

 


Click the Next button. Select a directory for the project and give a name to the project.

 


Add all design files. In our case only the HelloWorld.vhd file.

 

 
Select the FPGA device we are using (EP3C120F780C7).



Skip all EDA tools settings for now.



Summary display.

l


When we click Finish the design will be imported and the project (HelloWorld) is setup in the Project Navigator.



Compiling the design


To compile our design we choose the Processing menu and select Start Compilation. The compilation phase includes all steps to build the configuration file for configuring the FPGA.



If everything goes fine the result is displayed in the compilation report.
 

 

Pin configuration
 

Our design contains only two external ports (clock input and LED output). These ports are hard-wired on the board and we must find out which pins on the FPGA is used. Let's start by investigate the clocking. Here is a picture showing the clocking scheme.
 

Here is the information about the pin configuration. We will use the 50MHz clock as our input clock which connects to pin AH15.
 


The LEDs connect  to the following pins. We will use LED0 which is connected to pin AD15 on the FPGA.

 
 

Using the Pin Planner


We will use the Pin Planner to configure the pin placement. From the Assignment menu selet Pin Planner, double-click the Location field and select the right pin. We then have to rerun the compilation phase to get the new pin configuration.

 

 

Configure the FPGA


Downloading our hardware project into the FPGA is called configuration. To configure the FPGA we select the Programmer from the Tools menu. The configuration file is called HelloWorld.sof and should be displayed in the programmer window. Make sure the Program/Configure box is ticked and that the USB-Blaster is selected. To start the configuration click the Start button.


 



 
When the configuration has finished LED 0 will start blinking once every second.