Summer A 2001, Computer Organization, Assignment 3

Due Tuesday, June 12, at the start of class.

Type all the answers. Hand in a printout. Upload the assignment via the web: Submitting Homework Online.

  1. (2 points) What is the Micro Assembly Language (MAL) instruction for this hex microinstruction?
    6241E2126
  2. (2 points) What is the hex microinstruction for this Micro Assembly Language (MAL) instruction?
    MAR=SP=OPC-H>>1;wr;if (N) goto 0x192 else goto 0x092
  3. (2) In Mic-1, assume that it takes 1 nsec to set up MIR, 1 nsec to gate a register onto the B bus, 3 nsec to run the ALU and shifter, 1 nsec for the results to propagate back to the registers, and the clock is high for 2 nsec.
    1. Can this machine run at 100 MHz? Explain your answer.
    2. Can this machine run at 150 MHz? Explain your answer.
  4. (1) How long does a 200 MHz Mic-1 take to execute the Java statement
    i = j + k - 3
    Give your answer in nanoseconds.
  5. (2) What would be the microcode to implement the instruction IFGE offset that will branch to offset if the top of the stack is greater than or equal to 0? Indicate the necessary restictions on the location in the microstore of any labels that are used.
  6. (2) The full JVM has a special opcode for loading the third local variable: ILOAD_4. It is equivalent to ILOAD 4(load the fourth local onto the stack, not the iload4 statement from the microcode). However, it is only 1 byte long, with no index following it (in other words, the 4 isn't stored in the machine code anywhere). How could this be implemented in Mic-1? Try to do it in 5 or less instructions.
  7. Consider the following high level language code
    1. (4) Translate it into IJVM symbolic instructions (like IADD, BIPUSH, etc). All variables are local on the stack, be sure to allocate space for them. Use IRETURN to indicate when the main program terminates.
    2. (2) Translate the IJVM into hex, byte code.
    main {
            int total = 0;
            int count;
            int answer;
    
            for (count = 0; count < 10; count++) {
    		answer = calculate(count, 10);
                    if (answer > 0) {
                            total += answer;
                    }
            }
            return 0;
    }
  8. (1) The IJVM INVOKEVIRTUAL instruction needs to know how many parameters it has. Why?
  9. (2 points) State in 10 words or less what each of the following code fragments are doing: 10 words or less for part (a), and ten words or less for part (b) [I used 6 for each]. Do not explain what each line is doing, explain what each block of code does.
    1. PC = PC+1; fetch
      PC = PC+1; fetch
      H = MBRU << 8
      H = MBRU OR H
    2. MAR = SP = SP-1; rd

      TOS=MDR