Use of Registers and Code - MARIE-js/MARIE.js GitHub Wiki
Say we are Loading value from Address 104, Adding the Number at Address 105 and Storing it in Address 106 with the code:
Load 104
Add 105
Store 106
Halt
Load 104
| Step | RTL | PC | IR | MAR | MBR | AC |
|---|---|---|---|---|---|---|
| (initial) | 100 | - | - | - | - | |
| Fetch | MAR ← PC | 100 | - | 100 | - | - |
| IR ← M[MAR] | 100 | 1104 | 100 | - | - | |
| PC ← PC + 1 | 101 | 1104 | 100 | - | - | |
| Decode | MAR ← IR[11-0] | 101 | 1104 | 104 | - | - |
| (decode operation) | 101 | 1104 | 104 | - | - | |
| Get Operand | MBR ← M[MAR] | 101 | 1104 | 104 | 0023 | - |
| Execute | AC ← MBR | 101 | 1104 | 104 | 0023 | 0023 |
Add 105
| Step | RTL | PC | IR | MAR | MBR | AC |
|---|---|---|---|---|---|---|
| (initial) | AC ← MBR | 101 | 1104 | 104 | 0023 | 0023 |
| Fetch | MAR ← PC | 101 | 1104 | 101 | 0023 | 0023 |
| IR ← M[MAR] | 101 | 3105 | 101 | 0023 | 0023 | |
| PC ← PC + 1 | 102 | 3105 | 101 | 0023 | 0023 | |
| Decode | MAR ← IR[11-0] | 102 | 3105 | 105 | 0023 | 0023 |
| (decode operation) | 102 | 3105 | 105 | 0023 | 0023 | |
| Get Operand | MBR ← M[MAR] | 102 | 3105 | 105 | FFE9 | 0023 |
| Execute | AC ← MBR | 101 | 1104 | 104 | FFE9 | 000C |