Nexus Learn

Lecture 7: Classification of Instruction Set Architectures

Lecture Slides CS-704 Advanced Computer Architecture 6 min read Updated 8 Nov 2026

↓ Download slides (PowerPoint)

Recap of Lecture 6 and Homework Check

  • Three great ideas: parallelism, locality, the common case.
  • Amdahl: speedup = 1 / ((1 - F) + F / S).
  • F is a fraction of time, not of instructions.
  • The limit is 1 / (1 - F): the unimproved part decides.

Homework check

  • 1. 95% parallel, 16 cores: speedup? limit?
  • 2. A part becomes 10x faster. What F gives 3x overall?
  • 3. Practical 4: 'Other' = 20 of 42 cycles becomes 2x faster. Overall?

Today's Plan (50 minutes)

0-5

Recap and homework check Lecture 6

5-8

Plan and learning outcomes Unit 2 starts

8-18

Module 1: Where do operands live? ISA, four classes, operand counts

18-31

Module 2: C = A + B in every class code, counts, code size, a longer example

31-38

Module 3: Why registers won trade-offs, register count, RISC vs CISC

38-45

Class activity X = A x B + C in three classes

45-50

Mistakes, quiz and homework

Learning Outcomes (SLOs)

By the end of this lecture you will be able to:

SLO 7.1

Classify an instruction set by where its operands are kept: stack, accumulator, register-memory, load-store or memory-memory.

→ CLO3 · C2 Understand

SLO 7.2

Write code for a simple expression in each class and count instructions, memory accesses and code size.

→ CLO3 · C3 Apply

SLO 7.3

Explain the advantages and disadvantages of each class, and why modern ISAs are load-store (RISC).

→ CLO3 · C2 Understand

CLO3: Explain instruction set principles and advanced instruction-level and thread-level parallelism techniques.

Module 1: Where Do Operands Live?

The first question in designing any instruction set

What Is an Instruction Set Architecture?

The contract

  • Software is written for the ISA, not for one chip.
  • Like the 3-pin plug: any iron works in any socket.

Today: the most basic difference between ISAs is the kind of internal storage the processor uses for operands.

Four Kinds of Internal Storage

Stack

Accumulator

Reg-memory

Load-store

  • Operands on the top of a stack; none named.
  • A pile of plates.
  • One operand is always the accumulator.
  • A shop calculator display.
  • Named registers; one operand may be in memory.
  • x86, IBM 360.
  • Only load / store touch memory; ALU uses registers.
  • MIPS, ARM, RISC-V.

Key idea: operands are implicit (stack), one implicit (accumulator) or all explicit (register machines).

How Many Operands, How Many in Memory?

  • MIPS (0,3): add $t3, $t0, $t1
  • x86 (1,2): ADD EAX, [num] ; EAX = EAX + Mem[num]

In a 2-operand instruction one source is destroyed (it also receives the result).

Module 2: C = A + B in Every Class

Same statement, four very different programs

C = A + B in Four Classes

MIPS: lw $t0, A lw $t1, B add $t2, $t0, $t1 sw $t2, C

Only the load-store column must bring both operands into registers before adding.

Counting the Cost of C = A + B

  • Assume: opcode 8 bits, memory address 32 bits, register number 5 bits
  • Load-store: Load 8+5+32=45 Load 45 Add 8+5+5+5=23 Store 45 -> 158

Note: for one tiny statement load-store looks worst. Values that are reused change the picture.

Worked Example: D = (A + B) x (A - C)

MIPS (tested: 48)

  • lw $t0, A
  • lw $t1, B
  • lw $t2, C
  • add $t3, $t0, $t1
  • sub $t4, $t0, $t2
  • mul $t5, $t3, $t4
  • sw $t5, D

Lesson: fewest instructions (memory-memory) is not least work. Registers cut memory traffic.

Memory is much slower than registers (Lecture 2), so data accesses matter more than instruction count.

Stack Machines Are Still Alive

Python 3.13: dis.dis(g) (real output)

Java bytecode

  • def g(a, b, c):
  • y = a * b + c
  • LOAD_FAST_LOAD_FAST 1 (a, b)
  • BINARY_OP 5 (*)
  • LOAD_FAST 2 (c)
  • BINARY_OP 0 (+)
  • STORE_FAST 3 (y)

c = a + b: iload_1, iload_2, iadd, istore_3

Python and WebAssembly

Also stack virtual machines: compact code, easy compilers.

Fact: the Intel 8085 in our microprocessor labs is an accumulator machine (register A).

Module 3: Why Registers Won

Advantages, disadvantages and the RISC vs CISC story

Why General-Purpose Registers Won

Faster

Compiler-friendly

Shorter names

Registers are inside the processor; memory is far away.

Any order of evaluation; variables stay in registers.

  • Register: 5 bits.
  • Memory address: 32 bits.

Workbench: a carpenter keeps today's tools on the bench (registers), not in the store room (memory).

Advantages and Disadvantages

Link: similar CPI for every instruction is what makes pipelining easy - the reason load-store won (Unit 3).

How Many Registers?

Trade-off

  • More registers: fewer loads and stores.
  • Cost: more bits per instruction, more to save on a context switch.

Note: with only 8 registers, old x86 code had to use memory operands very often.

RISC vs CISC Today

Inside x86

Each x86 instruction is split into simple micro-ops: a RISC core inside.

Lab link: in MARS only lw / sw touch memory - add cannot. That is load-store.

Deal vs a-la-carte: CISC orders a 'deal' in one word; RISC orders item by item but the kitchen is faster.

Class Activity: X = A x B + C

7 min · pairs

In pairs. Write the code, then count instructions and data memory accesses.

Stack code for X = A x B + C.

Accumulator code for X = A x B + C.

Load-store code (H&P style or MIPS) for X = A x B + C.

Classify each: x86 ADD AX, [VAR]; MIPS add $t0, $t1, $t2; Java iadd.

Common Mistakes

Wrong idea

Correct idea

✗ Fewer instructions always means faster.

✓ Count memory accesses too: memory-memory has 3 instructions but 9 accesses.

✗ A stack machine has no memory accesses.

✓ Push and Pop are memory accesses; only Add/Mul are not.

✗ MIPS add can use a memory operand.

✓ MIPS is load-store: only lw/sw touch memory.

✗ RISC means fewer registers.

✓ RISC means simple, fixed-length instructions; it usually has more registers.

Recap Quiz

Answer on paper in 3 minutes, then we check together.

Q1

Name the four main classes of ISA by where operands are kept.

Q2

What do the numbers (1, 2) mean for a register-memory ISA? Give an example.

Q3

Write accumulator code for C = A + B.

Q4

Why does an accumulator machine need a temporary T for D = (A + B) x (A - C)?

Q5

Give two reasons why general-purpose registers won.

Homework and Next Lecture

  • Read Hennessy and Patterson, Appendix A, sections A.1-A.2.
  • Four classes: write code for Y = (A + B) x (C - D) in stack, accumulator, register-memory and load-store. Count instructions and data accesses.
  • Code size: with opcode 8, address 32 and register 5 bits, find the code size in bits of each D = (A + B) x (A - C) sequence (S12).
  • Try it: run Python's dis on a one-line function of your choice and classify the code.

NEXT LECTURE

Lecture 8: Memory Addressing and Addressing Modes

Byte addresses, alignment, big- and little-endian, and the addressing modes that find an operand in memory.

← All CS-704 material