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 + 10010 ------- b) 0110111 + 0011100 --------- c) 10010 - 11000 ------- d) 11000001 - 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 30 x 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 13 + -14 = -1 Unsigned Signed b) 10100112 , 55 + 28 = 83 55 + 28 = -45* Unsigned Signed c) 110102 , 18 – 24 = 26* -14 – -8 = -6 Unsigned Signed d) 100011012 , 193 – 52 = 141 -63 - +52 = -115 Unsigned Signed (*-Overflow) (2) a) 01101011 b) 10111011 c) 10000011 d) 10101011 e) 11111101 f) 10110100 a) 0 31 b) 192 c) –64 d) 9 bits e) 192 = 011000000 , -64 = 111000000 (3)