2-3编码.pptVIP

  • 3
  • 0
  • 约5.83千字
  • 约 31页
  • 2016-08-22 发布于河南
  • 举报
2-3编码

课前习题: 1、已知:1810=000100102 求其相反数的补码表示: -1810=( )2 2、写出-4910的二进制原码、补码表示。 3、已知:100111012是某个数的补码,问其用十进制的表达为? 4、分别以符号-数值数制、反码、补码将-39表示为一个8位数。 1、已知:1810=000100102 求其相反数的补码表示: -1810=( )2 2、写出-4910的8为二进制原码、补码表示11001111 3、已知:100111012是某个数的补码,问其用十进制的表达为? -99 4、分别以符号-数值数制、反码、补码将-24表示为一个8位数11100111 Sum up for the Complement (总结) Positive number has the same: Sign-Magnitude, Ones’ – Complement, and Two’s- Complement ( 正数的原码、反码、补码相同) Sign extension (符号位扩展) We can convert an n-bit two’s complement number X into an m-bit one, but some care is needed. If m n, we must append m - n copies of X’s sign bit to the left of X . That is, we pad a positive number with 0s and a negative one with 1s; this is called sign extension. If m n, we discard X’s n – m leftmost bits; however, the result is valid only if all of the discarded bits are the same as the sign bit of the result . What is most interesting is that we can also subtract n (or add -n) by moving the arrow 16 - n positions clockwise. Notice that the quantity 16 - n is what we defined to be the 4-bit two’s complement of n, that is, the two’s-complement representation of -n. (P41) 2.6 Two’s – Complement Addition and Subtraction (二进制补码的加法和减法) we define [x] to be the two’s complement representation of x [x + y] = ( [x] + [y] ) [x - y] = ( [x] + [-y] ) -5 1011 +7 0111 + -6 + 1010 + +3 +0011 2.6.3 Overflow(溢出)(P41) 如果加法运算产生的和超出了数制表示的范围,则结果发生了溢出(Overflow)。 Addition of two numbers with different signs can never produce overflow, but addition of two numbers of like sign can . An addition overflows if the signs of the addends’ signs are the same but the sum’s sign is different from the addends’ sign. 2.6.3 the rule for detecting overflow (溢出的

文档评论(0)

1亿VIP精品文档

相关文档