Exercises – Signed Binary Arithmetic – CSE 271 K. Dudeck

1. Determine the unsigned and signed decimal equivalent operations for the following binary operations. Also indicate if any of these equivalent operations generate an overflow condition.

a) 01101 b) 0110111 + 10010 + 0011100 ------

c) 10010 d) 11000001 - 11000 - 00110100 ------

2. Convert each of the following numbers into Signed 2’s Complement Binary Numbers. Use 8 bits for each conversion.

a) +10710 d) -1258

b) -6910 e) -112

c) –12510 f) +4C16

3. Suppose you have to write an assembly program that performs the following calculation:

y  x 2  30x 161

The input x is an UNSIGNED five-bit binary number.

a) What is the decimal range for input x?

b) What is the maximum positive value for y?

c) What is the maximum negative value for y?

d) How many bits will you need to allocate for the SIGNED result y?

e) Convert your decimal answers for parts b) and c) to SIGNED 2’s complement binary. Answers

(1) a) 111112 , 13 + 18 = 31 Unsigned 13 + -14 = -1 Signed

b) 10100112 , 55 + 28 = 83 Unsigned 55 + 28 = -45* Signed

c) 110102 , 18 – 24 = 26* Unsigned -14 – -8 = -6 Signed

d) 100011012 , 193 – 52 = 141 Unsigned -63 - +52 = -115 Signed (*-Overflow)

(2)

a) 01101011 b) 10111011 c) 10000011

d) 10101011 e) 11111101 f) 10110100

(3)

a) 0 31 b) 192 c) –64

d) 9 bits e) 192 = 011000000 , -64 = 111000000