Introduction to VHDL Design on Quartus II and DE2 Board

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

Laboratory Exercise 3

Lab 2 EECE473 Computer Organization & Architecture University of Maine

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

DE2 Board & Quartus II Software

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

Laboratory Exercise 8

QUARTUS II Altera Corporation

Chapter 2 Getting Hands on Altera Quartus II Software

Tutorial on Quartus II Introduction Using Verilog Code

NIOS CPU Based Embedded Computer System on Programmable Chip

Tutorial on Quartus II Introduction Using Schematic Designs

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

Laboratory Exercise 7

EN2911X: Reconfigurable Computing Lecture 01: Introduction

Quartus II Introduction Using Schematic Design

Quartus II Introduction Using Verilog Design

CSEE W4840 Embedded System Design Lab 1

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

Tutorial for Altera DE1 and Quartus II

NIOS CPU Based Embedded Computer System on Programmable Chip

Terasic DE0 Field Programmable Gate Array (FPGA) Development Board

Laboratory Exercise 1

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

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

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

Advanced Electronics Lab.

Introduction to the Altera SOPC Builder Using Verilog Design

Laboratory 4 Design a Muti-bit Counter

NIOS CPU Based Embedded Computer System on Programmable Chip

CSEE W4840 Embedded System Design Lab 1

CSEE W4840 Embedded System Design Lab 1

Today s Agenda Background/Experience Course Information Altera DE2B Board do Overview Introduction to Embedded Systems Design Abstraction Microprocess

FPGA Development Board Hardware and I/O Features

Digital Systems Laboratory

Chip Design with FPGA Design Tools

University of California, Davis Department of Electrical and Computer Engineering. EEC180B DIGITAL SYSTEMS Spring Quarter 2018

Field Programmable Gate Array

Experiment 8 Introduction to VHDL

Lecture 7. Standard ICs FPGA (Field Programmable Gate Array) VHDL (Very-high-speed integrated circuits. Hardware Description Language)

FPGA Introductory Tutorial: Part 1

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

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

Quick Tutorial for Quartus II & ModelSim Altera

ENGG3380: Computer Organization and Design Lab4: Buses and Peripheral Devices

ENEE245 Digital Circuits and Systems Lab Manual

FPGA briefing Part II FPGA development DMW: FPGA development DMW:

CHAPTER 3 METHODOLOGY. 3.1 Analysis of the Conventional High Speed 8-bits x 8-bits Wallace Tree Multiplier

CSC / EE Digital Systems Design. Summer Sample Project Proposal 01

ECE241 - Digital Systems. University of Toronto. Lab #2 - Fall Introduction Computer-Aided Design Software, the DE2 Board and Simple Logic

Making Qsys Components. 1 Introduction. For Quartus II 13.0

Introduction to the Altera Qsys System Integration Tool. 1 Introduction. For Quartus Prime 15.1

CSCB58 - Lab 3. Prelab /3 Part I (in-lab) /2 Part II (in-lab) /2 TOTAL /8

Altera DE1 Board DE1. Development and Education Board. User Manual. Copyright 2006 Altera Corporation

ENEE245 Digital Circuits and Systems Lab Manual

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

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

TLL5000 Electronic System Design Base Module. Getting Started Guide, Ver 3.4

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

QuartusII.doc 25/02/2005 Page 1

Laboratory Experiment Mastering Digital Design

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

Figure 2.1 The Altera UP 3 board.

Lab 3. Advanced VHDL

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

SFWR ENG 2DA4 Lab 1. Announcements: Marking Scheme: Lab Safety Manual:

CHAPTER 1 Introduction of the tnano Board CHAPTER 2 tnano Board Architecture CHAPTER 3 Using the tnano Board... 8

TLL5000 Electronic System Design Base Module

Physics 536 Spring Illustrating the FPGA design process using Quartus II design software and the Cyclone II FPGA Starter Board.

UNIVERSITI MALAYSIA PERLIS

4DM4 Lab. #1 A: Introduction to VHDL and FPGAs B: An Unbuffered Crossbar Switch (posted Thursday, Sept 19, 2013)

Experiment VERI: FPGA Design with Verilog (Part 1)

FPGA: FIELD PROGRAMMABLE GATE ARRAY Verilog: a hardware description language. Reference: [1]

DE2 Electronic Keyboard ReadMeFirst

Handouts. FPGA-related documents

Latch Based Design (1A) Young Won Lim 2/18/15

FPGA for Complex System Implementation. National Chiao Tung University Chun-Jen Tsai 04/14/2011

Laboratory Exercise 5

IMPLEMENTING COUNTERS

VHDL. Chapter 1 Introduction to VHDL. Course Objectives Affected. Outline

Tutorial 2 Implementing Circuits in Altera Devices

Handouts. 1. Project Guidelines and DSP Function Generator Design Specifications. (We ll discuss the project at the beginning of lab on Wednesday)

ECE 353 Lab 4. MIDI Receiver in Verilog. Professor Daniel Holcomb UMass Amherst Fall 2016

structure syntax different levels of abstraction

Here is a list of lecture objectives. They are provided for you to reflect on what you are supposed to learn, rather than an introduction to this

SignalTap II with Verilog Designs. 1 Introduction. For Quartus II 13.1

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

ENEE 245 Lab 1 Report Rubrics

CHAPTER 2 LITERATURE REVIEW

ECE 353 Lab 4. MIDI Receiver in Verilog. Professor Daniel Holcomb UMass Amherst Fall 2017

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.

The University of Reduced Instruction Set Computer (MARC)

EE 231 Fall EE 231 Lab 2

ECE241 - Digital Systems

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

PREFACE. Changes to the SOPC Edition

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

CCE 3202 Advanced Digital System Design

Transcription:

ECP3116 Digital Computer Design Lab Experiment Duration: 3 hours Introduction to VHDL Design on Quartus II and DE2 Board Objective To learn how to create projects using Quartus II, design circuits and simulate them in the software. To implement the designed circuits on the DE2 Board. Introduction The Quartus II is a Computer Aided Design (CAD) system by Altera Corporation which includes full support for all of the popular methods of entering a description of the desired circuit into a CAD system. CAD software makes it easy to implement a desired logic circuit by using a programmable logic device, such as a field-programmable gate array (FPGA) chip. The CAD flow involves the following steps: - Design Entry The desired circuit is specified either by means of a schematic diagram, or by using a hardware description language, such as VHDL or Verilog - Synthesis The entered design is synthesized into a circuit that consists of the logic elements (LEs) provided in the FPGA chip - Functional Simulation The synthesized circuit is tested to verify its functional correctness; this simulation does not take into account any timing issues - Fitting The CAD Fitter tool determines the placement of the LEs defined in the netlist into the LEs in an actual FPGA chip; it also chooses routing wires in the chip to make the required connections between specific LEs - Timing Analysis Propagation delays along the various paths in the fitted circuit are analyzed to provide an indication of the expected performance of the circuit - Timing Simulation The fitted circuit is tested to verify both its functional correctness and timing - Programming and Configuration The designed circuit is implemented in a physical FPGA chip by programming the configuration switches that configure the LEs and establish the required wiring connections

Figure 1 shows a typical FPGA CAD flow. Figure 1 Each logic circuit, or subcircuit, being designed with Quartus II software is called a project. The software works on one project at a time and keeps all information for that project in a single directory in the file system. Once a circuit design is completed, it can be compiled and a compilation report is produced. The Quartus II software provides a means to simulate the behavior of the designed circuit for ascertaining its correctness. This step is crucial, before implementing the circuit on the FPGA. A designed circuit can be simulated in two ways: functional and timing. Functional simulation assumes that logic elements and interconnection wires in the FPGA are perfect, thus causing no delay in propagation of signals through the circuit. Timing simulation takes all propagation delays into account. Typically, functional simulation is used to verify the functional correctness of a circuit as it is being designed. The Altera DE2 board features the Cyclone II 2C35 FPGA in a 672-pin package. All the components on the board are connected to pins of this chip, allowing the user to control all aspects of the board s

operation. The specifications: FPGA - Cyclone II EP2C35F672C6 FPGA - EPCS16 serial configuration device I/O Devices - Built-in USB Blaster for FPGA configuration - 10/100 Ethernet, RS-232, Infrared port - Video Out (VGA 10-bit DAC) - Video In (NTSC/PAL/Multi-format) - USB 2.0 (type A and type B) - PS/2 mouse or keyboard port - Line-in, Line-out, microphone-in - (24-bit audio CODEC) - Expansion headers (76 signal pins) Memory - 8-MB SDRAM, 512-KB SRAM, 4-MB Flash - SD memory card slot Switches, LEDs, Displays, and Clocks - 18 toggle switches - 4 debounced pushbutton switches - 18 red LEDs, 9 green LEDs - Eight 7-segment displays - 16 x 2 LCD display - 27-MHz and 50-MHz oscillators, external SMA clock input The DE2 board can be used to implement circuits designed using the Quartus II CAD system. Exercises Exercise 1: Getting Started with the Switches The DE2 board provides 18 toggle switches, called SW17 0, that can be used as inputs to a circuit, and 18 red lights, called LEDR17 0, that can be used to display output values. Steps: 1. Start the Quartus II program and create a new project using the New Project. Follow each step of the wizard and select Cyclone II EP2C35F672C6 as the target chip, which is the FPGA chip on the Altera DE2 board (see Figure 2).

Figure 2 2. Create a VHDL entity (a new VHDL file) and enter the following code: LIBRARY ieee; USE ieee.std logic 1164.all; - - Simple module that connects the SW switches to the LEDR lights ENTITY part1 IS PORT ( SW : IN STD LOGIC VECTOR(17 DOWNTO 0); LEDR : OUT STD LOGIC VECTOR(17 DOWNTO 0)); - - red LEDs END part1; ARCHITECTURE Behavior OF part1 IS BEGIN LEDR <= SW; END Behavior

Save the file as part1.vhd in the project directory and include it in the project (see Figure 3). 3. Set the pin assignments by importing the file DE2_pin_assignments.csv by selecting Assignments Import Assignments, then selecting the file in the window (see Figures 4) 4. Compile the project by selecting Processing Start Compilation. 5. Download the compiled circuit into the FPGA chip: a) Connect the DE2 board to the computer using the USB cable. Turn the power on. b) Select Tools Programmer to view the Programmer window (see Figure 5). Ensure the hardware selected is USB-Blaster and the mode is JTAG. c) Click Start. 6. Test the functionality of the circuit by toggling the switches and observing the LEDs. Figure 3

Figure 4 Figure 5 Specific Task 1: Note the behaviour of the LEDs when the switches are toggled. Explain and verify the functionality of the circuit.

Exercise 2: Multiplexers Part A Part (a) of Figure 6 shows a sum-of-products circuit that implements a 2-to-1 multiplexer with a select input s. If s = 0 the multiplexer s output m is equal to the input x, and if s = 1 the output is equal to y. Part (b) shows the truth table for this multiplexer, and part (c) its circuit symbol. Figure 6 The multiplexer can be described by the following VHDL statement: m <= ( NOT (s) AND x ) OR (s AND y); Figure 7 shows an 8-bit wide 2-to-1 multiplexer. The circuit has two 8-bit inputs X and Y and produces the 8-bit output M. If s = 0 then M = X, while if s = 1 then M = Y. Steps: 1. Create a new Quartus II project for the multiplexer circuit. 2. Include a VHDL file for the 8-bit wide 2-to-1 multiplexer in the project. Use switch SW 17 on the DE2 board as the s input, switches SW7 0 as the X input and SW15 8 as the Y input. Connect the SW switches to the red lights LEDR and connect the output M to the green lights LEDG7 0. 3. Import the required pin assignments for the DE2 board as per step 3 of Exercise 1. 4. Compile the project.

5. Download the compiled circuit into the FPGA chip. Test the functionality of the 8-bit wide 2- to-1 multiplexer by toggling the switches and observing the LEDs. Figure 7 Specific Task 2a: Write the VHDL entity to describe the circuit in Figure 7 and save as a VHDL file to be included into the project as per step 2. Note the behaviour of the LEDs when the switches are toggled. Explain and verify the functionality of the circuit. Part B Consider a 5-to-1 multiplexer circuit in which the output m has to be selected from five inputs u, v, w, x, and y. Figure 8 shows how a 5-to-1 multiplexer can be built by combining four 2-to-1 multiplexers. The circuit uses a 3-bit select input s 2 s 1 s 0 and implements the truth table shown in part (b). A circuit symbol for this multiplexer is given in part (c). Figure 9 shows a similarly constructed 3-bit wide 5-to-1 multiplexer. It contains three instances of the circuit in Figure 8. Steps: 1. Create a new Quartus II project for the multiplexer circuit. 2. Include a VHDL file for the 3-bit wide 5-to-1 multiplexer. Connect its select inputs to switches SW17 15, and use the remaining 15 switches SW14 0 to provide the five 3-bit

inputs U to Y. Connect the SW switches to the red lights LEDR and connect the output M to the green lights LEDG2 0. 3. Import the required pin assignments for the DE2 board. 4. Compile the project. 5. Download the compiled circuit into the FPGA chip. Test the functionality of the 3-bit wide 5- to-1 multiplexer by toggling the switches and observing the LEDs. Ensure that each of the inputs U to Y can be properly selected as the output M. Figure 8

Figure 9 Specific Task 2b: Write the VHDL entity to describe the circuit in Figure 9 and save as a VHDL file to be included into the project as per step 2. Note the behaviour of the LEDs when the switches are toggled. Explain and verify the functionality of the circuit. Exercise 3: Latches and Flip-flops Part A Altera FPGAs include flip-flops that are available for implementing a user s circuit. However, storage elements can be created in an FPGA without using its dedicated flip-flops. Figure 10 depicts a gated RS latch circuit. A style of VHDL code that uses logic expressions to describe this circuit is given is as follows: - - A gated RS latch LIBRARY ieee; USE ieee.std_logic_1164.all; ENTITY ls_latch IS PORT (Clk, R, S : IN STD_LOGIC; Q : OUT STD_LOGIC); END ls_latch; ARCHITECTURE Structural OF ls_latch IS SIGNAL R_g, S_g, Qa, Qb : STD_LOGIC ; ATTRIBUTE keep : boolean; ATTRIBUTE keep of R_g, S_g, Qa, Qb : SIGNAL IS true; BEGIN R_g <= R AND Clk; S_g <= S AND Clk; Qa <= NOT (R_g OR Qb);

Qb <= NOT (S_g OR Qa); Q <= Qa; END Structural; Figure 10 To preserve internal signals such as R-g and S_g in the implemented circuit, it is necessary to include a compiler directive in the code. The directive keep is included by using a VHDL ATTRIBUTE statement. It instructs the Quartus II compiler to use separate logic elements for each of the signals R_g, S_g,Qa, and Qb. Compiling the code produces the circuit with four 4- input lookup tables (LUTs) as shown in Figure 11. Figure 12 shows the circuit for a gated D latch. Steps: 1. Create a new Quartus II project. Figure 11 2. Write a VHDL file, using the style of the LS latch code given, for the gated D latch. Use the keep directive to ensure that separate logic elements are used to implement the signals R, S_g,R_g,Qa, and Qb.

3. Select as target chip the Cyclone II EP2C35F672C6 and compile the code. Examine the implemented circuit by selecting Tools Netlist Viewers RTL Viewer. 4. Create another new Quartus II project which will be used for implementation of the gated D latch on the DE2 board. This project should consist of a top-level entity that contains the appropriate input and output ports (pins) for the DE2 board. Instantiate the latch in this toplevel entity. Use switch SW0 to drive the D input of the latch, and use SW1 as the Clk input. Connect the Q output to LEDR0. 5. Recompile the project and download the compiled circuit onto the DE2 board. Test the functionality of your circuit by toggling the D and Clk switches and observing the Q output. Figure 12 Specific Task 3a: Write the VHDL file for the gated D latch in Figure 12 as specified in step 2. Note the Q output when D and Clk switches are toggled. Verify the functionality of the circuit. Part B Figure 13 shows the circuit for a master-slave D flip-flop. To simulate the circuit, perform the following steps. Steps: 1. Create a new Quartus II project. Generate a VHDL file that instantiates two copies of your gated D latch entity from Part A to implement the master-slave flip-flop. 2. Include in your project the appropriate input and output ports for the Altera DE2 board. Use switch SW 0 to drive the D input of the flip-flop, and use SW1 as the Clock input. Connect the Q output to LEDR0. 3. Compile your project and use the RTL Viewer to examine the D flip-flop circuit. 4. Download the circuit onto the DE2 board and test its functionality by toggling the D and Clock switches and observing the Q output.

Figure 13 Specific Task 3b: Generate the VHDL file for the master-slave flip-flop in Figure 13 as specified in step 1. Note the Q output when D and Clock switches are toggled. Verify the functionality of the circuit. Report writing guidelines Your lab report must be typed and must contain the following sections: Report cover page Use the report cover page format in the FOE lab website. Download the template at http://foe.mmu.edu.my/lab/sr.htm Brief Introduction [5 marks] Write a short description in your own words about the experiment, including the objectives. Do not reproduce the text / steps in this lab sheet. Results and Discussion [35 marks] Provide the VHDL codes and subsequent observations listed under Specific Task for all the exercises. Discuss and/or analyse the results. Conclusion [10 marks] Conclude your report with a brief summary on the knowledge and skills that you have acquired from this lab. Total marks for lab report: 50 *Exercises are adapted from Altera s support documents for Quartus II and DE2 Boards.