Computer Architecture ISA
Computer Architecture ISA
❑ Stored program
➢ A program is written as a sequence of instructions,
which are stored in a memory, in conjunction
with data, as binary bits.
➢ Instructions are automatically fetched, decoded,
and executed one by one.
Hardware
(implementation of
the instruction set)
1. Data Storage
❑ Design principles:
1. Simplicity favors regularity
2. Make the common case fast
3. Smaller is faster
4. Good design demands good compromises
CISC RISC
Many instructions and addressing Few instructions and addressing
modes modes
Single instruction performs Simple instructions, combined by
complex operation SW to perform complex operations
Smaller program size Larger program size
Complex implementation Easier to build/optimize hardware
RISC-V, Sun SPARC, HP PA-RISC,
Intel, AMD, Cyrix
IBM PowerPC
❑ Storage Architecture
❑ General Purpose Register Architecture
❑ Accumulator architecture:
➢ One operand is implicitly in the accumulator.
Examples: IBM 701, DEC PDP-8.
❑ Memory-memory architecture:
➢ All operands in memory. Example: DEC VAX.
Storage Architecture: GPR Architecture
❑ For modern processors (after 1980):
➢ General-Purpose Register (GPR) is the most common choice for storage
design.
➢ RISC computers typically uses Register-Register (Load/Store) design
E.g. RISC-V, ARM
➢ CISC computers use a mixture of Register-Register and Register-Memory
E.g. IA32.
❑ Design question
➢ How many GPRs should be sufficient?
➢ Design principle #3: smaller is faster.
Aspect #2 – Memory Addressing Mode
0 int A, B, C;
store 4 B C = A + B;
8 C
load 12 A
16
R0 ← Mem[12]
Up to 232 bytes . .
organized as 230 . . R1 ← Mem[4]
. .
4-byte words → R2 ← R0 * R1
addresses of 32-bit words
consecutive words Mem[8] ← R2
differ by 4.
Memory
RISC-V general registers
Numbers
hardware
understands
Human-friendly
symbolic names in
assembly code
More on RISC-V registers
❑ There are other registers!
➢ Not accessible to user (no name/number).
Big-endian: Little-endian:
Most significant byte stored in Least significant byte stored in
lowest address. lowest address.
Example: Example:
IBM 360, Motorola 68000, SPARC. Intel 80x86, DEC Alpha RISC-V.
Example: How are 16 consecutive bytes (0x) 0,1, …, E, F stored in a
32-bit wide memory from the address 0?
MSB LSB Word address MSB LSB
C D E F 3 3 F E D C
8 9 A B 2 2 B A 9 8
4 5 6 7 1 1 7 6 5 4
0 1 2 3 0 0 3 2 1 0
Byte address 0 1 2 3 3 2 1 0 Byte address
Addressing Modes
Addressing mode Example Meaning
Register Add R4,R3 R4 R4+R3
Will mainly work with
the first 3 modes in Immediate Add R4,#3 R4 R4+3
this course. Displacement Add R4,100(R1) R4 R4+Mem[100+R1]
Register indirect Add R4,(R1) R4 R4+Mem[R1]
Indexed / Base Add R3,(R1+R2) R3 R3+Mem[R1+R2]
Direct or absolute Add R1,(1001) R1 R1+Mem[1001]
Memory indirect Add R1,@(R3) R1 R1+Mem[Mem[R3]]
Auto-increment Add R1,(R2)+ R1 R1+Mem[R2]; R2 R2+d
Auto-decrement Add R1,–(R2) R2 R2-d; R1 R1+Mem[R2]
Scaled Add R1,100(R2)[R3] R1 R1+Mem[100+R2+R3*d]
registers .
.
.
Aspect #3 – Operations in Instructions
Set
❑ Standard Operations in an Instruction Set
❑ Frequently Used Instructions
❑ Things to be decided:
➢ Number of registers
➢ Number of addressing modes
➢ Instruction length
➢ Number of operands in an instruction
❑ Fixed-length instructions.
➢ Fixed number of operands, with addressing modes (if options exist) specified
as part of the opcode → largest code size.
➢ Allow for easy fetch and decode + simplify pipelining and parallelism → best
performance.
❑ Hybrid instructions.
➢ Has multiple formats: fixed-length plus one or two variable-length
instructions.
➢ Improving the variability in size and work of the variable-length architecture
while reducing the code size of fixed-length counterpart.
Aspect #5 – The role of compilers
❑ Instruction simplicity
➢ Special features that “match” a language construct (e.g. FOR and CASE
statements) or a kernel function often make the compiler work more.
➢ “Provide primitives, not solutions” – compiler works best with a minimalist
instruction set.
Summary
❑ ISA design is hard
➢ Adhere to 4 qualitative principles
➢ Applying quantitative method