This content has been downloaded from IOPscience. Please scroll down to see the full text.

Similar documents
Digital Design Using Digilent FPGA Boards -- Verilog / Active-HDL Edition

CONTENTS CHAPTER 1: NUMBER SYSTEM. Foreword...(vii) Preface... (ix) Acknowledgement... (xi) About the Author...(xxiii)

Excel VBA for Physicists. A Primer

EE178 Spring 2018 Lecture Module 1. Eric Crabill

Digital System Design with SystemVerilog

Digital Logic Design Lab

PINE TRAINING ACADEMY

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

ii) Do the following conversions: output is. (a) (101.10) 10 = (?) 2 i) Define X-NOR gate. (b) (10101) 2 = (?) Gray (2) /030832/31034

HANSABA COLLEGE OF ENGINEERING & TECHNOLOGY (098) SUBJECT: DIGITAL ELECTRONICS ( ) Assignment

KING FAHD UNIVERSITY OF PETROLEUM & MINERALS COMPUTER ENGINEERING DEPARTMENT

EPC6055 Digital Integrated Circuits EXAM 1 Fall Semester 2013

Outline. EECS Components and Design Techniques for Digital Systems. Lec 11 Putting it all together Where are we now?

Honorary Professor Supercomputer Education and Research Centre Indian Institute of Science, Bangalore

Principles of Digital Techniques PDT (17320) Assignment No State advantages of digital system over analog system.

FSM-based Digital Design using Veriiog HDL

Computer Organization

University of Toronto Faculty of Applied Science and Engineering Edward S. Rogers Sr. Department of Electrical and Computer Engineering

Microcontrollers. Principles and Applications. Ajit Pal +5 V 2K 8. 8 bit dip switch. P2 8 Reset switch Microcontroller AT89S52 100E +5 V. 2.

Lecture #1: Introduction

The QR code here provides a shortcut to go to the course webpage.

VALLIAMMAI ENGINEERING COLLEGE. SRM Nagar, Kattankulathur DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING EC6302 DIGITAL ELECTRONICS

Institute of Engineering & Management

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

(ii) Simplify and implement the following SOP function using NOR gates:

DIRECTORATE OF TECHNICAL EDUCATION DIPLOMA IN ELECTRICAL AND ELECTRONICS ENGINEERING II YEAR M SCHEME IV SEMESTER.

VHDL for Synthesis. Course Description. Course Duration. Goals

Music. Numbers correspond to course weeks EULA ESE150 Spring click OK Based on slides DeHon 1. !

Date Performed: Marks Obtained: /10. Group Members (ID):. Experiment # 09 MULTIPLEXERS

Elec 326: Digital Logic Design

Injntu.com Injntu.com Injntu.com R16

VERILOG QUICKSTART. Second Edition. A Practical Guide to Simulation and Synthesis in Verilog

UPY14602-DIGITAL ELECTRONICS AND MICROPROCESSORS Lesson Plan

A Tutorial Introduction 1

DIGITA L LOGIC AND COMPUTER ORGA NIZATION

VERILOG QUICKSTART. James M. Lee Cadence Design Systems, Inc. SPRINGER SCIENCE+BUSINESS MEDIA, LLC

Laboratory Exercise 7

St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

EMBEDDED SYSTEMS: Jonathan W. Valvano INTRODUCTION TO THE MSP432 MICROCONTROLLER. Volume 1 First Edition June 2015

SIR C.R.REDDY COLLEGE OF ENGINEERING, ELURU DEPARTMENT OF INFORMATION TECHNOLOGY LESSON PLAN

DIGITAL ELECTRONICS. P41l 3 HOURS

Verilog for High Performance

Verilog Module 1 Introduction and Combinational Logic

Scheme G. Sample Test Paper-I

Chapter 2 Basic Logic Circuits and VHDL Description

R10. II B. Tech I Semester, Supplementary Examinations, May

Keyboard Input to Seven Segment Display

Course Title III Allied Practical** IV Environmental Studies #

FUNDAMENTALS OF DIGITAL CIRCUITS

WELCOME TO. ENGR 303 Introduction to Logic Design. Hello my name is Dr. Chuck Brown

Computer Arithmetic andveriloghdl Fundamentals

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1

Physics 364, Fall 2012, reading due your answers to before the end of Wednesday s lab.

ES 210 Lab. Jack Ou, Ph.D.

PART B. 3. Minimize the following function using K-map and also verify through tabulation method. F (A, B, C, D) = +d (0, 3, 6, 10).

END-TERM EXAMINATION

ECE 341 Midterm Exam

V1 - VHDL Language. FPGA Programming with VHDL and Simulation (through the training Xilinx, Lattice or Actel FPGA are targeted) Objectives

Hours / 100 Marks Seat No.

THE VERILOG? HARDWARE DESCRIPTION LANGUAGE

Course Batch Semester Subject Code Subject Name. B.E-Marine Engineering B.E- ME-16 III UBEE307 Integrated Circuits

Verilog Sequential Logic. Verilog for Synthesis Rev C (module 3 and 4)

EECS150 - Digital Design Lecture 10 Logic Synthesis

CS 261 Fall Mike Lam, Professor. Combinational Circuits

D I G I T A L C I R C U I T S E E

COURSE OUTLINE & WEEK WISE BREAKAGE

MLR Institute of Technology

Laboratory Finite State Machines and Serial Communication

R a) Simplify the logic functions from binary to seven segment display code converter (8M) b) Simplify the following using Tabular method

6.1 Combinational Circuits. George Boole ( ) Claude Shannon ( )

Using Verilog HDL to Teach Computer Architecture Concepts

The Verilog Hardware Description Language

A B A+B

Written exam for IE1204/5 Digital Design Thursday 29/

Topics. Midterm Finish Chapter 7

VLSI DESIGN (ELECTIVE-I) Question Bank Unit I

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad ELECTRONICS AND COMMUNICATIONS ENGINEERING

CS2204 DIGITAL LOGIC & STATE MACHINE DESIGN FALL 2005

SRM ARTS AND SCIENCE COLLEGE SRM NAGAR, KATTANKULATHUR

Verilog HDL. A Guide to Digital Design and Synthesis. Samir Palnitkar. SunSoft Press A Prentice Hall Title

Digital Design. Verilo. and. Fundamentals. fit HDL. Joseph Cavanagh. CRC Press Taylor & Francis Group Boca Raton London New York

ANADOLU UNIVERSITY DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING. EEM Digital Systems II

Preface... xxi Chapter One: Digital Signals and Systems... 1 Chapter Two: Numbering Systems... 17

3. The high voltage level of a digital signal in positive logic is : a) 1 b) 0 c) either 1 or 0

One and a half hours. Section A is COMPULSORY UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE

Method We follow- How to Get Entry Pass in SEMICODUCTOR Industries for 3rd year engineering. Winter/Summer Training

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

Henry Lin, Department of Electrical and Computer Engineering, California State University, Bakersfield Lecture 7 (Digital Logic) July 24 th, 2012

MCMASTER UNIVERSITY EMBEDDED SYSTEMS

Lab Manual for COE 203: Digital Design Lab

Digital Systems Laboratory

Follow-up question: now, comment on what each of these acronyms actually means, going beyond a mere recitation of the definition.

KINGS COLLEGE OF ENGINEERING DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING QUESTION BANK NAME OF THE SUBJECT: EE 2255 DIGITAL LOGIC CIRCUITS

TEACHING & EXAMINATION SCHEME For the Examination COMPUTER SCIENCE. B.Sc. Part-I

1 Digital tools. 1.1 Introduction

COPYRIGHTED MATERIAL INDEX

ECE 331: N0. Professor Andrew Mason Michigan State University. Opening Remarks

Exp#8: Designing a Programmable Sequence Detector

register:a group of binary cells suitable for holding binary information flip-flops + gates

Transcription:

This content has been downloaded from IOPscience. Please scroll down to see the full text. Download details: IP Address: 148.251.232.83 This content was downloaded on 22/11/2018 at 08:50 Please note that terms and conditions apply.

Applied Digital Logic Exercises Using FPGAs

Applied Digital Logic Exercises Using FPGAs Kurt Wick University of Minnesota, USA Morgan & Claypool Publishers

Copyright ª 2017 Morgan & Claypool Publishers All rights reserved. No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without the prior permission of the publisher, or as expressly permitted by law or under terms agreed with the appropriate rights organization. Multiple copying is permitted in accordance with the terms of licences issued by the Copyright Licensing Agency, the Copyright Clearance Centre and other reproduction rights organisations. Rights & Permissions To obtain permission to re-use copyrighted material from Morgan & Claypool Publishers, please contact info@morganclaypool.com. ISBN ISBN ISBN 978-1-6817-4660-9 (ebook) 978-1-6817-4661-6 (print) 978-1-6817-4662-3 (mobi) DOI 10.1088/978-1-6817-4660-9 Version: 20171001 IOP Concise Physics ISSN 2053-2571 (online) ISSN 2054-7307 (print) A Morgan & Claypool publication as part of IOP Concise Physics Published by Morgan & Claypool Publishers, 1210 Fifth Avenue, Suite 250, San Rafael, CA, 94901, USA IOP Publishing, Temple Circus, Temple Way, Bristol BS1 6HG, UK

To Ying, Chloe and Abby.

Contents Preface Acknowledgments Author biography xi xii xiii 1 Introduction to digital logic 1-1 Additional reading 1-1 1.1 Basic definitions of digital concepts 1-1 1.1.1 Definition 1-1 1.1.2 Analog versus digital analogy 1-1 1.1.3 Binary states and digital logic levels 1-3 1.1.4 Manipulating digital logic levels with operators or gates 1-3 1.2 Digital and Boolean logic and its representation 1-4 1.2.1 Fundamental gates 1-6 1.3 Basic Boolean logic rules: application and examples 1-8 1.4 Interchangeability of gates and De Morgan s theorem 1-9 1.5 Implementing digital logic 1-12 1.5.1 Implementing truth tables with Boolean logic expressions 1-12 1.5.2 Creating a schematic representation from a Boolean expression 1-14 1.5.3 Creating a Boolean expression from a schematic representations 1-15 1.6 Tri-state logic 1-15 1.7 Boolean logic expression summary 1-16 1.8 Exercises 1-17 2 FPGA and VERILOG: combinational logic I 2-1 Additional reading 2-1 2.1 Introduction to digital hardware 2-1 2.2 Application specific standard parts (ASSP): 74XX digital logic chips 2-2 2.2.1 Review exercises 2-3 2.3 Introduction to the Vivado design environment and the 2-4 BASYS3 boards 2.3.1 Objective 2-4 2.3.2 Hardware: BASYS3 board with the Xilinx Artix 7 FPGA 2-5 2.3.3 Vivado project development: overview 2-5 2.3.4 Review exercises 2-22 2.4 Introduction to Verilog: wires, vectors, buses and Verilog operators 2-23 vii

Applied Digital Logic Exercises Using FPGAs 2.4.1 Single-bit wires and vectors 2-23 2.4.2 I/O ports and internal wires 2-23 2.4.3 Extracting individual bits from vectors 2-24 2.4.4 Bundling bits into vectors, concatenation 2-25 2.4.5 Verilog operators 2-26 2.4.6 Exercises 2-27 2.4.7 Review exercises 2-31 2.5 Instantiating modules 2-31 2.5.1 Example of how to instantiate a module 2-32 2.5.2 Review exercises: eight-input XOR gate/parity checker 2-38 3 FPGA and VERILOG: combinational logic part II 3-1 Additional reading 3-1 3.1 Binary number representation and Boolean mathematics 3-1 3.1.1 Exercise: instantiating the seven-segment display 3-2 3.1.2 Binary number representations and notation 3-6 3.1.3 Review exercises: binary number representation exercises 3-8 3.1.4 Signed binary numbers: two s complement 3-8 3.1.5 Review exercises: binary number representation: signed numbers 3-9 and two s complement 3.2 Boolean algebra and adder circuits 3-9 3.2.1 Half adder circuit 3-10 3.2.2 Full adder circuit 3-10 3.2.3 8-bit adder/calculator 3-13 3.2.4 8-bit subtractor/calculator and two s complement 3-14 3.2.5 Summary 3-15 3.2.6 Review exercises: 8-bit adder/calculator 3-15 3.3 Multiplexers (MUX)/demultiplexers (DEMUX) 3-16 3.3.1 MUX application: look-up tables (LUTs) 3-17 3.3.2 Review exercises: MUX/DEMUX 3-19 3.3.3 Verilog implementation: conditional logic with a single 3-20 logic condition 3.3.4 Verilog implementation: conditional logic with a multiple 3-20 logic condition 3.3.5 Review exercises: MUX/DEMUX II 3-21 3.3.6 Verilog project: look-up table (encoder) 3-22 3.3.7 Conclusion on MUXs and FPGAs 3-22 3.3.8 Review exercises: MUX/DEMUX III 3-22 viii

Applied Digital Logic Exercises Using FPGAs 4 FPGA and VERILOG part II: sequential logic 4-1 Additional reading 4-1 4.1 Sequential logic: latches 4-1 4.1.1 Verilog implementation of a transparent latch 4-3 4.1.2 Review exercises 4-4 4.2 Sequential logic: flip-flops 4-5 4.2.1 Verilog implementation of a D-type flip-flop 4-6 4.2.2 Flip-flop exercise 1 4-8 4.2.3 Flip-flop exercise 2 4-10 4.2.4 Review exercises 4-10 4.3 Sequential logic: fundamental counters 4-11 4.3.1 Counter exercise 1 4-11 4.3.2 Review exercises 4-13 4.3.3 Counter exercise 2 4-13 4.3.4 Review exercises 4-13 4.4 Sequential logic: counters with logic conditions 4-13 4.4.1 Example 1: previous exercise using adders 4-14 4.4.2 Example 2: decade counter; sequential logic if else statements 4-15 4.4.3 Exercise 1: 44.1 khz audio clock 4-17 4.4.4 Connecting signals to and from the BASYS3 board 4-17 4.4.5 Review exercises 4-20 4.5 Pulse width modulation (PWM) 4-20 4.5.1 Introduction: digital-to-analog conversion methods, pulse 4-20 width modulation 4.5.2 Introduction: light (LED) dimmer 4-21 4.5.3 Simple PWM technique 4-23 4.5.4 Exercise 1 4-25 4.5.5 Review exercises 4-25 4.6 An audio player with PWM 4-26 4.6.1 Introduction 4-26 4.6.2 Detailed description 4-27 4.6.3 AddressCounter module 4-28 4.6.4 Create the top module and instantiate the modules 4-28 4.6.5 Physical connections and the constraint file 4-28 4.6.6 Additional details 4-29 4.6.7 Review exercises 4-31 ix

Applied Digital Logic Exercises Using FPGAs 5 Counters 5-1 Additional reading 5-1 5.1 Introduction 5-1 5.1.1 Synchronous versus asynchronous sequential logic 5-1 5.2 One-shot or monostable multivibrator and synchronizer and 5-3 Vivado s behavior simulation tool 5.2.1 One-shot with synchronizer Verilog module 5-4 5.2.2 Review exercises 5-9 5.3 State machine frequency counter 5-10 5.3.1 Finite state machines (FSMs) 5-10 5.3.2 Event counter FSM 5-11 5.3.3 Verilog case statements and parameters 5-12 5.3.4 FSM in Verilog and language templates 5-13 5.3.5 Implementing the FSM code 5-15 5.3.6 Hardware testing 5-16 5.3.7 Complete FSM code 5-17 5.3.8 Review exercises 5-19 5.4 Period counter 5-19 5.4.1 Introduction to period counters 5-19 5.4.2 Exercise: implementing the period counter 5-20 5.4.3 Review exercises 5-21 5.5 Computer interfacing the design by embedding a microprocessor 5-21 5.5.1 Data communication hardware and software 5-22 5.5.2 Embedded designs and IP-cores 5-23 5.5.3 Final exercise 5-38 5.5.4 Debug suggestion 5-38 5.5.5 Review exercises 5-39 Appendix A A-1 x

Preface This book is for anyone interested in digital logic and who wants to learn how to implement it through detailed exercises with state of the art digital design tools and components. It exposes the reader to combinational and sequential digital logic concepts and implements them with hands-on exercises using the Verilog hardware description language (HDL) and a field programmable gate arrays (FGPA) teaching board. This book covers basic digital design concepts and then applies them through exercises. It teaches the reader the syntax of the Verilog language to build a simple calculator, a basic music player, a frequency and period counter and it ends with a microprocessor being embedded in the fabric of the FGPA to communicate with the PC. In the process, the reader learns about digital mathematics and digital-to-analog converter concepts through pulse width modulation. The topics are aimed at an audience of undergraduate students in a science or engineering course (or hobbyists) wanting an introduction to applied digital logic concepts. The material is deliberately kept brief so it can be covered in about four (course) weeks. No prior knowledge of digital logic or the Verilog programming language is required. Hardware & Software Requirements: Verilog compiler software, Vivado Version 2016.x., can be obtained (for free) by Xilinx Inc., and FPGA teaching boards, BASYS3 by Digilent Inc. are sold for about $100 making them affordable for students and hobbyists. Access to an oscilloscope and a function generator is required for some of the exercises. Detailed software installation instructions are presented in appendix A. xi

Acknowledgments I extend my thanks to Kevin Booth and Professor Müller for their constructive input and proofreading. I would also like to thank Adam Schaefer, Luke Molacek and Siddarth Karuka for finding many, but by no means all, tedious mistakes in this manual. Thanks also to James Duckworth at Worcester Polytechnic Institute for his documents and help in interfacing the FPGA with the microprocessor, and to Jeremiah Mans for providing the code for the binary to BCD conversion for the HEX display. Last but not least, thanks to all the Fall 2016 Phys4051 students who worked through the exercises and provided feedback. Kurt Wick, University of Minnesota, 13 June 2017 xii

Author biography Kurt Wick Kurt Wick received his MS in 1989 from the University of Minnesota where he has been developing and teaching, as Senior Scientist, the methods of experimental physics advanced laboratory course. The course covers a wide range of fields, such as optics, solid state and high energy physics and exposes students to electronics, programing and computer interfacing, statistics and data analysis. With his background in computers and electronics he is interested in teaching the fundamentals of digital electronics and how it pertains to today s consumer electronics and lab instruments. For the last five years, he has presented workshops on FPGAs through the Advanced Laboratory in Physics Association and when he s not working, he enjoys paddling in the woods of northern Minnesota and Ontario. xiii