Summer A 1999, Computer Org, Assignment 5

Due Wednesday 6/16 at 5 pm, it cannot be late

You must hand in the assignment on time.

  1. (3 points) The instruction ISHR (arithmetic shift right) exists in JVM but not in IJVM. It uses the top two values on the stack, replacing the top with a single value, the result. The second from top word of the stack is the operand to be shifted. Its content is shifted right by a value between 0 and 31 inclusive, depending on the value in the 5 least significant bits of the top word on the stack (the other 27 bits of the top word are ignored). The sign bit is replicated to the right for as many bits as the shift count. Extend the microcode to include this instruction as part of IJVM.
  2. (2 points) The JVM INVOKEVIRTUAL instruction needs to know how many parameters it has. Why?
  3. (2 points) Explain in detail why INVOKEVIRTUAL is only 11 instructions in Mic-2, but 22 instructions in Mic-1. Indicate why some instructions could be combined, and why some instructions could be eliminated altogether.
  4. (3 points) Draw a finite state machine for branch prediction that uses three bits. It should only change predictions after three consecutive mispredictions.
  5. (3 points) Mic-3. Figure 4-33 on page 258 shows how the SWAP instruction from Mic-2 would be sequenced in Mic-3. Create a similar table for ISTORE.
  6. (3 points) In Fig. 4-43, suppose that I6 was R5 = R0 - R2. Indicate which instructions could be issued and which could be retired in each cycle from cycle 6 forward. There will be fewer cycles to complete all the instructions.
  7. (4 points) Consider the direct-mapped cache on page 267.