《姜书艳数字逻辑设计及应用4[共64页]》由会员分享,可在线阅读,更多相关《姜书艳数字逻辑设计及应用4[共64页](64页珍藏版)》请在金锄头文库上搜索。
1、Digital Logic Design and Application ( (数字逻辑设计及应用数字逻辑设计及应用) )Review of Chapter 2 ( (第二章内容回顾第二章内容回顾) )General Positional-Number-System Conversion (常用按位计数制的转换常用按位计数制的转换)Addition and Subtraction of Non-decimal Numbers (非十进制的加法和减法非十进制的加法和减法)1 1Review of Chapter 2 ( (第二章内容回顾第二章内容回顾) )Representation of Ne
2、gative Numbers (负数的表示负数的表示)Signed-Magnitude 符号数值(原码)符号数值(原码)Complement Number Systems (补码数制补码数制) Radix Complement (基数补码基数补码) Diminished Radix Complement 基数减基数减1补码(基数反码)补码(基数反码)Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)2 2Review of Chapter 2 ( (第二章内容回顾第二章内容回顾) )Binary Signed-Magnitude,
3、 Ones Complement, and Twos Complement Representation (二进制的二进制的原码、反码、补码原码、反码、补码表示表示) 直接由补码直接由补码(反码反码)求二进制数值的大小:最高求二进制数值的大小:最高位位权为位位权为 -2n-1 (-2n-1 -1) (1011)2补补=( )10Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)3 3Review of Chapter 2 ( (第二章内容回顾第二章内容回顾) )Twos Complement Addition and Subtra
4、ction (二进制补码的加法和减法二进制补码的加法和减法)Overflow(溢出(溢出)如果加法运算产生的和超出了数制表示的范围,则结果如果加法运算产生的和超出了数制表示的范围,则结果发生了溢出(发生了溢出(OverflowOverflow)。)。如何判断溢出?如何判断溢出? MSB C in 与与 C out 不同不同Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)4 4Review of Chapter 2 ( (第二章内容回顾第二章内容回顾) )How to represent a 1-bit Decimal numbe
5、r with a 4-bit Binary code (如何用如何用 4位二进制码位二进制码 表示表示 1位十进制码位十进制码)? Binary Coded Decimal (BCD码码)(0.301)10=( )8421BCDDigital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)5 5Review of Chapter 2 ( (第二章内容回顾第二章内容回顾) )Addition of BCD Digits (BCD数的加法数的加法)思考:思考: 两个两个BCD码码 与两个与两个4位位二进制数二进制数 相加的区别相加的区别? Dig
6、ital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)6 6Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)7 7Review of Chapter 2 ( (第二章内容回顾第二章内容回顾) )Addition of BCD Digits (BCD数的加法数的加法)思考:思考:何时需要进行修正?何时需要进行修正? 如果如果(X+Y)产生进位信号产生进位信号C 或或 在在 10101111 之间之间如何修正?如何修正? 结果加结果加6Digital Logic Design a
7、nd Application (数字逻辑设计及应用数字逻辑设计及应用)8 8Review of Chapter 2 ( (第二章内容回顾第二章内容回顾) )Gray code(格雷码(格雷码)任意相邻码字间只有一位数位变化任意相邻码字间只有一位数位变化最高位的最高位的0和和1只改变一次只改变一次最大数回到最大数回到0也只有一位码元不同也只有一位码元不同Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)9 92.11 Gray code(格雷码(格雷码)Digital Logic Design and Application (数字
8、逻辑设计及应用数字逻辑设计及应用)构造方法构造方法Reflected Code(反射码(反射码)直接构造直接构造 The bits of an n-bit binary cord word are numbered from right to left, from 0 to n-1. 对对 n 位二进制的码字从右到左编号(位二进制的码字从右到左编号(0 n-1) Bit i of a Gray-code code word is 0 if bits i and i+1 of the corresponding binary code word are the same, else bit i
9、is 1. (若二进制码字的第若二进制码字的第 i 位和第位和第 i + 1 位相同,则对应位相同,则对应的葛莱码码字的第的葛莱码码字的第 i 位为位为0,否则为,否则为1。)1010Review of Chapter 2 ( (第二章内容回顾第二章内容回顾) )Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)From binary number to Gray code The width is same, the MSB is same; From left to right, if a bit in binary numb
10、er is same as its left bit, the gray code is 0, if it is different, the gray code is 1. Examples: binary number: 1001 0010 0110 0011 Gray code: 1101 1011 0101 00101111Review of Chapter 2 ( (第二章内容回顾第二章内容回顾) )构造方法构造方法异或(异或(XOR)运算:相异为运算:相异为1,相同为,相同为0Gn = Bn Bn = GnGn-1 = Bn Bn-1 Bn-1 = Gn Gn-1 G0 = B1
11、B0 B0 = GnGn-1 G0 Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)1212Chapter 3 Digital Circuits ( (数字电路数字电路) )Give a knowledge of the Electrical aspects of Digital Circuits (介绍数字电路中的电气知识介绍数字电路中的电气知识)Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)1313Consider some Questions(思考几个问题
12、)(思考几个问题)在模拟的世界中如何表征数字系统?在模拟的世界中如何表征数字系统?如何将物理上的实际值如何将物理上的实际值 映射为逻辑上的映射为逻辑上的 0 和和 1 ?什么时候考虑器件的逻辑功能;什么时候考虑器件的逻辑功能; 什么时候考虑器件的模拟特性?什么时候考虑器件的模拟特性?Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)1414Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)3.1 Logic Signals and Gates( (逻辑信号和门电路逻辑
13、信号和门电路) )How to get the HIGH and LOW Voltage (如何获得高、低电平如何获得高、低电平)?HIGH to 0 or 1 (高电平对应高电平对应 0 还是还是 1)?VOUTVINVccR获得高、低电平的基本原理获得高、低电平的基本原理PositivePositive( (正逻辑正逻辑) )10NegativeNegative( (负逻辑负逻辑) )10151516SwitchesSwitchesElectronic switches are the basis of binary digital circuitsA switch has three p
14、artsSource input, and outputCurrent tries to flow from source input to outputControl inputVoltage controls whether that current can flow “off”“on”outputsourceinputoutputsourceinputcontrolinputcontrolinput161617SwitchesSwitchesThe amazing(令人惊令人惊奇的)奇的) shrinking(逐(逐渐减小的)渐减小的) switch1930s: Relays1940s:
15、 Vacuum tubes1950s: Discrete transistor1960s: Integrated circuits (ICs)Initially just a few transistors on ICThen tens, hundreds, thousands. relayvacuum tubediscrete transistorICquarter(to see the relative size)171718The CMOS TransistorThe CMOS TransistorCMOS transistorBasic switch in modern ICsSili
16、con - not quite a conductor or insulator:Semiconductor2.3gatesourcedrainoxideA positive voltage here.(a)IC package IC.attracts electrons here, turning the channel betweenthe source and drain intoa conductor181819The CMOS TransistorThe CMOS TransistorCMOS transistorBasic switch in modern ICsdoes notc
17、onduct0conducts1gatenMOSdoes notconduct1gatepMOSconducts02.3191920Moores LawMoores LawIC capacity(容量,集成(容量,集成度)度) doubling about every 18 months for several decadesKnown as “Moores Law” after Gordon Moore, co-founder of IntelPredicted(预言)(预言) in 1965 predicted that components per IC would double rou
18、ghly(粗略地,(粗略地,大致上)大致上) every year or so2020Moores LawMoores LawFor a particular(特定(特定的)的) number of transistors, the IC area shrinks by half every 18 monthslConsider how much shrinking occurs in just 10 years (try drawing it)lEnables incredibly(不(不能相信的,难以置信的)能相信的,难以置信的) powerful computation in incre
19、dibly tiny devices2121Moores LawMoores LawTodays ICs hold billions of transistorsThe first Pentium processor (early 1990s) needed only 3 millionAn Intel Pentium processor IChaving millions of transistors22223.1 Logic Signals and Gates( (逻辑信号和门电路逻辑信号和门电路) )Digital Logic Design and Application (数字逻辑设计
20、及应用数字逻辑设计及应用)从物理的角度从物理的角度考虑电路如何工作,工作中的电气特性考虑电路如何工作,工作中的电气特性实际物理器件不可避免的时间延迟问题实际物理器件不可避免的时间延迟问题从逻辑角度从逻辑角度输入、输出的逻辑关系输入、输出的逻辑关系 三种基本逻辑:与、或、非三种基本逻辑:与、或、非232324Boolean Logic GatesBoolean Logic GatesBuilding Blocks for Digital Circuits Building Blocks for Digital Circuits (Because Switches are Hard to Work
21、 With)(Because Switches are Hard to Work With)“Logic gates” are better digital circuit building blocks than switches (transistors)Why?.2.4Abstraction(提取)(提取) reduces complexity!242425Boolean Algebra and its Relation Boolean Algebra and its Relation to Digital Circuitsto Digital CircuitsTo understand
22、 the benefits of “logic gates” vs. switches, we should first understand Boolean algebra“Traditional” algebraVariables represent real numbers (x, y)Operators(运算器)(运算器) operate on variables, return real numbers (2.5*x + y - 3)a252526Boolean Algebra and its Relation Boolean Algebra and its Relation to
23、Digital Circuitsto Digital CircuitsBoolean AlgebraVariables represent 0 or 1 onlyOperators return 0 or 1 onlyBasic operatorsAND: a AND b returns 1 only when both a=1 and b=1OR: a OR b returns 1 if either (or both) a=1 or b=1NOT: NOT a returns the opposite of a (1 if a=0, 0 if a=1)a26261、Basic Logic
24、Function: AND(基本逻辑运算:与(基本逻辑运算:与)0 0 00 1 01 0 01 1 1ABZLogic Expression (逻辑表达式逻辑表达式)Z = A BSwitch:1-on,0-off (开关:开关:1通通,0断断)Lamp: 1-Light,0-out (灯灯:1亮亮,0不亮不亮)Produce a 1 output if and only if its inputs are all 1 (当且仅当所有当且仅当所有输入全为输入全为1时,输出为时,输出为1)Truth Table (真真值表值表)&ABZABZ(逻辑符号)(逻辑符号)A B ZLogic Cir
25、cuitDigital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)27272、Basic Logic Function: OR(基本逻辑运算:或)(基本逻辑运算:或)Logic Expression (逻辑表达式逻辑表达式):Z = A + BA B Z真值表真值表ABZProduce a 1 output if any input is 1 (只要有任何一个输入为只要有任何一个输入为1,输出就为,输出就为1)1ABZABZ逻辑符号逻辑符号0 0 00 1 11 0 11 1 1Truth TableLogic CircuitDigita
26、l Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)2828A Z0 11 0真值表真值表Logic Expression (逻辑表达式逻辑表达式):Y = A = A AZRProduce an output value that is the opposite of its input value. (产生一个与输产生一个与输入相反的输出入相反的输出)Usually called an Inverter (通常称为(通常称为反相器反相器)1ZAAZ(逻辑符号逻辑符号)Digital Logic Design and Application
27、(数字逻辑设计及应用数字逻辑设计及应用)3、Basic Logic Function: NOT(基本逻辑运算:非)(基本逻辑运算:非)Truth TableLogic Circuit29294、NAND and NOR Gates ( (与非与非 和和 或非或非) )NAND (与非与非) Logic Expression (逻辑表达式逻辑表达式): Z = ( A B ) Logic Circuit ( 逻辑符号逻辑符号):NOR (或非或非) Logic Expression (逻辑表达式逻辑表达式): Z = ( A + B ) Logic Circuit (逻辑符号逻辑符号):&1Di
28、gital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)3030Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)Truth Table (真值表真值表)&1Logical Operation( (逻辑运算逻辑运算) ) NAND (NAND (与非与非) ) NOR (NOR (或非或非) ) Logic Circuit( (逻辑符号逻辑符号) ) Logic Expression( (逻辑表达式逻辑表达式) ) Y=(AB) Y=(A+B)A B 0 0 1 1 1 Y 1
29、 1 1 0 Y 1 0 0 0 100313132Boolean Algebra and its Relation Boolean Algebra and its Relation to Digital Circuitsto Digital CircuitsDeveloped mid-1800s by George Boole to formalize(使成正式)(使成正式) human thoughtEx: “Ill go to lunch if Mary goes OR John goes, AND Sally does not go.”Let F represent my going
30、to lunch (1 means I go, 0 I dont go)Likewise(类似地)(类似地), m for Mary going, j for John, and s for SallyThen F = (m OR j) AND NOT(s)323233Converting to Boolean EquationsConverting to Boolean EquationsQ1. A fire sprinkler(洒水器)(洒水器) system should spray(喷)(喷) water if high heat is sensed and the system is
31、 set to enabled.Answer: Let Boolean variable h represent “high heat is sensed,” e represent “enabled,” and F represent “spraying water.” Then an equation is: F = h AND e.a333334Converting to Boolean EquationsConverting to Boolean EquationsQ2. A car alarm should sound if the alarm is enabled, and eit
32、her the car is shaken or the door is opened. Answer: Let a represent “alarm is enabled,” s represent “car is shaken,” d represent “door is opened,” and F represent “alarm sounds.” Then an equation is: F = a AND (s OR d).a3434Relating Boolean Algebra to Digital Relating Boolean Algebra to Digital Des
33、ignDesignBooleanalgebra(mid-1800s)Booles intent: formalizehuman thoughtSwitches(1930s)Shannon (1938)Digital designShowed applicationof Boolean algebrato design of switch-based circuitsFor telephoneswitching and otherelectronic uses3535Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)3.2 Logi
34、c Families(逻辑系列(逻辑系列)同一系列的芯片具有类似的输入、输出同一系列的芯片具有类似的输入、输出及内部电路特征,但逻辑功能不同。及内部电路特征,但逻辑功能不同。不同系列的芯片可能不匹配不同系列的芯片可能不匹配 CMOS系列系列 TTL逻辑系列逻辑系列3636Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)3.3 CMOS Logic (CMOS 逻辑逻辑) ) CMOS Logic levels (COMS 逻辑电平逻辑电平)5.0V3.5V1.5V0.0VA Typical Logic Circuit: 5-Vo
35、lt Power Supply (典型的典型的5V电源电压电源电压)Other Power-Supply Voltages: 3.3 ,2.5 or 1.8Volts(其它电源电压:其它电源电压:3.3V ,2.5V或或1.8V)Logic 1 (High)逻辑逻辑1(高态)(高态)Logic 0 (Low)逻辑逻辑0(低态)(低态)3737Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)2、MOS Transistors (MOS晶体管晶体管) )Two Types: N-Channel and P-Channel (分为:分
36、为:N沟道沟道 和和 P沟道沟道)Drain (漏极漏极)Source (源极源极)Gate(栅极栅极 )Vgs+N-Channel (N沟道沟道)Source (源极源极)Drain(漏极漏极)Gate(栅极栅极) +VgsP-Channel (P沟道沟道)3838Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)2、MOS Transistors (MOS晶体管晶体管) )Two Types: N-Channel and P-Channel (分为:分为:N沟道沟道 和和 P沟道沟道)Source (源极源极)Drain (漏
37、极漏极)Gate(栅极栅极) +VgsP-Channel (P沟道沟道)Usually (通常通常): Vgs 兆欧)兆欧)Regardless of gate voltage (无论栅电压如何无论栅电压如何) Almost no current flows from the gate to source, or from the gate to drain. ( 栅源、栅漏之间几乎没有电流栅源、栅漏之间几乎没有电流) ( Leakage(漏出)(漏出) Current, Less than microampere (漏漏电流电流, A, 10-6A )The Gate is Capaciti
38、vely(容性地)(容性地) coupled to the source and drain ( 栅极与源和漏极之间有容性耦合栅极与源和漏极之间有容性耦合) The power need to charge and discharge this capacitance(电容)(电容) on each input signal transition accounts for a nontrivial(非平凡的)(非平凡的) portion of a circuits power consumption (信号转换时,电容充放电,功耗较大信号转换时,电容充放电,功耗较大).4040Digital
39、Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)MOS管的基本开关电路管的基本开关电路vI+vO+iD+ VDDRDDGS只要电路参数选择合理只要电路参数选择合理输入低,截止,输出高输入低,截止,输出高输入高,导通,输出低输入高,导通,输出低4141Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)3、Basic CMOS Inverter Circuit( ( 基本的基本的CMOSCMOS反相器反相器) )Functional Behavior (工作原理工作原理)1、VIN =
40、 0.0VVGSN = 0.0V, Tn Off (截止截止)VGSP = VIN VDD = 5.0V, Tp On (导通导通)VOUT VDD = 5.0VVDD = +5.0VVOUTVINTpTn42423、Basic CMOS Inverter Circuit( ( 基本的基本的CMOSCMOS反相器反相器) )2、VIN = VDD = 5.0VVGSN = 5.0V Tn On (导通导通)VGSP = VIN VDD = 0.0V Tp Off (截止截止)VOUT 0VDD = +5.0VVOUTVINTpTnDigital Logic Design and Applica
41、tion (数字逻辑设计及应用数字逻辑设计及应用)434344NOT gateNOT gatex01F1010F1x0(a)10F0x1(b)When the input is 0When the input is 10110timeFx4444Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)4、CMOS NAND (CMOS与非门与非门) ) Functional Behavior (工作原理工作原理):1、Either Input Low, (A、B至少有一个为低至少有一个为低), Then Either T1, T3 Of
42、f( T1、T3至少有一个截止至少有一个截止) Either T2, T4 On( T2、T4至少有一个导通至少有一个导通)Z is High Z为高为高 VDD)VDD = +5.0VZABT1T2T4T345454、CMOS NAND Gate (CMOS与非门与非门) )2、Both Inputs High (A、B都为高都为高), Then Both T1, T3 On (T1、T3都导通都导通) Both T2, T4 Off (T2,T4都截止都截止) Z is Low Z为低(为低( 0V)VDD = +5.0VZABT1T2T4T3Digital Logic Design an
43、d Application (数字逻辑设计及应用数字逻辑设计及应用)46465、CMOS NOR Gate (CMOS或非门或非门) )Functional Behavior (工作原理工作原理): 1、 Both Inputs Low (A、B都为低都为低), Then Both T1、T3 Off ( T1、T3都截止都截止) Both T2, T4 On ( T2,T4都导通都导通 ) Z is High Z为高(为高( VDD)VDD = +5.0VZABT1T2T4T3Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)4
44、7475、CMOS NOR Gate (CMOS或非门或非门) )Functional Behavior (工作原理工作原理): 2、 Either Input High (A、B至少有一个为高至少有一个为高) Then Either T1、T3 On (T1、T3至少有一个导通至少有一个导通)Either T2, T4 Off (T2、T4至少有一个截止至少有一个截止) Z is Low Z为低(为低( 0V)VDD = +5.0VZABT1T2T4T3Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)484849Buildin
45、g Circuits Using GatesBuilding Circuits Using GatesRecall(回想)(回想) the motion-in-dark exampleTurn on lamp (F=1) when motion sensed (a=1) and no light (b=0)F = a AND NOT(b)494950Building Circuits Using GatesBuilding Circuits Using GatesBuild using logic gates, AND and NOT, as shownWe just built our fi
46、rst digital circuit!505051Example: Seat Belt Example: Seat Belt Warning Light SystemWarning Light SystemDesign circuit for warning lightSensorss=1: seat belt fastened(系紧)(系紧)k=1: key insertedCapture Boolean equationseat belt not fastened, and key insertedw = NOT(s) AND k515152Example: Seat Belt Exam
47、ple: Seat Belt Warning Light SystemWarning Light SystemConvert equation to circuitTiming diagram illustrates circuit behaviorWe set inputs to any valuesOutput set according to circuitaatimeInputsOutputs111000kswkswBeltWarnSeatbelt525253More examples: Seat belt warning More examples: Seat belt warnin
48、g light extensionslight extensionsOnly illuminate (照(照亮)亮)warning light if person is in the seat (p=1), and seat belt not fastened and key insertedw = p AND NOT(s) AND kkpswBelt Warna535354More examples: Seat belt warning More examples: Seat belt warning light extensionslight extensionsaGiven t=1 fo
49、r 5 seconds after key inserted. Turn on warning light when t=1 (to check that warning lights are working)w = (p AND NOT(s) AND k) OR takwpstBelt Warn54546、 FanIn(扇入(扇入)The Number of Inputs that a Gate have (门电路所具有的输入端的数目门电路所具有的输入端的数目)The Additive “on” Resistance of series transistors limits the Fan
50、In of CMOS gates. (导通电阻的可加性限制了导通电阻的可加性限制了CMOS门的扇入数门的扇入数)A large number of inputs can be made by cascading gates with fewer inputs (可用较少输入门级联得到较多的输入可用较少输入门级联得到较多的输入)Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)55557、Non-inverting Gates ( (非反相门非反相门) )VDD = +5.0VAZ(Non-inverting buffers)非反相
51、缓冲器非反相缓冲器Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用) Add an inverter to the inverse output ! 56567、Non-inverting Gates ( (非反相门非反相门) )Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用) AND gate575758AND gateAND gatex0011y0101F00010111111yyFxx(a)0010101yyFxx(b)When both inputs are
52、 1When an input is 010xyF1100time585859OR gateOR gatex0011y0101F01110100111yxxyF(a)0000001yxxyF(b)When an input is 1When both inputs are 010xyF1100time5959Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用) NAND / NORNAND: NMOS serial , PMOS parallel; NOR: NMOS parallel, PMOS serial; 6060Digit
53、al Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)Each input control a PMOS and an NMOS;Logic function(功能)(功能) is represented by NMOS connections : AND - series OR - parallelPMOS is a duality connection. NAND / NOR6161VDD = +5.0VABZCD8、CMOS AND-OR-INVERT Gate ( CMOS与或非门与或非门) )Digital Logic Design
54、and Application (数字逻辑设计及应用数字逻辑设计及应用) AOI62628、CMOS OR-AND-INVERT Gate ( CMOS或与非门或与非门) )Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)OAI6363A Class ProblemA Class ProblemWrite out the BCD code of 8421 , 2421 , and Excess-3 for the decimal number, then write out the corresponding binary Gray code: +1247Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)6464