ISA & Assembly
What is the main advantage of making instructions a fixed length?
- AInstruction boundaries are known immediately, making it easy to decode several instructions at once
- BEvery instruction is shorter than variable-length ones, so programs always get smaller
- CThe number of instruction types can grow without limit
Show answer and explanation
Answer: A. Instruction boundaries are known immediately, making it easy to decode several instructions at once
With fixed length, the nth instruction always starts at byte 4n, so many instructions can be fetched and decoded in parallel. This especially helps superscalar CPUs that issue several instructions per cycle. On the other hand, common instructions cannot be made shorter, so code tends to be larger than with variable-length encodings. The RISC-V C extension adds 16-bit instructions to offset this weakness.
- A. Correct. The decoder becomes simpler.
- B. Variable-length encodings, which can shorten common instructions, usually give smaller code.
- C. A fixed number of bits limits how many instructions can be encoded.