This preview shows page 1. Sign up to view the full content.
Unformatted text preview: y truncating the representation to Û bits. The result is not as familiar mathematically as modular addition, however. The Û-bit two’s complement sum of two numbers has the exact same bit-level representation as the unsigned sum. In fact, most computers use the same machine instruction to perform either unsigned or signed 2.3. INTEGER ARITHMETIC
x +y 57 +2w
Case 4 Positive Overflow x +t y +2w –1
Case 3 +2w –1 0 –2w –1
Negative Overflow 0
Case 2 –2w –1
Case 1 –2w Figure 2.17: Relation Between Integer and Two’s Complement Addition. When Ü · Ý is less than ¾Û ½, there is a negative overﬂow. When it is greater than ¾Û ½ · ½, there is a positive overﬂow. addition. Thus, we can deﬁne two’s complement addition for word size Û, denoted as +tÛ on operands and Ý such that ¾Û ½ Ü Ý ¾Û ½ as Ü Ü +t Ý
Û Í¾Ì Û ´Ì¾Í Û ´Üµ +u Ì¾Í Û ´Ý µµ Û (2.11) By Equation 2.3 we can write Ì¾Í Û ´Üµ as ÜÛ ½ ¾Û · Ü, and Ì¾Í Û ´Ý µ as ÝÛ ½ ¾Û · Ý . Using the pro...
View Full Document
- Spring '10
- The American