Decode
The decode microinstruction is usually the last microinstruction in the fetch sequence. It is used to simulate a decoder. An instruction register (ir) must be specified. CPU Sim will decode the instruction in the ir, i.e., determine which machine instruction is to be executed, as follows.
CPU Sim initially inspects the leftmost bit of the ir. If there is a machine instruction with an opcode of one bit that matches the leftmost bit of the ir, then that machine instruction is chosen as the decoded instruction. If there is no such machine instruction, then the leftmost two bits of the ir are inspected and CPU Sim looks for a machine instruction with a 2-bit opcode that matches those two bits. CPU Sim continues inspecting more and more bits of the ir until it finds a machine instruction whose opcode matches those bits. Therefore, if you have one instruction with a one-bit opcode of 0 and another instruction with a two-bit opcode of 01, then the second instruction will never be decoded and executed. Once a machine instruction has been decoded, execution of the fetch sequence stops and execution of the decoded instruction begins, starting with the first microinstruction in its execute sequence.
Parameters: