HELP

Step 1: Input the Program

The  left-most panel of the simulator window is where the assembly level program has to be entered by the user. The user can enter the program by entering commands using the combo boxes. However, this facility allows the user to only enter a maximum of 12 instructions in the program. To enter larger programs the user can go to the editor by pressing the "Editor" button available right below the combo boxes.

If the user is entering the instructions using the combo boxes, it has to be made sure that the last instruction is the "END" instruction. If the program is being entered in the editor, the "END" is not necessary.

Once the program has been entered via the combo-boxes/editor, the user can press the "Go" button. This brings a new screen in the leftmost panel. In this screen, user can enter various parameters for the branch target buffer. Pressing the "Back" button takes the user back to the previous screen in this panel. Pressing the "Go" button here will display a new screen which will show the program that has been entered.

When the program is being executed, the instruction that is currently being executed is displayed in red.

Step 2: Press StepInstruction/StepBranch/RunToEnd Button to run the program & Choose the statistics and/or registers to display

The right-most panel of the simulator shows the various options for the user to run the program. The user can choose to press the following buttons:

In addition, when the program is running the user is also shown how the branch target buffer is changing. The user can also choose to view some specific registers (while the program is running) and statistics (once the program has finished). The choice of registers and statistics is made in the panel at the bottom. This choice can be done at any time - while running the program/at the start of the program/at the end of the program.

Step 3: Entering a fresh program

At any stage, to start the simulator again and enter a new program, press the "Reset" button in the right panel.

Valid Instructions and their Syntax

Each instruction should be followed by a ";" (semicolon). This is only required for programs entered in the editor. For programs entered through combo-boxes, no semicolon is specified. Valid registers are R1, R2, R3......R32. Any other register specified is considered to be invalid. An immediate value has to be pre-pended with a #. The labels specified for branch instructions can be any combination of alphabets and numerals and "_" except that the label should not start with a numeral.

The program can use the following instructions:

  1. MOV: This instruction moves a value into a register from another register or from an immediate value. For eg.
        "MOV R1 R2;"    will move the value of R2 into R1.
        "MOV R1 #3;"     will move the value 3 into R1.

  2. ADD: This instruction adds 2 values (from 2 registers or from a register and an immediate value) and puts them into a register. Similar format is used for SUB, MULT, DIV, MOD. For eg.
        "ADD R1 R2 R3;"    will move the value R2+R3 into R1.
        "ADD R1 R2 #3;"    will move the value R2 + 3 into R1.

  3. SUB: This instruction subtracts 2 values and puts them into a register. For eg.
        "SUB R1 R2 R3;"    will move the value R2-R3 into R1.
        "SUB R1 R2 #3;"    will move the value R2 - 3 into R1.

  4. MULT: This instruction multiplies 2 values and puts them into a register. For eg.
        "MULT R1 R2 R3;"    will move the value R2 * R3 into R1.
        "MULT R1 R2 #3;"    will move the value R2 * 3 into R1.

  5. DIV: This instruction divides 2 values and puts them into a register. For eg.
        "DIV R1 R2 R3;"    will move the value R2 / R3 into R1.
        "DIV R1 R2 #3;"    will move the value R2/3 into R1.

  6. MOD: This instruction calculates the remainder obtained by dividing two values. For eg.
        "MOD R1 R2 R3;"    will move the value R2%R3 into R1.
        "MOD R1 R2 #3;"    will move the value R2 % 3 into R1.

  7. BEQ: This instruction jumps to a label if the value of first operand is equal to the value of second operand. For eg.
        "BEQ R1 R2 label;"    will jump to the label if R1 is equal to R2.
        "BEQ R1 #3 label;"     will jump to the label if R1 is equal to 3.

  8. BNE: This instruction jumps to a label if the value of first operand is not equal to the value of second operand. For eg.
        "BNE R1 R2 label;"    will jump to the label if R1 is not equal to R2.
        "BNE R1 #3 label;"     will jump to the label if R1 is not equal to 3.

  9. BLE: This instruction jumps to a label if the value of first operand is less than or equal to the value of second operand. For eg.
        "BLE R1 R2 label;"    will jump to the label if R1 is less than or equal to R2.
        "BLE R1 #3 label;"     will jump to the label if R1 is less than or equal to 3. 

  10. BGE: This instruction jumps to a label if the value of first operand is greater than or equal to the value of second operand. For eg.
        "BGE R1 R2 label;"    will jump to the label if R1 is greater than or equal to R2.
        "BGE R1 #3 label;"    will jump to the label if R1 is greater than or equal to 3.

  11. BLT: This instruction jumps to a label if the value of first operand is less than the value of second operand. For eg.
        "BLT R1 R2 label;"    will jump to the label if R1 is less than R2.
        "BLT R1 #3 label;"    will jump to the label if R1 is less than 3.

  12. BGT: This instruction jumps to a label if the value of first operand is greater than the value of second operand. For eg.
        "BGT R1 R2 label;"    will jump to the label if R1 is greater than R2.
        "BGT R1 #3 label;"     will jump to the label if R1 is less than 3.

  13. END: This instruction doesn't do anything. It is just to show the end of the program. No further instructions specified after this instruction will be executed.