Member-only story

ARM, x86 and RISC-V Microprocessors Compared

A comparison of different design choices in the assembly language of three important microprocessor instruction-sets.

--

Official RISC-V logo

In the PC world x86 microprocessor from AMD and Intel dominate. On tablets and smartphones ARM chips from Qualcomm and Apple dominate. RISC-V is a new microprocessor instruction-set which various companies are starting to use.

Thus for those with some interest in assembly programming, I thought I would do a comparison of these chips, in how they deal with common operations and the rational for their differences.

Find this story hard to follow? Read: How Does a Modern Microprocessor Work?

Instruction Length

For RISC microprocessors such as ARM and RISC-V this is simply. Every instruction is 32-bit long (4-bytes). This is very common for RISC microprocessors: ARM, MIPS, RISC-V and PowerPC all use fixed length 32-bit instructions.

However don’t confuse this with whether it is a 64-bit or 32-bit microprocessor. A 64-bit microprocessor will typically have 64-bit registers which it can work on. However the instructions themselves will still typically be 32-bit. The reason is simple: You generally don’t need as much space as 64-bit for an instruction and if you have that long instruction you end up doubling the memory requirement for your binary code.

However there are some exceptions to this. The AVR microprocessor is an 8-bit RISC processor used mostly in microcontrollers such as the Arduino popular for hobbyists. It has 16-bit instructions. In fact you can pull off a limited RISC instruction-set on 16-bit. Which is why many CPU architectures including ARM, MIPS and RISC-V all have support for 16-bit instructions. We call these compressed instructions. The CPU still reads in 32-bit bits at a time. But once it is received the CPU can determine that it is a compressed instruction and inflate it to two normal 32-bit instructions.

CISC CPUs such as x86 are a big difference here. Their instructions don’t have a fixed length. For x86 instructions can be from 1 to 15 bytes long (8 to 120 bits). Actually in theory an x86 instruction could be of infinite length, but dealing with…

--

--

Erik Engheim
Erik Engheim

Written by Erik Engheim

Geek dad, living in Oslo, Norway with passion for UX, Julia programming, science, teaching, reading and writing.

Responses (4)

Write a response