Design a variablelength opcode to allow all of the following
Design a variable-length opcode to allow all of the following to be encoded in a 36-bit instruction:
instructions with two 15-bit addresses and one 3-bit register number
instructions with one 15-bit address and one 3-bit register number
instructions with no addresses or registers.
Solution
Design a variable-length opcode to allow all of the following to be encoded in a 36-bit instruction:
instructions with two 15-bit addresses and one 3-bit register number
instructions with one 15-bit address and one 3-bit register number
instructions with no addresses or registers.
Answer:-
1) The first format consists of a 3-bit opcode, two 15-bit address fields and one 3-bit register field. The 3-bit opcode allows for 7 instructions and one opcode for \"expansion\".
2) The second format consists of a 3-bit fixed \"extended\" opcode field, 15-bits for the extended opcode, one 15-bit address field, and one 3-bit register field. The 15-bit extended opcode allows 32,768 unique instructions, which easily contains the required 500 instructions.
3) The third format consists of a 3-bit fixed \"extended\" opcode field, a fixed 15-bit \"extendedextended\" opcode field, and 18-bits for additional instructions. Alternately, the second format had plenty of opcodes available to define 50 instructions where the address and register fields would be ignored.
