Professional Documents
Culture Documents
Computer Systems
What is Computing?
Computer Systems
Hardware Stack
Computer Systems
Problem
Algorithm
Program/Language
Runtime System
(VM, OS)
ISA (Architecture)
Microarchitecture
Logic
Circuits
Electrons
3
Advanced
Hardware Stack
Computer Systems
Problem
Algorithm
Program/Language
Runtime System
(VM, OS)
ISA (Architecture)
Microarchitecture
Logic
Circuits
Electrons
4
Advanced
Hardware Stack
Computer Systems
Problem
Algorithm
Program/Language
Runtime System
(VM, OS)
ISA (Architecture)
Microarchitecture
Logic
Circuits
Electrons
5
Advanced
Hardware Stack
Computer Systems
Problem
Algorithm
Program/Language
Runtime System
(VM, OS)
ISA (Architecture)
Microarchitecture
Logic
Circuits
Electrons
6
Advanced
Hardware Stack
Computer Systems
Problem
Algorithm
Program/Language
Runtime System
(VM, OS)
ISA (Architecture)
Microarchitecture
Logic
Circuits
Electrons
7
Advanced
Micro level:
• Transistors;
• Logic gates, memory cells, special circuits;
• Single-bit adders, multiplexers, decoders, flip-flops;
• Word-wide adders, multiplexers, decoders, registers, buses;
• ALUs, barrel shifters, register banks, memory blocks;
• Processor, cache and memory management organizations;
Macro Level:
• Processors, peripheral cells, cache memories, memory
management units;
• Integrated system chips;
• Printed circuit boards;
• Mobile telephones, PCs, engine controllers.
Advanced
9
Advanced
10
Advanced
• ISA
– Agreed upon interface between software and hardware
• SW/compiler assumes, HW promises
– What the software writer needs to know to write and
debug system/user programs
• Microarchitecture
– Specific implementation of an ISA
– Not visible to the software
• Microprocessor
– ISA, µarch, circuits
– “Architecture” = ISA + microarchitecture
12
Advanced
13
Advanced
software
instruction set
hardware
14
Advanced
Examples of ISAs
Computer Systems
• X86/IA-64
• PDP-x: Programmed Data Processor (PDP-11)
• VAX (very complex, Virtual Address Extension by DEC)
• IBM 360
• CDC 6600
• SIMD ISAs: CRAY-1, Connection Machine (e.g. add on a
million element)
• VLIW ISAs: Multiflow, Cydrome, IA-64 (EPIC), (e.g add,
mult, load and store operations in one instruction)
• PowerPC, POWER
• RISC ISAs: Alpha, MIPS, SPARC, ARM
• What are the fundamental differences?
– E.g., how instructions are specified and what they do
– E.g., how complex are the instructions 15
Advanced
Examples of µArch
Computer Systems
Destination of Results
Advanced
- +
Sequential
*
Dataflow
z
Advanced
OUT
21
Advanced
ISA DESIGN
24
Advanced
ISA design
Computer Systems
25
Advanced
ISA design
Computer Systems
27
Advanced
ISA design
Computer Systems
28
Advanced
29
Advanced
30
Advanced
Computer Systems
ELEMENTS OF AN ISA
Advanced
ISA
Computer Systems
• Instructions
– Opcodes, Addressing Modes, Data Types
– Instruction Types and Formats
– Registers, Condition Codes
• Memory
– Address space, Addressability, Alignment
– Virtual memory management
• Call, Interrupt/Exception Handling
• Access Control, Priority/Privilege
• I/O: memory-mapped vs. instr.
• Task/thread Management
• Power and Thermal Management
• Multi-threading support, Multiprocessor support
Advanced
34
Advanced
ARM
Computer Systems
35
Advanced
Bit Steering:
A bit in the instruction
determines the
interpretation of other
bits
36
Advanced
38
Advanced
39
Advanced
41
Advanced
42
Advanced
43
Advanced
• Be aware of the difference between address (Op1Addr) and the data stored
at that address, Op1.
• Result overwrites Operand 2, Op2, with result, Res
• This format needs only 2 addresses in the instruction but there is less choice
in placing data
44
Advanced
1 Address Instructions
Computer Systems
45
Advanced
46
Advanced
Example 1: Expression evaluation for 3-0 address
Computer Systems
instructions
47
Advanced
Example 1: Expression evaluation for 3-0 address
Computer Systems
instructions
48
Advanced
Principle of locality
Computer Systems
50
Advanced
51
Advanced
52
Advanced
53
Advanced
Instructions Classes
Computer Systems
I N, AL, KBD Load a byt e from in port KBD t o accum. Int e l Pe nt ium
LEA. L ( A0) , A2 Load a ddre ss point e d t o by A0 int o A2 M6 8 0 0 0
55
Advanced
56
Advanced
Branch Instructions
Computer Systems
57
Advanced
59
Advanced
60
Advanced
61
Advanced
62
Advanced
63
Advanced
64
Advanced
65
Advanced
Semantic Gap
Computer Systems
By Compiler
MIPS
Control Signals
By Hardware
68
Advanced
69
Advanced
70
Advanced
ISA
Computer Systems
• Instructions
– Opcodes, Addressing Modes, Data Types
– Instruction Types and Formats
– Registers, Condition Codes
• Memory
– Address space, Addressability, Alignment
– Virtual memory management
• Call, Interrupt/Exception Handling
• Access Control, Priority/Privilege
• I/O: memory-mapped vs. instr.
• Task/thread Management
• Power and Thermal Management
• Multi-threading support, Multiprocessor support
Advanced
72
Advanced
Endianness
Computer Systems
73
Advanced
Endianness (cont.)
Computer Systems
74
Advanced
M[0]
M[1]
M[2]
M[3] Registers:
M[4] - given special names in the ISA
(as opposed to addresses)
- general vs. special purpose
ISA
Computer Systems
• Instructions
– Opcodes, Addressing Modes, Data Types
– Instruction Types and Formats
– Registers, Condition Codes
• Memory
– Address space, Addressability, Alignment
– Virtual memory management
• Call, Interrupt/Exception Handling
• Access Control, Priority/Privilege
• I/O: memory-mapped vs. instr.
• Task/thread Management
• Power and Thermal Management
• Multi-threading support, Multiprocessor support
Advanced
– Tradeoffs?
• Which one is more general purpose? Memory mapped
79
Advanced
Ad d re s s
mk+k
+m
m
k
R/ W
CS CS CS
R/ W R/ W R/ W
Ad d re s s Ad d re s s Ad d re s s
Da t a Da t a Da t a
Data s s s
80
Advanced
A7 A6 A5 A4 A3 A2 A1 A0
0 0 x x x x X x
Ad d re s s
0 1 x x x x x x
m 2+k+ 6
1 0 x x x x x x
o 22 k
k 2t to
2
1 1 x x x x x x
Decoder
2k De c o d e r
m
6
R/ W
CS CS CS
R/ W R/ W R/ W
Ad d re s s Ad d re s s Ad d re s s
Da t a Da t a Da t a
Data s Device 3 s Device 2 Device 1s Device 0
s
81
Advanced
A7 A6 A5 A4 A3 A2 A1 A0
x x x x x x 0 0
Ad d re s s
x x x x x x 0 1
m 6+k+ 2
x x x x x x 1 0
o 22 k
k 2t to
2
x x x x x x 1 1
Decoder
2k De c o d e r
m
6
R/ W
CS CS CS
R/ W R/ W R/ W
Ad d re s s Ad d re s s Ad d re s s
Da t a Da t a Da t a
Data s Device 3 s Device 2 Device 1s Device 0
s
82
Advanced
83
Advanced
Evolution of ISA
Computer Systems
84
Advanced
85
Advanced
86
Advanced
CISC approach:
RISC approach:
LOAD A, 2:3
LOAD B, 5:2
PROD A, B
STORE 2:3, A
87
http://www-cs-faculty.stanford.edu/~eroberts/courses/soco/projects/risc/risccisc/index.html
Advanced
C++ Code
CISC RISC
Emphasis on hardware Emphasis on software
Small code sizes, high cycles per second Low cycles per second, large code sizes
Transistors used for storing complex instructions Spends more transistors on memory registers
CISC approach
Computer Systems
RISC approach
Computer Systems
Semantic Gap
Computer Systems
92
Advanced
93
Advanced
Computer Systems
More MIPS
r0 0 Programmable storage
r1
° 2^32 x bytes
° 31 x 32-bit GPRs (R0=0)
° 32 x 32-bit FP regs (paired DP)
r31
PC HI, LO, PC
lo
hi
Arithmetic/ logical
Integer: DADD, DADDU, DSUB, DSUBU, AND, OR, XOR, SLT, SLTU, DMUL, DDIV
Immediate: DADDI, DADDIU, ANDI, ORI, XORI, SLTI, SLTIU
Shifts: DSLL, DSRL, DSRA
Floating point: ADD.D, ADD.S, SUB.D, SUB.S, MUL.D, MUL.S, DIV.D, DIV.S
Memory Access
Loads: LB, LBU, LH, LHU, LW, L.S, L.D
Stores: SB, SH, SW, S.S, S.D
Control
Jumps (unconditional): J, JAL, JR, JALR
Branches (conditional): BEQ, BNE, BEQZ, BNEZ (+ pseudo-instructions)
94
Advanced
Reading
Computer Systems
• Optional:
– RISC-V: https://en.wikipedia.org/wiki/RISC-V
– ARM (Advanced RISC Machines):
https://en.wikipedia.org/wiki/ARM_architecture_family
95