Sprint 2001, Computer Org, Assignment 4

Due Tuesday, June 19 at the start of class

  1. (3 points) Assume there is an extra condition code for overflow (O). There is also a new jump bit in the microcode: JAMO. Create the Mic-1 microcode for IFGTS (If Greater Than Signed). If the Z bit is set, then it will not branch. It will branch if the N bit is 0 and the O bit is 0 (provided the Z bit is not set), or if the N bit is 1 and the O bit is 1. This instruction does not remove anything from the stack, it only tests the state of the condition codes and branches based on them. The instruction will have an operand that is the 16-bit offset for the jump (just like IFLT). Indiacte any relationships between some of the pairs of labels in your code. 
  2. (4 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 word on 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. You may not make any assumptions about what the opcode for the instruction is. (Hint: You will need to generate the number 31)
  3. (2 points) Draw a finite state machine for branch prediction that uses three bits. It should only change predictions after three consecutive mispredictions.
  4. (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 IF_ICMPEQ.
  5. (3 points) In Fig. 4-43, suppose that I6 was R6=R0-R2 and I8 was R2=R4+R4. Redraw the chart. You do not need to indicate the scoreboard for the registers being read and written.
  6. (1 point) Do question 27 from the Chapter 4 exercises in the book.
  7. (4 points) Consider the direct-mapped cache on page 267.