chapter 9 exercise solution according to edition 8



9.1 Represent the following decimal numbers in both binary sign/magnitude and twos
Complement using 16 bits:
A) 512                                                       B)-29
BINARY VALUE OF 512= 0000 0010 0000 0000
BINARY VALUE OF 29= 0 000 0000 0001 1101
SIGN MAGNITUDE:
512= 0000 0010 0000  0000  (MSB IS  KEPT 0 BECAUSE OF THE POSITIVE SIGN )
-29= 1 000 0000 0001 1101 (MSB IS CHANGED TO 1 BECAUSE NO. HAS A NEGATIVE SIGN)
TWOS COMPLEMENT:
512=0000 0010 0000 0000 (2’S COMPILEMENT IS NOT POSSIBLE BECAUSE IT IS NOT A NEGATIVE NUMBER)
-29= 1 111 1111 1110 0011(AFTER PERFORMING 2’S COMPIMENT)


9.2 Represent the following twos complement values in decimal: 1101011; 0101101.
                      BIT TO DECIDE THE SIGN(that is negative in this case)
a.     1101011 = -21
As the msb is showing that it is a negative number and then we calculate the magnitude as:
·        TAKE TWOS COMPLIMENT
                             16  8     4     2  1
                   0  0   1   0   1    0  1  =21 AND SIGN BIT OF ACTUAL NO. MAKES IT -21

b.     0101101 = 45
Because it starts with zero that indicates it to be a positive number so no 2s compliment is needed.
9.8: calculate (72530-13250) using 10’s compliment arithmetic. Assume rules similar to those for twos compliment arithmetic.
Sol:
We subtract [M+(-N)],where M=72532 and N=13250
M=72532
Tens comp of N= 86750
Sum=
              72532
        +    86750
     ______________
             159282
Discard carry digit: -10000
Result: 59282
9.9: Consider the twos complement addition of two n-but numbers:
Zn-1Zn-2……Zo   =      Xn-1 Xn-2 …. Xo + Yn-1 Yn-2 ….. Yo
Assume that bitwise addition is performed with a carry bit ci generated by the addition of xi+yi and ci-1. Let v be the binary variable indicating overflow when v=1.
Fill the table.

Input
Xn-1
0
0
0
0
1
1
1
1
Yn-1
0
0
1
1
0
0
1
1
Cn-2
0
1
0
1
0
1
0
1
output
Zn-1
0
0
1
0
1
0
1
1
V
0
1
0
0
0
0
1
0





Comments

Popular posts from this blog

CHAPTER # 14 PROCESSOR STRUCTURE AND FUNCTIONS

chapter 10 solution of q 10.6