Велике идеје
Велике идеје
Следећа велика идеја- RISC
Поређење
CISC
Идеја CISC-а
Особине циклуса извршења
Weighted Relative Dynamic Frequency of HLL Operations [PATT82a]
Dynamic Occurrence
Machine-Instruction Weighted
Memory-Reference Weighted
Pascal
C
Pascal
C
Pascal
C
ASSIGN
45%
38%
13%
13%
14%
15%
LOOP
5%
3%
42%
32%
33%
26%
CALL
15%
12%
31%
33%
44%
45%
IF
29%
43%
11%
21%
7%
13%
GOTO
—
3%
—
—
—
—
OTHER
6%
1%
3%
1%
2%
1%
Операнди
Pascal
C
Average
Integer Constant
16%
23%
20%
Scalar Variable
58%
53%
55%
Array/Structure
26%
24%
25%
Позивање процедура
Импликације
Шта су велики регистри?
Регистри за локалне варијабле
Register Windows
Overlapping Register Windows
Circular Buffer diagram
Кружни бафер
Глобалне варијабле
Регистри и Cache
Large Register File
Cache
All local scalars
Recently-used local scalars
Individual variables
Blocks of memory
Compiler-assigned global variables
Recently-used global variables
Save/Restore based on procedure nesting depth
Save/Restore based on cache replacement algorithm
Register addressing
Memory addressing
Referencing a Scalar - �Window Based Register File
Referencing a Scalar - Cache
Compiler Based Register Optimization
Graph Coloring
Graph Coloring Approach
Why CISC (1)?
Why CISC (2)?
RISC Characteristics
RISC v CISC
RISC Pipelining
Effects of Pipelining
Optimization of Pipelining
Loop Unrolling Twice �Example
do i=2, n-1
a[i] = a[i] + a[i-1] * a[i+l]
end do
Becomes
do i=2, n-2, 2
a[i] = a[i] + a[i-1] * a[i+i]
a[i+l] = a[i+l] + a[i] * a[i+2]
end do
if (mod(n-2,2) = i) then
a[n-1] = a[n-1] + a[n-2] * a[n]
end if
Normal and Delayed Branch
Address
Normal Branch
Delayed Branch
Optimized Delayed Branch
100
LOAD X, rA
LOAD X, rA
LOAD X, rA
101
ADD 1, rA
ADD 1, rA
JUMP 105
102
JUMP 105
JUMP 106
ADD 1, rA
103
ADD rA, rB
NOOP
ADD rA, rB
104
SUB rC, rB
ADD rA, rB
SUB rC, rB
105
STORE rA, Z
SUB rC, rB
STORE rA, Z
106
STORE rA, Z
Use of Delayed �Branch
Controversy
Required Reading
MIPS
MIPS
The instruction set consists of a variety of basic instructions, including:
RISC pipeline
RISC Pipelines�
CISC
MULT 2:3, 5:2
RISC
LOAD A, 2:3�LOAD B, 5:2�PROD A, B�STORE 2:3, A
Разлика у приступу смањењу времена обраде
CISC
RISC