This tutorial is intended to follow the tutorial on accessing memory in a microprogram.
The purpose of this tutorial is to illustrate how simple addition can be performed in a microprogram. The example program adds the values stored in registers 0 (MDR) and 1 (PC) and stores the result in register 4 (SP).
1. Go to the microprogram editor window.
2. Clear the control store.
To perform any binary operation (AND, OR, or ADD), one operand must first be copied to the H register which drives the A-bus side of the ALU.
3. Set the "Next Addr" field to 000000001.
4. Set up the ALU, B-bus, and C-bus fields to load the value in register 0 into register H. You should know how to do this from the tutorial on accessing registers.
Here is the microinstruction at 0x000:
In performing register transfers you performed an add operation with the ENA (enable A) bit set to 0: ALU = 0 + B-bus. This time, you want to set the ENA bit so that the value in the H register is gated to the A-bus: ALU = H + B-bus.
5. Set the "Next Addr" field to 000000010.
6. Set up the ALU, B-bus, and C-bus fields to add the values stored in H and register 1 (PC) and store the result in register 4 (SP).
Here is the microinstruction at 0x001
7. Write the micro "halt" instruction.
Here is the complete program:
If you want, you can save your microprogram (Control menu, Save Control Store option).
8. Go to the computer simulator window.
9. Reset the computer.
10. Enter a value of 00001111 into MDR and a value of 11110000 into PC:
11. Click Micro Step. Confirm that the value in MDR was copied to register H.
12. Click Micro Step. Confirm that the values in PC and H were added together (yielding a sum of 11111111) and stored in SP.
13. Click Micro Step. The microprogram should terminate.
The next tutorial covers branching in a microprogram.