210 likes | 518 Views
Instruction Set Architecture. The portion of the machine visible to the programmer Issues: Internal storage model Addressing modes Operations Operands Encoding Compilation Issues. Internal Storage Model. Memory- Memory ( Add C, A, B ). Internal Storage Model.
E N D
Instruction Set Architecture • The portion of the machine visible to the programmer • Issues: • Internal storage model • Addressing modes • Operations • Operands • Encoding • Compilation Issues
Internal Storage Model • Memory- Memory (Add C, A, B)
Internal Storage Model • Most post 1980 architectures use a load store architecture • Main reasons • registers faster than memory • Compilers can utilise registers more effectively than other models • Variables can be held in registers • Instruction set can use 2 or 3 operand format
Memory Addressing • How • memory addresses interpreted • memory addresses are specified • Interpretation • Size (byte, half word, word) • Ordering (Big Endian, Little Endian) • Alignment (Word)
Memory Addressing (Addressing modes) • How an address is specified • Modes included on machines: • Register (e.g. Add R4, R3) • Immediate (e.g. Add R4, #3) • Displacement (e.g. Add R4, 100(R1)) • Absolute (Add R4, (1000)) • Memory Indirect (Add R4 @(R3)) • Autoincrement (Add R4, (R1)+) • Autodecrement (Add R4, -(R1))
Memory Addressing • Use of addressing Modes: • register accounts for 50% (not counted below) 1%
Displacement • What is the range of displacements used
Operations in the Instruction Set • Can be classified into the following types • Arithmetic and logical • Data transfer • Control • System
Top 10 instructions on 8086 • Averaged over 5 SPECin92 programs
Instructions for Control Flow • Four types • Conditional Branches • Jumps • Procedure Calls • Procedure returns • Destination address must always be supplied. Can be: • specified explicitly • indirect jumps (procedure return)
PC relative Branching • Target often close to the branch instruction • Destination is obtained by adding a displacement to the PC • Requires fewer bits to encode instruction • helps make code position independent
Specifying Branch Condition • Most branches are equality|inequality tests or comparisons with zero
Type and Size of Operands • Two main alternatives • operand types specified in opcode(e.g. add, addb, addf) • data annotated with tags(very rare)
Encoding the Instruction Set • Representation affects • size of compiled program • implementation of CPU • Architect must balance • the desire to have as many registers and addressing modes as possible • the impact of the size of register and addressing mode fields
Variations in Instruction decoding • VIARABLE (e.g. VAX, 68000) • Better code density • FIXED (e.g. MIPS and PowerPC) • Simpler hardware ... Opcode Add spec 1 Add field 1 Add spec n Add field n Opcode Result Operand 1 Operand 2
Example 1: A Registerless processor • L1 Cache and registers about same speed • no need for registers • An fixed length instruction set with 3 operand format is proposed • Simulations show that the number of instructions execution is about half of a load store architecture