Tutorial 3 (week 6) Mic-‐1 MMV Simulator & IJVM assembly programming In this practical, you'll experience Assembly programming using the Mic-‐1 MMV microarchitecture simulator. Mic-‐1 is a Java-‐based simulator that implements the Mic-‐1 microarchitecture described in Chapter 4 of Andrew S. Tanenbaum, Structured Computer Organization, Fifth Edition (Prentice-‐Hall, 2006). It supports the following IJVM instructions: Mnemonic Operands Description BIPUSH byte Push a byte onto stack DUP N/A Copy top word on stack and push onto stack ERR N/A Print an error message and halt the simulator GOTO label name Unconditional jump HALT N/A Halt the simulator IADD N/A Pop two words from stack; push their sum IAND N/A Pop two words from stack; push Boolean AND IFEQ label name Pop word from stack and branch if it is zero IFLT label name Pop word from stack and branch if it is less than zero IF_ICMPEQ label name Pop two words from stack and branch if they are equal IINC variable name, byte Add a constant value to a local variable ILOAD variable name Push local variable onto stack IN N/A Reads a character from the keyboard buffer and pushes it onto the stack. If no character is available; 0 is pushed INVOKEVIRTUAL method name Invoke a method IOR N/A Pop two words from stack; push Boolean OR IRETURN N/A Return from method with integer value ISTORE variable name Pop word from stack and store in local variable ISUB N/A Pop two words from stack; push their difference LDC_W constant name Push constant from constant pool onto stack NOP N/A Do nothing OUT N/A Pop word off stack and print it to standard out POP N/A Delete word from top of stack SWAP N/A Swap the two top words on the stack WIDE N/A Prefix instruction; next instruction has a 16-‐bit index Lab tasks 1. Download “mic1.zip” on the course webpage and store in your directory (e.g., comp5213) 2. Unzip “mic1.zip” using any compression software program of your choice (e.g., WinZip, PowerArchive, or simply the unzip utility in Unix) 3. After unzipping, there will be a directory called “mic1” containing all necessary files for Mic-‐1 simulator including its user guide and some example assembly programs 4. Go to “doc” directory under “mic1”, open “index.html”, and read through 5. Go to “JAS-‐IJVM” directory under “mic1/examples”, and take a look at IJVM Assembly programs (i.e., add.jas, echo.jas and ijvm.jas). DO NOT OPEN .ijvm files 6. Once you’ve finished reading the documentation and looking at code examples, go to the “bin” directory under “mic1”, and run either of Mic-‐1 simulators (either Mic1MMV_hr.jar or Mic1MMV_lr.jar) using the following command in your terminal window: -‐bash-‐2.05b$ java –jar Mic1MMV_hr.jar 7. Note that, this will not work with PuTTy 8. Load and assemble echo.jas, run it, and find out what it does