2 ms·
> For an architecture with 50 instructions and 15 registers, that's 168750 instructions, which would require 18-bit opcodes. Interestingly, the optimal index-ba
by mcphage 7y ago
> For an architecture with 50 instructions and 15 registers, that's 168750 instructions, which would require 18-bit opcodes. Interestingly, the optimal index-based implementation would use 6 bits per opcode and 4 bits per register, also for a total of 18 bits per instruction.
Wouldn't it have to be the same # of bits/instruction, since it's the exact same information?
- traes 7y agoSometimes it can actually be more efficient, since more bits are wasted with indexing. Random example: 1234 opcodes, 12 registers. 1234 * 12^3 = 2132352 (22 bits) 1234 is 11 bits, 12 is 4 bits 11 + 3*4 = 23 bits so in this case, using indexes is less efficient by one bit per instruction.