The Altera FPGA and Quartus II Software

by Grissini in Circuits > Software

33570 Views, 21 Favorites, 0 Comments

The Altera FPGA and Quartus II Software

de2-dev-board.jpg
This is a step by step walk through of how to set-up and use Quartus software and upload it to the Altera Cyclone FPGA.  Done as a primer for my school's(Ivy Tech CC) Digital Fundementals EECT122 course.  This will cover in great detail the exact method to setup the software, your design and upload it to the FPGA(Field Programmable Gate Array) board.  

Open Quartus

openQuartus.jpg
Double click the Quartus Icon on the desktop.  

Folders

1.jpg
2.jpg
Once Quartus opens you will see this screen.  Go to the New Project Wizard located in the File tab.  
Create a parent folder on your flash drive.   You want this on your flash drive because anything saved on the colleges hard-drives may not be there next class.  
Create a parent folder where you want to keep all of your Labs!  i.e.  G:\Joe_Schmo_jumpdrive\EECT122\
Next:
Create a child folder this particular lab will be stored.  i.e.  G:\Joe_Schmo\EECT122\Lab_1-1\
 You can do this either in windows explorer or directly in the program Quartus. 

IMPORTANT!!!!:
VERY IMPORTANT!!!!!!!!!:

For quartus to work right, your build files(.bdf/.vhd/.etc) need to be in a folder(your child folder) that has the same name as the projects.   

New Project Wizard

3.jpg
Wizards are great aren't they?  This one guides you through the initial setup of your project.  After selecting the appropriate name of your parent folder and creating an appropriate child folder, it's time to name your project.  You want to call it "I rock Ivy Tech EE" I know.  But if you do that and it doesn't match the child folder you've create, the software will get really confuses later on.  Just name your project the EXACT same thing as the child folder.  In the picture below it is "tutorial."  And so EVERY different type of file in this project will get named "tutorial."  
tutorial.bdf
tutorial.vdl
turorial.etc

After that's done, click next.  

Add Files

5.jpg
Do you want to add files.  Well for our purposes NO.  Click next without hitting anything.  

Select the Right Board

6.jpg
7.jpg
In this class we are using the Cyclone II EP2C20F484C7.

EDA Tools?

8.jpg
You don't need any tools.  Hit next.  

Finish Your Set Up

9.jpg
Everything look right? 
Well hit finish and lets get started programming a FPGA.  

Block Diagram/ Schematic

schematic.jpg
10.jpg
11.jpg
We will now begin to enter gates and create a schematic "program" to be executed on the hardware development board.  
Go to the FILE tab and hit New.  Here you will have the option to create many different types of files.   For this tutorial we will be creating a Block Diagram/Schematic File.

Save the File

save.jpg
It is highly recommended that you save the file at this time.   Remember, this file name " *.bdf " must be the same name as the folder that was created earlier on.  Steps 1 though 8 go about created other files that are needed for everything to work properly and if this ".DBF" (Diagram-Block) file does not live in that same folder, it won't work right.

So for this example I saved it as "G:\tutorial.bdf

Create a Schematic

12.jpg
13.jpg
14.jpg
Now the fun part begins.   This is where we create the schematic.   On the left of this new window are various tools you can use to add logic gates and other parts to complete your project.  You are able to turns wires into buses, add text, zoom in and out, and many other things through the buttons on the left.  

The third picture in this series shows a diagram of a 4 bit comparator that was created rather quickly.  

Start Compilation

15.jpg
16.jpg
Just like written code, schematic diagrams must be compiled into machine code for it to be used.   Also like writing programming language, this is where you get error and must debug things.  The error messages provided by Quartus tend to be much more useful than other messages from IDE compilers.  

Up at the top tool bar,  the button that looks like play button will start the compilation.
You can also navigate to the "Processing Tab" and hit "Start Compilation".

Save

save.jpg
18.jpg
If you are successful your screen will look similar to image 2.  
You must save the compiled BDF before proceeding to create a Vector Waveform.  

Vector Waveforms

vector title.jpg
20.jpg
21.jpg
So you've wired some virtual chips together and it works.  Now it's time to see what the output actually is and determine if it's what was expected.  To do that we are going to use a Vector Waveform file. 
Under the File tab,  select New, and then Vector Waveform file.
This screen should look familiar, it is the same place where we created the Block Diagram file.


SAVE

save.jpg
22.jpg
Once again,  Immediately after creating the new vector waveform file,  Re-save it with the SAME name as the parent folder.  

So for this tutorial it is saved as "G:\Joe_Schmo\EECT122\Lab_1-1\tutorial\tutorial.VCF"

Setting Up the Waveform File-End Time

23.jpg
24.jpg
Typically, this window pops up with a total time to analyse the output of your circuit of 20 nanoseconds.  That is a little short on time.  We will change this by navigating to the Edit tab, and selecting End Time.

In this class, 16 micro-seconds will be a nice time frame to work with.  Some labs might specify a different time, this is where you change that.  

Setting Up the Waveform File-Edit Grid Size

25.jpg
26.jpg
The grid size doesn't automatically change.  So want to change it.   Under the Edit tab, click Grid Size
Inside the dialogue window, edit the boxes and double check that you have selected the right scale(nano, micro, milli). 

After the settings are correct,  Use the keyboard shortcut and press CTRL W to view the entire timeline.  It should look like picture 3.  

Add Inputs and Outputs

27.jpg
28.jpg
29.jpg
30.jpg
31.jpg
32.jpg
Now that the vector file is configured properly we need to import or link to the inputs and outputs created in our Schematic file.  

Right click on the left panel.  Scroll down to INSERT and over to INSERT NODE OR BUS.

This will bring up a new window with several options.  Underneath the cancel button, is a button called NODE FINDER.  Press that button and leave the other options alone.  

This brings up a new window called NODE FINDER.  
----At the top middle, scroll down and select "Pins: All"  
----next, over to the right is a button that says list.  It searches for the pins in your schematic.  Hit that button.
----Once pins are in the left tab, we need to select them.  This can be done individually if needed with the single arrow button,  or all pins at once with the double arrow button.  
-----Lastly, Click OK in the "Node Finder" window and also OK in the "Insert Node or Bus" window.

Simulating

36.jpg
37.jpg
This simulation will run your circuit and easily allow you to change the inputs.  This was our whole goal.
The first two pictures show my comparator circuit will no inputs.  Both data streams here A and B have no data, thus they are equal and the "W" output goes high. 

The next few pictures will show how to change the input and what happens to the output "W" when the two data streams are not equal. 

Changing the Input of the Circuit.

38.jpg
39.jpg
40.jpg
41.jpg
42.jpg
43.jpg
44.jpg
45.jpg
  1. Right click the input on the left hand column.
  2. Scroll down to Value and over to Count value or some other value(Like Clock).
  3. Shown is "count value." I will use Hex for this purpose
  4. This brings up a pop-up with option for how much to count by and when to count by.  (Change time and value)
  5. Do the same thing for the "B" data stream.
  6. No highlight a few clock cycles and you can manually change them by right clicking on the highlighted area and selecting the value. 
  7. Notice in this last picture that the two data stream are now no longer equal. 
  8. And the result is a low where the two data streams do not match up. 

Download to Board

download.jpg
We have now created and function circuit with virtual gates and now we want to see it in real life. 
  1. First thing is to assign to the pins on the Alterra board that we are going to use.  For this example we need 8 input pins and one output indicator. The DOC attached to this step has the Alterra pin assignments. 

Pin Planner

46.jpg
47.jpg
48.jpg
Go to the Assignments tab and down to Pin Planner.
This brings up a new window.  Go ahead and maximize it. 

Pin Planner 2

49.jpg
50.jpg
In this pin assignment window, you can select the individual pins by clicking in the location field and typing or searching for the correct pins. 

Get It on the Board

51.jpg
52.jpg
This last step is the easy one. 
Go to TOOLS and down to Programmer.

This will bring up a new window;  check to make sure it says Blaster and click Start. 
Congrats you're Done.