Reduced Instruction Set Computers: William Stallings Computer Organization and Architecture 7 Edition
Reduced Instruction Set Computers: William Stallings Computer Organization and Architecture 7 Edition
Reduced Instruction Set Computers: William Stallings Computer Organization and Architecture 7 Edition
Cache memory
IBM S/360 model 85 in 1968
Pipelining
Introduces parallelism into sequential process
Multiple processors
Comparison of processors
Intention of CISC
Ease compiler writing (narrowing the semantic gap) Improve execution efficiency
Complex operations in microcode (the programming language of the control unit)
Execution Characteristics
Operations performed (types of instructions) Operands used (memory organization, addressing modes) Execution sequencing (pipeline organization)
Operations
Assignments
Simple movement of data
Procedure call-return is very time consuming Some HLL instruction lead to many machine code operations and memory references
ASSIGN
LOOP CALL IF GOTO OTHER
45%
5% 15% 29% 6%
38%
3% 12% 43% 3% 1%
13%
42% 31% 11% 3%
13%
32% 33% 21% 1%
14%
33% 44% 7% 2%
15%
26% 45% 13% 1%
Operands
Mainly local scalar variables Optimisation should concentrate on accessing local variables
Pascal Integer constant 16% C 23% Average 20%
Scalar variable
58%
53%
55%
Array/structure
26%
24%
25%
Procedure Calls
Very time consuming - load Depends on number of parameters passed Depends on level of nesting Most programs do not do a lot of calls followed by lots of returns limited depth of nesting Most variables are local
Smaller programs?
Program takes up less memory but Memory is now cheap May not occupy less bits, just look shorter in symbolic form
More instructions require longer op-codes Register references require fewer bits
Implications - RISC
Best support is given by optimising most used and most time consuming features Large number of registers
Operand referencing (assignments, locality)
Simplified (reduced) instruction set - for optimization of pipelining and efficient use of registers
RISC v CISC
Not clear cut Many designs borrow from both design strategies: e.g. PowerPC and Pentium II No pair of RISC and CISC that are directly comparable No definitive set of test programs Difficult to separate hardware effects from compiler effects Most comparisons done on toy rather than production machines
RICS v CISC
No. of instructions: 69 - 303 No. of instruction sizes: 1 - 56 Max. instruction size (byte): 4 - 56 No. of addressing modes: 1 - 44 Indirect addressing: no - yes Move combined with arithmetic: no yes Max. no. of memory operands: 1 - 6
Hardware solution
Have more registers Thus more variables will be in registers
Register Windows
Only few parameters passed between procedures Limited depth of procedure calls Use multiple small sets of registers Call switches to a different set of registers Return switches back to a previously used set of registers
Temporary registers from one set overlap with parameter registers from the next
This allows parameter passing without moving data
Global Variables
Allocated by the compiler to memory
Inefficient for frequently accessed variables
Compiler Based Register Optimization Assume small number of registers (16-32) Optimizing use is up to compiler HLL programs usually have no explicit references to registers Assign symbolic or virtual register to each candidate variable Map (unlimited) symbolic registers to real registers Symbolic registers that do not overlap can share real registers If you run out of real registers some variables use memory
Graph Coloring Given a graph of nodes and edges Assign a color to each node Adjacent nodes have different colors Use minimum number of colors Nodes are symbolic registers Two registers that are live in the same program fragment are joined by an edge Try to color the graph with n colors, where n is the number of real registers Nodes that can not be colored are placed in memory
Load/store instruction:
I: Instruction fetch E: Execute (calculate memory address) D: Memory (register to memory or memory to register operation)
1 I
2 E
I
3 D
E I
D E I E D
Optimization of Pipelining
Code reorganization techniques to reduce data and branch dependencies Delayed branch
Does not take effect until the execution of following instruction This following instruction is the delay slot More successful with unconditional branch
1st approach: insert NOOP (prevents fetching instr., no pipeline flush and delays the effect of jump) 2nd approach: reorder instructions
1
I
2
E I
3
D
4
E I
E I
I 1
I
E 6
2
E I
3
D E I
E I E D