EELE 262 Logic Circuits Lab Lab #8 Sequential Logic in VHDL (Ripple Counter)

Similar documents
Quartus II Introduction Using VHDL Design

EXPERIMENT 8. Flip-Flops and Sequential Circuits

Lab 1: Introduction to Xilinx ISE Tutorial

LAB #3 VHDL RECOGNITION AND GAL IC PROGRAMMING USING ALL-11 UNIVERSAL PROGRAMMER

EC313 - VHDL State Machine Example

Introduction to the Altera Qsys System Integration Tool. 1 Introduction. For Quartus II 12.0

Using Xilinx ISE for VHDL Based Design

Start A New Project with Keil Microcontroller Development Kit Version 5 and Freescale FRDM-KL25Z

EXPERIMENT 4. Parallel Adders, Subtractors, and Complementors

Installing Remote Desktop Connection

Building an Embedded Processor System on a Xilinx Zync FPGA (Profiling): A Tutorial

Xilinx ISE. <Release Version: 10.1i> Tutorial. Department of Electrical and Computer Engineering State University of New York New Paltz

2. Scope of the DE0 Board and Supporting Material

CHAPTER 11: Flip Flops

To design digital counter circuits using JK-Flip-Flop. To implement counter using 74LS193 IC.

Jianjian Song LogicWorks 4 Tutorials (5/15/03) Page 1 of 14

Quartus II Introduction for VHDL Users

Implementation of Web-Server Using Altera DE2-70 FPGA Development Kit

Using the Altera Serial Flash Loader Megafunction with the Quartus II Software

The 104 Duke_ACC Machine

enter the administrator user name and password for that domain.

Lab: Data Backup and Recovery in Windows XP

Installing the IF-NMEASC & SC30 Windows XP Drivers & Software

SKP16C62P Tutorial 1 Software Development Process using HEW. Renesas Technology America Inc.

TE100-P21/TEW-P21G Windows 7 Installation Instruction

Additional Setup Instructions for Modbus: RTU, ASCII, TCP, Omni & Enron

Adafruit's Raspberry Pi Lesson 5. Using a Console Cable

Install MS SQL Server 2012 Express Edition

Lab - Data Backup and Recovery in Windows XP

3. USB DRIVER Installation of USB driver Driver for Infinity SD Data Logger. INFINITY Series Acquisition Tools Manual

Physics 226 FPGA Lab #1 SP Wakely. Terasic DE0 Board. Getting Started

The FlexiSchools Online Order Management System Installation Guide

Digital Fundamentals. Lab 8 Asynchronous Counter Applications

Important Notes for WinConnect Server VS Software Installation:

How to install and use the File Sharing Outlook Plugin

Lab 3: Introduction to Data Acquisition Cards

Software Licensing Management North Carolina State University software.ncsu.edu

Digital Circuit Design Using Xilinx ISE Tools

Tutorial: Configuring GOOSE in MiCOM S1 Studio 1. Requirements

RAPID PROTOTYPING OF DIGITAL SYSTEMS Second Edition

Lab 1: Full Adder 0.0

Outlook . Step 1: Open and Configure Outlook

BankLink Books Clients

To successfully initialize Microsoft Outlook (Outlook) the first time, settings need to be verified.

An Introduction to MPLAB Integrated Development Environment

ETEC 2301 Programmable Logic Devices. Chapter 10 Counters. Shawnee State University Department of Industrial and Engineering Technologies

The FlexiSchools Online Order Management System Installation Guide

20 Saving Device Data Backup

Lab #5: Design Example: Keypad Scanner and Encoder - Part 1 (120 pts)

SafeWord Domain Login Agent Step-by-Step Guide

Virtual Office Remote Installation Guide

Adafruit's Raspberry Pi Lesson 5. Using a Console Cable

Counters and Decoders

Screen Capture. User s Guide. For ClassPad Series

Important Notes for WinConnect Server ES Software Installation:

Print Server Application Guide. This guide applies to the following models.

Creating Cost Recovery Layouts

Pcounter Web Administrator User Guide - v Pcounter Web Administrator User Guide Version 1.0

Design Example: Counters. Design Example: Counters. 3-Bit Binary Counter. 3-Bit Binary Counter. Other useful counters:

Thermomark Roll - Driver Installation - Windows 7

TRILOGI 5.3 PLC Ladder Diagram Programmer and Simulator. A tutorial prepared for IE 575 by Dr. T.C. Chang. Use On-Line Help

SYMETRIX SOLUTIONS: TECH TIP August 2015

Adafruit's Raspberry Pi Lesson 5. Using a Console Cable. Created by Simon Monk

Instructions for Configuring a SAS Metadata Server for Use with JMP Clinical

Using Remote Web Workplace Version 1.01

DRV8312-C2-KIT How to Run Guide

IPRO Viewer. Installation

Decimal Number (base 10) Binary Number (base 2)

Export the address book from the Blackberry handheld to MS Outlook 2003, using the synchronize utility in Blackberry Desktop Manager.

MSP-EXP430G2 LaunchPad Workshop

Windows Firewall Configuration with Group Policy for SyAM System Client Installation

Using Microsoft Visual Studio API Reference

Lab View with crio Tutorial. Control System Design Feb. 14, 2006

PowerMapper/SortSite Desktop Deployment Guide v Introduction

To add Citrix XenApp Client Setup for home PC/Office using the 32bit Windows client.

Introduction to LogixPro - Lab

Current Cost Data Cable User Guide. Installing and configuring the data cable

Simulating Power Supply Sequences for Power Manager Devices Using PAC-Designer LogiBuilder

Start Active-HDL by double clicking on the Active-HDL Icon (windows).

ModelSim-Altera Software Simulation User Guide

INSTALLING AND USING ENTEL PROGRAMMER IN WINDOWS 7 Technical Support Bulletin

Print Server Application Guide

INF-USB2 and SI-USB Quick Start Guide

Lab Experiment 1: The LPC 2148 Education Board

Two's Complement Adder/Subtractor Lab L03

Installing the USB driver for Firmware 7 or later For use with E-blocks programmer boards and PICmicro Development boards.

Windows XP.. ELITE Firmware Update procedures.. v1.41

3. Programming the STM32F4-Discovery

ScanShell.Net Install Guide

FlowKit in-circuit debug system

Using Altera MAX Series as Microcontroller I/O Expanders

Digitale Signalverarbeitung mit FPGA (DSF) Soft Core Prozessor NIOS II Stand Mai Jens Onno Krah

Installing a Westell USB Network Adapter

Millennium Drive. Installation Guide

Downloading RIT Account Analysis Reports into Excel

Assignment 09. Problem statement : Write a Embedded C program to switch-on/switch-off LED.

Setting up VMware ESXi for 2X VirtualDesktopServer Manual

Leica Geosystems Software Licensing Introduction & Installation

Lab - Configure a Windows Vista Firewall

How do I configure the wireless printer using a USB or Ethernet cable and install the printer driver in Windows?

Transcription:

Objective EELE 262 Logic Circuits Lab Lab #8 Sequential Logic in VHDL (Ripple Counter) The objective of this lab is to introduce sequential logic in VHDL. This lab will cover the design of a simple binary counter circuit called a ripple counter which is made with D-flip-flops. The counter will drive your existing 7- segment display decoder in order to create an incrementing hex counter on your breadboard. Outcomes After completing this lab you should be able to: Design a 4-bit ripple counter on an FPGA using D-flip-flops. Use the counter output to drive the inputs to a 7-segment display decoder. Pre-Lab A) A ripple counter is made from D-flip-flops that are connected in a toggle flop configuration (e.g., the Qn output is wired back to the D input). This configuration provides an output on the Q of the D-flip-flop that has a frequency exactly ½ of the incoming clock. An inverted version of this divided down signal (e.g., Qn) can then be used to clock the next stage of the counter to provide a signal that is ¼ of the original clock. These divided down signals provide a simple binary counter and can be scaled to whatever size is desired by adding more D-flip-flops. The following logic diagram shows the architecture of a ripple counter. In your lab notebook, draw the logic diagram for a 4-bit ripple counter. Lab Work & Demonstration You are going to design and implement the circuit in the following figure. You will be provided a Dflipflip.vhd file that models a D-flip-flop in VHDL. You will design a 4-bit ripple counter on the DE0-nano FPGA which will be clocked by the KEY1 push button on the FPGA board. You will use KEY0 as the reset to your counter. The 4-bit output of the ripple counter will be used to drive the inputs to your 7-segment decoder from last week. You will also drive the 4-bit counter to the LEDs on the DE0-nano board.

1) Creating an FPGA Design for today s lab. A) Connect the DE0-nano board located in the lab to your breadboard as in the above pictures. B) Log into the lab computers using your MSU domain account. C) Create a folder for today s lab. If you wish, you can work on the desktop for now and then copy over to your own drive when finished. Name the folder something descriptive such as Lab08_ripple. D) Start the Altera Quartus II design tool - Start All Programs Altera 12.1 Build 177 (Web Edition) Quartus II 12.1 Quartus II 12.1 The following window will appear (it might take a minute). 2

E) Create a new project using the Project Wizard File New Project Wizard The following Window will appear (i): Click Next In the next window (ii), browse to the folder you created and choose Select Folder. Enter top as the name of the project and top-level design entity. i ii Click Next The next screen (iii) allows you to add existing VHDL files. We will create a new file later. Click Next In the next window (iv), choose the FPGA device. The DE0-nano board contains a Cyclone IV E, EP4CE22F17C6. Choose the Cyclone IV E as the Device Family and Select the EP4CE22F17C6 as the device. iii iv 3

Click Next on the next screen (v) and Finish on the last screen (vi). v vi F) Create a new VHDL design file called top.vhd File New VHDL File OK. A blank text file will appear. We need to first save this as top.vhd File Save As. The file name should default to top.vhd, verify it is named correctly and click Save We will enter the VHDL for our system in this file later. G) Add the Dflipflop.vhd file to your design Download the Dflipflop.vhd file from the course website and put into your Lab08_ripple folder. Use the pull down menu to add the file: Project Add/Remove Files in Project Click the button, browse to the Dflipflop.vhd file, and click Open Then click the Add button on the next screen to add to your project. Click OK H) Enter the VHDL entity for the system. Based on the block diagram provided above, the ports are: Inputs: Clock, Reset These will be driven by KEY1 and KEY0 on the DE0-nano board. Outputs: LED (3 downto 0) This is the 4-bit vector for the LEDs (0,1,2,3) on the DE0-nano Segment_a These lines will drive the LED segments of the 7-segment display. Segment_b They go to the GPIO_0 header on the DE0-nano board. Segment_c These pins are connected to your breadboard using jumper wires. Segment_d Segment_e Segment_f Segment_g 4

Type in the following entity definition in your top.vhd file: (if not active, click on the Files tab and then double click on top.vhd. entity top is port (Clock, Reset : in BIT; LED : out BIT_VECTOR (3 downto 0); Segment_a : out BIT; Segment_b : out BIT; Segment_c : out BIT; Segment_d : out BIT; Segment_e : out BIT; Segment_f : out BIT; Segment_g : out BIT); end entity; I) Create the VHDL architecture for our system. Our architecture will include the 7-segment decoder from last week in addition to the ripple counter. In order to create the ripple counter, we need to use the Dflipflop.vhd file. To do this, we treat is as a component. A component is first declared in the architecture before the begin statement and then instantiated as many times as desired. We will need internal nodes to connect to the ports of the 4 Dflipflops. We ll also need to define two vectors COUNT(3 downto 0) and COUNTn(3 downto 0). Enter the following architecture pieces prior to the begin statement: 5

architecture top_arch of top is signal COUNT, COUNTn : BIT_VECTOR (3 downto 0); signal DISPLAY : BIT_VECTOR (6 downto 0); component Dflipflop port (Clock : in BIT; Reset : in BIT; D : in BIT; Q, Qn : out BIT); end component; begin Now we will instantiate 4 Dflipflops and connect the ports as in the above block diagram. We will wire the Qn output of each Dflipflop back to its D input using the signals COUNTn. The output Q of the Dflipflop will be connected to COUNT. The input port Clock will drive the Clock of the first Dflipflop. The COUNTn output of the first Dflipflop will drive the Clock input of the subsequent Dflipflop and so on. The Reset port will be connected to all Dflipflops. Enter the following Dflipflop instantiations after the begin statement: -- 4-bit ripple counter. U1 : Dflipflop port map (Clock, Reset, COUNTn(0), COUNT(0), COUNTn(0)); U2 : Dflipflop port map (COUNTn(0), Reset, COUNTn(1), COUNT(1), COUNTn(1)); U3 : Dflipflop port map (COUNTn(1), Reset, COUNTn(2), COUNT(2), COUNTn(2)); U4 : Dflipflop port map (COUNTn(2), Reset, COUNTn(3), COUNT(3), COUNTn(3)); This configuration will produce a 4-bit binary counter that is located on COUNT. We want to drive this value to the LEDs and also use it as the input to our 7-segment decoder. Copy your decoder VHDL from last week into your top.vhd and change the input signal in your selected signal assignment from SWn to COUNT. Also add the assignment from COUNT to LED: with (COUNT) select DISPLAY <= "0000001" when "0000", "1001111" when "0001", "0010010" when "0010", "0000110" when "0011", "1001100" when "0100", "0100100" when "0101", "0100000" when "0110", "0001111" when "0111", "0000000" when "1000", "0000100" when "1001", "0001000" when "1010", "1100000" when "1011", "1110010" when "1100", "1000010" when "1101", "0110000" when "1110", "0111000" when "1111"; Segment_a <= DISPLAY(6); -- Display Segment "a" Segment_b <= DISPLAY(5); -- Display Segment "b" Segment_c <= DISPLAY(4); -- Display Segment "c" Segment_d <= DISPLAY(3); -- Display Segment "d" Segment_e <= DISPLAY(2); -- Display Segment "e" Segment_f <= DISPLAY(1); -- Display Segment "f" Segment_g <= DISPLAY(0); -- Display Segment "g" LED <= COUNT; end architecture; 6

At this point, compile your design to make sure there are no syntax errors. You can compile by either using the pull-down menus (Processing Start Compilation) or by double clicking on the Compile Design task in the Flow window on the left side of the Quartus window. If you experience compile errors, fix them and recompile until you are successful. J) Assign the pins of the FPGA Open the Pin Planner (Assignments Pin Planner) and assign the pins: Clock,PIN_E1 Reset,PIN_J15 LED[0],PIN_A15 LED[1],PIN_A13 LED[2],PIN_B13 LED[3],PIN_A11 Segment_a,PIN_D3 Segment_b,PIN_C3 Segment_c,PIN_A3 Segment_d,PIN_B4 Segment_e,PIN_B5 Segment_f,PIN_D5 Segment_g,PIN_A6 7

Once done, close the Pin Planner window (it will save automatically). Now recompile your design. Lab Grading K) Program the FPGA Connect the DE0-nano board to the computer using the retractable USB cable. In the Flow window of Quartus, double click on Program Device (Open Programmer). Click the Start button in the programmer window: L) Test your design You should be able to press the KEY1 button and see your 7-segment display increment through all 16 HEX characters. You should also see the 4-bit binary count value on the LEDs of the DE0- nano board. TA will check off Pre-Lab / 10 Lab Demo (step 1) / 90 Total / 100 8