Computer Science 281
Second Hour Exam
Name
___________________________
Thursday, March 28
(rescheduled from Tuesday,
March 26)
90 pts.
1.
Truth tables
and circuits
a. (10
pts.) Write the truth table for
the logical expression A(B+C)
A |
B |
C |
B+C |
A(B+C) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
b. (5 pts.) Write
the truth table for the following circuit:
A |
out |
|
|
|
|
c. (10 pts.) Write
the truth table for the following circuit:
A |
B |
out |
|
|
|
|
|
|
|
|
|
|
|
|
d. (10 pts.) Using
any of the typical gates (except XOR), construct a circuit to compute the XOR
function (i.e., if A and B are the inputs, the output is A XOR B).
e. (10 pts.) Draw
the circuit for a half-adder. Be sure to
label all of the inputs.
2. Data representation.
Give all answers in hex.
a. (10
pts.) Construct the integer
representation for the number -13.
b. (10
pts.) Construct the internal
representation for the double-precision floating point number -13.25
3. Bitwise operations
a. (10
pts.) Suppose that x = 0xFFFFFFF6 and
that y = FFFFFFF5. what is
x OR y
x AND y
x XOR y
if x were in %g1, and we executed
srl %g1,
4, %g1
what would the contents of %g1 be?
b. (15
pts.) Write assembly language
code which will test bit 3 of %g2 and which will set bit 2 of %g3 if the bit is
set and clear bit 2 of %g3 otherwise.