Homework 3
3.1. Convert 4096ten into a 32-bit two's complement binary number.
3.2. Convert -2047ten into a 32-bit two's complement binary number.
3.3. Convert -2,000,000ten into a 32-bit two's complement binary number.
3.4 What decimal number does this two's complement binary number represent:
1111 1111 1111 1111 1111 1111 0000 0110
two?
3.5 What decimal number does this two's complement binary number represent:
1111 1111 1111 1111 1111 1111 1110 1111
two?
3.6 What decimal number does this two's complement binary number represent:
0111 1111 1111 1111 1111 1111 1110 1111
two?
3.7 Find the shortest sequence of MIPS instructions to determine the absolute
value of two's complement integer. Convert this instruction (accepted by the MIPS
assembler):
abs $t2, $t3
This instruction means that register $t2
has a copy of register $t3
if register $t3
is positive, and the two's complement of register $t3
if $t3
is negative. (Hint: it can be done with three instructions).
3.10 Find the shortest sequence of MIPS instructions to determine if there is a carry
out from the addition of two registers, say, registers $t3
and $t4
.
Place a 0 or 1 in register $t2
if the carry out is 0 or 1, respectivelly. (Hint:
it can be done in two instructions).
3.12 Suppose that all of the conditional branch instructions except beq
and bne
were removed from the MIPS instruction set along with slt
and all of its variants (slti, sltu, sltui
). Show how to perform:
slt $t0, $s0, $s1
using the modified (reduced) instruction set in which slt
is not available. (Hint:
it requires more than two instructions).
3.39 Show the IEEE 754 binary representation for the floating point-number 0.1ten
in single and double precision.
3.44 The IEEE 754 floating-point standard specifies 64-bit double precision with a 53-bit
significand (including the implied 1) and the 11-bit exponent. IA-32 offers an extended precision
option with a 64-bit significand and a 16-bit exponent.
- Assuming extended precision is similar to single and double precision, what is the bias in
the exponent?
- What is the range of numbers that can be represented by the extended precision option?
- How much greater is this accuracy compared to double precision?
B.1, B.2, and B.15 can be found in here. (If you
need Appendix B, let me know via e-mail).
B.11 Assume that X consists of 3 bits: x2 x1 x0. Write four logic functions that are
true if and only if:
- X contains only one 0
- X contains an even number of zeros
- X when interpreted as an unsigned binary number is less than 4
- X when interpreted as a signed (two's complement) binary number is negative