Quick Tutorial for Quartus II & ModelSim Altera

Similar documents
FPGA Introductory Tutorial: Part 1

UNIVERSITY OF CALIFORNIA, DAVIS Department of Electrical and Computer Engineering. EEC180A DIGITAL SYSTEMS I Winter 2015

Tutorial on Quartus II Introduction Using Verilog Code

ECE 3610 Microprocessing Systems Lab #1 Verilog Design of the TOC Using Quartus II

Tutorial on Quartus II Introduction Using Schematic Designs

QUARTUS II Altera Corporation

Quartus II Introduction Using Verilog Design

Quartus II Introduction Using Schematic Design

The development board used in this class is ALTERA s DE The board provides the following hardware:

Tutorial for Altera DE1 and Quartus II

Quartus II Introduction Using Verilog Designs. 1 Introduction. For Quartus II 12.0

EMT1250 LABORATORY EXPERIMENT. EXPERIMENT # 6: Quartus II Tutorial and Practice. Name: Date:

Using Synplify Pro, ISE and ModelSim

Terasic DE0 Field Programmable Gate Array (FPGA) Development Board

NIOS CPU Based Embedded Computer System on Programmable Chip

CSEE W4840 Embedded System Design Lab 1

EE 231 Fall EE 231 Lab 2

IMPLEMENTING COUNTERS

Chapter 2 Getting Hands on Altera Quartus II Software

EMT1250 LABORATORY EXPERIMENT. EXPERIMENT # 7: VHDL and DE2 Board. Name: Date:

EE 231 Fall Lab 1: Introduction to Verilog HDL and Altera IDE

University of Florida EEL 3701 Dr. Eric M. Schwartz Madison Emas, TA Department of Electrical & Computer Engineering Revision 1 5-Jun-17

2 nd Year Laboratory. Experiment: FPGA Design with Verilog. Department of Electrical & Electronic Engineering. Imperial College London.

1 Introduction 2. 2 Background 3. 3 Getting Started 4. 4 Starting a New Project 6. 5 Design Entry Using VHDL Code 13

NIOS CPU Based Embedded Computer System on Programmable Chip

Quartus II Tutorial. September 10, 2014 Quartus II Version 14.0

Laboratory Exercise 8

CPE 200L LABORATORY 4: INTRODUCTION TO DE2 BOARD UNIVERSITY OF NEVADA, LAS VEGAS GOALS: BACKGROUND:

Chapter 2: Hardware Design Flow Using Verilog in Quartus II

CSEE W4840 Embedded System Design Lab 1

E85: Digital Design and Computer Engineering Lab 2: FPGA Tools and Combinatorial Logic Design

CSEE W4840 Embedded System Design Lab 1

NOTE: This tutorial contains many large illustrations. Page breaks have been added to keep images on the same page as the step that they represent.

Quartus II Version 14.0 Tutorial Created September 10, 2014; Last Updated January 9, 2017

CET4805 Component and Subsystem Design II. EXPERIMENT # 5: Adders. Name: Date:

Quartus II Tutorial. September 10, 2014 Quartus II Version 14.0

CSE P567 - Winter 2010 Lab 1 Introduction to FGPA CAD Tools

Lab 2: Introduction to Verilog HDL and Quartus

Laboratory 4 Design a Muti-bit Counter and Programming a FPGA

Contents. Appendix B HDL Entry Tutorial 2 Page 1 of 14

Introduction to Simulation of VHDL Designs Using ModelSim Graphical Waveform Editor. 1 Introduction. For Quartus Prime 16.1

Using ModelSim to Simulate Logic Circuits in VHDL Designs. 1 Introduction. For Quartus II 13.0

UNIVERSITI MALAYSIA PERLIS

Laboratory 4 Design a Muti-bit Counter

EMT1250 LABORATORY EXPERIMENT. EXPERIMENT # 10: Implementing Binary Adders. Name: Date:

Engineering 303 Digital Logic Design Spring 2017

NIOS CPU Based Embedded Computer System on Programmable Chip

Using ModelSim to Simulate Logic Circuits for Altera FPGA Devices

JEE2600 INTRODUCTION TO DIGITAL LOGIC AND COMPUTER DESIGN. ModelSim Tutorial. Prepared by: Phil Beck 9/8/2008. Voter Function

Design Flow Tutorial

University of Massachusetts Amherst Computer Systems Lab 2 (ECE 354) Spring Lab 1: Using Nios 2 processor for code execution on FPGA

Introduction to VHDL Design on Quartus II and DE2 Board

Lab 6: Integrated the Decoder with Muti-bit Counter and Programming a FPGA

SOPC LAB1. I. Introduction. II. Lab contents. 4-bit count up counter. Advanced VLSI Due Wednesday, 01/08/2003

DOWNLOADING DESIGNS TO THE ALTERA DE10-LITE FPGA

Lab 2 EECE473 Computer Organization & Architecture University of Maine

Digital Systems Laboratory

Altera Technical Training Quartus II Software Design

University of Florida EEL 3701 Dr. Eric M. Schwartz Department of Electrical & Computer Engineering Revision 0 12-Jun-16

FPGA RGB Matrix. Created by lady ada. Last updated on :15:42 PM UTC

Laboratory Exercise 3 Comparative Analysis of Hardware and Emulation Forms of Signed 32-Bit Multiplication

ENSC 350 ModelSim Altera Tutorial

CET4805 Component and Subsystem Design II. EXPERIMENT # 2: VHDL(VHSIC Hardware Descriptive Language) Name: Date:

E85: Digital Design and Computer Architecture J. Spjut and R. Wang Spring 2014

University Program 3 Kit

Advanced Electronics Lab.

ECT 224: Digital Computer Fundamentals Using Xilinx StateCAD

TUTORIALS FOR MAX3000A CPLD DEVICES

Programming Xilinx SPARTAN 3 Board (Simulation through Implementation)

University of Massachusetts Amherst Computer Systems Lab 1 (ECE 354) LAB 1 Reference Manual

Introduction to the Altera SOPC Builder Using Verilog Design

VIVADO TUTORIAL- TIMING AND POWER ANALYSIS

Chip Design with FPGA Design Tools

QuartusII.doc 25/02/2005 Page 1

TUTORIALS FOR MAX3000A CPLD DEVICES

How to Customize the ModelSim Wave View in the Altera Quartus Simulation Flow

5 January ModelSim v5.7 Quick Reference Guide

SCHEMATIC DESIGN IN QUARTUS

ECE 4305 Computer Architecture Lab #1

PRELAB! Read the entire lab, and complete the prelab questions (Q1- Q3) on the answer sheet before coming to the laboratory.

MANUAL XILINX ISE PROJECT NAVIGATOR

EET2141 Project 2: Binary Adder Using Xilinx 7.1i Due Friday April 25

Altera Quartus II Tutorial ECE 552

and 32 bit for 32 bit. If you don t pay attention to this, there will be unexpected behavior in the ISE software and thing may not work properly!

CHAPTER 1 INTRODUCTION... 1 CHAPTER 2 ASSIGN THE DEVICE... 7 CHAPTER 3 DESIGN ENTRY CHAPTER 4 COMPILE AND VERIFY YOUR DESIGN...

Xilinx Tutorial Basic Walk-through

HyperBus Memory Controller (HBMC) Tutorial

Verilog Design Entry, Synthesis, and Behavioral Simulation

Introduction to the Altera SOPC Builder Using Verilog Designs. 1 Introduction

AN 839: Design Block Reuse Tutorial

University of California, Davis Department of Electrical and Computer Engineering. Lab 1: Implementing Combinational Logic in the MAX10 FPGA

TLL5000 Electronic System Design Base Module

Simulation with ModelSim Altera from Quartus II

Logic Implementation on a Xilinx FPGA using VHDL WWU Linux platform assumed. rev 10/25/16

Experiment VERI: FPGA Design with Verilog (Part 1)

FPGA Design Tutorial

Xilinx ISE/WebPack: Introduction to Schematic Capture and Simulation

DKAN0011A Setting Up a Nios II System with SDRAM on the DE2

EE183 LAB TUTORIAL. Introduction. Projects. Design Entry

Transcription:

Quick Tutorial for Quartus II & ModelSim Altera By Ziqiang Patrick Huang Hudson 213c Ziqiang.huang@duke.edu Download & Installation For Windows or Linux users : Download Quartus II Web Edition v13.0 (ModelSim Altera included) from http://dl.altera.com/13.0/?edition=web, then follow the instruction and install it. For Mac users: Either use virtual machines or the computers in the lab (Already installed with all the software you need) Create a new project 1. Open Quartus II, select File > New Project Wizard to reach the window in Figure 1 and choose the working directory and name for the project. The name of top-level design entity usually matches the project name.

Figure 1 2. Click Next, if the working directory does not exist, a pop-up box will appear to ask you to create the directory, click yes and reach the window in Figure 2. Here you could include the existing design files. Figure 2 3. After adding all the files you want to include or if you don t have any, click next to reach the window in Figure 3. Here you need to specify the device in which the design circuit will be implemented. Under Family, select Cyclone II, under Available Device, select EP2C35F672C6, which is the FPGA used on Altera DE2 board in the lab.

Figure 3 4. Click Next to reach the window in Figure 4. Here you can specify the EDA tools you want to use. We will use ModelSim in this class, and the format is VHDL, so just leave the default settings Figure 4 5. Click Next and a summary of settings will be shown to you as in Figure 5.

Figure 5 6. Click Finish and you will return to the main Quartus II window, under Project Navigator sub-window, you can see the project you just created with no design file at this moment, as in Figure 6 Figure 6

Write design files in VHDL 1. Using the Quartus II Text Editor Select File > New to get the window in Figure 7, choose VHDL File, and click OK. This opens the Text Editor window. The first step is to specify a name for the file that will be created. Select File > Save As to open the pop-up box depicted in Figure 8. In the box labeled Save as type choose VHDL File. In the box labeled File name type adderdemo. Put a checkmark in the box Add file to current project. Click Save, which puts the file into the directory work and leads to the Text Editor window shown in Figure 9, now in the Project Navigator, under Files, you can see the design file you just created. We ll use adderdemo.vhd file from the course website as an example, you don t need to understand all the details in the code at this moment. Figure 7 Figure 8

Figure 9 2. Using other Text Editor You can also use any other text editor that stores ASCII files (Emacs, Vim, etc.) to write the source code, but then you need to manually add files into the project. Select Project > Add/Remove files in project to reach the window in Figure 10. Figure 10

Compile the designed files After writing or adding your design files, run the Compiler by selecting Processing > Start Compilation, or by clicking on the toolbar icon that looks like a purple triangle. As the compilation moves through various stages, its progress is reported in a window on the left side of the Quartus II display. Successful (or unsuccessful) compilation is indicated in a pop-up box. Acknowledge it by clicking OK, which leads to the Quartus II display in Figure 11. In the message window, at the bottom of the figure, various messages are displayed. In case of errors, there will be appropriate messages given. When the compilation is finished, a compilation report is produced. A window showing this report is opened automatically, as seen in Figure 11. The window can be resized, maximized, or closed in the normal way, and it can be opened at any time either by selecting Processing > Compilation Report or by clicking on the icon. The report includes a number of sections listed on the left side of its window. Figure 11 displays the Compiler Flow Summary section, which indicates that 38 logic elements and 44 pins are needed to implement this circuit on the selected FPGA chip. Figure 11 Simulate with ModelSim-Altera 1. Set up the EDA tool options Select Tools > Options to open up the options window, under General, select EDA Tool Options on the left as the Figure 12. Click the Browse button to the right of

ModelSim-Altera in the EDA Tool list to specify the location of the ModelSim-Altera executable. Finally click OK. Figure 12 2. Set up the simulation Select Assignment > Settings. In the Settings dialog box, under EDA Tools Settings, select Simulation, as shown in Figure 13. In the Tool name list, select ModelSim- Altera. Ensure that Run gate-level simulation automatically after compilation box is turned off. Under EDA Netlist Writer settings, in the Format for output netlist list, select VHDL. Ensure that the Map illegal HDL characters, Enable glitch filtering and Generate Value Change Dump(VCD) file script boxes are turned off. Under NativeLink settings, select None. Finally, click OK.

Figure 13 3. Running ModelSim-Altera from Quartus II Select Tools > Run Simulation Tool > RTL simulation to start ModelSim within Quartus II, as shown in Figure 14. Figure 14 4. Compile Select Compile > Compile, in the pop-out window shown in Figure 15, choose adderdemo.vho, click Compile, then click done.

Figure 15 5. Initialize the simulation using command line function. On the transcript window at the bottom, type command: vsim work.adderdemo The format is vsim <library_name>.<design_unit>, then you will see the sim tab and the object window initialized with all the signals in your design, as show in Figure 16. 6. Add/force signals to wave window Figure 16

Under sim tab, right click the top-level design unit, choose add wave, then all the signals will be automatically added in the wave window on the right, you can detach and expand the window as shown in Figure 17. Figure 17 7. Force the input signals Now you can add forces to the input signals so that you can simulate and test the functionality of your design. There are multiple ways of doing that. One is to directly edit on the wave window. Right click the signal you want to edit. A pop-out box will appear as Figure 18. Set the value of the signal by entering either a 1 or 0 in the Value field and then select the Freeze option in the Kind area. Repeat this step for all the input signals. Note if a signal has multiple bits, you can set them at once by right click the top-level of this signal, in other words: don t expand it. 8. Simulate and look at the wave form Figure 18

After forcing all the input signals, the design is ready for simulation. Find the button labeled Run. Clicking this will run the simulation for the default time of 100ns. Clicking the Run button again will run the simulation from the previous stopping point, NOT from time 0. You can test a different set of inputs by switching to the signals window, applying new forces, and running the simulation again. You can verify the result in the wave form as shown in Figure 19. Figure 19 9. Use command line functions and write Do script to simulate When simulating large designs, it is often too cumbersome to manually force a signal using the graphic interface each time you want it to change. ModelSim remedies this by providing a long list of simulator commands. The complete list can be found in the ModelSim help documentation, but for purposes of this tutorial we will cover some of the most commonly used commands. First do restart force -nowave to restart simulation from time 0. Then do add wave * to add all the signals from the current simulation. You can add radix/hex to change how it shows up(hex or decimal). Then use force deposit <signal> to force the initial state of the signal, for example, Force deposit switches 16#0 set the switches signal to 0, Note that 16#0 means 0 as a hex number. In this simple example, we don t have to set clock, but in most of the designs you will have to do it. For example if you want to set the clk signal to 20ns per cycle in the top-design unit named cache, you do force -deposit /cache/clk 1 0, 0 {10 ns} -repeat 20 ns, note / is used to show hierarchy.

Your design is also likely to have a reset signal and you should set it at the beginning of your simulation, you do force -deposit /cache/rst 1 -- set the reset signal to 1 run 20 ns -- run for one cycle to let it take effect force -deposit /cache/rst 0 -- set it back to 0 Then you can start change the inputs and time to process them force deposit switches 16#235 run 40 ns etc To see the result of the simulation, do view wave You can write comments with #.. # #Initialize state# ModelSim allows you to automate sequences of commands using DO files. The files are simple in structure, containing only comments starting with a # and a sequential list of commands. To create a new DO file, navigate to the ModelSim main window and choose File > New > Source > Do. This will open the editor window with a blank document. Type the following in the editor and then save the file as "tutorial.do". To execute the file, simply type command do tutorial.do Pin Assignment If the simulation is successful, we can go back to Quartus II to continue the rest of the work. During the previous compilation, the Quartus II Compiler was free to choose any pins on the selected FPGA to serve as inputs and outputs. However, the DE2 board has hardwired connections between the FPGA pins and the other components on the board. We will use the 18 toggle switches labeled from SW0 to SW17 on the left bottom of the board, to provide the external inputs, and the red and green led lights above the switches to provide outputs. Pin assignments are made by using the Pin Planner. Select Assignment > Pin Planner to reach the window in Figure 20.

Figure 20 On the bottom you can see all the inputs and outputs are listed. Under each Location, type in the corresponding pin number for the FPGA. (You can find a detailed Pin table for the board at http://www.terasic.com.tw/attachment/archive/30/de2_pin_table.pdf. As shown in figure 21.

Figure 21 Programming and configure the FPGA device The FPGA device must be programmed and configured to implement the designed circuit. The required configuration file is generated by the Quartus II Compiler s Assembler module. Altera s DE2 board allows the configuration to be done in two different ways, known as JTAG and AS modes. The configuration data is transferred from the host computer (which runs the Quartus II software) to the board by means of a cable that connects a USB port on the host computer to the leftmost USB connector on the board. To use this connection, it is necessary to havethe USB-Blaster driver installed. Select Tool > Programmer to reach the window in Figure 22. Here it is necessary to specify the programming hardware and the mode that should be used. If not already chosen by default, select JTAG in the Mode box. Also, if the USB-Blaster is not chosen by default, press the Hardware Setup... button and select the USB-Blaster in the window that pops up, as shown in Figure 22.

Figure 22 Finally click start to start programming the FPGA, after it finished, you will see the progress showing 100% successful on the upper right corner. Then you can use the Altera DE2 board to test your design! Acknowledgement This tutorial is for Course ECE 550D: Fundamentals and Computer Systems Engineering. The material is derived from Altera User Guide: Getting started with Quartus II simulation using the ModelSim-Altera and Quartus II Simulation with VHDL Designs.