First Exam, Fall 1997
1. A computer executes a program that consists of 75% integer
instructions, 10% floating-point instructions, and 15% string
instructions. The integer instructions all require 1 clock to
execute, the floating-point instructions require an average of
2.0 clocks to execute, and the string instructions require an
average of 4.0 clocks to execute. The processor uses a 125 MHz
clock.
- How long is the clock period, in nanoseconds.
- What is the average number of clocks per instruction for the
entire program.
- How long would it take to run the program (in seconds) if
it has to execute a total of a billion instructions.
- If there were a way to make the string instructions execute
in an average of 2.0 clocks instead of 4.0, what would the total
execution time be for the same program, in seconds.
- What speedup does your answer to (1D) represent.
2.
- Tell the name and number of bits for each field of a MIPS
lw instruction.
- Tell how the MIPS CPU uses the contents of these fields to
compute the address of the memory word to be loaded.
- You should have mentioned all but two of the fields in your
answer to (2B); Tell how the CPU uses these other two fields when
it processes a lw instruction.
3.
- Tell the name and number of bits for each field of a MIPS
beq instruction.
- Tell how the MIPS CPU uses the contents of these fields to
compute the address of the next instruction to execute if the
branch succeeds.
- Tell how the MIPS CPU determines the address of the next instruction
to execute if the branch fails.
4. In a MIPS CPU, assume register 18 contains 0x7FFFFFFF and register
19 contains 0x80000000:
- Which register contains the numerically larger two's complement
value.
- What will be the contents of register 17 after this instruction
is executed (answer in hexadecimal):
slt $17, $18, $19
- Translate that instruction into hexadecimal. Show all work.
- What will be the contents of register 17 after this instruction
is executed (answer in both hexadecimal and decimal):
add $17, $18, $19
- Tell the value of the carry out of the leftmost position when
the add instruction
in (4D) is executed, and whether or not overflow occurs.
5. Encode -7.6875 as an IEEE-754 single precision number. Answer
in hexadecimal, and show all work.