1、数字逻辑全册配套完整数字逻辑全册配套完整教学课件教学课件2Digital Design Pincinples and Practices Chapter 1: Introduction What is Digital signal Why Digital How to represent a digital system The target of the text The arrangement of the text Signals in electric circuitReal signal : voice, music, moving pictureAnalog signal: vol
2、tage changed with time Digital signal : sampling values from analog an abstract sequence of numbersThe advantage of digital signalNot influenced by circumstance and deviceCan be recorded and transmitted easilyThe system can be easily constructed use standard devices and can be integratedThe properti
3、es of digital signal Digit in binary system: the string of 1 and 0 1 : High voltage or the power source;0 : Low voltage or the ground; Use several lines to transmit one digit; Only changed in discrete time !Digital system Any inputs and outputs can only be 1 or 0 !For each output, its state must be
4、determined by all the inputs. Basic device in digital system NOT gate (inverter , INV) xyBuffer xy Truth table Diagram Equation AND gate 21 xxydiagram equation Truth table Basic device in digital system OR gate 21xxyBasic device in digital system NANDbafNORbafBasic device in digital system XORbababa
5、fBasic device in digital system The target of digital design Gates design Design basic device by transistors Functional design Design functional circuits by basic device combinational logic sequential logicWithout memory and states Combinational logic Sequential logicWith memory and states The arran
6、gement of the text Teach in 32 times:Arithmetic and device Char.1,2,3 7 Combinational circuit Char.4,6 10 Sequential circuit Char.7,8 13Memory and ADC/DAC 2Exercise and Exams : 100 Exercise in class : 10 Home work: 6 Test in class: 4 Middle exam: 20 Final exam: 60 Chapter 2: Number systems and codes
7、 Positional number system : representation and conversion Representations of negative binary numbersBCD codes and Gray code2.1 Positional number systemsUse few digit to express infinite values Each digit position has a different weightDefinition:121012.pniiirddddddDNumber digit base/radixPositional
8、number systemsNumber: a string of digits;Each digit position has a different weight;Radix is written as 10 in any system.2211001122rdrdrdrdrdDDdrDecimal system: base is 10, the digit may be 0 to 91012101011011001011 .101Binary system: base is 2, the digit may be 0 or 1210122212021202101.101bit: one
9、digit in binary system; Examples of positional number systemBinary numbers with certain width ;The numbers always be set as 0.xxxxxxxx;We can take these numbers as integers !0011011000110110. 0Example for an 8-bit binary number: Positional number system in digital designMSB/LSB binary to decimal: ba
10、sed on definitions;Examples :10764322109375. 0222200110110. 01012452542222001101105422109375. 08Conversion: from one system to another binary to decimal Examples :102?1101.001010245148320010110110428125. 22/451101.0010Conversion: from one system to another Conversion: from Decimal to binary For inte
11、ger numbers : divided by 2, get its remainders;21010110011179Examples for 8-bit binary numbers:17989 442211521 1 1 0 0 1 1 0 1Conversion: from Decimal to binary For decimal fraction numbers : multiplied by radix, and get its integers; Examples for 8-bit binary numbers:21000101011. 017. 00.170.34 0.6
12、81.360.721.440.881.761.52Different number systemsP.28 Table 2-1A short way to represent numbers Binary to octal: 3-bit to one digit;Binary to hexadecimal: 4-bit to one digit;Key point: divide from the radix point !168285613111011100010BB1682.226.134211.1011100010CEExamples :Conversion: from one syst
13、em to another Summary: p.31 Table 2-2Operations for unsigned numbersBasic rules: 0+0=0 1+0=1 1+1=10 10-1=1 Addition and subtractionC:carry S:sum B:borrow D:difference Operations for unsigned numbersBasic rules: 0A = 0 1A = A Multiplication Shift-add : use adders and shift-registers;The product width
14、 will be 2n ! 2.2 Representations of signed numbersIn binary systems , an n-bit string can only represent 2n different numbers !Unsigned: 02n-1signed: -(2n-1-1)2n-1-1Representations of signed numbersIf we want to represent 2n different numbers and their negative part, we have to use n+1 bits !MSB is
15、 not a value bit , but a sign bit :Negative : 1 Positive : 0 How to represent negative signed numbersSigned-magnitude code(S-M code): reversal ! Ones compliment code : shift !Twos compliment code : shift !Converting rules for signed numbersFrom unsigned to signed: Its MSB is changed to the sign bit.
16、 The number must be a positive ! Beware the overflow !Key point: A positive signed number with any code must be the same ! Its MSB is “0” ! Change the sign of a signed number signed-magnitude : change the sign-bit; +21: 0001 0101 -21: 1001 0101 ones complement: change every bit; +21: 0001 0101 -21:
17、1110 1010twos complement: change every bit, and add 1 at LSB; +21: 0001 0101 -21: 1110 1011 note: keep the width of the string in addition ! Conversion: from one code to another Step 1: check the MSB (sign-bit) ; For positive number (MSB =0) : no changes !Step 2: For negative number (MSB =1) : first
18、 change its sign by the former code way; then change its sign by the next code way ! Conversion: from one code to another Examples : 01101001MSA10101001soneB11001010stwoC?stwoA?MSB?soneCAddition for signed numbersUse addition rules for signed numbers , only Twos code can get right result ! Rules for
19、 Twos complement addition1 two numbers must be the same width, keep the width in addition. 2 subtract a number means add the negative number ;Examples: 1110 + 1010 = 1000 0110 0011 = 0110 + 1101 = 0011 Twos complement additionOverflow : the result exceeds the number ranges ; condition : two numbers
20、has the same sign; checking: the sign is wrong! solving : increase the data width ! Examples: 0101 + 0101 = 1010(两个正数相加变负数)(两个正数相加变负数) 1101 + 1010 = 0111(两个负数相加变正数)(两个负数相加变正数)How to increase the width of the signed numberS-M: add 0 bit after the signed-bit (MSB);Others : add signed-bit before MSB;Ex
21、amples: S-M : 0101 = 0000 0101 1100 = 1000 0100 OTHERS: 0101 = 0000 0101 1100 = 1111 1100Multiplication for signed numbersOnly S-Ms code can be easy done! The sign-bit of the result is the XOR of the sign-bits of the inputs! The value-bits of the result is decided by the multiplication rules for the
22、 unsigned numbers! 2.3 Codes in binary systemBCD codes: for decimal digit;Gray code: for numbers in binary system;ASCII code: for characters;Codes in binary systemKey point : Use n bits, we can make 2n different words;To make n code-words, you must use (向上取整)向上取整)bits.n2logBCD codesBinary codes for
23、decimal digits ( Table 2-9 ) BCD codesExpress 10 digit ( 09) : use 4 or more bits, many different way for coding8421 codeNatural code , just lake 4-bit binary numbers;Each digit is weighted;It has 10 valid code words and 6 invalid code words. BCD codesEach digit is weighted;Self-complementing;Use MS
24、B to express higher/lower part;It has 10 valid codes and 6 invalid codes.2421 codesBCD codesExcess-3 codeIts digit is not weighted; Self-complementing ;8421 code + “0011” .BCD codesExamples: use BCD code for decimal numbers A = 19.468421 code : A = 0001 1001. 0100 01102421 code : A = 0001 1111. 0100
25、 1100Excess-3 code: A = 0100 1100. 0111 1001 Key point Each decimal digit is coded by a 4-bits string!BCD codes1-out-of-10 codeOne hot code;It is very useful in control systems.BCD codesBiquinary code 7-bits; two hot code; first 2 bits is one hot code for higher/lower range; last 5 bits is one hot c
26、ode in the range. error-detecting property ! Gray codesTarget: code for continues changed numbers (in binary system) to prevent wrong code happened in transition time;Property : In each pair of successive code words, only one bit changes.Gray codesFrom binary number to Gray code The width is same, t
27、he MSB is same; From left to right, if a bit in binary number 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 codes: 1101 1011 0101 0010Codes for other thingsCharacter codes : ASCII , 7-bits string, 128 code words
28、; p.54 Table 2-11Example: How are you! 1001000 1101111 1110111 0100000 1100001 1110010 1100101 0100000 1111001 1101111 1110101 0100001 Codes for other thingsCodes for actions , conditions or states: Use n bits, we can make 2n different words; To make n different words, we must use bits. p.55 Table 2
29、-12n2logCodes in digital circuitParallel codes use n-line to transmit an n-bits code words ; transmit an n-bits code words in one time period;Serial codes use one line to transmit an n-bits code words ; transmit an n-bits code words in n time period;Basic StructureElectrical behaviorChapter 3 Digita
30、l circuitSwitch modelStatic modelDynamic model The models for CMOS device Switch modelAny node must get 1/0 from Vcc/Gnd by switchesSwitch is made by MOS device Switch model for MOS transistor Switch is controlled by G through electric field; Off: RD-S is high; On: RD-S is low; PMOS: when G is 0, Sw
31、itch on; when G is 1, Switch off;NMOS: when G is 1, Switch on; when G is 0, Switch off;Two types of MOS transistorCMOS inverter F: get 1 from PMOS, get 0 from NMOS; When X=1, NMOS is on; When X=0, PMOS is on;Why must be complement ? NAND gate / NOR gate NAND: NMOS serial , PMOS parallel; NOR: NMOS p
32、arallel, PMOS serial; NAND gate / NOR gate Each input control a PMOS and an NMOS; AND - series OR - parallelLogic is represented by NMOS connections ,PMOS is a duality connection. AOI / OAI Summery for basic CMOSEach input is connected both NMOS and PMOS;The logic is expressed in N net , P net is it
33、s duality;The output is a negative logic ! Output of the positive logic Buffer AND gate Add an inverter to the inverse output ! CMOS transmission gate (TG)Three state output: 0 / 1 / ZWhen c=1, signal is passedWhen c=0, signal is cutoff Three state buffer Three state inverter Circuit made by three-s
34、tate devices XOR gate MUX 2Open gate and wired logic Only N-net exist, Output: 0/Z ; Get 1 by pull-up resistor;The output can be connected to get AND logic . when output is hold on 1 or 0Static model of CMOS R will be changed with VGThe electric model for basic CMOS circuitWhen Vx is increased, Rp w
35、ill be increased and Rn be decreased !Figure 3-8 3-9The output voltage is changed When input voltage changed.The resistors are changed with input Steady-state behavior for inverter Ideal behaviorReal behaviorThe input between VIL and VIH : amplified area !Logic level and noise marginThe input limit
36、: to avoid the noise be amplified!Device informations from the data sheetUse Table 3-3 : 74HC00 (NAND2x4) Commercial: Vcc 4.75 Military:Vcc4.5Get resistor value from the data sheetnpRR4 . 402. 035. 0npRR84. 3491. 0For commercial device High level output (use minimal value)151151. 0kRpOutput driven a
37、bilityFor NAND2 in Table 3-3: If VOHmin= 3.84 VThen IOHmax=4 mAR 3.84/4 = 0.96 kLimitation for output current and resistive load.Use NAND2 to drive LED Fig 3-54 74AC Device : VOLmax = 0.37 V 303303. 010/ )6 . 137. 05(kRIf an input is not used ?If an input keep floating, the output will be undecided,
38、 or the gate may be damaged ! Must connected it to some where !Can we connect more than one output to a single line?Never Yes , but only one is not Z ! Yes , but need pull up resistor ! Schmitt Trigger inputUse feedback circuit to shift the switching threshold depending on the input changing ways. H
39、ysteresis: the difference between the threshold Schmitt Trigger inputIt can be used to eliminate noise ! Cg: gate capacitorCd and Cs: junction capacitorsDynamic model of CMOSThe electric model for basic CMOS circuitAny device has input and output capacitors ! Dynamic behaviorWhen state changed, capa
40、citors must be charged or uncharged through a resistor !Analyze without resistive load High state : VH=5V Low state : VL=0VFrom H to L : From L to H :nsCRnf10nsCRpr20Dynamic behaviorFrom H to L : fall time ftLHLOUTeVVVV/nsVVtLLff5 . 85 . 15 . 3lnFrom L to H : rise time rtHLHOUTeVVVV/nsVVtHHrr9 .165
41、. 35 . 1lnHigh state : VH=? Low state : VL=?From H to L : From L to H :?f?rAnalyze with resistive load DC Driven ability 1/Ron Limitation for output current and resistive load.Time constant Ron Time delay and frequency limit.The importance for RonIf Ron in all the transistors are same ? Ron will be
42、different for devises and states.The optimize design way Make Ron in any devices the same value by adjust transistor width.Ron 1/W; C W; A W.When Ron in any devices are same: DC driven ability for any devices are same; Rise time and fall time of one devices are same ; Delay time of a device will be
43、only rely on its capacitors, on rely on its input numbers. The optimize design way Fan-in :The input numbers of a single deviceFor VLSI design of CMOS devices , the time delay is proportional to the fan-in !If we use smaller device for design , we can get better result ! 0tntdUse parallel design to
44、limit the fan-in If the fan-in is greater than 5 , it should be instead by parallel circuit !08ttd07142ttd06222ttdUse parallel design for positive output gate 0422 ttd0514 ttdThe fan-in should be less than 4 !Output driven strengthIn optimize design , Ron in any devices are same;If Ron is same as a
45、minimal transistors, the device is called 1X device.If Ron is only 1/n of the 1X, the device is called nX device. Time delay on the interconnect lineThe time delay maybe very large !RCinRCRCouttLdnX devise and inverter buffer The time delay will be decreased ! Dynamic power consumptionfVCCPPPCCLPDLD
46、2Power consumption is mainly happened when the state is changed!Diode logicOther digital circuit Simple , fast , but the driving ability is weak !Transistor-Transistor Logic : TTL circuitOther digital circuit Diode logic-Inverter-Output driverEmitter-Coupled Logic : ECL circuitOther digital circuit
47、fastest, power consumption is the largest ! Switching algebraRepresentations of the logic functionHow to make a best circuit in logic design Chapter 4 Combinational logic design principlesPrinciple of Switching algebraBasic value of any variable or function: 1 / 0 basic operation in logic algebra: A
48、ND () , OR(+), NOT()Axiom of switching algebra if x1,then x =0; if x =1 ,then x0; if x =0 ,then x=1; if x =1 ,then x=0; 00 = 0 11=1 01=10=0 0+0=0 1+1=1 1+0=0+1=1Some important theoremSome important theoremImportant theoremDeMorgans theorem: (x1+x2)=x1 x2 (x1 x2)=x1+x2 The perfect induction of the th
49、eoremUse the truth table to prove the functions on both side are same !babaImportant theoremPrinciple of Duality: Any theorem or identity remains true if 0 and 1 are swapped , and + are swapped !, , 0 , 1 ,)(, 1 , 0 ,()xfxFxfxFDAll the axiom and theorem have their duality !Be careful to keep the ope
50、ration orders of the functions. Two kind of logic Positive logic : 1 ( high level ) 0 (low level)Negative logic: 0 ( high level ) 1 (low level)If a logic relation exist in positive logic, it must be exist in negative logic.Relation between two logic: NPFF NPXXExample: from positive to negative posit