Digital Systems Design Using VHDL - WordPress

2y ago
66 Views
4 Downloads
9.41 MB
593 Pages
Last View : 2m ago
Last Download : 2m ago
Upload by : Anton Mixon
Transcription

Digital Systems DesignUsing VHDL Second EditionCharles H. Roth, JrThe University of Texasat AustinLizy Kurian JohnThe University of Texasat AustinAustralia Brazil Canada Mexico Singapore SpainUnited Kingdom United StatesCopyright 2008 Thomson Learning, Inc. All Rights Reserved.May not be copied, scanned, or duplicated, in whole or in part.

Digital Systems Design Using VHDL (Second Edition)by Charles H. Roth, Jr and Lizy Kurian JohnPublisher:Chris CarsonProofreader:Erin WagnerCover Design:Andrew AdamsDevelopmental Editor:Hilda GowansIndexer:Shelly Gerger-KnechtlCompositor:IntegraPermissions Coordinator:Vicki GouldProduction Manager:Renate McCloyPrinter:Thomson/WestProduction Services:RPK Editorial Services, Inc.Creative Director:Angela CluerCopy Editor:Patricia DalyInterior Design:Carmela PereiraCover Image Credit: 2007 JupiterImages and itsLicensors. All Rights ReservedCOPYRIGHT 2008 by ThomsonLearning, part of the ThomsonCorporationALL RIGHTS RESERVED. No partof this work covered by thecopyright herein may bereproduced, transcribed, or usedin any form or by any means—graphic, electronic, or mechanical,including photocopying, recording, taping, Web distribution, orinformation storage and retrievalsystems—without the writtenpermission of the publisher.North AmericaThomson Learning1120 Birchmount RoadToronto, Ontario M1K 5G4CanadaFor permission to use materialfrom this text or product,submit a request online atwww.thomsonrights.comAustralia/New ZealandThomson Learning102 Dodds StreetSouthbank, VictoriaAustralia 3006Every effort has been made totrace ownership of all copyrightmaterial and to secure permissionfrom copyright holders. In theevent of any question arising as tothe use of any material, we will bepleased to make the necessarycorrections in future printings.Europe/Middle East/AfricaThomson LearningHigh Holborn House50/51 Bedford RowLondon WCIR 4LRUnited KingdomWCN: 02-200-203Printed and bound in the UnitedStates of America1 2 3 4 07For more information contactThomson Learning, 1120Birchmount Road, Toronto,Ontario, Canada, MIK 5G4. Oryou can visit our Internet site athttp://www.thomsonlearning.comLibrary of Congress ControlNumber: 2006934930ISBN: 10: 0-534-38462-5ISBN: 13: 978-0-534-38462-3AsiaThomson Learning5 Shenton Way #01-01UIC BuildingSingapore 068808Latin AmericaThomson LearningSeneca, 53Colonia Polanco11560 Mexico D.F.MexicoSpainParaninfoCalle/Magallanes, 2528015 Madrid, SpainCopyright 2008 Thomson Learning, Inc. All Rights Reserved.May not be copied, scanned, or duplicated, in whole or in part.

ContentsPrefaceviiChapter 1 Review of Logic Design binational Logic1Boolean Algebra and Algebraic SimplificationKarnaugh Maps7Designing with NAND and NOR Gates11Hazards in Combinational Circuits12Flip-Flops and Latches14Mealy Sequential Circuit Design17Moore Sequential Circuit Design25Equivalent States and Reduction of State TablesSequential Circuit Timing30Tristate Logic and Busses41Chapter 2 Introduction to 42.15132851Computer-Aided Design51Hardware Description Languages54VHDL Description of Combinational Circuits57VHDL Modules61Sequential Statements and VHDL Processes67Modeling Flip-Flops Using VHDL Processes69Processes Using Wait Statements73Two Types of VHDL Delays: Transport and Inertial Delays75Compilation, Simulation, and Synthesis of VHDL Code77VHDL Data Types and Operators82Simple Synthesis Examples84VHDL Models for Multiplexers87VHDL Libraries90Modeling Registers and Counters Using VHDL Processes95Behavioral and Structural VHDL101iiiCopyright 2008 Thomson Learning, Inc. All Rights Reserved.May not be copied, scanned, or duplicated, in whole or in part.

ivContents2.162.172.182.19Variables, Signals, and ConstantsArrays114Loops in VHDL117Assert and Report Statements111119Chapter 3 Introduction to Programmable Logic Devices3.13.23.33.4Brief Overview of Programmable Logic Devices137Simple Programmable Logic Devices (SPLDs)140Complex Programmable Logic Devices (CPLDs)156Field-Programmable Gate Arrays (FPGAs)160Chapter 4 Design BCD to 7-Segment Display Decoder191A BCD Adder19232-Bit Adders194Traffic Light Controller201State Graphs for Control Circuits204Scoreboard and Controller205Synchronization and Debouncing208A Shift-and-Add Multiplier210Array Multiplier216A Signed Integer/Fraction Muliplier219Keypad Scanner231Binary Dividers239Chapter 5 SM Charts and Microprogramming5.15.25.35.45.55.6137State Machine Charts260Derivation of SM Charts265Realization of SM Charts275Implementation of the Dice GameMicroprogramming283Linked State Machines297260279Chapter 6 Designing with Field Programmable Gate Arrays6.16.26.36.46.56.6Implementing Functions in FPGAs310Implementing Functions Using Shannon’s DecompositionCarry Chains in FPGAs321Cascade Chains in FPGAs323Examples of Logic Blocks in Commercial FPGAs324Dedicated Memory in FPGAs326310316Copyright 2008 Thomson Learning, Inc. All Rights Reserved.May not be copied, scanned, or duplicated, in whole or in part.

Contents6.76.86.96.106.116.12Dedicated Multipliers in FPGAs332Cost of Programmability333FPGAs and One-Hot State Assignment335FPGA Capacity: Maximum Gates Versus Usable GatesDesign Translation (Synthesis)338Mapping, Placement, and Routing349Chapter 7 Floating-Point .108.118.12361Representation of Floating-Point NumbersFloating-Point Multiplication367Floating-Point Addition377Other Floating-Point Operations383Chapter 8 Additional Topics in VHDL361389VHDL Functions389VHDL Procedures393Attributes395Creating Overloaded Operators399Multi-Valued Logic and Signal Resolution400The IEEE 9-Valued Logic System405SRAM Model Using IEEE 1164408Model for SRAM Read/Write System410Generics413Named Association414Generate Statements415Files and TEXTIO417Chapter 9 Design of a RISC Microprocessor9.19.29.39.49.5The RISC Philosophy429The MIPS ISA432MIPS Instruction Encoding438Implementation of a MIPS SubsetVHDL Model449429441Chapter 10 Hardware Testing and Design for Testability10.110.210.310.410.5337468Testing Combinational Logic468Testing Sequential Logic473Scan Testing476Boundary Scan479Built-In Self-Test490Copyright 2008 Thomson Learning, Inc. All Rights Reserved.May not be copied, scanned, or duplicated, in whole or in part.v

viContentsChapter 11 Additional Design Examples50711.1 Design of a Wristwatch50711.2 Memory Timing Models51811.3 A Universal Asynchronous Receiver Transmitter (UART)526Appendix A545VHDL Language SummaryAppendix B553IEEE Standard LibrariesAppendix C555TEXTIO PACKAGEAppendix DProjects557References568Index571Copyright 2008 Thomson Learning, Inc. All Rights Reserved.May not be copied, scanned, or duplicated, in whole or in part.

PrefaceThis textbook is intended for a senior-level course in digital systems design. Thebook covers both basic principles of digital system design and the use of a hardwaredescription language, VHDL, in the design process. After basic principles have beencovered, design is best taught by using examples. For this reason, many digital system design examples, ranging in complexity from a simple binary adder to a microprocessor, are included in the text.Students using this textbook should have completed a course in the fundamentals of logic design, including both combinational and sequential circuits. Althoughno previous knowledge of VHDL is assumed, students should have programmingexperience using a modern high-level language such as C. A course in assembly language programming and basic computer organization is also very helpful, especially for Chapter 9.Because students typically take their first course in logic design two yearsbefore this course, most students need a review of the basics. For this reason,Chapter 1 includes a review of logic design fundamentals. Most students canreview this material on their own, so it is unnecessary to devote much lecture timeto this chapter. However, a good understanding of timing in sequential circuitsand the principles of synchronous design is essential to the digital system designprocess.Chapter 2 starts with an overview of modern design flow. It also summarizesvarious technologies for implementation of digital designs. Then, it introduces thebasics of VHDL, and this hardware description language is used throughout therest of the book. Additional features of VHDL are introduced on an as-neededbasis, and more advanced features are covered in Chapter 8. From the start, werelate the constructs of VHDL to the corresponding hardware. Some textbooksteach VHDL as a programming language and devote many pages to teaching thelanguage syntax. Instead, our emphasis is on how to use VHDL in the digital designprocess. The language is very complex, so we do not attempt to cover all its features. We emphasize the basic features that are necessary for digital design andomit some of the less-used features. Use of standard IEEE VHDL libraries isintroduced in this chapter and only IEEE standard libraries are used throughoutthe text.viiCopyright 2008 Thomson Learning, Inc. All Rights Reserved.May not be copied, scanned, or duplicated, in whole or in part.

viiiPrefaceVHDL is very useful in teaching top-down design. We can design a system at ahigh level and express the algorithms in VHDL. We can then simulate and debugthe designs at this level before proceeding with the detailed logic design. However,no design is complete until it has actually been implemented in hardware and thehardware has been tested. For this reason, we recommend that the course includesome lab exercises in which designs are implemented in hardware. We introducesimple programmable logic devices (PLDs) in Chapter 3 so that real hardware canbe used early in the course if desired. Chapter 3 starts with an overview of programmable logic devices and presents simple programmable logic devices first,followed by an introduction to complex programmable logic devices (CPLDs) andField Programmable Gate Arrays (FPGAs). There are many products in the market, and it is good for students to learn about commercial products. However, it ismore important for them to understand the basic principles in the constructionof these programmable devices. Hence we present the material in a generalizedfashion, with references to specific products as examples. The material in thischapter also serves as an introduction to the more detailed treatment of FPGAs inChapter 6.Chapter 4 presents a variety of design examples, including both arithmeticand non-arithmetic examples. Simple examples such as a BCD to 7-segmentdisplay decoder to more complex examples such as game scoreboards, keypadscanners and binary dividers are presented. The chapter presents common techniques used for computer arithmetic, including carry look-ahead addition, andbinary multiplication and division. Use of a state machine for sequencing theoperations in a digital system is an important concept presented in this chapter.Synthesizable VHDL code is presented for the various designs. A variety ofexamples are presented so that instructors can select their favorite designs forteaching.Use of sequential machine charts (SM charts) as an alternative to state graphs ispresented in Chapter 5. We show how to write VHDL code based on SM chartsand how to realize hardware to implement the SM charts. Then, the technique ofmicroprogramming is presented. Transformation of SM charts for different typesof microprogramming is discussed. Then, we show how the use of linked statemachines facilitates the decomposition of complex systems into simpler ones. Thedesign of a dice-game simulator is used to illustrate these techniques.Chapter 6 presents issues related to implementing digital systems in FieldProgrammable Gate Arrays. A few simple designs are first hand-mapped intoFPGA building blocks to illustrate the mapping process. Shannon’s expansion fordecomposition of functions with several variables into smaller functions is presented. Features of modern FPGAs like carry chains, cascade chains, dedicated memory,and dedicated multipliers are then presented. Instead of describing all features ina selected commercial product, the features are described in a general fashion. Oncestudents understand the general principles, they will be able to understand anduse any commercial product they have to work with. This chapter also presents anintroduction to the processes and algorithms in the software design flow. Synthesis,mapping, placement, and routing processes are briefly described. Optimizationsduring synthesis are illustrated.Copyright 2008 Thomson Learning, Inc. All Rights Reserved.May not be copied, scanned, or duplicated, in whole or in part.

PrefaceixBasic techniques for floating-point arithmetic are described in Chapter 7.A simple floating-point format with 2’s complement numbers is presented andthen the IEEE standard floating-point formats are presented. A floating-pointmultiplier example is presented starting with development of the basic algorithm,then simulating the system using VHDL, and finally synthesizing and implementing the system using an FPGA. Some instructors may prefer to coverChapter 8 and 9 before teaching Chapter 7. Chapter 7 can be omitted withoutloss of any continuity.By the time students reach Chapter 8, they should be thoroughly familiar withthe basics of VHDL. At this point we introduce some of the more advanced featuresof VHDL and illustrate their use. The use of multi-valued logic, including the IEEE1164 standard logic, is one of the important topics covered. A memory modelwith tri-state output busses is presented to illustrate the use of the multi-valuedlogic.Chapter 9 presents the design of a microprocessor, starting from the descriptionof the instruction set architecture (ISA). The processor is an early RISC processor,the MIPS R2000. The important instructions in the MIPS ISA are described and asubset is then implemented. The design of the various components of the processor,such as the instruction memory module, data memory module and register file areillustrated module by module. These components are then integrated together anda complete processor design is presented. The model can be tested with a test bench,or can be synthesized and implemented on an FPGA. In order to test the design onan FPGA, one will need to write input-output modules for the design. This examplerequires understanding of the basics of assembly language programming and computer organization.The important topics of hardware testing and design for testability are coveredin Chapter 10. This chapter introduces the basic techniques for testing combinational and sequential logic. Then scan design and boundary-scan techniques, whichfacilitate the testing of digital systems, are described. The chapter concludes with adiscussion of built-in self-test (BIST). VHDL code for a boundary-scan exampleand for a BIST example is included. The topics in this chapter play an importantrole in digital system design, and we recommend that they be included in anycourse on this subject. Chapter 10 can be covered any time after the completion ofChapter 8.Chapter 11 presents three complete design examples that illustrate the use ofVHDL synthesis tools. First, a wristwatch design is presented. It shows the progressof a design from a textual description to a state diagram and then a VHDL model.This example illustrates modular design. The test bench for the wristwatch illustratesthe use of multiple procedure calls to facilitate the testing. The second exampledescribes the use of VHDL to model RAM memories. The third example, a serialcommunications receiver-transmitter, should easily be understood by any studentwho has completed the material through Chapter 8.For instructors who used the first edition of this text, here is a mapping to helpthem understand the changes in the second edition. The homegrown library BITLIBis not used in this edition of the book. The IEEE numeric-bit library is used first untilmulti-valued logic is introduced in Chapter 8. The multi-valued IEEE numeric-stdCopyright 2008 Thomson Learning, Inc. All Rights Reserved.May not be copied, scanned, or duplicated, in whole or in part.

xPrefacelibrary is used thereafter.All code has been converted to use IEEE standard librariesinstead of the BITLIB library.Chapter 1Simpler Mealy and Moore designs added. More detaileddescriptions added to sequential circuit timing section.Chapter 2Overview of design flow and design technologies added.Functions and procedures from old Chapter 2 moved toChapter 8. Inertial delays and transport delays moved fromChapter 8 to Chapter 2. Synthesis is introduced in Chapter 2and all code presented is generally synthesizeable.Chapter 3Contains first part of old Chapter 3. New material on CPLDsand FPGAs added. The design examples from old Chapter 3(traffic light, keypad scanner) are moved to Chapter 4.Chapter 4Several new examples are added. Old Chapter 4 examples arelargely retained, but converted to synthesizeable code. Twoexamples from old Chapter 3 are now here.Chapter 5Added more detailed treatment of microprogramming.Chapter 6New material on FPGAs in a generalized fashion, withoutmaking it specific to any commercial product, but drawingexamples from several commercial devices. A brief treatmentof software design flow including principles of mapping,placement, routing added.Chapter 7IEEE floating point standards and floating point adder designadded.Chapter 8Functions and procedures from old Chapter 2 moved to here.Many sections from old Chapter 8 are still here. A memorymodel previously in old Chapter 9 presented as example ofmulti-valued logic design in new Chapter 8Chapter 9This chapter is new. MIPS instruction set and design of a MIPSprocessor presented. Memory models from old Chapter 9 aremoved to Chapter 8 or 11. Bus model from old Chapter 9omitted.Chapter 10Added details on boundary scan and STUMPS architecture.Chapter 11A new design (wristwatch) added. Memory timing models fromold Chapter 9 appear here now. UART design from oldChapter 11 retained. Microcontroller design is omitted.This book is the result of many years of teaching a senior course in digital systemsdesign at the University of Texas at Austin. Throughout the years, the technology forhardware implementation of digital systems has kept changing, but many of the samedesign principles are still applicable. In the early years of the course, we handwired modules consisting of discrete transistors to implement our designs. Then integrated circuitsCopyright 2008 Thomson Learning, Inc. All Rights Reserved.May not be copied, scanned, or duplicated, in whole or in part.

Prefacexiwere introduced, and we were able to implement our designs using breadboards andTTL logic. Now we are able to use FPGAs and CPLDs to realize very complex designs.We originally used our own hardware description language together with a simulatorrunning on a mainframe computer.When PCs came along, we wrote an improved hardware description language and implemented a simulator that ran on PCs. When VHDLwas adopted as an IEEE standard and became widely used in industry, we switched toVHDL. The widespread availability of high-quality commercial CAD tools nowenables us to synthesize complex designs directly from the VHDL code.All of the VHDL code in this textbook has been tested using the ModelSim simulator. The ModelSim software is available in a student edition, and we recommendits use in conjunction with this text. The CD that accompanies this text provides alink for downloading the ModelSim student edition and an introductory tutorial tohelp students get started using the software. All of the VHDL code in this textbookis available on the CD. The CD also contains two software packages, LogicAid andSimUaid, which are useful in teaching digital system design. Instruction manu

1.7 Mealy Sequential Circuit Design 17 1.8 Moore Sequential Circuit Design 25 1.9 Equivalent States and Reduction of State Tables 28 1.10 Sequential Circuit Timing 30 1.11 Tristate Logic and Busses 41 Chapter 2 Introduction to VHDL 51 2.1 Computer-Aided Design 51 2.2 Hardware Description Languages 54 2.3 VHDL Description of Combinational .

Related Documents:

VHDL/PLD design methodology VHDL is a programming language for designing and modeling digital hardware systems. Using VHDL with electronic design automation (EDA) software tools and user programmable logic devices (PLDs), we can quickly design, verify, and implement a digital system. W

The VHDL Golden Reference Guide is a compact quick reference guide to the VHDL language, its syntax, semantics, synthesis and application to hardware design. The VHDL Golden Reference Guide is not intended as a replacement for the IEEE Standard VHDL Language Reference Manual. Unlike that document, the Golden Reference guide does not offer a

exposed to VHDL modeling of digital circuits, they learn the concepts and non-VHDL design of the digital circuits. Additionally, they spend two hours (or more) per week in the lab to go over the lab assignments and do the lab assignments in which VHDL and FPGAs are used from week 3 through week 10.

I CIRCUIT DESIGN 1 Introduction 1.1 About VHDL 1.2 Design Flow 1.3 EDA Tools 1.4 Translation of VHDL Code into a Circuit 1.5 Design Examples 2 Code Structure 2.1 Fundamental VHDL Units 2.2 LIBRARY Declarations 2.3 ENTITY 2.4 ARCHITECTURE 2.5 Introductory Examples 2.6 Problems 3 Data Types 3.1 Pre-Defined Data Types

VHDL Retrospective zVHDL is an IEEE and ANSI standard for describing digital systems zCreated in 1981 for the DoD VHSIC program - First version developed by IBM, TI, and Intermetric - First release in 1985 - Standardized in 1987 and revised several times thereafter zStandard 1076, 1076.1 (VHDL-AMS), 1076.2, 1076.3 zStandard 1164, VHDL-2006 - Inherits many characteristics of ADA: Strong .

VHDL is a description language for digital electronic circuits that is used in di erent levels of abstraction. The VHDL acronym stands for VHSIC (Very High Spdee Integrated Circuits) Hardware Description Language . This means that VHDL can be used to accelerate the design process.

Language Reference Manual Cosponsors Design Automation Standards Committee (DASC) of the IEEE Computer Society and Automatic Test Program Generation Subcommittee of the IEEE Standards Coordinating Committee 20 (SCC 20) Approved 30 January 2000 IEEE-SA Standards Board Abstract: VHSIC Hardware Description Language (VHDL) is defined. VHDL is a .

Digital Design with Synthesizable VHDL Prof. Stephen A. Edwards sedwards@cs.columbia.edu Columbia University Spring 2008 Digital Design with Synthesizable VHDL – p. 1. Why HDLs? Y B A Vdd Vss B A Y 1970s: SPICE transistor-level netlists An