We want to design a basic Microprocessor System. We can assume that our microprocessor consists of a fixed number of registers, say 4 : A, B, C and D. These registers are capable of storing an integer value in them. The microprocessor should be capable of handling following sets of instructions: -
SET B 7: Sets the value in register B to 7.ADR C A: Adds the content of register A to the content of C and writes it back to C i.e. C = C + AADD D 15: Adds the constant value 15 to the contents of D and writes it back to D i.e. D = D + 15MOV C D: Updates the content of C to the content of D, without changing content of D.INR B: Same as B++, increments value by 1DCR A: Same as A--RST: Resets the values stored inside all registers to 0.
Note : It is very important for the code to be super extensible, so that we can support new instructions like AND, OR, XOR etc in future.