A More Complex Example
Notes
- Assume that we have two different processors in the same family
- This means that they have the same instruction set.
- However as we have seen, different instructions can have different CPIs
- So assume, that there are three different classes of instruction, with the following CPIs
Processor\
Instruction Class1 2 3 PA 1 2 4 PB 1 3 3 - Assume the following instruction mix:
Processor\
Instruction Class Use1 2 3 PA 60% 20% 20% PB 50% 20% 30% - We don't have a single CPI, but we can compute that.
- We will compute a Weighted Average
- Let ci be the CPI for class i∈{1,2,3}, (Table 1)
- Let pi be the Percent of time each instruction class is used (table 2)
- $\text{CPI}_x = \sum_i c_i \times p_i$
- $\text{CPI}_A = 1 \times .6 + 2 \times .2 + 4 \times .2 = 1.8$
- $\text{CPI}_B = 1 \times .5 + 3 \times .2 + 3 \times .3 = 2.0$
- It is important to note that the weights (percent use) total 100%
- We may have to compute these percents
- PA uses 4× 105 instructions from class 1, 2× 105 for class 2 and 1×105 for class 3
- We will use a total of (4 + 2 + 1) × 105 or 7 × 105 instructions.
- Class 1 will be used 4/7 or about 57% of the time
- Class 2 will be used 2/7 or about 29% of the time
- Class 3 will be used 1/7 or about 14% of the time
- Notice the total 100%
- PA uses 4× 105 instructions from class 1, 2× 105 for class 2 and 1×105 for class 3
- We may have to compute these percents
- So if instructions and IPS remain the same, CPU A will be better.
- But what if, by changing the instruction execution percentage we either get fewer instructions, or can run the clock faster?
- Ie assume that the clock speed remains constant, but
Processor Instruction Count PA 2.1×109 PA 1.7×109 - Each processor would need
c cycles ninstructionsx ------------- = n×c cycles 1instructionPA = 1.8 & times; 2.1 × 109 = 3.7 × 109 cycles PA = 2.0 & times; 1.7 × 109 = 3.4 × 109 cycles - In this case, speeding up the third instruction class by changing the instruction count and mix would make a difference.
- Does it make sense that we can "tune" a cpu/circuit to perform some instructions better at the cost of other instructions?