\(CPI_{alu} = 1.1\)
\(CPI_{branch} = 3.0\)
\(Cache_Hitatio = 60\%\)
\(CPI_{hit} = 1\)
\(CPI_{miss} = 120\)
\(Percentage_{branch} = 20\%\) of the instructions are loads
\(Percentage_{load} = 22\%\) of the instructions are loads
\(Percentage_{stores} = 12\%\) of the instructions are stores
The loads & stores are impacted by the cache hit ratio.
To find the \(CPI_{total}\) we need to use the equation \[CPI_{total} = \sum_{i=1}^{n} {CPI_i \times Percentage_i}\] \((CPI_{alu} \times Percentage_{alu}) + (CPI_{branch} \times Percentage_{branch}) + (CPI_{load} \times Percentage_{load}) + (CPI_{store} \times Percentage_{store})\)
To calculate the \(CPI_{load}\) and \(CPI_{store}\) we determine the \(CPI\) based on the hit ratio of the cache. We’re assuming here that load and store have an even distribution of how the cache and memory is accessed. \(CPI_{cache} = ((CPI_{hit} \times Cache\_Hitatio) + (CPI_{miss} \times (100 - Cache\_Hitratio))) = (60\% \times 1) + (40\% \times 120) = 48.6\)
Next we need to determine the percentage of ALU instructions which is calculated as:
\(Percentage_{alu} = 100 - (Percentage{branch} + Percentage_{load} + Percentage_{branch}) = 100 - (20\% + 22\% + 12\%) = 46\%\)
Now that we have the \(CPI_{cache}\) we have calcule the \(CPI_{total}\). Each CPI will be multiplied by the percentage that the instruction type is executed. The \(CPI_{load}\) and \(CPI_{store}\) will be substituted with the \(CPI_{cache}\)
\(CPI_{total} = (1.1 \times 46\%) + (3 \times 20\%) + (48.6 \times 22\%) + (48.6 \times 12\%) = \textbf{17.63}\)