姜书艳 数字逻辑设计及应用ppt课件_第1页
姜书艳 数字逻辑设计及应用ppt课件_第2页
姜书艳 数字逻辑设计及应用ppt课件_第3页
姜书艳 数字逻辑设计及应用ppt课件_第4页
姜书艳 数字逻辑设计及应用ppt课件_第5页
已阅读5页,还剩40页未读 继续免费阅读

下载本文档

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

文档简介

1、Chapter 2 Number Systems and Chapter 2 Number Systems and codes (codes (数系与编码数系与编码) )Numeric DataNumeric Data Number Systems and their Number Systems and their Conversions Conversions (数值信息(数值信息 数制及其转换)数制及其转换) Nonnumeric Data Nonnumeric Data Codes Codes (非数值信息(非数值信息 编码)编码)Digital Logic Design and Ap

2、plication (数字逻辑设计及应用数字逻辑设计及应用)Review of Chapter 2 (Review of Chapter 2 (第二章内容回顾第二章内容回顾) )Binary, Octal, and Hexadecimal Numbers (二进制、八进制、十六进制二进制、八进制、十六进制)Positional Number System (按位计数制按位计数制) 1pniiirdDDigital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)Review of Chapter 2 (Review of Chapter 2 (

3、第二章内容回顾第二章内容回顾) )General Positional-Number-System Conversion (常用按位计数制的转换常用按位计数制的转换)A Number in any Radix to Radix 10 : Expanding the formula using radix-10 arithmetic (任意进制数任意进制数 十进制数:利用位权展开十进制数:利用位权展开)Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)Review of Chapter 2 (Review of Chapter 2

4、(第二章内容回顾第二章内容回顾) )General Positional-Number-System Conversion (常用按位计数制的转换常用按位计数制的转换)A Number in Radix 10 to any Radix : Radix Multiplication or Division (十进制十进制 其它进制:基数乘除法其它进制:基数乘除法)Note: Decimal Fraction Parts Conversion 留意:小数部分的转换误差)留意:小数部分的转换误差)Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设

5、计及应用)Review of Chapter 2 (Review of Chapter 2 (第二章内容回顾第二章内容回顾) )Addition and Subtraction of Nondecimal Numbers (非十进制的加法和减法非十进制的加法和减法) (Table 2-3) 进位输入进位输入 Cin 、进位输出、进位输出 Cout 、 本位和本位和 S 借位输入借位输入 Bin 、借位输出、借位输出 Bout 、 本位差本位差 DDigital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)Review of Chapter

6、2 (Review of Chapter 2 (第二章内容回顾第二章内容回顾) )Representation of Negative Numbers (负数的表示负数的表示) Signed-Magnitude 符号数值原码)符号数值原码) Complement Number Systems (补码数制补码数制)Radix Complement (基数补码基数补码)Diminished Radix Complement 基数减基数减1补码基数反码)补码基数反码)Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)Review of

7、Chapter 2 (Review of Chapter 2 (第二章内容回顾第二章内容回顾) )Binary Signed-Magnitude, Ones Complement, and Twos Complement Representation (二进制的原码、反码、补码二进制的原码、反码、补码)正数的原码、反码、补码表示相同正数的原码、反码、补码表示相同负数的原码表示:符号位为负数的原码表示:符号位为 1负数的反码表示:负数的反码表示: 符号位不变,其余在原码基础上按位取反符号位不变,其余在原码基础上按位取反 在在 |D| 的原码基础上按位取反包括符号位)的原码基础上按位取反包括符号位

8、)负数的补码表示:反码负数的补码表示:反码 + 1Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)2.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) Only one representations of Zero ( 零只有一种表示零

9、只有一种表示 ) Obtain a Twos- Complement ( 二进制补码的求取二进制补码的求取 ): Ones Complement (反码反码) + 1 (为什(为什么?)么?) Expanding the Sign Bit ( 符号位扩展符号位扩展 )Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)2.5 Representation of Negative Numbers 2.5 Representation of Negative Numbers ( (负数的表示负数的表示) )Example 2.5.2:W

10、rite the 8-bit signed-magnitude, twos-complement for each of these binary numbers. (分别写出下面二进制数的分别写出下面二进制数的8位符号位符号数值码、数值码、补码补码) ( 1101 )2 ( 0 . 1101 )2 Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)2.5 Representation of Negative Numbers 2.5 Representation of Negative Numbers ( (负数的表示负数的表示)

11、 )Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用) 1 1、( ( 1101 )2 1101 )2 2 2、( ( 0 . 1101 )2 0 . 1101 )2 1 1、5 5位二进制表示:位二进制表示: 原码原码 反码反码 补码补码1 1101 1 0010 1 00111 1101 1 0010 1 00112 2、8 8位二进制表示:位二进制表示: 原码原码 反码反码 补码补码1000 1101 1111 0010 1111 00111000 1101 1111 0010 1111 0011 D D 反反 反反 = D

12、 = D D D 补补 补补 = D = D2.6 Twos 2.6 Twos Complement Addition and Complement Addition and Subtraction (Subtraction (二进制补码的加法和减法二进制补码的加法和减法) )Addition Rules: Added by ordinary binary addition (加法:按普通二进制加法相加加法:按普通二进制加法相加)P.39Subtraction Rules: Taking its twos complement, then add (减法:将减数求补,再相加减法:将减数求补,再

13、相加)Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)2.6 Twos 2.6 Twos Complement Addition and Complement Addition and Subtraction (Subtraction (二进制补码的加法和减法二进制补码的加法和减法) )Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用) 2 0010 3 1101 5 0101 5 1011 7 0111 8 11000 7 0111 1 0001 4 1100 6

14、 1010 3 10011 5 101113Adder/Subtractor Example: CalculatorAdder/Subtractor Example: CalculatorPrevious calculator used separate adder and subtractorDIP swi tches108-bitregisterCALCLEDsefclkld88800888882x10110wiciAABBSScowo8-bit adder8-bit subt ractor14Adder/Subtractor Example: CalculatorAdder/Subtra

15、ctor Example: CalculatorImprove by using adder/subtractor, and twos complement numbersDIP switches108-bit register8-bit adder/subtractorsubCALCLEDseSABfclkld1088882.6 Twos 2.6 Twos Complement Addition and Complement Addition and Subtraction (Subtraction (二进制补码的加法和减法二进制补码的加法和减法) )Overflow溢出)溢出)如果加法运算

16、产生的和超出了数制表示的范围,则结果如果加法运算产生的和超出了数制表示的范围,则结果发生了溢出发生了溢出Overflow)。)。 对于二进制补码,加数的符号相同,和的符号与加数的对于二进制补码,加数的符号相同,和的符号与加数的符号不同。(或者,符号不同。(或者,C in 与与 C out 不同)不同) P.41对于无符号二进制数,若最高有效位上发生进位或借位,对于无符号二进制数,若最高有效位上发生进位或借位,就指示结果超出范围。就指示结果超出范围。 5 1011 7 0111 6 1010 3 0011 11 10101 5 10 1010 6 Digital Logic Design and

17、 Application (数字逻辑设计及应用数字逻辑设计及应用)16OverflowOverflowSometimes result cant be represented with given number of bitsEither too large magnitude of positive or negativeEx. 4-bit twos complement addition of 0111+0001 (7+1=8). But 4-bit twos complement cant represent number 70111+0001 = 1000 WRONG answer,

18、1000 in twos complement is -8, not +8Adder/subtractor should indicate when overflow has occurred, so result can be discarded17Detecting Overflow: Method 1Detecting Overflow: Method 1For twos complement numbers, overflow occurs when the two numbers sign bits are the same but differ from the results s

19、ign bitIf the two numbers sign bits are initially different, overflow is impossibleAdding positive and negative cant exceed largest magnitude positive or negative0 1 1 11 0 0 0+000 1sign bitsoverflow(a )1 1 1 10 1 1 1+010 0overflow(b)1 0 0 01 1 1 1+101 1no overflow(c)If the numbers sign bits have th

20、e same value, whichdiffers from the results sign bit, overflow has occurred.18Detecting Overflow: Method 2Detecting Overflow: Method 2Even simpler method: Detect difference between carry-in to sign bit and carry-out from sign bit01111111001000+0001overflow( a )11100010111+0100overflow( b )1000000111

21、1+1011no overflow( c )If the carry into the sign bit column differs from thecarry out of that column, overflow has occurred.2.10 Binary Codes for Decimal Numbers2.10 Binary Codes for Decimal Numbers ( (十进制数的二进制编码十进制数的二进制编码) )Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)A set of n-bit str

22、ings in which different bit stringsRepresent different numbers or other things. (用于表示不同数或其它事件的一组用于表示不同数或其它事件的一组n位二进制码的集合位二进制码的集合)2.10 Binary Codes for Decimal Numbers2.10 Binary Codes for Decimal Numbers ( (十进制数的二进制编码十进制数的二进制编码) )How to represent a 1-bit Decimal number with a 4-bit Binary code (如何用如

23、何用 4位二进制码位二进制码 表示表示 1位十进制码位十进制码)? Binary Coded Decimal (BCD码)码)Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)2.10 Binary Codes for Decimal Numbers2.10 Binary Codes for Decimal Numbers ( (十进制数的二进制编码十进制数的二进制编码) )How to represent a Negative BCD number (负的负的BCD数如何表示数如何表示)?Signed-Magnitude Rep

24、resentation: Encoding of the sign bit is arbitrary (符号数值表示:符号位的编码任意符号数值表示:符号位的编码任意)10s-complement: 0000 indicates plus, 1001 indicates minus. (十进制补码表示:十进制补码表示:0000正,正,1001负负)Addition of BCD Digits (BCD数的加法数的加法) P.50Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)Digital Logic Design and App

25、lication (数字逻辑设计及应用数字逻辑设计及应用)2.10 Binary Codes for Decimal Numbers2.10 Binary Codes for Decimal Numbers ( (十进制数的二进制编码十进制数的二进制编码) (Table 2-9) (Table 2-9)Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)BCD Code2421 CodeExcess-3 (余余3码码)Biquinary Code (二五混合码二五混合码)1-out-of-10 (10中取中取1码码) Weighte

26、d Code (加权码加权码)Self-Complement Code自反码自反码Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)8421 codeNatural code , just like 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 MSB to express h

27、igher/lower part;It has 10 valid codes and 6 invalid codes.2421 codesBCD codesBCD codesExcess-3 codeIts digit is not weighted; 8421 code + “0011”; Self-complementing .Examples: use BCD code for decimal numbers A = 19468421 code : A = 0001 1001 0100 01102421 code : A = 0001 1111 0100 1100Excess-3 cod

28、e: A = 0100 1100 0111 1001 BCD codes1-out-of-10 codeOne hot code:It is very useful in control systems.One hot codesTwo hot codesBiquinary code 7-bits; two hot code; First 2 bits is one hot code for higher/lower range; Last 5 bits is one hot code in the range. Error-detecting property ! From one code

29、 to its neighbor, only one bit changed, no transition state.Temperature code2.11 Gray code2.11 Gray code格雷码)格雷码)Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)2.11 Gray code2.11 Gray code格雷码)格雷码)Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)特点:特点:任意相邻码字间只有一位数位变化任意相邻码字间只有一位数位变化最高

30、位的最高位的0和和1只改变一次只改变一次最大数回到最大数回到0也只有一位码元不同也只有一位码元不同2.11 Gray code2.11 Gray code格雷码)格雷码)Digital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)构造方法构造方法直接构造直接构造 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-c

31、ode code word is 0 if bits i and i+1 of the corresponding binary code word are the same, else bit i is 1. (若二进制码字的第若二进制码字的第 i 位和第位和第 i + 1 位相同,则位相同,则对应的格雷码码字的第对应的格雷码码字的第 i 位为位为0,否则为,否则为1。)Reflected Code反射码)反射码)Gray codesTarget: code for continues changed numbers (in binary system) to prevent wrong c

32、ode 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, the 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

33、 code is 1. Examples: binary number: 1001 0010 0110 0011 Gray codes: 1101 1011 0101 0010Error-detecting codeInformation word + checking bitDigital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)2.12 Character Codes (字符编码字符编码) ASCII码码P36 表表2-11) ASCII code:128 Keyboard signs , 7-bit Used for keyboa

34、rd or display deviceDigital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)2.13 Codes for Actions, Conditions, and States (动作、条件和状态的编码) 运用 b 位二进制编码来表示 n 个不同状态Word: a digital string to represent an object Use n bits, we can make 2n different words;To make n words, you must use bits.n2logDigital Logic Design and Application (数字逻辑设计及应用数字逻辑设计及应用)2.16 Codes for Serial Data Transmission and Storage (用于串行数据传输与存储的编码用于串行数据传输与存储的编码)Parallel way use n-line to transmit an n-bits code words ; transmit an n-bits code words in one time period;Serial way use one line to transmit an n-bits cod

温馨提示

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

评论

0/150

提交评论