电子科大第二章 (1)_第1页
电子科大第二章 (1)_第2页
电子科大第二章 (1)_第3页
电子科大第二章 (1)_第4页
电子科大第二章 (1)_第5页
已阅读5页,还剩28页未读 继续免费阅读

付费下载

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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 62.1 2

6、.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 2i i D D1616= d= d i i 16 16i i 1pniiirdWeight of i bit; Base or Radix of r Number

7、 System(第第i位的权;位的权; r 计数制的基数计数制的基数)Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)7 72.1 2.1 Positional Number System Positional Number System ( (按位计数制按位计数制) )按位计数制的特点按位计数制的特点 1) 采用采用基数基数(Base or Radix), R进制的基数是进制的基数是R 2) 基数基数确定数符的确定数符的个数个数 如十进制的数符为:如十进制的数符为:0、1、2、3、4、5、6、7、8、9,个数为,个数为10 二

8、进制的数符为:二进制的数符为:0、1,个数为,个数为2 3)逢)逢基数基数进一进一Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)8 82.2 2.2 Octal and Hexadecimal Numbers Octal and Hexadecimal Numbers ( (八进制和十六进制八进制和十六进制) ) 基数基数 数码数码 特性特性 Octal Number ( (八八进制进制) ) 8 8 0707 逢逢八八进一进一 Binary Number ( (二进制二进制) ) 2 2 0,10,1 逢二进一逢二进一 He

9、xadecimal Number(十六进制十六进制) ) 1616 09,09,AFAF 逢十六进一逢十六进一 Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)9 9说说 明明Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)选择什么数制来表示信息,选择什么数制来表示信息, 对数字系统的成本和性能影响很大,对数字系统的成本和性能影响很大, 在数字电路中在数字电路中多使用二进制多使用二进制.Most Significant Bit(MSB, 最高有效位最高有效位)Le

10、ast Significant Bit(LSB, 最低有效位最低有效位)1011100010112MSB LSB1010Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)表表2.1 十进制、二进制、八进制与十六进制数十进制、二进制、八进制与十六进制数十进制十进制二进制二进制八进制八进制十六进制十六进制 00000 00 10001 11 20010 22 30011 33 40100 44 50101 55 60110 66 70111 77 81000108 9100111910101012A11101113B11 11二进制与

11、八进制和十六进制之间的转换二进制与八进制和十六进制之间的转换位数替换法:保持小数点不变,每位位数替换法:保持小数点不变,每位八八进制数对进制数对 应应3位二进制数位二进制数; 每位每位十六十六进制数对应进制数对应4位二进制数位二进制数;二进制转换时,从小数点开始向左右分组,在二进制转换时,从小数点开始向左右分组,在MSB前前面和面和LSB后面可以加后面可以加0;转换为二进制时,转换为二进制时,MSB前面和前面和LSB后面的后面的0不写;不写;例:例:1011100010112=56138=B8B16 10111000.10112=207.548=B8.B16100011001001100011

12、0010012 2 = ( )= ( )8 8 = ( )= ( )1616Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)12122.3 2.3 General Positional-Number-System General Positional-Number-System Conversion (Conversion (常用按位计数制的转换常用按位计数制的转换) )Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)A Number in any Radix t

13、o Radix 10 (任意进制数任意进制数 十进制数十进制数)Method: Expanding the formula 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

14、 ) +1 ) 16 + A ) 16 + A ) 16 + C 16 + C13132.3 2.3 General Positional-Number-System General Positional-Number-System Conversion (Conversion (常用按位计数制的转换常用按位计数制的转换) )Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)A Number in Radix 10 to any Radix (十进制十进制 其它进制其它进制)Method:Radix Multiplication

15、or Division (基数乘除法基数乘除法) Integer Parts (整数部分整数部分): 除除 r 取取余余,逆序逆序排列排列 Example 2:( 156 )10 = ( )2 Decimal Fraction Parts (小数部分小数部分): 乘乘 r 取取整整,顺序顺序排列排列 Example 3:( 0.37 )10 = ( )214142.3 2.3 General Positional-Number-System General Positional-Number-System Conversion (Conversion (常用按位计数制的转换常用按位计数制的转换

16、) )Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)Example 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

17、 = 7n = 715152.4 2.4 Addition and Subtraction of Nondecimal Addition and Subtraction of Nondecimal Numbers (Numbers (非十进制数的加法和减法非十进制数的加法和减法) )Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)Two Binary Number Arithmetic (两个二进制数的算术运算两个二进制数的算术运算)Addition (加法加法): Carry (进位进位) 1 + 1 = 10Subtract

18、ion (减法减法): Borrows (借位借位) 10 1 = 11616Carry in (进位输入进位输入): C in (P.32) Carry out ( 进位输出进位输出 ) C out Sum ( 本位和本位和 ): S2.4 Addition and Subtraction of Non-decimal Numbers (非十进制数的加法和减法非十进制数的加法和减法)Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用) 1011 1110+ 1000 11011717Digital Logic Design and

19、 Application (数字逻辑设计及应用数字逻辑设计及应用)表表2.3.1 二进制加法真值表二进制加法真值表输输 入入输输 出出被加数被加数X加数加数Y输入进位输入进位Cin和和S进位输出进位输出Cout00000001100101001101100101010111001111111818Borrow in ( 借位输入借位输入 ): Bin Borrow out ( 借位输出借位输出 ): Bout Difference bit ( 本位差本位差 ): D2.4 Addition and Subtraction of Non-decimal Numbers (非十进制数的加法和减法非

20、十进制数的加法和减法)Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用) 1010 1010 0101 01011919Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)表表2.3.2 二进制减法真值表二进制减法真值表输输 入入输输 出出被减数被减数X减数减数Y输入借位输入借位Bin差差D输出借位输出借位Bout000000011101011011011001010100110001111120202.5 2.5 Representation of Negative

21、Numbers Representation of Negative Numbers ( (负数的表示负数的表示) )Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)2.5.1 Signed-Magnitude Representation 符号符号 数值表示法(数值表示法(原码原码)MSB as the Sign bit (0 = plus, 1 = minus) 最高有效位表示符号位(最高有效位表示符号位( 0 = 正,正,1 = 负负)01111111127 111111111270010111046 1010111046

22、000000000 10000000021212.5 2.5 Representation of Negative Numbers Representation of Negative Numbers ( (负数的表示负数的表示) )Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)2.5.1 Signed-Magnitude Representation 符号符号 数值表示法(数值表示法(原码原码)Two possible representations of Zero 零有两种表示零有两种表示(+ 0、 0)An n-bit

23、signed-magnitude integer range is (n位二进制整数表示范围位二进制整数表示范围): ( 2n-1 1) + ( 2n-1 1) 22222.5 2.5 Representation of Negative Numbers Representation of Negative Numbers ( (负数的表示负数的表示) )2.5.2 Complement Number Systems (补码数制补码数制)Radix Complement (基数补码基数补码)Diminished Radix Complement 基数减基数减1补码补码 (反码反码) Digit

24、al Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)23232.5 2.5 Representation of Negative Numbers Representation of Negative Numbers ( (负数的表示负数的表示) )2.5.3 Radix Complement Representation ( 基数补码表示法基数补码表示法) The complement of an n-digit number is obtained by subtracting it from r n (n位数的补码等于从位数的补码等于从

25、r n 中减去该数中减去该数)Example : Table 2-4 P.36Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)24242.5 2.5 Representation of Negative Numbers Representation of Negative Numbers ( (负数的表示负数的表示) )Diminished Radix Complement Representation 基数减基数减1补码表示法(补码表示法(反码反码): The Diminished Radix Complement of an

26、 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 Design and Application (数字逻辑设计及应用数字逻辑设计及应用)25252.5.4 Twos 2.5.4 Twos Complement Representation Complement Representation ( (二进制补码表示法二进制补码表示法) ) The MSB of a number in

27、 this system serves as the sign bit(最高有效位用做符最高有效位用做符号位号位);The weight of the MSB is -2n-1 instead of + 2n-1 (MSB的权是的权是-2n-1 而不是而不是+ 2n-1 )Obtain a Twos- Complement ( 二进制补码的求取二进制补码的求取 ): Ones Complement (反码反码) + 1 (Why?)?)Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)26262.5.4 Twos 2.5.4 Tw

28、os Complement Representation Complement Representation ( (二进制补码表示法二进制补码表示法) )Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)例例2.5.1 若约定字长是一个字节,试求若约定字长是一个字节,试求119的的补码。补码。解:因解:因119的绝对值的绝对值11901110111,则补码,则补码可以通过下式算法得到:可以通过下式算法得到: 全全1码:码: 1 1 1 1 1 1 1 1 减去减去119绝对值:绝对值: 0 1 1 1 0 1 1 1 119的反码

29、:的反码: 1 0 0 0 1 0 0 0 加加1: 1 119补码:补码: 1 0 0 0 1 0 0 127272.5.4 Twos 2.5.4 Twos Complement Representation Complement Representation ( (二进制补码表示法二进制补码表示法) )Only one representations of Zero ( 零只有一种表示零只有一种表示 ) 00 0 0 0 0 0 0 0 逐位取反逐位取反 1 1 1 1 1 1 1 1 1约定约定8位位 0 0 0 0 0 0 0 00Digital Logic Design and Ap

30、plication (数字逻辑设计及应用数字逻辑设计及应用)28282.5.4 Twos 2.5.4 Twos Complement Representation Complement Representation ( (二进制补码表示法二进制补码表示法) )An n-bit Twos- Complement range is (n位二进制补码表示范围位二进制补码表示范围): 2 n-1 + ( 2 n-1 1) 约定字长(约定字长(8比特)后,补码表示数的范围比特)后,补码表示数的范围128127 Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)29292.5.4 Twos 2.5.4 Twos Complement Representation Complement Representation ( (二进制补码表示法二进制补码表示法) )Positive number has the same: Sign-Magnitude, Ones Complement, and Twos- Complement ( 正数正数的原码、反码、补码的原码、反码、补码相同相同)Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论