正在加载图片...
反码 Ones'Complement2 反唱Ones, Complement ◆符号位应和数值位一同运算!!! ◆反码(1 s complement ●正数的反码:与原码相同 1011 ●负数的反码:“1"为符号位,数值位按位取反 1111A1s 10114 Ones' Complement Arithmetic Questions sians 1.M+N是否有可能 Carry out of the sign position? 710111 M+N呢? End-around cart 2.如何判定是否溢出? 019 +01111 1 End-around carry 0001 When result carry=1 (i.e. Carry out of the sign position) we have end around carry subtract 2" and +1 补码 Twos complement Two’ s complement ◆补码(2 s complement ●源于补数,计量系统最大量程—模 示例:时分秒,(+9)12和(-3)2两种处理方式 Ex. Two's complement of7 sub 7 =0111 ◆补码的意义 1001= Repr. of -7 ●两数之和等于模值,则两数互补 ●减其中一数,(等于)可视为加上其补数 Ex. Two's complement of-7 sub-7= 1001 0011,1111 0111 Repr of 0011,1101 Twos complement =bitwise complement+ 1 +)1100,0011 000000 0111÷1000+1÷1001( epresentation of-7) 0000,0010 1001→0110+1÷0111( epresentation of7) 77 38 反码Ones’ ComplementL2 ’ Complement ‹ 符号位应和数值位一同运算!!! ‹ 反码(1’s complement) z正数的反码:与原码相同 z负数的反码:“1”为符号位,数值位按位取反 39 0000 0111 0011 1011 1111 1110 1101 1100 1010 1001 1000 0110 0101 0100 0010 0001 +0 +1 +2 +3 +4 +5 +6 -7 +7 -6 -5 -4 -3 -2 -1 -0 0 100 = + 4 1 011 = - 4 + - 1111 All 1s 0100 4 —— 1011 -4 反码Ones’ Complement Complement 40 4 + 3 7 0100 0011 0111 -4 -3 -7 1011 1100 10111 End-around carry End-around carry Same signs Different signs When result carry = 1 (i.e. Carry out of the sign position) we have end around carry Æ subtract 2n and +1 Ones’ Complement Arithmetic 1 1000 1 0001 4 -3 1 0100 1100 10000 0000 0111 0011 1011 1111 1110 1101 1100 1010 1001 1000 0110 0101 0100 0010 0001 +0 +1 +2 +3 +4 +5 +6 -7 +7 -6 -5 -4 -3 -2 -1 -0 -0 +0 -0 1111 0000 1111 -0 + -0 +0 1111 1111 11110 42 1. M+N是否有可能Carry out of the sign position? -M+N呢? Questions 2. 如何判定是否溢出? 43 补码Two’s complement s complement ‹ 补码(2’s complement) z源于补数,计量系统最大量程——模 z示例:时分秒,(+9)12和(-3)12两种处理方式 ‹ 补码的意义 z两数之和等于模值,则两数互补 z减其中一数,(等于)可视为加上其补数 示例: (63)10-(61)10= 2 (63)10+(195)10= 2 0011,1111 -) 0011,1101 0000,0010 0011,1111 +) 1100,0011 1 0000,0010 44 2 C n A = − A 2 = 10000 7 = 0111 1001 = Repr. of -7 4 Ex. Two’s complement of 7 sub Ex. Two’s complement of -7 2 = 10000 -7 = 1001 0111 = Repr. of 7 4 sub Shortcut method: Two’s complement = bitwise complement + 1 0111 Æ 1000 + 1 Æ 1001 (representation of -7) 1001 Æ 0110 + 1 Æ 0111 (representation of 7) Two’s complement s complement ( ) −A
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有