Ift 212 Computer Architecture Lecture Notes 2
Ift 212 Computer Architecture Lecture Notes 2
LECTURE NOTES 2
Instruction Set Architectures:
History and Issues
Computer Architecture’s
Intro
Changing Definition
• 1950s to 1960s:
– Computer Architecture Course =
• Computer Arithmetic
• 1970s to 1980s:
– Computer Architecture Course =
• Instruction Set Design (especially ISA appropriate for compilers)
• 1990s+
– Computer Architecture Course =
• Design of CPU (microarchitecture)
• Design of memory system & I/O system
• Multiprocessor/multi-thread issues
Intro
Interface Design
A good interface:
• Lasts through many implementations (portability,
compatibility)
• Is used in many different ways (generality)
• Provides convenient functionality to higher levels
• Permits an efficient implementation at lower levels
use imp 3
History
Electronic Delay Storage Automatic Calculator
Evolution of Instruction Sets
Single Accumulator (EDSAC 1950)
Accumulator + Index Registers
(Manchester Mark I, IBM 700 series 1953)
RISC
(Mips,Sparc,HP-PA,IBM RS6000,PowerPC . . .1987)
“EPIC”? (IA-64. . .1999)
History
Classifying ISAs
Accumulator (before 1960):
1 address add A acc − acc + mem[A]
Classifying ISAs
Overview: Classification
Stack Architectures
• Instruction set:
add, sub, mult, div, . . .
push A, pop A
• Example: A*B - (A+C*B)
push A
push B A B A*B A C B B*C A+B*C result
A A*B A C A A*B
mul A*B A A*B
A*B
push A
push C
push B
mul
add
sub
Overview: Classification
Accumulator Architectures
• Instruction set:
add A, sub A, mult A, div A, . . .
load A, store A
• Pros
– Very low hardware requirements
– Easy to design and understand
• Cons
– Accumulator becomes the bottleneck
– Little ability for parallelism or pipelining
– High memory traffic
– How about an OoO machine?
Overview: Classification
Memory-Memory Architectures
• Instruction set:
(3 operands) add A, B, C sub A, B, C mul A, B, C
Memory-Memory:
Pros and Cons
• Pros
– Requires fewer instructions (especially if 3 operands)
– Easy to write compilers for (especially if 3 operands)
• Cons
– Very high memory traffic (especially if 3 operands)
– Variable number of clocks per instruction (especially if 2
operands)
– With two operands, more data movements are required
– How about an OoO machine?
Overview: Classification
Register-Memory Architectures
• Instruction set:
add R1, A sub R1, A mul R1, B
load R1, A store R1, A
• Example: A*B - (A+C*B)
load R1, A
mul R1, B /* A*B */
store R1, D
load R2, C
mul R2, B /* C*B */
add R2, A /* A + CB */
sub R2, D /* AB - (A + C*B) */
Overview: Classification
Memory-Register:
Pros and Cons
• Pros
– Some data can be accessed without loading first
– Instruction format easy to encode
– Good code density
• Cons
– Operands are not equivalent (poor orthogonality)
– Variable number of clocks per instruction
– May limit number of registers
Overview: Classification
Load-Store Architectures
• Instruction set:
add R1, R2, R3 sub R1, R2, R3 mul R1, R2, R3
load R1, R4 store R1, R4
• Example: A*B - (A+C*B)
load R4, &A
load R5, &B
load R6, &C
mul R7, R6, R5 /* C*B */
add R8, R7, R4 /* A + C*B */
mul R9, R4, R5 /* A*B */
sub R10, R9, R8 /* A*B - (A+C*B) */
Overview: Classification
Load-Store:
Pros and Cons
• Pros
– Simple, fixed length instruction encoding
– Instructions take similar number of cycles
– Relatively easy to pipeline
• Cons
– Higher instruction count
– Not all instructions need three operands
– Dependent on good compiler
– Need to schedule registers well at the least.
Overview: Classification
Distribution of Displacement
Values
Overview: Other issues
• Disadvantages of Registers
– Need to save and restore on procedure calls and context
switch
– Can’t take the address of a register (for pointers)
– Fixed size (can’t store strings or structures efficiently)
– Generally limited in number
Overview: Other issues
Alignment Issues
• If the architecture does not restrict memory accesses to be
aligned then
– Software is simple
– Hardware must detect misalignment and make 2+ memory accesses
– Expensive detection logic is required
– All references can be made slower
• Sometimes unrestricted alignment is required for backwards
compatibility
• If the architecture restricts memory accesses to be aligned then
– Software must guarantee alignment
– Hardware detects misalignment access and traps
– No extra time is spent when data is aligned
• Since we want to make the common case fast, having restricted
alignment is often a better choice, unless compatibility is an
issue
Overview: Other issues
• Sum-up.
Sum-up