Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)
Architecture (ISA)
Objectives
software
instruction set
hardware
Instruction Set Architecture
5
A Basic Instruction
C code: a=b+c;
C code a = b + c + d + e;
translates into the following assembly code:
add a, b, c add a, b, c
add a, a, d or add f, d, e
add a, a, e add a, a, f
7
Subtract Example
C code f = (g + h) – (i + j);
8
Operands
A good interface:
• Lasts through many implementations
(portability, compatability)
• Is used in many different ways (generality)
• Provides convenient functionality to higher
levels
• Permits an efficient implementation at lower
levels
Evolution of Instruction Sets
• Design decisions must take into
account
• Technology
• Machine organization
• Programming languages
• Compiler technology
• Operating systems
• And they in turn influence these
Information in an instruction
• Operation to be done
• Source operands
• Destination operand
• Address of the next instruction
• Use of Program Counter
Stack Accumulator
Push A Load A
Push B Add B
Add Store C
Pop C
Register Register
(register-memory) (load-store)
Load R1,A Load R1,A
Add R1,B Load R2,B
Store C, R1 Add R3,R1,R2
Store C,R3
Code sequence for (C = A + B) for different
classes of instruction sets
Registers are the class that won out.
The more registers on the CPU, the better.
GPR Architectures
Number of Type of
Maximum number of Examples
memory addresses Architecture
operands allowed
IBM360/370,
1 2 Register-memory Intel 80x86
2 2 Memory- VAX
memory
3 3 Memory-memory VAX
Features to be considered while designing the ISA
Types of instructions (Operations in the
Instruction set)
Types and sizes of operands
Addressing Modes
Addressing Memory
Encoding and Instruction Formats
Compiler related issues
Types of instructions
Choose commonly used instructions
Make them faster
Specialized instructions depending upon the
application of the processor
Eg. Media and Signal Processing
• Single-instruction multiple-data (SIMD) or
vector instructions
• Saturating arithmetic operations
• Multiply-accumulate (MAC) instructions
Categories of instructions and examples
Addressing Modes
Interpreting Memory Addresses - Endian-ness
Two major formats for transferring values between registers and memory
Little-endian register: the first byte read goes in the low end of the register
Register: 7f 87 7b 45
Most-significant byte Least-significant byte (x86)
Big-endian register: the first byte read goes in the big end of the register
Register: 45 7b 87 7f
Most-significant byte Least-significant byte (MIPS, IBM)
26
Alignment
• Data must be aligned on a boundary
equal to its size
• An access to an object of size s bytes
at byte address A is aligned if A mod s
=0
• Misalignment typically results in an
alignment fault that must be handled
by the Operating System
Addressing Modes
Address
Operation Specifier Address field
Address Address
Operation Specifier 1 Specifier 2 Address field
Address
Operation Specifier Address field Address field
1 2
The Role of Compilers
Compiler goals
• All correct programs execute
correctly
• Most compiled programs execute
fast (optimizations)
• Fast compilation
• Debugging support
OPTIMIZATIONS
• Regularity
• Orthogonality
• Composability
RISC
(Mips,Sparc,HP-PA,IBM RS6000,PowerPC . . .1987)
LIW/”EPIC”? (IA-64. . .1999)
Evolution of Instruction Sets