本教材根據(jù)普通高等學校計算機專業(yè)教學大綱精神,以及數(shù)字電路與邏輯設計課程的特點編寫而成,全面系統(tǒng)地闡述了數(shù)字電路與邏輯設計的基本理論、基本概念、基本方法以及現(xiàn)代邏輯設計技術(shù)。全書共分 8 章:數(shù)制與編碼、邏輯代數(shù)基礎、組合邏輯、同步時序邏輯、脈沖產(chǎn)生電路、數(shù)/模與模/數(shù)轉(zhuǎn)換電路、編程邏輯及數(shù)字系統(tǒng)綜合設計。
本教材的編者是長期從事高校數(shù)字邏輯課程教學的骨干教師,并有豐富的數(shù)字系統(tǒng)設計經(jīng)驗與相關項目工程背景。教材中不僅對經(jīng)典邏輯理論作了詳細地論述,同時也考慮到當今數(shù)字電路與邏輯設計的發(fā)展趨勢,介紹了當今先進的邏輯設計方法與技術(shù),如 PLD(可編程邏輯器件)、HDL(硬件描述語言)、SoC(片上系統(tǒng))、EDA(電子設計自動化)技術(shù)等。理論緊密聯(lián)系實踐。
本教材適合作為高等學校計算機及其相關專業(yè)本科教材,也可作為相關專業(yè)高職高專教材和工程科研人員的參考用書。
《數(shù)字邏輯》是普通高等教育十一五*規(guī)劃教材,再版修訂增加了許多圖片與視頻,豐富了教材實踐內(nèi)容;修改EDA及其應用手段,更加符合現(xiàn)代數(shù)字技術(shù)發(fā)展趨勢。
《數(shù)字邏輯》伴隨著讀者厚愛,走過了風風雨雨十年歷程。本次改版(第 3 版)使該書升級為多媒體立體化教材:全書增加了多處小視頻和圖片。讀者只要掃描書中二維碼就可以得到相關概念、芯片、實驗以及實例講解,如同編者親臨。此外,將原 Altera 實踐環(huán)節(jié)改編為 Modelsim 仿真軟件,使得讀者可以通過仿真學習邏輯設計,以適應更多專業(yè)的學生;原 Altera 部分作為附錄,保持了版本的兼容性。數(shù)字邏輯教程的主旨在于訓練學生的邏輯思維能力,掌握運用形式化方法來描述客觀世界,為學習計算機硬件課程打下扎實基礎。本書著眼于培養(yǎng)讀者分析問題和解決問題的能力。對每一個邏輯問題的講述做到條理清晰、深入淺出,盡量避免就事論事,從而達到舉一反三的效果。每章均列舉了相當數(shù)量的例題,以加深基本概念的理解,掌握基本方法的運用。zui終以 MIPS CPU綜合邏輯描述與設計作為總結(jié),期望能對學生能力有質(zhì)的提高,同時為計算機系統(tǒng)設計打下基礎、本教材除了全面詳盡地論述經(jīng)典數(shù)字邏輯外,具有以下四個特色:(1)可編程邏輯技術(shù)。介紹業(yè)界 PLD 領軍企業(yè) Xilinx 和 Altera(Intel 收購)的 CPLD、FPGA硬件芯片,以及 HDL 邏輯設計語言。(2)EDA 仿真。介紹業(yè)界zui流行的仿真軟件 Modelsim 及其仿真應用。(3)CPU 設計實例。闡述學界經(jīng)典 CPU MIPS 基本設計原理及其邏輯仿真。(4)小視頻:生動地講解了相關概念、芯片、實驗以及實例,增加了讀者的感性認識。全書共分 8 章:數(shù)制與編碼、邏輯代數(shù)基礎、組合邏輯、同步時序邏輯、脈沖產(chǎn)生電路、數(shù)/模與模/數(shù)轉(zhuǎn)換電路、編程邏輯和數(shù)字系統(tǒng)綜合設計。全書由朱勇教授主編,并編寫數(shù)制與編碼、編程邏輯及數(shù)字系統(tǒng)綜合部分,高曉清編寫同步時序邏輯、脈沖產(chǎn)生電路和數(shù)/模與模/數(shù)轉(zhuǎn)換電路部分,曾西洋編寫邏輯代數(shù)基礎與組合邏輯部分,王君負責實驗視頻錄制以及文檔管理工作,姜志鵬編寫 Modelsim 仿真軟件使用及其實例仿真。還要感謝吳官東、黃瀟、孫愛珂、楊慧鑫提供 CPU 邏輯仿真以及視頻解說和圖片處理工作。對于教材中的不妥之處,敬請同仁和讀者批評指正。編 者2018 年 10 月于金陵
朱勇,華中科技大學計算機系統(tǒng)結(jié)構(gòu)專業(yè)博士,博導,F(xiàn)在就職于江蘇金陵科技學院,教授。湖北省有突出貢獻的中青年專家,教育部高等學校教學指導委員會委員會專家工作組成員,湖北省高校計算機教育專業(yè)委員會常務理事,湖北省微機學會副主任委員,中國計算機學會高級會員,中國電子學會高級會員。主編教材《數(shù)字邏輯》入選國家十一五規(guī)劃教材,主講課程數(shù)字邏輯為首批校精品課程,2009年省級精品課程數(shù)字邏輯課程負責人。
第 1 章 數(shù)制與編碼 .............................................................................................................. 1
1-1 數(shù)字邏輯概述 ......................................................................................................................1
1-1-1 數(shù)字系統(tǒng) ................................................................................................................1
1-1-2 片上系統(tǒng).................................................................................................................3
1-2 數(shù)制及其轉(zhuǎn)換 ......................................................................................................................5
1-2-1 十進制 ....................................................................................................................5
1-2-2 二進制 ....................................................................................................................6
1-2-3 八進制 ....................................................................................................................6
1-2-4 十六進制.................................................................................................................6
1-2-5 數(shù)制轉(zhuǎn)換.................................................................................................................7
1-3 帶符號二進制數(shù)的代碼表示 .............................................................................................12
1-3-1 機器碼與真值.......................................................................................................12
1-3-2 原碼 ......................................................................................................................12
1-3-3 反碼 ......................................................................................................................13
1-3-4 補碼 ......................................................................................................................14
1-3-5 數(shù)碼運算...............................................................................................................15
1-4 編碼....................................................................................................................................17
1-4-1 BCD 碼..................................................................................................................17
1-4-2 格雷碼 ..................................................................................................................18
1-4-3 奇偶檢驗碼...........................................................................................................20
1-4-4 CRC 碼..................................................................................................................20
1-4-5 ASCII 碼................................................................................................................21
小結(jié) .............................................................................................................................................22
習題 .............................................................................................................................................22
第 2 章 邏輯代數(shù)基礎 ......................................................................................................... 23
2-1 邏輯代數(shù)的基本定理和規(guī)則 .............................................................................................23
2-1-1 邏輯代數(shù)公理.......................................................................................................23
2-1-2 邏輯代數(shù)定理.......................................................................................................23
2-1-3 邏輯代數(shù)規(guī)則.......................................................................................................25
2-2 邏輯函數(shù)的表示方法.........................................................................................................27
2-2-1 邏輯表達式...........................................................................................................27
2-2-2 真值表 ..................................................................................................................27
2-2-3 邏輯圖 ..................................................................................................................28
2-3 邏輯函數(shù)表達形式與變換.................................................................................................28
CONTENTS ???
2
數(shù)字邏輯(第三版)
2-3-1 積之和 ..................................................................................................................29
2-3-2 和之積 ..................................................................................................................29
2-3-3 zui小項標準形式...................................................................................................29
2-3-4 zui大項標準形式...................................................................................................31
2-4 邏輯函數(shù)的化簡 ................................................................................................................34
2-4-1 與或式的化簡.......................................................................................................34
2-4-2 或與式的化簡.......................................................................................................36
2-5 卡諾圖................................................................................................................................37
2-5-1 卡諾圖構(gòu)成...........................................................................................................37
2-5-2 典型卡諾圈...........................................................................................................39
2-5-3 卡諾圖化簡...........................................................................................................42
2-5-4 無關項的卡諾圖表示 ...........................................................................................45
小結(jié) .............................................................................................................................................46
習題 .............................................................................................................................................47
第 3 章 組合邏輯 ............................................................................................................... 49
3-1 門電路................................................................................................................................49
3-1-1 二極管、三極管門電路 .......................................................................................49
3-1-2 TTL 門電路...........................................................................................................52
3-1-3 CMOS 門電路........................................................................................................57
3-2 組合邏輯分析 ....................................................................................................................59
3-2-1 分析步驟...............................................................................................................59
3-2-2 分析實例...............................................................................................................60
3-3 組合邏輯設計 ....................................................................................................................62
3-3-1 設計步驟...............................................................................................................62
3-3-2 問題的描述...........................................................................................................62
3-3-3 設計實例...............................................................................................................65
3-3-4 不完全項設計.......................................................................................................68
3-4 組合邏輯電路的險象.........................................................................................................70
3-4-1 險象的產(chǎn)生...........................................................................................................71
3-4-2 險象的判斷...........................................................................................................71
3-4-3 險象的解決...........................................................................................................72
3-5 常用的中規(guī)模組合邏輯構(gòu)件的使用..................................................................................73
3-5-1 譯碼器 ..................................................................................................................74
3-5-2 編碼器 ..................................................................................................................81
3-5-3 多路選擇器...........................................................................................................83
3-5-4 比較器 ..................................................................................................................88
3-5-5 加法器 ..................................................................................................................89
3-5-6 ALU.......................................................................................................................93
目 錄
3
小結(jié) .............................................................................................................................................98
習題 .............................................................................................................................................99
第 4 章 同步時序邏輯 ....................................................................................................... 102
4-1 時序邏輯結(jié)構(gòu)模型...........................................................................................................102
4-1-1 結(jié)構(gòu)模型.............................................................................................................102
4-1-2 時序電路的分類.................................................................................................104
4-2 觸發(fā)器..............................................................................................................................104
4-2-1 RS 觸發(fā)器...........................................................................................................104
4-2-2 D 觸發(fā)器.............................................................................................................107
4-2-3 JK 觸發(fā)器 ...........................................................................................................109
4-2-4 T 觸發(fā)器 .............................................................................................................113
4-2-5 不同類型時鐘觸發(fā)器間的轉(zhuǎn)換..........................................................................113
4-2-6 集成觸發(fā)器的參數(shù) .............................................................................................118
4-3 同步時序邏輯分析...........................................................................................................119
4-3-1 特性函數(shù).............................................................................................................119
4-3-2 激勵表 ................................................................................................................119
4-3-3 狀態(tài)圖、狀態(tài)表.................................................................................................119
4-3-4 波形圖 ................................................................................................................121
4-3-5 分析實例.............................................................................................................121
4-4 同步時序邏輯設計...........................................................................................................126
4-4-1 原始狀態(tài)圖和狀態(tài)表 .........................................................................................127
4-4-2 狀態(tài)表化簡.........................................................................................................131
4-4-3 狀態(tài)分配.............................................................................................................137
4-4-4 設計實例.............................................................................................................141
4-5 常用的中規(guī)模同步時序邏輯構(gòu)件的使用........................................................................145
4-5-1 寄存器 ................................................................................................................145
4-5-2 計數(shù)器 ................................................................................................................148
小結(jié) ...........................................................................................................................................157
習題 ...........................................................................................................................................157
第 5 章 脈沖產(chǎn)生電路 ....................................................................................................... 161
5-1 多諧振蕩器 ......................................................................................................................161
5-1-1 TTL 環(huán)形振蕩器 .................................................................................................161
5-1-2 MOS 多諧振蕩器 ................................................................................................163
5-2 單穩(wěn)態(tài)觸發(fā)器 ..................................................................................................................164
5-3 施密特觸發(fā)器 ..................................................................................................................166
5-4 555 定時器及其應用........................................................................................................168
5-4-1 555 定時器..........................................................................................................168
5-4-2 單穩(wěn)態(tài)觸發(fā)器.....................................................................................................169
4
數(shù)字邏輯(第三版)
5-4-3 多諧振蕩器.........................................................................................................170
5-4-4 施密特振蕩器.....................................................................................................171
小結(jié) ...........................................................................................................................................172
習題 ...........................................................................................................................................172
第 6 章 數(shù) / 模與模 / 數(shù)轉(zhuǎn)換電路 .......................................................................................... 174
6-1 數(shù)/模轉(zhuǎn)換電路 .................................................................................................................174
6-1-1 權(quán)電阻網(wǎng)絡 DAC ................................................................................................174
6-1-2 倒 T 形電阻網(wǎng)絡 DAC ........................................................................................175
6-1-3 DAC 的主要技術(shù)指標.........................................................................................176
6-1-4 集成 DAC 舉例 ...................................................................................................177
6-1-5 DAC 轉(zhuǎn)換器應用舉例.........................................................................................179
6-2 模/數(shù)轉(zhuǎn)換電路 .................................................................................................................181
6-2-1 逐次比較型 ADC ................................................................................................184
6-2-2 雙積分型 ADC ....................................................................................................187
6-2-3 ADC 的主要技術(shù)指標.........................................................................................189
6-2-4 集成 ADC 舉例 ...................................................................................................189
6-2-5 ADC 應用舉例 ....................................................................................................191
小結(jié) ...........................................................................................................................................193
習題 ...........................................................................................................................................193
第 7 章 編程邏輯 ............................................................................................................. 195
7-1 陣列示意圖 ......................................................................................................................195
7-1-1 ROM....................................................................................................................195
7-1-2 陣列示意圖概述.................................................................................................196
7-2 CPLD ................................................................................................................................198
7-2-1 PLA.....................................................................................................................198
7-2-2 PAL.....................................................................................................................199
7-2-3 GAL.....................................................................................................................200
7-2-4 CPLD 簡介 ..........................................................................................................201
7-2-5 CPLD 編程原理...................................................................................................203
7-3 FPGA................................................................................................................................204
7-3-1 FPGA 編程原理 ..................................................................................................204
7-3-2 Altera FPGA 典型結(jié)構(gòu)........................................................................................205
7-3-3 Xilinx FPGA 典型結(jié)構(gòu)........................................................................................209
7-4 VHDL ...............................................................................................................................212
7-4-1 VHDL 概述 .........................................................................................................212
7-4-2 VHDL 基本結(jié)構(gòu)..................................................................................................213
7-4-3 VHDL 數(shù)據(jù)類型與表達式 ..................................................................................214
7-4-4 VHDL 基本語句..................................................................................................219
目 錄
5
7-4-5 ModelSim 仿真 ....................................................................................................225
7-4-6 組合邏輯設計實例 .............................................................................................231
7-4-7 時序邏輯設計實例 .............................................................................................238
小結(jié) ...........................................................................................................................................245
習題 ...........................................................................................................................................246
第 8 章 數(shù)字系統(tǒng)綜合設計 ................................................................................................ 247
8-1 設計流程..........................................................................................................................247
8-2 七段 LED 顯示.................................................................................................................248
8-2-1 LED 顯示原理.....................................................................................................248
8-2-2 電路設計.............................................................................................................249
8-2-3 VHDL 設計 .........................................................................................................250
8-3 交通燈控制 ......................................................................................................................252
8-3-1 系統(tǒng)需求.............................................................................................................252
8-3-2 狀態(tài)分析.............................................................................................................253
8-3-3 系統(tǒng)設計.............................................................................................................253
8-3-4 模塊 VHDL 描述.................................................................................................253
8-3-5 仿真與運行結(jié)果.................................................................................................258
8-4 ADC 0804 數(shù)據(jù)采集.........................................................................................................258
8-4-1 ADC 0804 時序 ...................................................................................................258
8-4-2 原理圖 ................................................................................................................259
8-4-3 VHDL 設計 .........................................................................................................259
8-5 單周期 CPU 描述 .............................................................................................................261
8-5-1 MIPS 處理器概述 ...............................................................................................261
8-5-2 指令描述.............................................................................................................262
8-5-3 微結(jié)構(gòu) ................................................................................................................263
8-6 單周期 CPU 設計 .............................................................................................................265
8-6-1 指令執(zhí)行步驟.....................................................................................................265
8-6-2 取指令(IF)邏輯設計......................................................................................265
8-6-3 指令譯碼(ID)邏輯設計..................................................................................266
8-6-4 指令執(zhí)行(EXE)邏輯設計 ..............................................................................270
8-6-5 存儲器訪問(MEM)邏輯設計 .........................................................................270
8-6-6 結(jié)果寫回(WB)邏輯設計................................................................................270
8-6-7 系統(tǒng)邏輯設計及仿真 .........................................................................................271
小結(jié) ...........................................................................................................................................273
習題 ...........................................................................................................................................274
附錄 A 邏輯符號對照表 .................................................................................................... 275
附錄 B Quartus II 開發(fā)環(huán)境 .............................................................................................. 278
參考文獻 ............................................................................................................................ 292