10 Isa
10 Isa
CS 3410
Computer System Organization & Programming
These slides are the product of many rounds of teaching CS 3410 by Professors Weatherspoon, Bala, Bracy, and Sirer.
iClicker Question (first alone, then pairs)
Which is not considered part of the ISA?
A
memory register
D
alu
file
B
+4
addr
inst
M
B
memory
imm
extend
new
forward
pc unit
detect
hazard Write
ctrl
ctrl
ctrl
Fetch Decode Execute Memory Back
IF/ID ID/EX EX/MEM MEM/WB 3
Big Picture: Where are we going?
C int x = 10;
compiler x = x + 15;
32 RF 32
Circuits
Gates A
B
Transistors
Silicon 4
Big Picture: Where are we going?
C int x = 10;
compiler x = 2 * x + 15;
High Level
addi r5, r0, 10 Languages
MIPS
muli r5, r5, 2
assembly addi r5, r5, 15
assembler
00100000000001010000000000001010
machine 00000000000001010010100001000000
code 00100000101001010000000000001111
loader Instruction Set
CPU Architecture (ISA)
Circuits
Gates
Transistors
Silicon 5
Goals for Today
Instruction Set Architectures
• ISA Variations, and CISC vs RISC
• Peek inside some other ISAs:
• X86
• ARM
6
Instruction Set Architecture (ISA)
Different CPU architectures specify different instructions
7
iClicker Question
What does it mean for an architecture to be called a
load/store architecture?
8
ISA Variations
ISA defines the permissible instructions
• MIPS: load/store, arithmetic, control flow, …
• ARMv7: similar to MIPS, but more shift,
memory, & conditional ops
• ARMv8 (64-bit): even closer to MIPS, no
conditional ops
• VAX: arithmetic on memory or registers,
strings, polynomial evaluation, stacks/queues,
…
• Cray: vector operations, …
• x86: a little of everything
9
Brief Historical Perspective on ISAs
Accumulators
• Early computers had one register!
ISA design
CDC 6600
IBM 360
8
18
Load-Store
Register-Memory
1963
1964
DEC PDP-8 1 Accumulator 1965
DEC PDP-11 8 Register-Memory 1970
Intel 8008 1 Accumulator 1972
Motorola 6800 2 Accumulator 1974
DEC VAX 16 Register-Memory, Memory-Memory 1977
Intel 8086 1 Extended Accumulator 1978
Motorola 6800 16 Register-Memory 1980
Intel 80386 8 Register-Memory 1985
ARM 16 Load-Store 1985
MIPS 32 Load-Store 1985
HP PA-RISC 32 Load-Store 1986
SPARC 32 Load-Store 1987
PowerPC 32 Load-Store 1992
DEC Alpha 32 Load-Store 1992
HP/Intel IA-64 128 Load-Store 2001
AMD64 (EMT64) 16 Register-Memory 2003 12
In the Beginning…
People programmed in assembly and machine code!
• Needed as many addressing modes as possible
• Memory was (and still is) slow
13
Reduced Instruction Set Computer (RISC)
John Cock
• IBM 801, 1980 (started in 1975)
• Name 801 came from the bldg that housed the
project
• Idea: Can make a very small and very fast core
• Known as “the father of RISC Architecture”
• Turing Award and National Medal of Science
14
Reduced Instruction Set Computer (RISC)
Dave Patterson John L. Hennessy
• RISC Project, 1982 • MIPS, 1981
• UC Berkeley • Stanford
• RISC-I: ½ transistors & • Simple, full pipeline
3x faster
• Influences: Sun SPARC, • Influences: MIPS
namesake of industry computer system,
PlayStation, Nintendo
15
RISC vs. CISC
MIPS = Reduced Instruction Set Computer (RlSC)
• ≈ 200 instructions, 32 bits each, 3 formats
• all operands in registers
- almost all are 32 bits each
• ≈ 1 addressing mode: Mem[reg + imm]
x86 = Complex Instruction Set Computer (ClSC)
• > 1000 insns, 1-15 bytes each (dozens of add insns)
• operands in dedicated registers, general purpose
registers, memory, on stack, …
- can be 1, 2, 4, 8 bytes, signed or unsigned
• 10s of addressing modes
- e.g. Mem[segment + reg + reg*scale + offset]
16
The RISC Tenets
RISC CISC
• Single-cycle execution • many multicycle operations
• Hardwired control • microcoded multi-cycle
operations
• Load/store architecture • register-mem and mem-mem
• Few memory addressing • many modes
modes
• Fixed-length insn format • many formats and lengths
17
RISC vs CISC
RISC Philosophy CISC Rebuttal
Regularity & simplicity Compilers can be smart
Leaner means faster Transistors are plentiful
Optimize common case
Legacy is important
Code size counts
Micro-code!
“RISC Inside”
Energy efficiency
Embedded Systems
Phones/Tablets Desktops/Servers
18
iClicker Question (alone first, then pairs)
What is one advantage of a CISC ISA?
I-type op rs rt immediate
6 bits 5 bits 5 bits 16 bits
Control Independence! 23
ARMv7: Other Cool operations
Shift one register (e.g., Rc) any amount
Add to another register (e.g., Rb)
Store result in a different register (e.g. Ra)
24
ARMv7 Instruction Set Architecture
ARMv7 instructions are 32 bits long, 3 formats
Reduced Instruction Set Computer (RISC) properties
• Only Load/Store instructions access memory
• Instructions operate on operands in processor registers
• 16 registers
25
ARMv8 (64-bit) Instruction Set Architecture
ARMv8 instructions are 64 bits long, 3 formats
Reduced Instruction Set Computer (RISC) properties
• Only Load/Store instructions access memory
• Instructions operate on operands in processor registers
• 32 registers and r0 is always 0
26
ISA Takeaways
The number of available registers greatly influenced the
instruction set architecture (ISA)