Quick Quartus: Schematic Entry

Please contact me if you find any errors or other problems (e.g., something is unclearly stated) in this web page

This document presents a (very) quick introduction to the use of Quartus to design a system for schematic entry.

The Basics
Automatic Pin Assignment
Adding other parts
Common Problems

The Basics

  1. Start Quartus (it is in the "Altera" folder in the Windows Start menu).
  2. A dialog box will open.  Select "Create a New Project (New Project Wizard)"
  3. On the next page ("Directory, Name, Top-Level Entity [page 1 of 5]") choose a working directory (perhaps a folder on the desktop or a network drive) and choose a project name.  Note: you cannont choose the desktop as the project directory, but it can be a folder that is on the desktop. Then hit "Next >"
  4. Hit "Next >" ("Add Files [page 2 of 5]")
  5. On the next page ("Family and Device Settings [page 3 of 5]"):
    1. choose Family: "Cyclone II"
    2. choose Available Devices: "EP2C35F672C6" (the number on the large chip on the DE2 Altera board).  Note, these are not alphabetical, so you need to scroll through the choices.
    3. hit "Next >"
  6. Hit "Next >" ("EDA Tool Settings [page 4 of 5]")
  7. Hit "Finish" ("Summary [page 5 of 5]")
  8. From the Quartus main menu choose "File→New→Design Files→Block Diagram/Schematic File" then "OK"
  9. To add a circuit element, choose the Add Circuit Element Icon icon from the menu bar (just above the main window).  Expand the libraries entry and choose "Primitives→logic→or2"  Hit "OK" and place it on the open page.  Hit "Esc" after placing one element.
  10. Repeat the above with "Primitives→pin→output" (1 of these) and "Primitives→pin→input" (2 of these).
  11. Connect the input pins to the input of the or gate (click and drag to add wires).  You should have a diagram something like the one shown below.

    Note: as you are doing wiring, it may be convenient to enable "rubberbanding."  ( icon in top menu bar).  This allows you to move components and keep wires connected.
  12. Save your design.
  13. From the main Quartus menu go to "Processing→Start→Start Analysis & Elaboration."  This is the first step in compiling your design and determines inputs and output to your design.  This make take a few seconds to start.  After this is successfully completed, move on to the next step.
  14. To demonstrate this circuit in action, we need to assign the inputs and outputs to physical devices on the DE2 board.  To do this, relabel the inputs as "A" and "B" (it doesn't matter which is which) and label the output "X".  Hit "Processing→Start→Start Analysis & Elaboration" again.  This is necessary because we have changed pin names, so inputs and outputs have to be redetermined. 
  15. Now we need to assign the connections on our schematic to physical connections to the FPGA (the EP2C35F672C6  chip).  From the main Quartus menu, go to "Assignment→Pin Planner. " This shows a rather complicated diagram representing all of the outputs available on the EP2C35F672C6 device (the pins are on the bottom of the chip (called a ball grid array (or BGA) package), so you can't see them).  Towards the bottom of the window, your inputs and outputs are defined.  We need to specify the "location" of each of your inputs and outputs on the chip.  Refer to the file DE2_Pin_Table.pdf for a description of each.  We will connect the inputs to two of the pushbuttons on the DE2 board and the output to an LED.
    1. For the input "A" go to the "Location" column and choose "PIN_G26" which is connected to KEY[0] (the rightmost pushbutton).  Note: the list is very long, it can be quicker to type in the name than to scroll through the list.
    2. Set "B" to "PIN_N23" (KEY[1]). 
    3. Set "X" to "PIN_U18" (LEDG[4]).
    4. Close the "Pin Planner" window.
    5. Your design should show the pin assignments.
      Design with pin assignments
  16. Go to "ProcessingStart Compilation".  You will get several warnings - ignore these for now.
  17. Make sure the DE2 board is turned on and connected to the computer through the USB port labeled "Blaster" (there are two USB ports on the DE2 board - choose the one near the power cord). Go to "Tools→Programmer" or choose the "Programmer" icon (). The "Hardware Setup" should show "USB-Blaster". 
  18. Your window should now look something like the one shown below.  If  so, hit "Start".  If the "Byte Blaster" is not listed by the "Hardware Setup" button,  you'll have to start by  setting up the hardware.
  19. If no file is listed we have to choose the file to be download.  Click on "Add File..." and and choose the .sof (SRAM Object File) file (this may be in a subdirectory named "output_files."  You'll also have to delete any lines without file.  When the dialog box resembles the one above,  hit "Start".  When finished, close the programmer window (and save the configuration - you'll be able to reuse this configuration later if desired).
  20. Your design is now running, with the inputs connected to KEY[0] and KEY[1], and the output to LEDG[4].  Note that the buttons are active low (i.e., they are at a logic high when not pushed, and logic low when pushed), so you'll have to push in both buttons to turn the LED off.  Make sure the circuit works as expected (i.e., the LED is off unless both buttons are pushed).

A Simpler way to assign pins

There is an easier way to define input/output (I/O) pins using the definitions in the file E15DE2_IO.qsf.  This file predefines all of the pins with the names given in DE2_Pin_Table.pdf.  To see how this works, download E15DE2_IO.qsf to your working directory.

  1. Change the labels on the inputs to SW[16] and SW[17] (the two leftmost toggle switches on the DE2 board) and the output to LEDR[0].
  2. Go to "Assignment→Import Assignments..." and choose the E15DE2_IO.qsf file.  This should automatically assign the proper pins.
  3. Compile and download the design to verify that it works.  Note that SW[16] and SW[17] are on the far left of the DE2 board.  Sometimes the pin assignments don't show up (even though they are there).  In this case just close the schematic file and reopen it - the pin assignments should be visible.

Adding A Predefined Circuit Element

We can also add our own circuits to those supplied by Altera.  In particular, it will sometimes be useful to add a counter so that we can cylce through multiple inputs.

  1. Download the files E15Counter1Hz.bsf and E15Counter1Hz.v into your project directory (note: we could have added these at the start and included them as part of the project using the project wizard).  You'll learn what's in the .v file later.
  2. Go to "Project→Add/Remove Files in Project..." and browse to add E15Counter1Hz.v to the project.  Note: After you select the file, you still have to hit the "Add..". button to add it to the project.  Hit "OK."
  3. Now go the the schematic, choose Add Circuit Element Icon and select the part "E15Counter1Hz" from the "Project" library.   This is a counter with 4 output bits (Q3...Q0, with Q3 being the Most Significant Bit and Q0 the least) that takes a 50MHz input (available on the DE2) and counts at 1 Hz until the output reaches the number on the inputs (D3...D0).
  4. Connect as shown below.  Note the "Vcc" (equivalent to logic 1) and "GND" (equivalent to logic 0) parts are found by choosing Add Circuit Element Icon, and then going to "primitives→other" in the Altera library.  The pin labeled "CLOCK_50" (i.e., PIN_N2) is set to a signal (called a clock) that oscillates at 50 Megahertz (50 MHz = 50 million times per second).
    Circuit with counter
  5. Make sure all parts have different instance names (in the example above the OR2 gate is "inst2" and the counter is "inst").  To change the the instance name you can double click on the element and change it.
  6. Compile and run.  Four of the green LED's will count up in binary for 12 counts (from 0 to 11; D3...D0=10112(binary)=1110(decimal)), and the red LED should be off only when the two least significant bits (Q0 and Q1) are both off.  Make sure you observe the green LED's and understand how the counting works - this is necessary in the lab.
    If you haven't worked with binary counters before all you need to know is that the first 16 numbers are given in binary as:

    Decimal Binary
    0 0000
    1 0001
    2 0010
    3 0011
    4 0100
    5 1010
    6 0110
    7 0111
    8 1000
    9 1001
    10 1010
    11 1011
    12 1100
    13 1101
    14 1110
    15 1111

Common Problems (and their solution)

Please contact me if you find any errors or other problems (e.g., something is unclearly stated) in this web page