Summer A 2000, Computer Org, Assignment 3

Due Tuesday 6/13 at the start of class.

  1. (8 points) In the microprogram on page 234,
    1. What would be the hex microcode for the ivokevirtual16 instruction? Assume the next address field in binary is 000110001.
    2. What would be the hex microcode for the if_icmpeq6 instruction? Make up reasonable address for the T and F locations.
    3. What would be the MAL code for the hex microcode of
      0001C2140
    4. What would be the MAL code for the hex microcode of
      2583C00A3
  2. (5 points) Translate the following high level language code into IJVM symbolic instructions (like IADD, BIPUSH, etc). Make the function call and return as is described in the text. All variables are local on the stack, be sure to allocate space for them. Remember to make space for OBJREF when making the call. Use IRETURN to indicate when the main program terminates.
    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;
    }
    
    function calculate(int count, int max) {
    	int result;
    	result = count + max - 30;
    	return result;
    }
    
    
  3. (2 points) Draw a circuit diagram for the "High Bit" box in Fig. 4-6. 
  4. (2 points) The full JVM has a special opcode for loading the third local variable: ILOAD_3. It is equivalent to ILOAD 3. However, it is only 1 byte long, with no index following it. How could this be implemented in Mic-1? Try to do it in 5 or less instructions.
  5. (3 points) State succinctly what each of the following code fragments are doing.
    1. PC = PC+1; fetch
      PC = PC+1; fetch
      H = MBRU << 8
      H = MBRU OR H
    2. MAR = SP = SP-1;rd

      TOS = MDR
    3. TOS = MDR
      MAR = SP = SP+1; wr