The user's original program must first be translated into machine code. The instructions that make up this machine code can be called macro-instructions (as opposed to the micro-instructions). These macro-instructions are the basic instructions that make up a user's program. When the instruction set (the set of all micro-instructions stored in the control store is executed, it interprets each macro-instruction and executes the command. Macro-instructions are composed of opcodes and addresses. Opcodes are the part of the macro-instruction that tells the computer what the instruction actually is, while the address tells the computer where the data that the instruction acts on is. Each computer has its own unique set of macro-instructions, with varying numbers of opcodes, and varying numbers of addresses for each opcode. In our example, in order to keep things simple, we have implemented a one-address machine. This means that every opcode has only one address with it. The results of every operation are stored in the AC register for use by future instructions. Our macro-instruction set is made up of sixteen instructions, each four bits long with a twelve bit address:
Address Contents 0 1010000000000101 3 0000000000010001 (the number 17) 5 0000000000000011 (the number 3)Micro-instruction 0: mar=pc;rd; The contents of the PC are copied into the MAR and data starts to load from the memory address denoted by the MAR.
PC: 0 AC: 0 IR: 0 TIR: 0 MAR: 0 MBR: 1111111111111111Micro-instruction 1: pc=pc+1;rd; The contents of the PC is incremented and the read cycle is completed.
PC: 1 AC: 0 IR: 0 TIR: 0 MAR: 0 MBR: 1010000000000101Note that the first four bits from the left are the opcode for Add Indirect, while the remaining bits form the number '5' in binary.
PC: 1 AC: 0 IR: 1010000000000101 TIR: 0 MAR: 0 MBR: 1010000000000101Note that N is 1 in this case.
PC: 1 AC: 0 IR: 1010000000000101 TIR: 0100000000001010 MAR: 0 MBR: 1010000000000101Micro-instruction 23: mar=ir&amask;rd; MAR is set to IR AND'ed with AMASK (thus isolating the address) and a read cycle is begun.
PC: 1 AC: 0 IR: 1010000000000101 TIR: 0100000000001010 MAR: 000000000101 MBR: 1111111111111111Micro-instruction 24: rd; The read cycle is completed.
PC: 1 AC: 0 IR: 1010000000000101 TIR: 0100000000001010 MAR: 000000000101 MBR: 0000000000000011Note that the contents of address 5 are '3', and the MBR's contents are now 3.
PC: 1 AC: 0 IR: 1010000000000101 TIR: 0100000000001010 MAR: 000000000011 MBR: 1111111111111111Micro-instruction 5: tir:=lshift(tie);rd;if n goto 10; The TIR is left shifted, the read cycle is finished, and another goto check is performed.
PC: 1 AC: 0 IR: 1010000000000101 TIR: 1000000000010100 MAR: 000000000011 MBR: 0000000000010001Micro-instruction 10: tir=lshift(tir);if n goto 12; The TIR is left shifted again, and another goto check is performed.
PC: 1 AC: 0 IR: 1010000000000101 TIR: 0000000000101000 MAR: 000000000011 MBR: 0000000000010001Micro-instruction 11: ac=ac+mbr;goto 0; The accumulator's contents are added to the contents of the MBR, and we're ready for the next instruction.
PC: 1 AC: 0000000000010001 IR: 1010000000000101 TIR: 0000000000101000 MAR: 000000000011 MBR: 0000000000010001This macro-instruction is now completed, and the cycle begins again.The objective was accomplished, that is, the accumulator now contains 0 plus the contents of the address stored in address 5 (i.e. 17).