Вы находитесь на странице: 1из 2

Computer Science 304

Computer Organization
Spring 2018
Assignment 1

Due: Wednesday, 2/7/2018

Answer the following questions and submit solutions at the beginning of class on the due date.
Show your work for full credit. All submission must be completely your own work.

1. [15 points] Convert the following decimal values to 12-bit two’s complement binary, octal,
and hexadecimal.

a. 114
b. 568
c. -197
d. 1113
e. -2018

2. [15 points] Convert the following to decimal.

a. 1011 1101 (8-bit two’s complement)


b. A9 3F16 (unsigned)
c. 6378 (9-bit two’s complement)
d. 41335 (12-bit two’s complement)
e. 0111 1001 0101 (12-bit two’s complement)

3. [15 points] For a computer with word size of 12 bits using two’s complement, compute the
following system values in both binary and decimal.

a. Number of values
b. Min unsigned integer
c. Max unsigned integer
d. Max integer
e. Min integer

4. [20 points] Suppose a = 1100 0010 0110, b = 1011 1000 0110, c = 0011 1101 1111. Compute the
following using binary operations assuming 12-bit two’s complement. Express your final an-
swers in both binary and hexadecimal.

a. ~(a & a)
b. a|b|c
c. (a & c) | b
d. ~a ^ b
e. ~((a & b) ^ (b | c))
(continued on back)
5. [20 points] Assuming a, b, and c from problem 4, compute the following using binary opera-
tions assuming 12-bit two’s complement. Express your final answers in both binary and hex-
adecimal. Also, state whether any is an overflow or underflow.

a. a+b
b. (a << 6) + c
c. (c >> 3) + b
d. b–c
e. (c – a) << 4

6. [15 points] Assuming a, b, and c from problem 4, evaluate the following C boolean expres-
sions using binary operations that assume 12-bit two’s complement.

a. (a > 0) || (a & b)
b. (b < 0) && c
c. (c < 0) || !(a && b)
d. (~a ^ b) && !(~c & c)
e. (a >> 11) && (b << 11)

Вам также может понравиться