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