Third Edition - Elsevier

Transcription

The Designer’s Guideto VHDLThird Edition

The Morgan Kaufmann Series in Systems on SiliconSeries Editor: Wayne Wolf, Georgia Institute of TechnologyThe Designer’s Guide to VHDL, Second EditionPeter J. AshendenThe System Designer’s Guide to VHDL-AMSPeter J. Ashenden, Gregory D. Peterson, and Darrell A. TeegardenModeling Embedded Systems and SoCsAxel JantschASIC and FPGA Verification: A Guide to Component ModelingRichard MundenMultiprocessor Systems-on-ChipsEdited by Ahmed Amine Jerraya and Wayne WolfFunctional VerificationBruce Wile, John Goss, and Wolfgang RoesnerCustomizable and Configurable Embedded ProcessorsEdited by Paolo Ienne and Rainer LeupersNetworks-on-Chips: Technology and ToolsEdited by Giovanni De Micheli and Luca BeniniVLSI Test Principles & ArchitecturesEdited by Laung-Terng Wang, Cheng-Wen Wu, and Xiaoqing WenDesigning SoCs with Configured ProcessorsSteve LeibsonESL Design and VerificationGrant Martin, Andrew Piziali, and Brian BaileyAspect-Oriented Programming with eDavid RobinsonReconfigurable Computing: The Theory and Practice of FPGA-Based ComputationEdited by Scott Hauck and André DeHonSystem-on-Chip Test ArchitecturesEdited by Laung-Terng Wang, Charles E. Stroud, and Nur A. ToubaVerification Techniques for System-Level DesignMasahiro Fujita, Indradeep Ghosh, and Mukul PrasadVHDL-2008: Just the New StuffPeter J. Ashenden and Jim LewisOn-Chip Communication Architectures: System on Chip InterconnectSudeep Pasricha and Nikil DuttEmbedded DSP Processor Design: Application Specific Instruction Set ProcessorsDake LiuProcessor Description LanguagesPrabhat Mishra

The Designer’s Guideto VHDLThird EditionPeter J. AshendenEDA CONSULTANT, ASHENDEN DESIGNS PTY. LTD.ADJUNCT ASSOCIATE PROFESSOR, ADELAIDE UNIVERSITY

Morgan Kaufmann Publishers is an imprint of Elsevier.30 Corporate Drive, Suite 400, Burlington, MA 01803, USAThis book is printed on acid-free paper. 2008 by Elsevier Inc. All rights reserved.Designations used by companies to distinguish their products are often claimed as trademarks or registeredtrademarks. In all instances in which Morgan Kaufmann Publishers is aware of a claim, the product namesappear in initial capital or all capital letters. Readers, however, should contact the appropriate companies formore complete information regarding trademarks and registration.No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or byany means—electronic, mechanical, photocopying, scanning, or otherwise—without prior written permission of the publisher.Permissions may be sought directly from Elsevier's Science & Technology Rights Department in Oxford, UK:phone: ( 44) 1865 843830, fax: ( 44) 1865 853333, E-mail: permissions@elsevier.com. You may alsocomplete your request online via the Elsevier homepage (http://elsevier.com), by selecting “Support &Contact” then “Copyright and Permission” and then “Obtaining Permissions.”Library of Congress Cataloging-in-Publication DataAshenden, Peter J.The designer’s guide to VHDL / Peter J. Ashenden. -- 3rd ed.p. cm. -- (The Morgan Kaufmann series in systems on silicon)Includes bibliographical references and index.ISBN 978-0-12-088785-9 (hardcover : alk. paper) 1. VHDL (Computer hardware description language)2. Electronic digital computers--Computer simulation. I. Title.TK7888.3.A863 2008621.39'2--dc222008011059ISBN: 978-0-12-088785-9For information on all Morgan Kaufmann publications,visit our Web site at www.mkp.com or www.books.elsevier.comPrinted in the United States.08 09 105 4 3 2 1

To my wife Katrina

ContentsPreface1xviiFundamental Concepts11.11.2Modeling Digital Systems 1Domains and Levels of Modeling 31.2.1Modeling Example 31.3 Modeling Languages 71.4 VHDL Modeling Concepts 71.4.1Elements of Behavior 81.4.2Elements of Structure 101.4.3Mixed Structural and Behavioral Models 121.4.4Test Benches 131.4.5Analysis, Elaboration and Execution 141.5 Learning a New Language: Lexical Elements and Syntax1.5.1Lexical Elements 17Comments 17Identifiers 19Reserved Words 20Special Symbols 22Numbers 22Characters 23Strings 23Bit Strings 241.5.2Syntax Descriptions 26Exercises 292Scalar Data Types and Operations2.12.2Constants and Variables 312.1.1Constant and Variable Declarations2.1.2Variable Assignment 33Scalar Types 342.2.1Type Declarations 342.2.2Integer Types 352.2.3Floating-Point Types 382.2.4Physical Types 39Time 422.2.5Enumeration Types 43Characters 44Booleans 46163131vii

viiiContentsBits 47Standard Logic 48Condition Conversion 492.3 Type Classification 512.3.1Subtypes 522.3.2Type Qualification 532.3.3Type Conversion 542.4 Attributes of Scalar Types 542.5 Expressions and Predefined OperationsExercises 62357Sequential Statements653.1If Statements 653.1.1Conditional Variable Assignments 683.2 Case Statements 693.2.1Selected Variable Assignments 743.3 Null Statements 753.4 Loop Statements 763.4.1Exit Statements 773.4.2Next Statements 803.4.3While Loops 813.4.4For Loops 833.4.5Summary of Loop Statements 863.5 Assertion and Report Statements 87Exercises 934Composite Data Types and Operations4.14.24.3Arrays 954.1.1Multidimensional Arrays 984.1.2Array Aggregates 994.1.3Array Attributes 103Unconstrained Array Types 1054.2.1Predefined Array Types 106Strings 106Boolean Vectors, Integer Vectors, Real Vectors, and Time VectorsBit Vectors 107Standard-Logic Arrays 108String and Bit-String Literals 1084.2.2Unconstrained Array Element Types 1094.2.3Unconstrained Array Ports 111Array Operations and Referencing 1144.3.1Logical Operators 1144.3.2Shift Operators 1164.3.3Relational Operators 117Maximum and Minimum Operations 1194.3.4The Concatenation Operator 1194.3.5To String Operations 12095106

ixContents4.3.64.3.74.3.84.3.9Array Slices 120Array Type Conversions 122Arrays in Case Statements 124Matching Case Statements 125Matching Selected Variable Assignments 1274.4 Records 1284.4.1Record Aggregates 1314.4.2Unconstrained Record Element Types 131Exercises 1345Basic Modeling Constructs1375.1Entity Declarations and Architecture Bodies 1375.1.1Concurrent Statements 1415.1.2Signal Declarations 1415.2 Behavioral Descriptions 1435.2.1Signal Assignment 143Conditional Signal Assignments 146Selected Signal Assignments 1475.2.2Signal Attributes 1495.2.3Wait Statements 1515.2.4Delta Delays 1555.2.5Transport and Inertial Delay Mechanisms 1585.2.6Process Statements 1645.2.7Concurrent Signal Assignment Statements 166Concurrent Simple Signal Assignments 166Concurrent Conditional Signal Assignment 167Concurrent Selected Signal Assignments 1715.2.8Concurrent Assertion Statements 1735.2.9Entities and Passive Processes 1745.3 Structural Descriptions 1765.4 Design Processing 1865.4.1Analysis 1865.4.2Design Libraries and Contexts 188Context Declarations 1905.4.3Elaboration 1935.4.4Execution 195Exercises 1976Subprograms6.16.26.3Procedures 2076.1.1Return Statement in a Procedure 212Procedure Parameters 2136.2.1Signal Parameters 2176.2.2Default Values 2206.2.3Unconstrained Array Parameters 2216.2.4Summary of Procedure Parameters 224Concurrent Procedure Call Statements 225207

xContents6.4Functions 2276.4.1Functional Modeling 2306.4.2Pure and Impure Functions 2306.4.3The Function now 2326.5 Overloading 2336.5.1Overloading Operator Symbols 2346.6 Visibility of Declarations 236Exercises 2407Packages and Use Clauses2457.1Package Declarations 2457.1.1Subprograms in Package Declarations 2507.1.2Constants in Package Declarations 2507.2 Package Bodies 2527.2.1Local Packages 2557.3 Use Clauses 2577.3.1Visibility of Used Declarations 261Exercises 2648Resolved SignalsBasic Resolved Signals 2678.1.1Composite Resolved Subtypes 2728.1.2Summary of Resolved Subtypes 2788.1.3IEEE std logic 1164 Resolved Subtypes8.2 Resolved Signals, Ports, and Parameters 2808.2.1Resolved Ports 2828.2.2Driving Value Attribute 2858.2.3Resolved Signal Parameters 286Exercises 2872678.19278Predefined and Standard PackagesThe Predefined Packages standard and env 293IEEE Standard Packages 2969.2.1Standard VHDL Mathematical Packages 296Real Number Mathematical Package 296Complex Number Mathematical Package 2999.2.2The std logic 1164 Multivalue Logic System 3019.2.3Standard Integer Numeric Packages 3049.2.4Standard Fixed-Point Packages 3139.2.5Standard Floating-Point Packages 3189.2.6Package Summary 322Operator Overloading Summary 323Conversion Function Summary 326Strength Reduction Function Summary 334Exercises 3359.19.2293

xiContents10Case Study: A Pipelined Multiplier Accumulator10.1 Algorithm Outline 33710.2 A Behavioral Model 34010.2.1 Testing the Behavioral Model 34210.3 A Register-Transfer-Level Model 34610.3.1 Testing the Register-Transfer-Level ModelExercises 35311337350Aliases35511.1 Aliases for Data Objects 35511.2 Aliases for Non-Data Items 360Exercises 36312Generics36512.1 Generic Constants 36512.2 Generic Types 37212.3 Generic Lists in Packages 37612.3.1 Local Packages 38112.3.2 Abstract Data Types Using Packages 38412.4 Generic Lists in Subprograms 38912.5 Generic Subprograms 39412.6 Generic Packages 407Exercises 41413Components and Configurations41713.1 Components 41713.1.1 Component Declarations 41713.1.2 Component Instantiation 41913.1.3 Packaging Components 42013.2 Configuring Component Instances 42213.2.1 Basic Configuration Declarations 42213.2.2 Configuring Multiple Levels of Hierarchy 42513.2.3 Direct Instantiation of Configured Entities 42813.2.4 Generic and Port Maps in Configurations 42913.2.5 Deferred Component Binding 43513.3 Configuration Specifications 43713.3.1 Incremental Binding 438Exercises 44414Generate Statements14.1 Generating Iterative Structures 44914.2 Conditionally Generating Structures 45514.2.1 Recursive Structures 46214.3 Configuration of Generate Statements 465Exercises 473449

xii15ContentsAccess Types47915.1 Access Types 47915.1.1 Access Type Declarations and Allocators 47915.1.2 Assignment and Equality of Access Values 48215.1.3 Access Types for Records and Arrays 48315.2 Linked Data Structures 48615.2.1 Deallocation and Storage Management 49015.3 An Ordered-Dictionary ADT Using Access Types 491Exercises 49516Files and Input/Output49916.1 Files 49916.1.1 File Declarations 49916.1.2 Reading from Files 50116.1.3 Writing to Files 50416.1.4 Files Declared in Subprograms 50716.1.5 Explicit Open and Close Operations 50916.1.6 File Parameters in Subprograms 51216.1.7 Portability of Files 51416.2 The Package Textio 51416.2.1 Textio Read Operations 51816.2.2 Textio Write Operations 52316.2.3 Reading and Writing Other Types 527Standard Package Read and Write OperationsExercises 53017Case Study: A Package for Memories52853517.1 The Memories Package 53517.2 Using the Memories Package 54617.2.1 Common Address and Data Conversions 551Exercises 55818Test Bench and Verification Features55918.1 External Names 55918.2 Force and Release Assignments 57018.3 Embedded PSL in VHDL 575Exercises 58219Shared Variables and Protected Types58519.1 Shared Variables and Mutual Exclusion 58519.2 Uninstantiated Methods in Protected Types 597Exercises 60120Attributes and Groups20.1 Predefined Attributes 60320.1.1 Attributes of Scalar Types603603

xiiiContents20.1.2 Attributes of Array Types and Objects20.1.3 Attributes Giving Types 60520.1.4 Attributes of Signals 60620.1.5 Attributes of Named Items 60720.2 User-Defined Attributes 61620.2.1 Attribute Declarations 61620.2.2 Attribute Specifications 61620.3 Groups 628Exercises 63021604Design for Synthesis21.1 Synthesizable Subsets 63321.2 Use of Data Types 63421.2.1 Scalar Types 63521.2.2 Composite and Other Types 63621.3 Interpretation of Standard Logic Values 63721.4 Modeling Combinational Logic 63821.5 Modeling Sequential Logic 64121.5.1 Modeling Edge-Triggered Logic 64221.5.2 Level-Sensitive Logic and Inferring Storage21.5.3 Modeling State Machines 65221.6 Modeling Memories 65421.7 Synthesis Attributes 65821.8 Metacomments 666Exercises 66722633650Case Study: System Design Using the Gumnut Core22.1 Overview of the Gumnut 66922.1.1 Instruction Set Architecture 66922.1.2 External Interface 674The Gumnut Entity Declaration 676Instruction and Data Memories 67722.2 A Behavioral Model 68122.2.1 The Gumnut Definitions Package 68122.2.2 The Gumnut Behavioral Architecture Body 687Overview of the Interpreter 690Resetting the Interpreter 691Acknowledging an Interrupt 691Fetching an Instruction 692Performing an Arithmetic/Logical Operation 693Performing a Shift Operation 694Performing a Memory-I/O Instruction 695Performing a Branch Instruction 697Performing a Jump Instruction 697Performing a Miscellaneous Instruction 69822.2.3 Verifying the Behavioral Model 69922.3 A Register-Transfer-Level Model 704669

xivContents22.3.1 The Architecture Body 70622.3.2 Verifying the RTL Model 72022.4 A Digital Alarm Clock 72122.4.1 System Design 72222.4.2 Synthesizing and Implementing the Alarm ClockExercises 73123729Miscellaneous Topics73323.1 Guards and Blocks 73323.1.1 Guarded Signals and Disconnection 733The Driving Attribute 737Guarded Ports 738Guarded Signal Parameters 73923.1.2 Blocks and Guarded Signal Assignment 739Explicit Guard Signals 742Disconnection Specifications 74323.1.3 Using Blocks for Structural Modularity 744External Names and Blocks 747Generics and Ports in Blocks 748Configuring Designs with Blocks 74823.2 IP Encryption 75023.2.1 Key Exchange 76923.3 VHDL Procedural Interface (VHPI) 77023.3.1 Direct Binding 77123.3.2 Tabular Registration and Indirect Binding 77323.3.3 Registration of Applications and Libraries 77523.4 Postponed Processes 77623.5 Conversion Functions in Association Lists 77923.6 Linkage Ports 785Exercises 786AStandard PackagesA.1A.2A.3A.4A.5A.6A.7The Predefined Package standard 793The Predefined Package env 797The Predefined Package textio 797Standard VHDL Mathematical Packages 799A.4.1 The math real Package 799A.4.2 The math complex Package 801The std logic 1164 Multivalue Logic System PackageStandard Integer Numeric Packages 806A.6.1 The numeric bit Package 806A.6.2 The numeric std Package 812A.6.3 The numeric bit unsigned Package 813A.6.4 The numeric std unsigned Package 815Standard Fixed-Point Packages 816A.7.1 The fixed float types Package 816A.7.2 The fixed generic pkg Package 816793802

xvContentsA.8BA.7.3 The fixed pkg Package 829Standard Floating-Point Packages 829A.8.1 The float generic pkg PackageA.8.2 The float pkg Package 840VHDL Syntax829841B.1 Design File 843B.2 Library Unit Declarations 843B.3 Declarations and Specifications 845B.4 Type Definitions 848B.5 Concurrent Statements 850B.6 Sequential Statements 852B.7 Interfaces and Associations 855B.8 Expressions and Names 856CAnswers to Exercises859References889Index891

PrefaceVHDL is a language for describing digital electronic systems. It arose out of the UnitedStates government’s Very High Speed Integrated Circuits (VHSIC) program. In the courseof this program, it became clear that there was a need for a standard language for describing the structure and function of integrated circuits (ICs). Hence the VHSIC Hardware Description Language (VHDL) was developed. It was subsequently developed further underthe auspices of the Institute of Electrical and Electronic Engineers (IEEE) and adopted inthe form of the IEEE Standard 1076, Standard VHDL Language Reference Manual, in 1987.This first standard version of the language is often referred to as VHDL-87.Like all IEEE standards, the VHDL standard is subject to review from time to time.Comments and suggestions from users of the 1987 standard were analyzed by the IEEEworking group responsible for VHDL, and in 1992 a revised version of the standard wasproposed. This was eventually adopted in 1993, giving us VHDL-93. A second round ofrevision of the standard was started in 1998. That process was completed in 2001, givingus VHDL-2002. After that, further development took place in the IEEE working group andin a technical committee of an organization, Accellera, whose charter is to promote standards for electronics design. These efforts led to the current version of the language,VHDL-2008, described in this book.VHDL is designed to fill a number of needs in the design process. First, it allows description of the structure of a system, that is, how it is decomposed into subsystems andhow those subsystems are interconnected. Second, it allows the specification of the function of a system using familiar programming language forms. Third, as a result, it allowsthe design of a system to be simulated before being manufactured, so that designers canquickly compare alternatives and test for correctness without the delay and expense ofhardware prototyping. Fourth, it allows the detailed structure of a design to be synthesizedfrom a more abstract specification, allowing designers to concentrate on more strategicdesign decisions and reducing time to market.This book presents a structured guide to the modeling facilities offered by the VHDLlanguage, showing how they can be used for the design of digital systems. The book doesnot purport to teach digital design, since that topic is large enough by itself to warrantseveral textbooks covering its various aspects. Instead, the book assumes that the readerhas at least a basic grasp of digital design concepts, such as might be gained from a firstcourse in digital design in an engineering degree program. Some exposure to computerprogramming and to concepts of computer organization will also be beneficial. This bookis suitable for use in a course in digital or computer design and will also serve practicingengineers who need to acquire VHDL fluency as part of their changing job requirements.One pervasive theme running through the presentation in this book is that modelinga system using a hardware description language is essentially a software design exercise.This implies that good software engineering practice should be applied. Hence the treatment in this book draws directly from experience in software engineering. There are nuxvii

xviiiPrefacemerous hints and techniques from small-scale and large-scale software engineeringpresented throughout the book, with the sincere intention that they might be of use toreaders.I am particularly pleased to be able to include this book in the Morgan Kaufmann Series in Systems on Silicon. Modeling for simulation and synthesis is a vital part of a designmethodology for large-scale systems. VHDL allows models to be expressed at a range oflevels of abstraction, from gate-level up to algorithmic and architectural levels. It will continue to play an important role in the design of silicon-based systems for some time tocome.Structure of the BookThe Designer’s Guide to VHDL is organized so that it can be read linearly from front toback. This path offers a graduated development, with each chapter building on ideas introduced in the preceding chapters. Each chapter introduces a number of related conceptsor language facilities and illustrates each one with examples. Scattered throughout thebook are three case studies, which bring together preceding material in the form of extended worked examples.Chapter 1 introduces the idea of a hardware description language and outlines thereasons for its use and the benefits that ensue. It then proceeds to introduce the basic concepts underlying VHDL, so that they can serve as a basis for examples in subsequent chapters. The next three chapters cover the aspects of VHDL that are most like conventionalprogramming languages. These may be used to describe the behavior of a system in algorithmic terms. Chapter 2 explains the basic type system of the language and introducesthe scalar data types. Chapter 3 describes the sequential control structures, and Chapter 4covers composite data structures used to represent collections of data elements. In Chapter5, the main facilities of VHDL used for modeling hardware are covered in detail. Theseinclude facilities for modeling the basic behavioral elements in a design, the signals thatinterconnect them and the hierarchical structure of the design.The next group of chapters extends this basic set of facilities with language featuresthat make modeling of large systems more tractable. Chapter 6 introduces procedures andfunctions, which can be used to encapsulate behavioral aspects of a design. Chapter 7 introduces the package as a means of collecting together related parts of a design or of creating modules that can be reused in a number of designs. Chapter 8 deals with theimportant topic of resolved signals, and Chapter 9 describes a number of predefined andstandard packages for use in VHDL designs. The combination of facilities described inthese early chapters is sufficient for many modeling tasks, so Chapter 10 brings them together in the first case study, in which a multiplier/accumulator circuit is designed.The third group of chapters covers advanced modeling features in VHDL. Chapter 11covers aliases as a way of managing the large number of names that arise in a large model.Chapter 12 describes generics as a means of parameterizing the behavior and structure ofa design and enhancing the resusability of designs. This leads to a discussion of abstractdata types as a means of managing the complexity associated with large designs. Chapter13 deals with the topics of component instantiation and configuration. These features areimportant in large real-world models, but they can be difficult to understand. Hence thisbook introduces structural modeling through the mechanism of direct instantiation in ear-

xixPrefacelier chapters and leaves the more general case of component instantiation and configuration until this later chapter. In Chapter 14, generated regular structures are covered.The fourth group of chapters covers language facilities generally used for system-levelmodeling. Chapter 15 introduces the notion of access types (or pointers) and uses themto develop linked data structures. The topic of abstract data types is revisited in the contextof container data types. Chapter 16 covers the language facilities for input and output using files, including binary files and text files. Chapter 17 is a case study in which a packagefor designing memories is developed. The package draws upon features described in thethird and fourth groups of chapters.In the fifth group of chapters, we introduce language features for advanced designand verification. Chapter 18 deals with features for test bench support and verification. Itdescribes how specifications written in the IEEE standard Property Specification Language(PSL) can be embedded in VHDL models. Chapter 19 covers protected types and their useas a means of concurrency control. Chapter 20 describes how we can annotate items in adesign with attributes to specify information to be used by design automation tools. Thisleads into Chapter 21, which covers guidelines for writing synthesizable models. Thisgroup of chapters is drawn together in a further case study, Chapter 22, showing development of a synthesizable processor core and its use in a small embedded system, a digitalalarm clock.The final chapter, Chapter 23, is a miscellany of advanced topics not covered in theprevious chapters. It includes a discussion of blocks and guarded signals, which are notas widely used in modern designs as previously. Nonetheless, we describe them here forcompleteness. The chapter also covers use of features for encrypting the source text ofmodels as a means of protecting intellectual property (IP), and use of features of the VHDLProcedureall Interface (VHPI) for incorporating models and applications written in nonVHDL programming languages.Each chapter in the book is followed by a set of exercises designed to help the readerdevelop understanding of the material. Where an exercise relates to a particular topic described in the chapter, the section number is included in square brackets. An approximate“difficulty” rating is also provided, expressed using the following symbols:➊quiz-style exercise, testing basic understanding➋basic modeling exercise—10 minutes to half an hour effort➌advanced modeling exercise—one half to two hours effort➍modeling project—half a day or more effortAnswers for the first category of exercises are provided in Appendix C. The remainingcategories involve developing VHDL models. Readers are encouraged to test correctnessof their models by running them on a VHDL simulator. This is a much more effective learning exercise than comparing paper models with paper solutions.Changes in the Second and Third EditionsThe first edition of this book was published in 1995, just as VHDL-93 was gaining acceptance. The second edition was updated to reflect the changes in VHDL-2002. Many of the

xxPrefacechanges in the language standard corrected ambiguities in the previous standard thatcaused incompatibility between VHDL tools from different vendors. There were alsochanges that enhanced the usability of the language. The text and examples in the secondedition were revised where necessary to reflect the changes in the language. Furthermore,following publication of the first edition, a number of VHDL-related standards were published and gained widespread acceptance. The second edition added descriptions of theIEEE 1076.3 synthesis and IEEE 1076.2 math packages, and was revised to cover the IEEE1076.6 Synthesis Interoperability Standard.The latest revision of the language, VHDL-2008, adds a number of significant new language features, making this edition of The Designer’s Guide to VHDL significantly biggerthan its predecessors. VHDL-2008 also specifies numerous minor new features andchanges to existing features to enhance the usability of the language. This edition integrates descriptions of all of the new and revised features into the text. The differencesbetween the various versions are highlighted in call-outs within the text, headed with“VHDL-2002,” “VHDL-93,” or “VHDL-87,” as appropriate. In addition, some of the materialhas been removed or rearranged. The case study on a package for arithmetic on bit-vectoroperands has been deleted because the standard numeric packages have now becomewidespread. The first case study in this book is a revised version of the MAC case studyin previous editions, and shows how the standard packages can be used. The chapter onblocks and guarded signals has been contracted and moved to a section in the last chapter,since the features are now little used in practice. There is a greater emphasis on synthesisin this edition. What was an appendix on the topic in previous editions has been substantially revised and promoted to full chapter status. The large case study showing development of a 32-bit processor model has been revised to show a smaller synthesizable modelof an 8-bit microcontroller core and its use in an embedded system. This is much morerelevant, both for educational purposes and professional practice. Finally, this edition includes a listing of all of the VHDL standard packages as an appendix for reference.Resources for Help and InformationAlthough this book attempts to be comprehensive in its coverage of VHDL, there will nodoubt be questions that it does not answer. For these, the reader will need to seek otherresources. A valuable source of experience and advice, often overlooked, is one’s colleagues, either at the workplace or in user groups. User groups generally hold regularmeetings that either formally or informally include a time for questions and answers. Manyalso run e-mail lists and on-line discussion groups for problem solving.Accellera is one of a number of organizations that sponsors the EDA Industry WorkingGroups Web server (www.eda.org). The server has links to Web pages and repositories ofseveral VHDL standards groups and user groups.Readers who have access to the Usenet electronic news network will find the newsgroup comp.lang.vhdl a valuable resource. This discussion group is a source of announcements, sample models, questions and answers and useful software. Participants includeVHDL users and people actively involved in the language standard working group and inVHDL tool development. The “frequently asked questions” (FAQ) file for this group is amine of useful pointers to books, products and other information. It is archived atwww.eda.org.

xxiPrefaceOne resource that must be mentioned is IEEE Standard 1076, IEEE Standard VHDLLanguage Reference Manual, sometimes referred to as the “VHDL Bible.” It is the authoritative source of information about VHDL. However, since it is a definitional document,not a tutorial, it is written in a complex legalistic style. This makes it very difficult to useto answer the usual questions that arise when writing VHDL models. It should only beused once you are somewhat familiar with VHDL. It can be ordered from the IEEE atstandards.ieee.org.This book contains numerous examples of VHDL models that may also serve as a resource for resolving questions. The VHDL source code for these examples and the casestudies, as well as other related information, is available on the companion website for thebook at gh I have been careful to avoid errors in the example code, there are no doubtsome that I have missed. I would be pleased to hear about them, so that I can correct themin the on-line code and in future printings of this book. Errata and general comments canbe e-mailed to me at vhdl-book@ashenden.com.au.AcknowledgmentsThe seeds for this book go back to 1990 when I developed a brief set of notes, The VHDLCookbook, for my computer architecture class at the University of Adelaide. At the time,there were few books on VHDL available, so I made my booklet available for on-line access. News of its availability spread quickly around the world, and within days, my e-mailin-box was bursting. At the time of writing this, nearly 20 years later, I still regularly receivemessages about the Cookbook. Many of the respondents urged me to write a full textbookversion. With that encourag

visit our Web site at www.mkp.com or www.books.elsevier.com Printed in the United States. 08 09 10 5 4 3 2 1. To my wife Katrina. vii Contents Preface xvii 1 Fundamental Concepts 1 1.1 Modeling Digital Systems 1 1.2 Domains and Levels of Modeling 3 1.2.1 Modeling Example 3