Skip navigation

This solution is for the book I am currently reading. All of my notes and solutions are available at Google Code.

Here is my work for problem 2.29:

Fill in the following table in the style of Figure 2.24. Give the integer value of
the 5-bit arguments, the values of both their integer and two's-complement sums,
the bit-level representation of the two's-complment sum, and the case from the
derivation of Equation 2.14.

   x         y        x + y    x+t5y        Case
-----------------------------------------------------
[10100]   [10001]      -27      5             1
-----------------------------------------------------
[11000]   [11000]      -16     -16            2
-----------------------------------------------------
[10111]   [01000]       -1     -1             2
-----------------------------------------------------
[00010]   [00101]        7      7             3
-----------------------------------------------------
[01100]   [00100]       16     -16            4
-----------------------------------------------------

Work:

[10100]   [10001]

 -2^4 + 2^2
 -16 + 4
 -12

 10001
 -16 + 1
 -15

 -12 + -15 = -27

Possible negative max: -16
possible positive max: 15

2^w = 2^5 = 32

-27 + 32 = 5

[11000]   [11000]

-2^4 + 2^3 =
-16 + 8 = -8

-8 + -8 = -16
within range



[10111]   [01000]

-2^4 + 2^2 + 2^1 + 2^0 =
-16 + 4 + 2 + 1
-9

8
-1

[00010]   [00101]

2 + 5 = 7

[01100]   [00100]

12 + 4 = 16

Possible positive max: 15

16 in binary:
-0 + 16
[010000]
take of extra bit:
[10000]
-2^4
-16

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: