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.22:

Show that each of the following bit vectors is a two's complement representation
of -5 by applying Equation 2.3

A. [1011]
B. [11011]
C. [111011]

Observe that the second and third bit vectors can be derived from the first by sign
extension.

Answers:

A.
 1011
 -(1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (1 * 2^0)
 -8 + 0 + 2 + 1
 -8 + 3
 -5

B.
 11011
 -(1 * 2^4) + (1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (1 * 2^0)
 -16 + 8 + 0 + 2 + 1
 -8 + 3
 -5

c.
 111011
 -(1 * 2^5) + (1 * 2^4) + (1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (1 * 2^0)
 -32 + 16 + 8 + 0 + 2 + 1
 -16 + 8 + 3
 -8 + 3
 -5



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: