ISA & Assembly

Which statement about instruction length in the RISC-V base ISA and in x86 is correct?

  1. ABoth use a fixed 32-bit length
  2. BRISC-V is variable-length and x86 is a fixed 32 bits
  3. CRISC-V base instructions are a fixed 32 bits; x86 instructions vary from 1 to 15 bytes
Show answer and explanation

Answer: C. RISC-V base instructions are a fixed 32 bits; x86 instructions vary from 1 to 15 bytes

All RISC-V base instructions are 32 bits, so instruction boundaries are obvious (the compressed C extension mixes in 16-bit instructions). x86 ranges from 1-byte instructions up to 15 bytes including prefixes and immediates, and the start of the next instruction is unknown until the current one is decoded. As a result, decoding several x86 instructions at once requires complex circuitry.

  • A. x86 is not fixed-length.
  • B. It is the other way around.
  • C. Correct. x86 lengths vary because of decades of extensions.
Practice this topic Back to topic

More ISA & Assembly questions

  1. What is the main advantage of making instructions a fixed length?
  2. In RISC-V instructions, each register field (rd, rs1, rs2) is 5 bits wide. Why?
  3. The immediate of RISC-V addi is a 12-bit signed integer. What range can it represent?
  4. In RISC-V, what is the usual way to put a 32-bit constant that does not fit in a 12-bit immediate (e.g. 0x12345678) into a register?
  5. To build the constant 0x12345FFF in RISC-V with lui and addi, which pair is correct?