

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


CEG 320/520, Homework #1 Solutions
Page 1 of 2
Name: _____________________________
Assume we have an eight-bit machine, and that we are using unsigned eight-bit integers. Perform the following addition operations. For each operation convert both numbers to eight-bit binary numbers, perform the operation, and express the result as an unsigned hex and an unsigned decimal number. Finally, indicate whether unsigned overflow has occurred.
EXAMPLE: Binary Unsigned Hex Unsigned Decimal Overflow? 212 11010100
PROBLEMS:
Binary Unsigned Hex Unsigned Decimal Overflow? 112 01110000
Binary Unsigned Hex Unsigned Decimal Overflow? 31 00011111
Binary Unsigned Hex Unsigned Decimal Overflow? 241 11110001
Binary Unsigned Hex Unsigned Decimal Overflow? 201 11001001 +112 +01110000 $39 57 YES 00111001
Binary Unsigned Hex Unsigned Decimal Overflow? 128 10000000
CEG 320/520, Homework #1 Solutions
Page 2 of 2
Assume we have an eight-bit machine, and that we are using signed 2’s complement eight-bit integers. Perform the following addition operations. For each operation, convert both numbers to eight-bit binary numbers, perform the operation, convert the result to 2’s complement hex, and express the result as a signed decimal number. Finally, indicate whether 2’s complement overflow has occurred.
EXAMPLE 1: 2’s complement 2’s complement Hex Signed Decimal Overflow? 117 01110101
2’s complement 2’s complement Hex Signed Decimal Overflow? 82 01010010
2’s complement 2’s complement Hex Signed Decimal Overflow? 112 01110000
2’s complement 2’s complement Hex Signed Decimal Overflow? 93 01011101 -24 +11101000 $45 69 NO 01000101
2’s complement 2’s complement Hex Signed Decimal Overflow? -61 11000011 -27 +11100101 $A8 -88 NO 10101000
2’s complement 2’s complement Hex Signed Decimal Overflow? -103 10011001 -39 +11011001 $72 114 YES 01110010