Due: September 12th 11pm.
Ques.1:
Number conversions.
(a)
Convert
the
binary number 01100101 to decimal.
(b)
Convert
the
decimal number 17 to an 8-bit unsigned binary representation.
(c)
Convert
the 8-bit
2’s complement binary number 11001010 to decimal.
(d)
Convert
the
decimal number -101 to an 8-bit 2’s complement binary
representation.
(e)
Convert
the
decimal number -101 to an 8-bit signed magnitude binary representation.
(f)
Convert
the 8-bit
unsigned binary number 11011110 to hexadecimal.
(g)
Convert
the
unsigned hexadecimal number 24 to unsigned 8-bit binary.
Ques.2:
Arithmetic and logical operations.
Let A = 00110101 and B = 11001011 be 2’s complement integers.
Compute the
following. Assume a fixed width of 8 bits (i.e., your answers
must be 8
bits). Please show your work
-- failure to do so means you get zero points.
(a) A +B
(b) A
OR B
(c) A
AND B
(d) B − A
(e) A − B
(f) A +B’ + 1
(B’ refers to
complement of
B)
Ques.3:
Consider the following 8-bit 2’s complement
numbers:
A = 01111111, B = 00000101, and C = 10001011. Assume that only 8 bits are
available to represent values.
Show your
work.
(a)
Evaluate
A+B.
Give your answer as an 8-bit 2’s complement
number. Convert this number to decimal. Does this represent the sum of A
and
B? If your answer is No, then explain.
(b)
Evaluate
C−A.
Give your
answer as an 8-bit 2’s complement number. Convert this number to
decimal. Does
this represent the difference of C and A? If your
answer is No,
then explain.
Ques.4: Logical
operations. Complete
the following truth tables. The notation A’ refers to complement
of logical
variable A (i.e., the operation NOT A).
|
A |
B |
C |
(A AND B) OR C |
(A AND C) OR
(B AND C) |
|
0 |
0 |
0 |
|
|
|
0 |
0 |
1 |
|
|
|
.. |
.. |
.. |
.. |
.. |
|
1 |
1 |
1 |
|
|
|
A |
B |
C |
(A AND B) AND
(A’ AND B’) OR C |
|
|
|
|
|