Chapter 15 of 39

Instruction Set Architecture: RISC vs CISC

A program compiled for your laptop's Intel or AMD processor will not run on your phone's ARM processor, even though both are "computers" and both can run the same app written in Java or Python. Yet a program compiled for an old Intel Pentium still runs on today's Intel and AMD chips, which are built in a completely different way inside. Why?

The answer is the Instruction Set Architecture (ISA). It is the agreement between software and hardware: the exact list of instructions, registers and rules that a processor promises to support. Two chips with the same ISA run the same machine code, however differently they are built. Two chips with different ISAs cannot.

An Instruction Set Architecture (ISA) is the part of a computer's design that is visible to the machine-language programmer or compiler: its instructions, registers, data types, addressing modes, memory model, instruction encoding, and the handling of interrupts and exceptions.

In Introduction to Computer Organization & Architecture we separated architecture (what the machine does) from organization (how it is built). The ISA is the architecture. This chapter covers what an ISA contains, the main kinds of ISA, and the long-running debate between the two design philosophies: CISC (Complex Instruction Set Computer) and RISC (Reduced Instruction Set Computer).


ISA vs Microarchitecture

ISA (architecture)

Microarchitecture (organization)

What the processor does

How a particular chip does it

Instructions, registers, addressing modes, encoding

Pipeline depth, cache sizes, branch predictor, number of execution units

Fixed for decades, so old software keeps working

Changes with every new chip generation

Examples: x86-64, ARMv8-A (AArch64), RISC-V, MIPS

Examples: Intel's and AMD's different designs that implement x86-64; Apple's and Qualcomm's different designs that implement ARMv8/ARMv9

This separation is what makes backward compatibility possible: the ISA stays the same while the hardware underneath improves.


What an ISA Specifies

  • Instructions: the operations and their encodings (see Instruction Format & Instruction Cycle).

  • Registers: how many, how wide, and any special ones (PC, stack pointer, flags). x86-64 has 16 general-purpose 64-bit registers; RISC-V and MIPS have 32, with register 0 always reading as zero; AArch64 has 31 plus a zero register / stack pointer encoding.

  • Data types and sizes: bytes, halfwords, words, double words, floating point (usually IEEE 754, see Floating-Point Representation (IEEE 754)).

  • Addressing modes: how operands are located (see Addressing Modes).

  • Memory model: byte addressing, address width, endianness, alignment rules.

  • Control flow: branches, jumps, calls and returns, and how conditions are tested (flags or register comparisons).

  • System features: privilege levels (user/kernel mode), interrupts and exceptions, I/O access.

Types of Instructions

Category

Purpose

Examples

Data transfer

Move data between registers, memory and I/O

LOAD, STORE, MOV, PUSH, POP

Arithmetic

Integer and floating-point math

ADD, SUB, MUL, DIV, INC, NEG

Logical and shift

Bitwise operations

AND, OR, XOR, NOT, SHL, SHR, ROL

Control transfer

Change the flow of execution

JMP, conditional branches (BEQ, JNZ), CALL, RET

Comparison / test

Set flags or registers based on a comparison

CMP, TEST, SLT (set if less than)

I/O

Talk to devices (on machines with separate I/O space)

IN, OUT (x86)

System / privileged

OS support

System call (SYSCALL, ECALL), interrupt return, halt


Classifying ISAs by Where Operands Live

The most basic difference between ISAs is where an ALU instruction finds its operands. Here is C = A + B (A, B, C in memory) in the four classic styles:

Stack

Accumulator

Register-memory

Load-store (register-register)

PUSH A
PUSH B
ADD
POP C

LOAD A
ADD B
STORE C

LOAD R1, A
ADD R3, R1, B
STORE R3, C

LOAD R1, A
LOAD R2, B
ADD R3, R1, R2
STORE R3, C

Operands on top of a stack

One operand in the accumulator

ALU instructions may use a memory operand

Only LOAD/STORE touch memory; ALU uses registers only

JVM bytecode, old HP calculators

Early computers, 8-bit microcontrollers

x86, IBM System/360 and z

RISC-V, ARM, MIPS

Almost every ISA designed since about 1980 is a general-purpose register machine (register-memory or load-store), because registers are much faster than memory and compilers can keep variables in them. How the CPU is organised for each style is covered in CPU Organization: Accumulator, General Register & Stack.


Memory Model: Endianness and Alignment

Endianness

A 32-bit value occupies 4 bytes. In which order are those bytes stored in memory?

  • Little-endian: the least significant byte at the lowest address (x86, and RISC-V and ARM as normally used).

  • Big-endian: the most significant byte at the lowest address (IBM System/z, classic SPARC and Motorola 68000; also the standard "network byte order" for Internet protocols).

Value 0x12345678 stored at address 100:

Address        100   101   102   103
Little-endian   78    56    34    12
Big-endian      12    34    56    78

You can check your own machine with this C program, which looks at a 32-bit integer one byte at a time:

#include <stdio.h>
#include <stdint.h>

int main(void) {
    uint32_t x = 0x12345678;
    unsigned char *b = (unsigned char *)&x;
    for (int i = 0; i < 4; i++)
        printf("byte at address +%d : %02X\n", i, b[i]);
    puts(b[0] == 0x78 ? "little-endian" : "big-endian");
    return 0;
}

Output on an x86-64 machine (GCC 15.2, Linux):

byte at address +0 : 78
byte at address +1 : 56
byte at address +2 : 34
byte at address +3 : 12
little-endian

Endianness matters whenever bytes cross between systems: network packets, binary file formats, and memory dumps in a debugger.

Alignment

An n-byte item is aligned if its address is a multiple of n (a 4-byte int at address 100 is aligned; at 102 it is not). Aligned accesses fit neatly inside one memory word or cache line. Some ISAs (classic MIPS, SPARC) raise an exception on misaligned accesses; x86 allows them but they may be slower. This is why C compilers insert padding inside structs.


CISC: Complex Instruction Set Computer

Why CISC Made Sense

In the 1960s and 1970s:

  • Memory was tiny and expensive, so compact code (powerful, variable-length instructions) saved real money.

  • Compilers were weak and much code was written in assembly, so instructions that looked like high-level statements made programmers' lives easier. Designers spoke of closing the "semantic gap" between high-level languages and machine language.

  • Microprogramming (see Microprogrammed Control Unit) made adding a complex instruction cheap: just write more microcode.

The result was instruction sets with hundreds of instructions, many addressing modes, and instructions that did a lot of work. The DEC VAX (1977) is the classic example: it had instructions to evaluate a polynomial (POLY) and to manipulate queues and character strings in one instruction, with operands that could each use any addressing mode.

Characteristics of CISC

  • Large number of instructions, some very complex.

  • Variable-length instructions (x86: 1 to 15 bytes).

  • Many addressing modes; ALU instructions can operate directly on memory.

  • Instructions take varying (often many) clock cycles.

  • Fewer general-purpose registers (x86 had only 8 until x86-64 doubled them to 16).

  • Traditionally microprogrammed control.

Examples: x86 / x86-64, DEC VAX, IBM System/360 and its descendants (IBM Z), Motorola 68000.


RISC: Reduced Instruction Set Computer

The Observation Behind RISC

In the mid-1970s, John Cocke's group at IBM (the IBM 801 project) and later teams at Berkeley (David Patterson's RISC I, 1982) and Stanford (John Hennessy's MIPS) studied what compiled programs actually do. They found that:

  • a small set of simple instructions (load, store, add, compare, branch) accounts for the vast majority of executed instructions;

  • compilers rarely used the complex instructions and addressing modes, and sometimes a sequence of simple instructions was even faster than the equivalent complex one;

  • the hardware needed to support rare complex instructions slowed down the common simple ones.

The idea: make the common case fast. Keep instructions simple and uniform so they can be pipelined (see Pipelining Basics) and finish at a rate of about one per clock cycle, and let the compiler combine them. Patterson and Ditzel's 1980 paper "The Case for the Reduced Instruction Set Computer" named the idea, and Hennessy and Patterson later received the 2017 Turing Award for this work.

Characteristics of RISC

  • Relatively few, simple instructions. (The RISC-V base integer set, RV32I, has about 40.) "Reduced" refers mostly to the complexity of each instruction.

  • Fixed-length instructions (32 bits) with few, regular formats, so decoding is fast.

  • Load-store architecture: only LOAD and STORE access memory; ALU instructions work on registers.

  • Few, simple addressing modes (often just base + displacement for memory).

  • Many registers (typically 32), so variables stay in registers.

  • Most instructions designed to complete in one cycle in a pipeline; hardwired control (see Hardwired Control Unit).

  • More work done by the compiler (register allocation, instruction scheduling).

Examples: RISC-V, ARM (originally "Acorn RISC Machine"), MIPS, SPARC, IBM POWER.


The Same Statement on CISC and RISC

Take the C statement a[i] += v; where a is an int array. GCC 15.2 at -O1 for x86-64 produces (disassembled with objdump -d -M intel, raw bytes shown on the left):

01 14 b7          add    DWORD PTR [rdi+rsi*4],edx
c3                ret

One 3-byte instruction computes the address a + 4i, reads memory, adds v and writes the result back. A RISC-V (RV32I) compiler needs a sequence of simple instructions (a in a0, i in a1, v in a2):

slli  t0, a1, 2       # t0 = i * 4
add   t0, a0, t0      # t0 = address of a[i]
lw    t1, 0(t0)       # t1 = a[i]           (load)
add   t1, t1, a2      # t1 = a[i] + v       (register-only ALU)
sw    t1, 0(t0)       # a[i] = t1           (store)
ret

Five 4-byte instructions (20 bytes) instead of one 3-byte instruction. But each RISC instruction is simple, decodes instantly and flows smoothly through a pipeline, while the x86 instruction must be broken into several internal steps anyway.

x86 Instruction Lengths Vary

From the same disassembly, notice how x86 instruction lengths depend on the operands:

c3                    ret                                 1 byte
8b 07                 mov    eax,DWORD PTR [rdi]          2 bytes
8b 47 04              mov    eax,DWORD PTR [rdi+0x4]      3 bytes
b8 2a 00 00 00        mov    eax,0x2a                     5 bytes
8b 05 00 00 00 00     mov    eax,DWORD PTR [rip+0x0]      6 bytes

A RISC-V or AArch64 decoder always knows the next instruction is 4 bytes away. An x86 decoder must partly decode each instruction to find where the next one begins, which makes decoding several instructions per cycle much harder.


RISC vs CISC Comparison

Feature

CISC

RISC

Number of instructions

Large, many complex ones

Smaller, simple ones

Instruction length

Variable

Fixed (usually 32 bits)

Instruction formats

Many

Few, regular

Addressing modes

Many, complex

Few, simple

Memory access

Most instructions can access memory

Only LOAD and STORE

Cycles per instruction

Varies, often several

About 1 in a pipeline

Registers

Fewer

Many (often 32)

Control unit

Traditionally microprogrammed

Hardwired

Code size

Smaller (denser)

Larger

Instructions per program

Fewer

More

Complexity lives in

Hardware / microcode

Compiler

Pipelining

Harder

Easier

Examples

x86, VAX, IBM Z, 68000

RISC-V, ARM, MIPS, SPARC, POWER


The Performance Equation

To compare RISC and CISC fairly, we need the basic equation for CPU time:

CPU time = Instruction count × CPI × Clock cycle time
         = (Instruction count × CPI) / Clock rate

CPI = average clock Cycles Per Instruction

CISC tries to reduce the instruction count (each instruction does more). RISC accepts a higher instruction count in exchange for a much lower CPI and, often, a shorter clock cycle. Which wins depends on the product of all three.

Worked Example 1: Comparing Two Processors

Problem. A program compiles to 2 million instructions on a CISC machine with average CPI 4 at 2 GHz. On a RISC machine it compiles to 3 million instructions with average CPI 1.2 at 2.5 GHz. Which is faster, and by how much? Also compute each machine's MIPS rating.

Solution.

CISC: (2 × 10^6 × 4)   / (2 × 10^9)   = 4 ms
RISC: (3 × 10^6 × 1.2) / (2.5 × 10^9) = 1.44 ms

Speedup of RISC = 4 / 1.44 ≈ 2.78

The RISC machine executes 50% more instructions but is about 2.78 times faster.

MIPS (millions of instructions per second) = clock rate / (CPI × 106): CISC = 2000 / 4 = 500 MIPS, RISC = 2500 / 1.2 ≈ 2083 MIPS. Be careful: MIPS ignores how much work each instruction does, so it is a misleading way to compare different ISAs. Only execution time for the same program is a fair comparison.

Worked Example 2: CPI from an Instruction Mix

Problem. A program's instructions are 45% ALU (1 cycle), 25% loads (3 cycles), 15% stores (2 cycles) and 15% branches (4 cycles). Find the average CPI and the time for 1 million instructions at 1 GHz.

Solution.

CPI = 0.45×1 + 0.25×3 + 0.15×2 + 0.15×4
    = 0.45 + 0.75 + 0.30 + 0.60 = 2.1

Time = 10^6 × 2.1 / 10^9 = 2.1 ms

Notice that loads contribute the most cycles (0.75 of the 2.1) even though ALU instructions are the most common. Making loads faster (with caches) helps more than speeding up the ALU.


The Modern Reality: Convergence

The RISC vs CISC battle of the 1980s and 1990s did not end with one side simply winning:

  • CISC chips became RISC inside. Since the Intel Pentium Pro (1995), x86 processors decode each x86 instruction into one or more simple internal operations called micro-operations (µops), which are then executed by a RISC-like, deeply pipelined, out-of-order core. The complex ISA is kept for compatibility; the hardware behind it borrows RISC ideas.

  • RISC ISAs gained complex instructions where they pay off: SIMD/vector instructions, cryptography (AES) instructions, and load/store-multiple or paired operations. ARM's Thumb and RISC-V's compressed extension added 16-bit instructions to improve code density.

  • Where they are used. x86-64 dominates desktops, laptops and servers. ARM dominates smartphones and embedded devices, and has moved into laptops (Apple M-series since 2020) and servers (for example AWS Graviton). RISC-V, started at UC Berkeley in 2010, is a free and open ISA that anyone can implement without a licence, and is growing fast in embedded and academic designs.

Today the real differences are less about raw speed and more about decoder complexity, power efficiency, code density, licensing, and the software ecosystem tied to each ISA.


Common Mistakes

  • Thinking RISC means "fewer than N instructions". The key ideas are simplicity, uniform format and load-store design; some RISC ISAs have hundreds of instructions once extensions are counted.

  • Saying CISC programs run slower because they have more instructions. CISC programs have fewer instructions; the question is CPI and clock rate.

  • Comparing different ISAs using MIPS. A RISC instruction does less work than a CISC instruction; compare execution time instead.

  • Confusing ISA with microarchitecture. "Intel Core vs AMD Ryzen" is a microarchitecture comparison; both implement x86-64.

  • Assuming RISC must be hardwired and CISC must be microprogrammed. These are traditional tendencies, not rules.

  • Reversing endianness. Little-endian puts the little (least significant) end first, at the lowest address.


GATE and Interview Questions

What is an ISA, and why is it important for software?

The ISA is the programmer-visible interface of a processor: instructions, registers, data types, addressing modes, memory model and encoding. Compiled software depends only on the ISA, so any processor implementing the same ISA runs the same binaries.

List four characteristics of a RISC processor.

Fixed-length instructions; load-store architecture (only loads and stores access memory); few simple addressing modes; large register file; simple instructions designed for single-cycle pipelined execution; usually hardwired control.

Why are RISC processors easier to pipeline?

All instructions have the same length and few formats, so fetch and decode are uniform; memory is accessed only by loads and stores; and most instructions take the same number of steps. This makes each pipeline stage simple and predictable.

Machine A runs a program in 10 million instructions at CPI 2.5 and 2 GHz. Machine B needs 14 million instructions at CPI 1.5 and 2 GHz. Which is faster?

A: 107 × 2.5 / (2 × 109) = 12.5 ms. B: 1.4 × 107 × 1.5 / (2 × 109) = 10.5 ms. B is faster, by 12.5 / 10.5 ≈ 1.19 times.

The value 0xA1B2C3D4 is stored at address 200 on a big-endian machine. What byte is at address 201? And on a little-endian machine?

Big-endian: A1 at 200, B2 at 201, so B2. Little-endian: D4 at 200, C3 at 201, so C3.

Is x86 RISC or CISC today?

Its ISA is CISC (variable-length instructions, memory operands, many addressing modes). Internally, modern x86 processors translate instructions into RISC-like micro-operations and execute them in an out-of-order pipeline.

What is the "semantic gap" and how did CISC try to close it?

The gap between high-level language statements and simple machine instructions. CISC designers added complex instructions and addressing modes that mirror high-level operations (string copies, loops, procedure calls), hoping to simplify compilers and shorten programs.

Why is RISC-V significant?

It is an open, royalty-free ISA with a small base integer set and optional standard extensions, so anyone (companies, universities, students) can design and sell processors that implement it without a licence fee.


Summary

  • The ISA is the contract between software and hardware: instructions, registers, data types, addressing modes, memory model and encoding. The microarchitecture is how a particular chip implements it.

  • Instructions fall into data transfer, arithmetic, logical/shift, control transfer, comparison, I/O and system categories.

  • ISAs differ in where operands live: stack, accumulator, register-memory, load-store.

  • Endianness: little-endian stores the least significant byte first (x86); big-endian stores the most significant byte first (network order).

  • CISC: many complex, variable-length instructions, memory operands, many addressing modes, fewer instructions per program, higher CPI.

  • RISC: simple, fixed-length instructions, load-store, many registers, simple addressing, CPI near 1 with pipelining, more instructions per program.

  • CPU time = Instruction count × CPI × cycle time; compare machines by time, not MIPS.

  • Modern designs converge: x86 cores translate to RISC-like µops, while RISC ISAs add selected complex instructions.

CISC asks the hardware to do more per instruction; RISC asks the compiler to do more with simpler instructions. Performance depends on the product of instruction count, CPI and clock time, never on one of them alone.