ISA & Assembly
What is the main purpose of the RISC-V C extension (compressed instructions)?
- ATo add instructions that compress data and reduce memory use
- BTo let the CPU run C programs directly
- 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 typically shrink code by about 25-30%. 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. Code size shrinks by roughly 25-30%.