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.

  1. How long is the clock period, in nanoseconds.
  2. What is the average number of clocks per instruction for the entire program.
  3. How long would it take to run the program (in seconds) if it has to execute a total of a billion instructions.
  4. 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.
  5. What speedup does your answer to (1D) represent.

2.

  1. Tell the name and number of bits for each field of a MIPS lw instruction.
  2. Tell how the MIPS CPU uses the contents of these fields to compute the address of the memory word to be loaded.
  3. 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.

  1. Tell the name and number of bits for each field of a MIPS beq instruction.
  2. 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.
  3. 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:

  1. Which register contains the numerically larger two's complement value.
  2. What will be the contents of register 17 after this instruction is executed (answer in hexadecimal):
    slt $17, $18, $19
  3. Translate that instruction into hexadecimal. Show all work.
  4. What will be the contents of register 17 after this instruction is executed (answer in both hexadecimal and decimal):
    add $17, $18, $19
  5. 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.