ISA & Assembly

What is the main purpose of the RISC-V C extension (compressed instructions)?

  1. ATo add instructions that compress data and reduce memory use
  2. BTo let the CPU run C programs directly
  3. CTo encode common instructions in 16 bits and make programs smaller
Show answer and explanation

Answer: C. To encode common instructions in 16 bits and make programs smaller

The C extension represents common instructions in 16-bit forms with restricted fields, for example "addi sp, sp, -16" or lw and sw with small offsets. They mix freely with 32-bit instructions and make code smaller. Smaller programs fit more easily in limited flash memory and more of them fit in the instruction cache, which helps both embedded devices and high-performance CPUs.

  • A. It does not compress data.
  • B. C stands for compressed, unrelated to the C language.
  • C. Correct. It makes code smaller.