图书简介:
Chapter 1 Introduction to Microprocessor Design
1.1 Overview of Microprocessor Design
1.2 Design Abstraction Levels
1.3 Examples of a 2-to-1 Multiplexer
1.3.1 Behavioral Level
1.3.2 Gate Level
1.3.3 Transistor Level
1.4 Introduction to Hardware Description Language
1.5 Synthesis
1.6 Going Forward
1.7 Problems
Chapter 2 Fundamentals of Digital Circuits
2.1 Binary Numbers
2.1.1 Counting in Binary
2.1.2 Converting between Binary and Decimal
2.1.3 Octal and Hexadecimal Notations
2.1.4 Binary Number Arithmetic
2.2 Negative Numbers
2.2.1 Two’s Complement Representation
2.2.2 Sign Extension
2.2.3 Signed Number Arithmetic
2.3 Binary Switch
2.4 Basic Logic Operators and Logic Expressions
2.5 Logic Gates
2.6 Truth Tables
2.7 Boolean Algebra and Boolean Equations
2.7.1 Boolean Algebra
2.7.2 Duality Principle
2.7.3 Boolean Functions and Their Inverses
2.8 Minterms and Maxterms
2.8.1 Minterms
2.8.2 Maxterms
2.9 Canonical, Standard, and Non-Standard Forms
2.10 Digital Circuits
2.11 Designing a Car Security System
2.12 Verilog and VHDL Code for Digital Circuits
2.12.1 Verilog Code for a Boolean Function
2.12.2 VHDL Code for a Boolean Function
2.13 Problems
Chapter 3 Combinational Circuits 65
3.1 Analysis of Combinational Circuits
3.1.1 Using a Truth Table
3.1.2 Using a Boolean Function
3.2 Synthesis of Combinational Circuits
3.2.1 Using Only NAND Gates
3.3 Minimization of Combinational Circuits
3.3.1 Boolean Algebra
3.3.2 Karnaugh Maps
3.3.3 Don’t-Cares
3.3.4 Tabulation Method
3.4 Timing Hazards and Glitches
3.4.1 Using Glitches
3.5 BCD to 7-Segment Decoder
3.6 Verilog and VHDL Code for Combinational Circuits
3.6.1 Structural Verilog Code
3.6.2 Structural VHDL Code
3.6.3 Dataflow Verilog Code
3.6.4 Dataflow VHDL Code
3.6.5 Behavioral Verilog Code
3.6.6 Behavioral VHDL Code
3.7 Problems
Chapter 4 Standard Combinational Components
4.1 Signal Naming Conventions
4.2 Multiplexer
4.3 Adder
4.3.1 Full Adder
4.3.2 Ripple-Carry Adder
4.3.3 Carry-Lookahead Adder
4.4 Subtractor
4.5 Adder-Subtractor Combination
4.6 Arithmetic Logic Unit
4.7 Decoder
4.8 Tri-State Buffer
4.9 Comparator
4.10 Shifter
4.11 Multiplier
4.12 Problems
Chapter 5 Sequential Circuits
5.1 Bistable Element
5.2 SR Latch
5.3 Car Security System—Version 2
5.4 SR Latch with Enable
5.5 D Latch
5.6 D Latch with Enable
5.7 Verilog and VHDL Code for Memory Elements
5.7.1 VHDL Code for a D Latch with Enable
5.7.2 Verilog Code for a D Latch with Enable
5.8 Clock
5.9 D Flip-Flop
5.9.1 Alternative Smaller Circuit
5.10 D Flip-Flop with Enable
5.10.1 Asynchronous Inputs
5.11 Description of a Flip-Flop
5.11.1 Characteristic Table
5.11.2 Characteristic Equation
5.11.3 State Diagram
5.12 Register
5.13 Register File
5.14 Memories
5.14.1 ROM
5.14.2 RAM
5.15 Shift Registers
5.15.1 Serial-to-Parallel Shift Register
5.15.2 Serial-to-Parallel and Parallel-to-Serial Shift Register
5.15.3 Linear Feedback Shift Register
5.16 Counters
5.16.1 Binary Up Counter
5.16.2 Binary Up Counter with Parallel Load
5.17 Timing Issues
5.18 Problems
Chapter 6 Finite-State Machines
6.1 Finite-State Machine Models
6.2 State Diagrams
6.3 Analysis of Finite-State Machines
6.3.1 Next-State Equations
6.3.2 Next-State Table
6.3.3 Output Equations
6.3.4 Output Table
6.3.5 State Diagram
6.3.6 Example
6.4 Synthesis of Finite-State Machines
6.4.1 State Diagram
6.4.2 Next-State Table
6.4.3 Next-State Equations
6.4.4 Output Table and Output Equations
6.4.5 FSM Circuit
6.5 Optimizations for FSMs
6.5.1 State Reduction
6.5.2 State Encoding
6.5.3 Unused States
6.6 FSM Construction Examples
6.6.1 Car Security System—Version 3
6.6.2 Modulo-6 Up-Counter
6.6.3 One-Shot Circuit
6.6.4 Simple Microprocessor Control Unit
6.6.5 Elevator Controller Using a Moore FSM
6.6.6 Elevator Controller Using a Mealy FSM
6.7 Verilog and VHDL Code for FSM Circuits
6.7.1 Behavioral Verilog Code for a Moore FSM
6.7.2 Behavioral Verilog Code for a Mealy FSM
6.7.3 Behavioral VHDL Code for a Moore FSM
6.7.4 Behavioral VHDL Code for a Mealy FSM
6.8 Problems
Chapter 7 Dedicated Microprocessors
7.1 Need for a Datapath
7.2 Constructing the Datapath
7.2.1 Selecting Registers
7.2.2 Selecting Functional Units
7.2.3 Data Transfer Methods
7.2.4 Generating Status Signals
7.3 Constructing the Control Unit
7.3.1 Deriving the Control Signals
7.3.2 Deriving the State Diagram
7.3.3 Timing Issues
7.3.4 Deriving the FSM Circuit
7.4 Constructing the Complete Microprocessor
7.5 Dedicated Microprocessor Construction Examples
7.5.1 Greatest Common Divisor
7.5.2 High-Low Number Guessing Game
7.5.3 Traffic Light Controller
7.6 Verilog and VHDL Code for Dedicated Microprocessors
7.6.1 FSM1D Model
7.6.2 FSMD Model
7.6.3 Algorithmic Model
7.7 Problems
Chapter 8 General-Purpose Microprocessors
8.1 Overview of the CPU Design
8.2 The EC-1 General-Purpose Microprocessor
8.2.1 Instruction Set
8.2.2 Datapath
8.2.3 Control Unit
8.2.4 Complete Circuit
8.2.5 Sample Program
8.2.6 Simulation
8.2.7 Hardware Implementation
8.3 The EC-2 General-Purpose Microprocessor
8.3.1 Instruction Set
8.3.2 Datapath
8.3.3 Control Unit
8.3.4 Complete Circuit
8.3.5 Sample Program
8.3.6 Hardware Implementation
8.4 Extending the EC-2 Instruction Set
Chapter 9 Interfacing Microprocessors
9.1 Multiplexing 7-Segment LED Display
9.1.1 Theory of Operation
9.1.2 Controller Design
9.2 Issues with Interfacing Switches
9.3 3×4 Keypad Controller
9.3.1 Theory of Operation
9.3.2 Controller Design
展开
阎波 辽宁鞍山人,1973年生,民盟成员。现为电子科技大学教授,电子科技大学核心课程(“微处理器系统结构与嵌入式系统设计”)首席教授,四川省电子学会嵌入式与SoC专委会秘书长。目前主要研究方向为通信ASIC设计、嵌入式微系统设计、人工智能与物联网定位、信号分析与信息处理等。发表SCI、EI收录论文20余篇,主编“十二五”普通高等教育本科国家级规划教材1本,出版教材和专著10余部。
朱晓章 河北保定人,1984年生。现为电子科技大学副教授,“成都人才计划”特聘专家,电子科技大学2016年度人物。目前主要研究方向为高精度空间定位、复杂电磁环境中的信号与信息处理等。发表SCI、EI收录论文20余篇(其中JCR-2区两篇),申请国家发明专利20余项,孵化“学科性公司”四川中电昆辰科技有限公司。
姚毅 四川成都人,1983年生。现为电子科技大学讲师,欧洲鲁汶大学(KUL)访问学者。目前主要研究方向为通信信号处理、信息隐藏技术、超大规模集成电路设计等。承担或参与多项国家级、省部级科研项目,发表SCI 、EI收录论文10余篇,参与编写教材和著作3部。
Preface
This book is about the digital logic design of microprocessors, and is intended to provide both an understanding of the basic principles of digital logic design, and how these fundamental principles are applied in the building of complex microprocessor circuits using current technologies. Although the basic principles of digital logic design
have not changed, the design process and the implementation of the circuits have. With the advances in fully integrated modern hardware computer-aided design (CAD) tools for logic synthesis, simulation, and the implementation of digital circuits in field-programmable gate arrays (FPGAs), it is now possible to design and implement complex digital circuits very easily and quickly.
Many excellent books on digital logic design have followed the traditional approach of introducing the basic principles and theories of digital logic design and the building of separate standard combinational and sequential components. However, students are left to wonder about the purpose of these individual components and how they are used in the building of more complex digital circuits, such as microcontrollers and microprocessors that are used in controlling real-world electronic devices. The primary goal of this book is to fill in this gap by going beyond the logic principles and the building of basic standard components. The book discusses in detail how the basic components are combined together to form datapaths, how control units are designed, and how these two main components (datapath and control unit) are connected together to produce actual dedicated custom microprocessors and general-purpose microprocessors. The book ends with an entire chapter containing many examples on how microprocessors are interfaced with real-world devices.
Many texts on digital logic design and implementation techniques mainly focus on the logic gate level. At this low level, it is difficult to discuss larger and more complex circuits that are beyond the standard combinational and sequential circuits. However, with the introduction of the register-transfer technique for designing datapaths and the concept of a finite-state machine for control units, we can easily design a dedicated microprocessor for any arbitrary algorithm and then implement it on a FPGA chip to execute that algorithm. The book uses an easy-to-understand ground-up approach with complete circuit diagrams, and both Verilog and VHDL codes, starting with the building of basic digital components. These components are then used in the building of more complex components, and finally the building of the complete dedicated microprocessor circuit. The construction of a general-purpose microprocessor then comes naturally as a generalization of a dedicated microprocessor. At the end, students will have a complete understanding of how to design, construct, and implement fully working custom microprocessors.
Design of Circuits using Verilog and VHDL
Although this book provides coverage on both Verilog and VHDL for all of the circuits, this information can be omitted entirely while gaining an understanding of digital circuits and their design. For an introductory course in digital logic design, learning the basic principles is more important than learning how to use a hardware description language (HDL). In fact, instructors may find that students can get lost in learning the principles while trying to learn the language at the same time. With this in mind, the Verilog and VHDL code in the text is totally independent of the presentation of each topic and may be skipped without any loss of continuity.
On the other hand, by studying the HDL codes, the student can not only learn the use of a hardware description language but also learn how digital circuits can be designed automatically using a synthesizer. This book provides an introduction to both Verilog and VHDL and uses the “learn-by-examples” approach. In writing either Verilog or VHDL code at the dataflow and behavioral levels, the student will see the power and usefulness of a state-of-the-art hardware CAD synthesis tool.
New to This Edition ①
In this newly revised second edition, a new chapter on interfacing microprocessors with external devices has been added. Just knowing how to design and implement a microprocessor is not sufficient. The main purpose and usage of a microprocessor is to control external devices. This entire chapter contains many real-world examples on interfacing microprocessors with external devices. Students can use these examples to help them in doing their final projects.
Throughout the book, many new examples have been added and old examples updated. This new edition also covers the usage of both Verilog and VHDL, the two industry standard hardware description languages for describing digital circuits. All circuit examples, in addition to having schematic diagrams, also include codes written in both VHDL and Verilog.
Using either the Altera or the Xilinx FPGA development software and their respective FPGA hardware development boards, students can actually implement these microprocessor circuits and see them execute, both in software simulation and in hardware. The book contains many interesting examples with complete schematic diagrams and Verilog and VHDL codes for implementing them in hardware. With the hands-on exercises, students will learn not only the principles of digital logic design but, also in practice, how circuits are implemented using current technologies.
To actually see your own microprocessor come to life in real hardware and being able to control real-world external devices is an exciting experience. Hopefully, this will help students to not only remember what they have learned but will also get them interested in the world of microprocessor controllers and digital circuit design.
① 打开http://www.cengageasia.com/Browse/2017/1/1/9781305859456,并点击Student Companion Site链接,可打开用于学生免费下载文件的页面。登录华信教育资源网(www.hxedu.com.cn)也可注册下载部分代码和文档。——编者注
Using This Book
This book can be used in either an introductory or a more advanced course in digital logic design. For an introductory course with no previous background in digital logic, Chapters 1 and 2 are intended to provide the fundamental basic concepts in digital logic design, while Chapters 3 and 4 cover the design of combinational circuits and standard combinational components. Chapter 5 on the design of sequential circuits can be introduced and lightly covered.
An advanced digital logic design course will start with sequential circuits in Chapter
5, and the design of finite-state machines in Chapter 6. Chapters 7 and 8 cover the design of datapaths and control units, and the building of dedicated and general-purpose
microprocessors. Finally, Chapter 9 concludes with the interfacing of microprocessors with the external world.
It is strongly recommended that a lab component be fully integrated with the lecture. With an integrated lab, students can have a hands-on learning experience alongside the theoretical concepts that they have learned in class. In fact, many teachers find that too often not enough hours are given to the lab. As we probably know, it is often easier to understand the theory, but to actually implement a circuit and to get it to work requires much more detail and time. Ready-to-use labs that complement the lecture are available for download from the teachers’ resource website at https://login.cengage.com.
Chapter 1—Introduction to Microprocessor Design gives an overview of the various components of a microprocessor circuit and the different abstraction levels in which digital circuits can be designed.
Chapter 2—Fundamentals of Digital Circuits provides the basic principles and theories for designing digital logic circuits by introducing binary numbers, the use of truth tables, Boolean algebra, and how the theories get translated into logic gates and circuit diagrams. Also a brief introduction to Verilog and VHDL is given.
Chapter 3—Combinational Circuits shows how combinational circuits are analyzed, synthesized, and optimized.
Chapter 4—Standard Combinational Components discusses the standard combinational components that are used as building blocks for larger digital circuits. These components include the adder, subtractor, arithmetic logic unit, decoder, multiplexer, tri-state buffer, comparator, shifter, and multiplier. In a hierarchical design, these components
will be used in the building of the datapath used in the microprocessor.
Chapter 5—Sequential Circuits introduces latches and flip-flops as basic storage elements and then continues with larger storage components such as registers, register files, and memories. Special sequential components such as shift registers and counters are also covered.
Chapter 6—Finite-State Machines shows how finite-state machines are analyzed, synthesized, and optimized.
Chapter 7—Dedicated Microprocessors first introduces the need for a datapath, and then explains how a control unit, in the form of a finite-state machine, is used to control the datapath. The chapter expands further showing how dedicated microprocessors are constructed by connecting the datapath and the control unit together as one coherent circuit.
Chapter 8—General-Purpose Microprocessors continues on from Chapter 7 to suggest that a general-purpose microprocessor is really a dedicated microprocessor that is dedicated to only read, decode, and execute instructions. The chapter discusses the complete design and construction of two simple general-purpose microprocessors with their own custom instruction set, and how programs written in machine language are executed on them. The highlight of this chapter and this book is that these two fully-working general-purpose microprocessors can be implemented in hardware and have programs executed by them.
Chapter 9—Interfacing Microprocessors provides several complete examples on how to interface microprocessors with real-world external devices.
Acknowledgments
I want to thank Professor Zhiguo Shi, Ph.D., and many of his graduate students from Zhejiang University, Hangzhou, China, for translating this book into Chinese. In the process, we have become lasting friends.
I also want to thank the following reviewers for their constructive feedback:
Christopher Doss, North Carolina A&T State University
Eric Durant, Milwaukee School of Engineering
Rajiv J. Kapadia, Minnesota State University, Mankato
Emma Regentova, University of Nevada, Las Vegas
Darrin Rothe, Milwaukee School of Engineering
I wish to acknowledge and thank the Global Engineering team at Cengage Learning for their dedication to this new book:
Timothy Anderson, Product Director; Ashley Kaupert, Associate Media Content Developer; Kim Kusnerak, Senior Content Project Manager; Kristin Stine, Marketing Manager; Elizabeth Brown, Learning Solutions Specialist; and Alexander Sham, Product Assistant. They have skillfully guided every aspect of this text’s development and production to successful completion.
I also want to thank the College of Information Science and Electronic Engineering at Zhejiang University for inviting me as a visiting professor to teach their Digital Systems Design course (in English) using the contents of this book. During this time, I was able to gather many valuable ideas and feedbacks from the bright and enthusiastic students on how to make the book better. As a result, numerous changes have been made. This book truly is field-tested.
I also want to thank my school, La Sierra University in sunny California, for giving me the time off to be at Zhejiang University and to work on this book. It would have been extremely difficult without this extra time.
Finally, I want to thank my wife, Windy, for her support and giving me the time to focus and to finish this book.
Enoch O. Hwang, Ph.D.
Riverside, California
展开