2019姜书艳数字逻辑设计及应用ppt课件.ppt

上传人:飞****2 文档编号:32165693 上传时间:2022-08-08 格式:PPT 页数:66 大小:979.02KB
返回 下载 相关 举报
2019姜书艳数字逻辑设计及应用ppt课件.ppt_第1页
第1页 / 共66页
2019姜书艳数字逻辑设计及应用ppt课件.ppt_第2页
第2页 / 共66页
点击查看更多>>
资源描述

《2019姜书艳数字逻辑设计及应用ppt课件.ppt》由会员分享,可在线阅读,更多相关《2019姜书艳数字逻辑设计及应用ppt课件.ppt(66页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、1 1数字逻辑设计及应用数字逻辑设计及应用Chapter 2 Number Systems and codes (数系与编码数系与编码) 介绍在数字逻辑体系中信号的介绍在数字逻辑体系中信号的表达方式表达方式、类型类型,不同表达方式之间的,不同表达方式之间的转换转换,运算运算的规则的规则等。等。Digital Logic Design and Application ( (数字逻辑设计及应用数字逻辑设计及应用) )2 2Review of Chapter 1 (Review of Chapter 1 (第一章内容回顾第一章内容回顾) )Analog versus Digital (模拟与数字模拟

2、与数字)Digital Devices (数字器件数字器件): Gates(门电路(门电路)、)、 Flip-flops(触发器(触发器)Electronic and Software Aspects of Digital Design (数字设计的电子技术和软件技术数字设计的电子技术和软件技术)Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)3 3Review of Chapter 1 (Review of Chapter 1 (第一章内容回顾第一章内容回顾) )Integrated Circuit(IC,集成电路集成电路)P

3、rogrammable Logic Devices(PLA、PLD、CPLD、FPGA, 可编程逻辑器件可编程逻辑器件)Application-Specific ICs(ASIC, 专用集成电路专用集成电路)Printed-Circuit Boards (PCB, 印制电路板印制电路板)Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)4 4Chapter 2Chapter 2 Number Systems and codes Number Systems and codes ( (数系与编码数系与编码) )Two kinds o

4、f InformationTwo kinds of Information ( (信息主要有两类信息主要有两类) ): Numeric Data (Numeric Data (数值信息数值信息) ) Nonnumeric Data (Nonnumeric Data (非数值信息非数值信息) )Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用) Number Systems and their Conversions ( (数制及其转换数制及其转换) )- Nonnumeric Data Representation Codes (

5、非数值信息的表征非数值信息的表征 - 编码编码)5 5Chapter 2Chapter 2 Number Systems and codes Number Systems and codes ( (数系与编码数系与编码) )数字系统只处理数字信号数字系统只处理数字信号 0 , 1;需要将任意信息用需要将任意信息用( 0 ,1 )表达;表达;用(用(0,1)表达数量:)表达数量: 数制数制 二进制二进制 用(用(0,1)表达不同对象:)表达不同对象: 符号编码符号编码Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)6 66How

6、to Encode Text: ASCII, UnicodeHow to Encode Text: ASCII, UnicodeASCII: 7- (or 8-) bit encoding of each letter, number, or symbolSample ASCII encodingsSymbolEncoding010 0000 010 0001 !010 0010 010 0011 #010 0100 $010 0101 %010 0110 &010 0111 010 1000 (010 1001 )010 1010 *010 1011 +010 1100 ,010 1101

7、-010 1110 .010 1111 /SymbolEncoding100 1110 N100 1111 O101 0000 P101 0001 Q101 0010 R101 0011 S101 0100 T101 0101 U101 0110 V101 0111 W101 1000 X101 1001 Y101 1010 Z100 0001 A100 0010 B100 0011 C100 0100 D100 0101 E100 0110 F100 0111 G100 1000 H100 1001 I100 1010 J100 1011 K100 1100 L100 1101 MSymbo

8、lEncodingSymbolEncoding011 0000 0011 0001 1011 0010 2011 0011 3011 0100 4011 0101 5011 0110 6011 0111 7011 1000 8011 1001 9110 0001 a110 0010 b .111 1001 y111 1010 z 7 77How to Encode Text: ASCII, UnicodeHow to Encode Text: ASCII, UnicodeUnicode: Increasingly popular 16-bit encodingEncodes character

9、s from various world languages 8 88How to Encode Numbers: Binary How to Encode Numbers: Binary NumbersNumbersBase ten (decimal)Ten symbols: 0, 1, 2, ., 8, and 9More than 9 - next positionlSo each position power (幂)(幂) of 10Nothing special about base 10 - used because we have 10 fingers10410310252310

10、1100 Each position represents a base quantity; symbol in position means how many of that quantity9 99How to Encode Numbers: Binary How to Encode Numbers: Binary NumbersNumbersBase two (binary)Two symbols: 0 and 1More than 1 - next positionlSo each position power(幂)(幂) of 22 42 32 21 0 12 12 0Q: How

11、much? + = 4 1 5 + =a Each position represents a base quantity; symbol in position means how many of that quantityThere are only 10 types of people in the world: those who understand binary, and those who dont.101010Useful to know powers of 2:Useful to know powers of 2:2423222120292827262516 84215122

12、5612864 3216 8 4 2 1512 256 1286432Practice counting up by powers of 2:11 112.1 2.1 Positional Number System Positional Number System ( (按位计数制按位计数制) )Any Decimal Number D Can Be Represented as the Following (任意十进制数任意十进制数 D 可表示如下可表示如下):D = dp-1 dp-2 . d1 d0 . d-1 d-2 . d-n推广:推广: D D2 2 = d= d i i 2 2

13、i i D D1616= d= d i i 16 16i i 1pniiirdWeight of i bit; Base or Radix of r Number System(第第i位的权;位的权; r 计数制的基数计数制的基数)Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)12122.1 2.1 Positional Number System Positional Number System ( (按位计数制按位计数制) )按位计数制的特点按位计数制的特点 1) 采用采用基数基数(Base or Radix), R进制的

14、基数是进制的基数是R 2) 基数基数确定数符的确定数符的个数个数 如十进制的数符为:如十进制的数符为:0、1、2、3、4、5、6、7、8、9,个数为,个数为10 二进制的数符为:二进制的数符为:0、1,个数为,个数为2 3)逢)逢基数基数进一进一Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)13132.1 2.1 Positional Number System Positional Number System ( (按位计数制按位计数制) )Digital Logic Design and Application (数字逻辑

15、设计及应用数字逻辑设计及应用)Decimal and BinaryDecimal system: base is 10, the digit may be 0 to 91012101011011001011 .101Binary system: base is 2, the digit may be 0 or 110122212120211 .101bit: one digit in binary system; 141414Using Digital Data in a Digital SystemUsing Digital Data in a Digital Systemtemperatu

16、re sensor0011000033A temperature sensor outputs temperature in binaryThe system reads the temperature, outputs ASCII code:“F” for freezing (0-32)“B” for boiling (212 or more)“N” for normal 151515Using Digital Data in a Digital SystemUsing Digital Data in a Digital Systemtemperature sensor0 0 110 0 0

17、 033Digital Systemdisplay NN1 000 1 1 1if (input = 11010100) / 212 output = 1000010 / Belse output = 1001110 / NA display converts its ASCII input to the corresponding letter16162.2 2.2 Octal and Hexadecimal Numbers Octal and Hexadecimal Numbers ( (八进制和十六进制八进制和十六进制) ) 基数基数 数码数码 特性特性 Octal Number ( (

18、八八进制进制) ) 8 8 0707 逢逢八八进一进一 Binary Number ( (二进制二进制) ) 2 2 0,10,1 逢二进一逢二进一 Hexadecimal Number(十六进制十六进制) ) 1616 09,09,AFAF 逢十六进一逢十六进一 Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)1717说说 明明Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)选择什么数制来表示信息,选择什么数制来表示信息, 对数字系统的成本和性能影响很大,对数字

19、系统的成本和性能影响很大, 在数字电路中在数字电路中多使用二进制多使用二进制.Most Significant Bit(MSB, 最高有效位最高有效位)Least Significant Bit(LSB, 最低有效位最低有效位)1011100010112MSB LSB1818Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)表表2.1 十进制、二进制、八进制与十六进制数十进制、二进制、八进制与十六进制数十进制十进制二进制二进制八进制八进制十六进制十六进制 00000 00 10001 11 20010 22 30011 33 40

20、100 44 50101 55 60110 66 70111 77 81000108 9100111910101012A11101113B191919Base Sixteen: Another Base Used by Base Sixteen: Another Base Used by DesignersDesignersNice because each position represents four base-two positionsCompact way to write binary numbersKnown as hexadecimal, or just hexQ: Write

21、 11110000 in hexF0Q: Convert hex A01 to binary1010 0000 0001A:A:2020二进制与八进制和十六进制之间的转换二进制与八进制和十六进制之间的转换位数替换法:保持小数点不变,每位位数替换法:保持小数点不变,每位八八进制数对进制数对 应应3位二进制数位二进制数; 每位每位十六十六进制数对应进制数对应4位二进制数位二进制数;二进制转换时,从小数点开始向左右分组,在二进制转换时,从小数点开始向左右分组,在MSB前前面和面和LSB后面可以加后面可以加0;转换为二进制时,转换为二进制时,MSB前面和前面和LSB后面的后面的0不写;不写;例:例:1

22、011100010112=56138=B8B16 10111000.10112=207.548=B8.B161000110010011000110010012 2 = ( )= ( )8 8 = ( )= ( )1616Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)212121Hex Example: RFID TagHex Example: RFID TagBatteryless(无电池)(无电池) tag powered(功率)(功率) by radio fieldTransmits(发送)(发送) unique iden

23、tification(鉴(鉴定)定) numberExample: 32 bit id(身份证明)(身份证明)8-bit province number, 8-bit city number, 16-bit animal numberTag contents are in binaryBut programmers use hex when writing/readingRFIDtagProvince #City #Animal #Province: 7City: 160Animal: 513101000000000011100000010 00000001A00702 01 Tag ID i

24、n hex: 07A00201(a)(b)(c)(d)(f)(e)22222.3 2.3 General Positional-Number-System General Positional-Number-System Conversion (Conversion (常用按位计数制的转换常用按位计数制的转换) )Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)A Number in any Radix to Radix 10 (任意进制数任意进制数 十进制数十进制数)Method: Expanding the formula

25、using radix-10 arithmetic (方法:利用方法:利用位权位权展开展开)Example 1Example 1:( 101.01 )( 101.01 )2 2 = ( )= ( )1010 ( 7 ( 7F.8 )F.8 )16 16 = ( )= ( )1010More easy way(More easy way(更简便的方法更简便的方法) )? ( F1AC )( F1AC )16 16 = ( ( ( F= ( ( ( F16 ) +1 ) 16 ) +1 ) 16 + A ) 16 + A ) 16 + C 16 + C23232.3 2.3 General Pos

26、itional-Number-System General Positional-Number-System Conversion (Conversion (常用按位计数制的转换常用按位计数制的转换) )Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)A Number in Radix 10 to any Radix (十进制十进制 其它进制其它进制)Method:Radix Multiplication or Division (基数乘除法基数乘除法) Integer Parts (整数部分整数部分): 除除 r 取取余余,逆

27、序逆序排列排列 Example 2:( 156 )10 = ( )2 Decimal Fraction Parts (小数部分小数部分): 乘乘 r 取取整整,顺序顺序排列排列 Example 3:( 0.37 )10 = ( )224242.3 2.3 General Positional-Number-System General Positional-Number-System Conversion (Conversion (常用按位计数制的转换常用按位计数制的转换) )Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)Ex

28、ample Example 4 4:Require Require 10 10-2-2 ,Complete theComplete the following conversion following conversion ( 617.28 ) ( 617.28 )10 10 = ( )= ( )2 22 2- -n n = 10 10-2 -2 思考:任意两种进位计数制之间的转换思考:任意两种进位计数制之间的转换 以十进制(二进制)作为桥梁以十进制(二进制)作为桥梁 n = 7n = 7252525Converting To/From Binary by Hand: Converting T

29、o/From Binary by Hand: SummarySummaryBinaryDecimal1684010211116 + 8 + 2To decimalTo hex1 1010= 2610= 1A16To octal11 010= 3282610To binary401201161811616+8= 2424-24+2= 26262626Divide-By-2 Method Common in Divide-By-2 Method Common in Automatic ConversionAutomatic ConversionRepeatedly divide decimal n

30、umber by 2, place remainder in current binary digit (starting from 1s column)1. Divide decimal number by 2 Insert remainder into the binary number Continue since quotient (6) isgreater than 02. Divide quotient by 2 Insert remainder into the binary number Continue since quotient (3) isgreater than 00

31、1181402011402010102DecimalBinary1221206626033. Divide quotient by 2 Insert remainder into the binary number Continue since quotient (1) isgreater than 0322114. Divide quotient by 2 Insert remainder into the binary number Quotient is 0, done12010(current value: 12)(current value: 4)(current value: 0)

32、(current value: 0)Note: Works for any base Njust divide by N instead272727Bytes, Kilobytes, Megabytes, and Bytes, Kilobytes, Megabytes, and MoreMoreByte: 8 bitsCommon metric prefixes: kilo (thousand, or 103), mega (million, or 106), giga (billion, 千兆千兆or 109), and tera (trillion, 万亿万亿or 1012), e.g.,

33、 kilobyte, or KByte282828Bytes, Kilobytes, Megabytes, and Bytes, Kilobytes, Megabytes, and MoreMoreBUT, metric prefixes also commonly used inaccurately216 = 65536 commonly written as “64 Kbyte”Typical when describing memory sizesAlso watch out for “KB” for kilobyte vs. “Kb” for kilobit292929Example:

34、 DIP-Switch Controlled Example: DIP-Switch Controlled ChannelChannelCeiling fan receiver should be set in factory to respond to channel “73”Convert 73 to binary, set DIP(指拨)(指拨) switch accordinglyDesired value: 7340 0211160813206411280647273sum:(b)(a)Q:3030Example: DIP-Switch Controlled Example: DIP

35、-Switch Controlled ChannelChannelchannel receiverCeiling fanmodule0if (InA = InB) Out = 1else Out = 00 1 010 1 0 073DIP switch100 0 1000 01InAInBOut34(c)31312.4 2.4 Addition and Subtraction of Addition and Subtraction of NondecimalNondecimal Numbers (Numbers (非十进制数的加法和减法非十进制数的加法和减法) )Digital Logic D

36、esign and Application (数字逻辑设计及应用数字逻辑设计及应用)Two Binary Number Arithmetic (两个二进制数的算术运算两个二进制数的算术运算)Addition (加法加法): Carry (进位进位) 1 + 1 = 10Subtraction (减法减法): Borrows (借位借位) 10 1 = 13232Carry in (进位输入进位输入): C in (P.32) Carry out ( 进位输出进位输出 ) C out Sum ( 本位和本位和 ): S2.4 Addition and Subtraction of Non-dec

37、imal Numbers (非十进制数的加法和减法非十进制数的加法和减法)Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用) 1011 1110+ 1000 11013333Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)表表2.3.1 二进制加法真值表二进制加法真值表输输 入入输输 出出被加数被加数X加数加数Y输入进位输入进位Cin和和S进位输出进位输出Cout0000000110010100110110010101011100111111343434Adder

38、Example: DIP-Switch-Based Adding CalculatorGoal: Create calculator that adds two 8-bit binary numbers, specified using DIP switchesDIP switch: Dual-In-line Package switch, move each switch up or downSolution: Use 8-bit adder3535Adder Example: Adder Example: DIP-Switch-Based DIP-Switch-Based Adding C

39、alculatorAdding CalculatorSolution: Use 8-bit adderDIP switches10a7.a0b7.b0s7s08-bit carry-ripple addercoci0CALCLEDs363636Adder Example: Adder Example: DIP-Switch-Based DIP-Switch-Based Adding CalculatorAdding CalculatorTo prevent spurious(假的)假的) values from appearing at output, can place register a

40、t outputActually, the light flickers(闪烁)闪烁) from spurious values would be too fast for humans to detectbut the principle of registering outputs to avoid spurious values being read by external devices (which normally arent humans) applies here.3737Adder Example: Adder Example: DIP-Switch-Based DIP-Sw

41、itch-Based Adding CalculatorAdding CalculatorDIP switches10a7.a0b7b0s7s08-bit adder8-bit registercoci0CALCLEDseclkld3838Borrow in ( 借位输入借位输入 ): Bin Borrow out ( 借位输出借位输出 ): Bout Difference bit ( 本位差本位差 ): D2.4 Addition and Subtraction of Non-decimal Numbers (非十进制数的加法和减法非十进制数的加法和减法)Digital Logic Desi

42、gn and Application (数字逻辑设计及应用数字逻辑设计及应用) 1010 1010 0101 01013939Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)表表2.3.2 二进制减法真值表二进制减法真值表输输 入入输输 出出被减数被减数X减数减数Y输入借位输入借位Bin差差D输出借位输出借位Bout00000001110101101101100101010011000111114040Subtractor Example:Subtractor Example: DIP-Switch Based DIP-Swit

43、ch Based Adding/Subtracting CalculatorAdding/Subtracting CalculatorExtend earlier calculator exampleSwitch f indicates whether want to add (f=0) or subtract (f=1)Use subtractor and 2x1 mux4141Subtractor Example:Subtractor Example: DIP-Switch Based DIP-Switch Based Adding/Subtracting CalculatorAdding

44、/Subtracting CalculatorDIP switches108-bit registerCALCLEDsefclkld88800888882x10110wiciAABBSScowo8-bit adder8-bit subtractor42422.5 2.5 Representation of Negative Numbers Representation of Negative Numbers ( (负数的表示负数的表示) )Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)2.5.1 Signed-Magnitud

45、e Representation 符号符号 数值表示法(数值表示法(原码原码)MSB as the Sign bit (0 = plus, 1 = minus) 最高有效位表示符号位(最高有效位表示符号位( 0 = 正,正,1 = 负负)01111111127 111111111270010111046 1010111046000000000 10000000043432.5 2.5 Representation of Negative Numbers Representation of Negative Numbers ( (负数的表示负数的表示) )Digital Logic Design

46、 and Application (数字逻辑设计及应用数字逻辑设计及应用)2.5.1 Signed-Magnitude Representation 符号符号 数值表示法(数值表示法(原码原码)Two possible representations of Zero 零有两种表示零有两种表示(+ 0、 0)An n-bit signed-magnitude integer range is (n位二进制整数表示范围位二进制整数表示范围): ( 2n-1 1) + ( 2n-1 1) 44442.5 2.5 Representation of Negative Numbers Represent

47、ation of Negative Numbers ( (负数的表示负数的表示) )2.5.2 Complement Number Systems (补码数制补码数制)Radix Complement (基数补码基数补码)Diminished Radix Complement 基数减基数减1补码补码 (反码反码) Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)45452.5 2.5 Representation of Negative Numbers Representation of Negative Numbers ( (

48、负数的表示负数的表示) )2.5.3 Radix Complement Representation ( 基数补码表示法基数补码表示法) The complement of an n-digit number is obtained by subtracting it from r n (n位数的补码等于从位数的补码等于从 r n 中减去该数中减去该数)Example : Table 2-4 P.36Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)46462.5 2.5 Representation of Negative Nu

49、mbers Representation of Negative Numbers ( (负数的表示负数的表示) )Diminished Radix Complement Representation 基数减基数减1补码表示法(补码表示法(反码反码): The Diminished Radix Complement of an n-digit number is obtained by subtracting it from r n -1 n位数的反码等于从位数的反码等于从 r n 1 中减去该数中减去该数Example : Table 2-4 2-5 P.36Digital Logic Des

50、ign and Application (数字逻辑设计及应用数字逻辑设计及应用)474747Tens ComplementTens ComplementBefore introducing twos complement, lets consider tens complementBut, be aware that computers DO NOT USE TENS COMPLEMENT. Introduced for intuition(直觉)(直觉) only.Complements for each base ten number shown to right. Complement

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 教案示例

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁