but even if we use them can we increase the range of the immediate operand?
Thanks, I got it. Even if we were to use the lost encodings, not every opcode would be able to use the range increased above 2^n -1.
Here is one such encoding that uses expanded opcode:
0-5 : first register operand
6-11: second register operand
Bits after 11:
- For the first 32 opcodes: 6 bits needed ( the format is 0 _ _ _ _ _ ), 14 bits left for immediate value
- For the next 8 opcodes: 5 bits needed (1 0 _ _ _ ), 15 bits for immediate value
- For next 4 opcodes: 5 bits needed (1 1 0 _ _ ), 15 bits for immediate value
- For the last opcode : 3 bits needed (1 1 1), 17 bits immediate value.
So for just one opcode we will get immediate value range of 0 to 2^17-1.
Clearly, not every opcode gets equal range of immediate value. The question never said that all opcodes need equal range for immediate value, but I think it is valid to assume that immediate operands should have same range across all opcodes if nothing else is specified. is this correct?