Given a RAM configuration 1 K × 16 1\text{K} \times 16 1 K × 16 , we want to:
Increase the RAM capacity 10 times
Access word 3079 (draw the circuit and indicate the settings to accommodate this task)
Solution
Put 10 chips together (C 0 C_0 C 0 —C 9 C_9 C 9 ), 1024 words each
3079 = 3 × 1024 + 7 ⟹ access chip 3, with offset 7 3079 = 3 \times 1024 + 7 \implies \text{access chip 3, with offset 7} 3079 = 3 × 1024 + 7 ⟹ access chip 3, with offset 7
3079 = 2 11 + 2 10 + 7 = 110000000111 2 3079 = 2^{11} + 2^{10} + 7 = \texttt{110000000111}_2 3079 = 2 11 + 2 10 + 7 = 110000000111 2
Chip config 1 K × 16 = 2 10 × 16 1\text{K} \times 16 = 2^{10} \times 16 1 K × 16 = 2 10 × 16 indicates:
Bit width for the offset: 10 bits \text{Bit width for the offset: } 10 \text{ bits} Bit width for the offset: 10 bits
Word size: 16 bits ⟹ 16 -bit address \text{Word size: } 16 \text{ bits } \implies 16\text{-bit address} Word size: 16 bits ⟹ 16 -bit address
16 − 10 = 6 ⟹ 6 bits for chip # 16 - 10 = 6 \implies 6 \text{ bits for chip \#} 16 − 10 = 6 ⟹ 6 bits for chip #
Address Structure:
0 0 0 0 0 1 1 / 6 bits 0 0 0 0 0 0 0 0 1 1 1 / 10 bits \underset{{6 \text{ bits}}}{\boxed{\phantom{0}0\ 0\ 0\ 0\ 1\ 1\phantom{/}}}
\underset{{10 \text{ bits}}}{\boxed{\phantom{0}0\ 0\ 0\ 0\ 0\ 0\ 0\ 1\ 1\ 1\phantom{/}}} 6 bits 0 0 0 0 0 1 1 / 10 bits 0 0 0 0 0 0 0 0 1 1 1 /
Circuit and its settings:
Implement a decoder to act as chip select. To accomodate 10 chips, we need a decoder with input size: ⌈ l o g 2 10 ⌉ = 4 \lceil log_2{10} \rceil = 4 ⌈ l o g 2 10 ⌉ = 4 bits
So, our 4 × 2 4 4 \times 2^4 4 × 2 4 decoder takes chip # 3 3 3 (= 0011 2 0011_2 001 1 2 ) as input and enables output line 3, activating C 3 C_3 C 3 ‘s CS line. Outputs 10—15 are unused.
Given a RAM configuration 2 K × 8 2\text{K} \times 8 2 K × 8 and a 16-bit address size, we want to:
Increase the RAM capacity 8 times
Access word 5140 (draw the circuit and indicate the settings to accommodate this task)
Solution
Put 8 chips together (C 0 C_0 C 0 —C 7 C_7 C 7 ), 2048 words each
5140 = 2 × 2048 + 1044 ⟹ access chip 2, with offset 1044 5140 = 2 \times 2048 + 1044 \implies \text{access chip 2, with offset 1044} 5140 = 2 × 2048 + 1044 ⟹ access chip 2, with offset 1044
5140 = 2 12 + 2 10 + 2 4 + 2 2 = 1010000010100 2 5140 = 2^{12} + 2^{10} + 2^4 + 2^2 = \texttt{1010000010100}_2 5140 = 2 12 + 2 10 + 2 4 + 2 2 = 1010000010100 2
Chip config 2 K × 8 = 2 11 × 8 2\text{K} \times 8 = 2^{11} \times 8 2 K × 8 = 2 11 × 8 indicates:
Bit width for the offset: 11 bits \text{Bit width for the offset: } 11 \text{ bits} Bit width for the offset: 11 bits
Address size: 16 bits (indicated in the problem statement) \text{Address size: } 16 \text{ bits (indicated in the problem statement)} Address size: 16 bits (indicated in the problem statement)
16 − 11 = 5 ⟹ 5 bits for chip # 16 - 11 = 5 \implies 5 \text{ bits for chip \#} 16 − 11 = 5 ⟹ 5 bits for chip #
Address Structure:
0 0 0 0 1 0 / 5 bits 0 1 0 0 0 0 0 1 0 1 0 0 / 11 bits \underset{{5 \text{ bits}}}{\boxed{\phantom{0}0\ 0\ 0\ 1\ 0\phantom{/}}}
\underset{{11 \text{ bits}}}{\boxed{\phantom{0}1\ 0\ 0\ 0\ 0\ 0\ 1\ 0\ 1\ 0\ 0\phantom{/}}} 5 bits 0 0 0 0 1 0 / 11 bits 0 1 0 0 0 0 0 1 0 1 0 0 /
Circuit and its settings:
Implement a decoder to act as chip select. To accomodate 8 chips, we need a decoder with input size: ⌈ l o g 2 8 ⌉ = 3 \lceil log_2{8} \rceil = 3 ⌈ l o g 2 8 ⌉ = 3 bits
So, our 3 × 2 3 3 \times 2^3 3 × 2 3 decoder takes chip # 2 2 2 (= 010 2 010_2 01 0 2 ) as input and enables output line 2, activating C 2 C_2 C 2 ‘s CS line.
Find the total # of bytes for a direct mapping cache to store 64 KB in 1-word blocks, assuming a word size of 32 bits and MIPS addressing.
Solution
1-word blocks ⟹ \implies ⟹ no word select bits.
Word size 32 bits ⟹ \implies ⟹ 32-bit address.
MIPS Addressing ⟹ \implies ⟹ Byte Addressing ⟹ \implies ⟹ Allocate bits for byte #
Address structure:
000 Tag 00 / 0 line # / 0 byte # / ⏞ 32 bits \overbrace{
\boxed{\phantom{000}\text{Tag}\phantom{00/}}
\boxed{\phantom{0}\text{line \#}\phantom{/}}
\boxed{\phantom{0}\text{byte \#}\phantom{/}}
}^{\small 32 \text{ bits}} 000 Tag 00/ 0 line # / 0 byte # / 32 bits
Word size = 32 bits = 4 B = 2 2 B ⟹ 2 bits for byte # Data = 64 KB = 2 6 × 1 KB = 2 6 × 2 10 B = 2 16 B # of lines = Data Size Block Size = 2 16 B 2 2 B = 2 14 lines ⟹ 14 bits for line # \begin{aligned}
\text{Word size} &= 32 \text{ bits} \\
&= 4\text{ B} \\
&= 2^2 \text{ B} \implies 2 \text{ bits for byte \#} \\[2em]
\text{Data} &= 64 \text{ KB} \\
&= 2^6 \times 1 \text{ KB} \\
&= 2^6 \times 2^{10} \text{ B}\\
&= 2^{16} \text{ B} \\[2em]
\text{\# of lines} &= \frac{\text{Data Size}}{\text{Block Size}} \\[1em]
&= \frac{2^{16} \text{ B}}{2^2 \text{ B}} \\[1em]
&= 2^{14} \text{ lines} \implies 14 \text{ bits for line \#}
\end{aligned} Word size Data # of lines = 32 bits = 4 B = 2 2 B ⟹ 2 bits for byte # = 64 KB = 2 6 × 1 KB = 2 6 × 2 10 B = 2 16 B = Block Size Data Size = 2 2 B 2 16 B = 2 14 lines ⟹ 14 bits for line #
Tag = 32 − ( 14 + 2 ) = 16 bits \text{Tag} = 32 - (14 + 2) = 16 \text{ bits} Tag = 32 − ( 14 + 2 ) = 16 bits
Address Structure:
000 Tag 000 16 b 0 line # 0 14 b 0 byte # 0 2 b \underset{16\ b}{\boxed{\phantom{000}\text{Tag}\phantom{000}}}
\underset{14\ b}{\boxed{\phantom{0}\text{line \#}\phantom{0}}}
\underset{2\ b}{\boxed{\phantom{0}\text{byte \#}\phantom{0}}} 16 b 000 Tag 000 14 b 0 line # 0 2 b 0 byte # 0
Each line is 1 + 16 + 32 = 49 1 + 16 + 32 = 49 1 + 16 + 32 = 49 bits.
Total cache size:
2 14 lines × 49 bits/line = 49 ⋅ 2 14 b = 49 ⋅ 2 11 B = 49 ⋅ 2 KB = 98 KB \begin{aligned}
2^{14} \text{ lines} \ \times \ 49 \text{ bits/line} \ &= 49 \cdot 2^{14} \text{ b} \\
& = 49 \cdot 2^{11} \text{ B} \\
& = 49 \cdot 2 \text{ KB} \\
& = 98 \text{ KB}
\end{aligned} 2 14 lines × 49 bits/line = 49 ⋅ 2 14 b = 49 ⋅ 2 11 B = 49 ⋅ 2 KB = 98 KB
Find the total # of bytes for a direct mapping cache to store 128 KB in 2-word blocks, assuming a word size of 64 bits and byte addressing.
Solution
2-word blocks ⟹ \implies ⟹ 1 word select bit.
Word size 64 bits ⟹ \implies ⟹ 64-bit address.
Byte Addressing ⟹ \implies ⟹ Allocate bits for byte #
Address structure:
000 Tag 00 / 0 line # / 0 word # / 0 byte # / ⏞ 64 bits \overbrace{
\boxed{\phantom{000}\text{Tag}\phantom{00/}}
\boxed{\phantom{0}\text{line \#}\phantom{/}}
\boxed{\phantom{0}\text{word \#}\phantom{/}}
\boxed{\phantom{0}\text{byte \#}\phantom{/}}
}^{\small 64 \text{ bits}} 000 Tag 00/ 0 line # / 0 word # / 0 byte # / 64 bits
Word size = 64 bits = 8 B = 2 3 B ⟹ 3 bits for byte # Block size = 2 words = 2 1 words ⟹ 1 bit for word # Data = 128 KB = 2 7 × 1 KB = 2 7 × 2 10 B = 2 17 B Block size = 2 words = 2 × 64 b = 2 × 8 B = 16 B = 2 4 B # of lines = Data Size Block Size = 2 17 B 2 4 B = 2 13 lines ⟹ 13 bits for line # \begin{aligned}
\text{Word size} &= 64 \text{ bits} \\
&= 8\text{ B} \\
&= 2^3 \text{ B} \implies 3 \text{ bits for byte \#} \\[2em]
\text{Block size} &= 2 \text{ words} \\
&= 2^1 \text{ words} \implies 1 \text{ bit for word \#} \\[2em]
\text{Data} &= 128 \text{ KB} \\
&= 2^7 \times 1 \text{ KB} \\
&= 2^7 \times 2^{10} \text{ B}\\
&= 2^{17} \text{ B} \\[2em]
\text{Block size} &= 2 \text{ words} \\
&= 2 \times 64 \text{ b} \\
&= 2 \times 8 \text{ B} \\
&= 16 \text{ B} \\
&= 2^4 \text{ B} \\[2em]
\text{\# of lines} &= \frac{\text{Data Size}}{\text{Block Size}} \\[1em]
&= \frac{2^{17} \text{ B}}{2^4 \text{ B}} \\[1em]
&= 2^{13} \text{ lines} \implies 13 \text{ bits for line \#}
\end{aligned} Word size Block size Data Block size # of lines = 64 bits = 8 B = 2 3 B ⟹ 3 bits for byte # = 2 words = 2 1 words ⟹ 1 bit for word # = 128 KB = 2 7 × 1 KB = 2 7 × 2 10 B = 2 17 B = 2 words = 2 × 64 b = 2 × 8 B = 16 B = 2 4 B = Block Size Data Size = 2 4 B 2 17 B = 2 13 lines ⟹ 13 bits for line #
Tag = 64 − ( 13 + 1 + 3 ) = 47 bits \text{Tag} = 64 - (13 + 1 + 3) = 47 \text{ bits} Tag = 64 − ( 13 + 1 + 3 ) = 47 bits
Address Structure:
000 Tag 000 47 b 0 line # 0 13 b 0 word # 0 1 b 0 byte # 0 3 b \underset{47\ b}{\boxed{\phantom{000}\text{Tag}\phantom{000}}}
\underset{13\ b}{\boxed{\phantom{0}\text{line \#}\phantom{0}}}
\underset{1\ b}{\boxed{\phantom{0}\text{word \#}\phantom{0}}}
\underset{3\ b}{\boxed{\phantom{0}\text{byte \#}\phantom{0}}} 47 b 000 Tag 000 13 b 0 line # 0 1 b 0 word # 0 3 b 0 byte # 0
Each line is 1 + 47 + 128 = 176 1 + 47 + 128 = 176 1 + 47 + 128 = 176 bits.
Total cache size:
2 13 lines × 176 bits/line = 176 ⋅ 2 13 b = 176 ⋅ 2 10 B = 176 ⋅ 1 KB = 176 KB \begin{aligned}
2^{13} \text{ lines} \ \times \ 176 \text{ bits/line} \ &= 176 \cdot 2^{13} \text{ b} \\
& = 176 \cdot 2^{10} \text{ B} \\
& = 176 \cdot 1 \text{ KB} \\
& = 176 \text{ KB}
\end{aligned} 2 13 lines × 176 bits/line = 176 ⋅ 2 13 b = 176 ⋅ 2 10 B = 176 ⋅ 1 KB = 176 KB
Given the following block access sequence:
1 , 2 , 4 , 6 , 1 , 2 , 4 , 2 , 4 , 3 , 5 1, 2, 4, 6, 1, 2, 4, 2, 4, 3, 5 1 , 2 , 4 , 6 , 1 , 2 , 4 , 2 , 4 , 3 , 5
Find the number of misses with (assume LRU is used as the replacement policy):
fully associative mapping , consisting of 4 one-word blocks, given the following sequence of block addresses
Direct Mapping , consisting of 4 one-word blocks
2-way set associative mapping , consisting of 4 one-word blocks
Solution: Fully Associative Mapping
× × × × ✓ ✓ ✓ ✓ ✓ × × 1 2 4 6 1 2 4 2 4 3 5 ⟶ 6 misses \begin{array}{ccccccccccc}
\color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{red}{\times} & \color{red}{\times} \\
1 & 2 & 4 & 6 & 1 & 2 & 4 & 2 & 4 & 3 & 5
\end{array}
\;\longrightarrow\; \textbf{6 misses} × 1 × 2 × 4 × 6 ✓ 1 ✓ 2 ✓ 4 ✓ 2 ✓ 4 × 3 × 5 ⟶ 6 misses
Solution: Direct Mapping
Each block maps to line: ( block# ) m o d 4 \quad (\text{block\#}) \bmod 4 ( block# ) mod 4 .
× × × × ✓ × ✓ ✓ ✓ × × 1 2 4 6 1 2 4 2 4 3 5 ⟶ 7 misses \begin{array}{ccccccccccc}
\color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{blue}{\checkmark} & \color{red}{\times} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{red}{\times} & \color{red}{\times} \\
1 & 2 & 4 & 6 & 1 & 2 & 4 & 2 & 4 & 3 & 5
\end{array}
\;\longrightarrow\; \textbf{7 misses} × 1 × 2 × 4 × 6 ✓ 1 × 2 ✓ 4 ✓ 2 ✓ 4 × 3 × 5 ⟶ 7 misses
Solution: 2-way set associative mapping
2-way set associative mapping ⟹ \implies ⟹ 2 lines per set
Given: 4 lines and 2-way ⟹ \implies ⟹ 4 / 2 4/2 4/2 ⟹ \implies ⟹ 2 sets: S 0 \ S_0 S 0 and S 1 S_1 S 1
block # \# # maps to set: ( block# ) m o d 2 \ (\text{block\#}) \bmod 2 ( block# ) mod 2 ; LRU within each set.
× × × × ✓ × × ✓ ✓ × × 1 2 4 6 1 2 4 2 4 3 5 ⟶ 8 misses \begin{array}{ccccccccccc}
\color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{blue}{\checkmark} & \color{red}{\times} & \color{red}{\times} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{red}{\times} & \color{red}{\times} \\
1 & 2 & 4 & 6 & 1 & 2 & 4 & 2 & 4 & 3 & 5
\end{array}
\;\longrightarrow\; \textbf{8 misses} × 1 × 2 × 4 × 6 ✓ 1 × 2 × 4 ✓ 2 ✓ 4 × 3 × 5 ⟶ 8 misses
Given the following block access sequence:
2 , 3 , 5 , 7 , 1 , 4 , 6 , 9 , 2 , 3 , 5 , 3 , 5 , 4 , 6 , 8 , 0 , 2 , 9 , 7 2, 3, 5, 7, 1, 4, 6, 9, 2, 3, 5, 3, 5, 4, 6, 8, 0, 2, 9, 7 2 , 3 , 5 , 7 , 1 , 4 , 6 , 9 , 2 , 3 , 5 , 3 , 5 , 4 , 6 , 8 , 0 , 2 , 9 , 7
Find the number of misses with (assume LRU is used as the replacement policy):
fully associative mapping , consisting of 8 one-word blocks, given the following sequence of block addresses
Direct Mapping , consisting of 8 one-word blocks
2-way set associative mapping , consisting of 8 one-word blocks
Solution: Fully Associative Mapping
× × × × × × × × ✓ ✓ ✓ ✓ ✓ ✓ ✓ × × ✓ ✓ × 2 3 5 7 1 4 6 9 2 3 5 3 5 4 6 8 0 2 9 7 ⟶ 11 misses \begin{array}{cccccccccccccccccccc}
\color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{red}{\times} & \color{red}{\times} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{red}{\times} \\
2 & 3 & 5 & 7 & 1 & 4 & 6 & 9 & 2 & 3 & 5 & 3 & 5 & 4 & 6 & 8 & 0 & 2 & 9 & 7
\end{array}
\;\longrightarrow\; \textbf{11 misses} × 2 × 3 × 5 × 7 × 1 × 4 × 6 × 9 ✓ 2 ✓ 3 ✓ 5 ✓ 3 ✓ 5 ✓ 4 ✓ 6 × 8 × 0 ✓ 2 ✓ 9 × 7 ⟶ 11 misses
Solution: Direct Mapping
Each block maps to line: ( block# ) m o d 8 \quad (\text{block\#}) \bmod 8 ( block# ) mod 8 .
× × × × × × × × ✓ ✓ ✓ ✓ ✓ ✓ ✓ × × ✓ ✓ ✓ 2 3 5 7 1 4 6 9 2 3 5 3 5 4 6 8 0 2 9 7 ⟶ 10 misses \begin{array}{cccccccccccccccccccc}
\color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{red}{\times} & \color{red}{\times} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{blue}{\checkmark} \\
2 & 3 & 5 & 7 & 1 & 4 & 6 & 9 & 2 & 3 & 5 & 3 & 5 & 4 & 6 & 8 & 0 & 2 & 9 & 7
\end{array}
\;\longrightarrow\; \textbf{10 misses} × 2 × 3 × 5 × 7 × 1 × 4 × 6 × 9 ✓ 2 ✓ 3 ✓ 5 ✓ 3 ✓ 5 ✓ 4 ✓ 6 × 8 × 0 ✓ 2 ✓ 9 ✓ 7 ⟶ 10 misses
Solution: 2-way set associative mapping
2-way set associative mapping ⟹ \implies ⟹ 2 lines per set
Given: 8 lines and 2-way ⟹ \implies ⟹ 8 / 2 8/2 8/2 ⟹ \implies ⟹ 4 sets: S 0 , S 1 , S 2 , S 3 \ S_0, S_1, S_2, S_3 S 0 , S 1 , S 2 , S 3
block # \# # maps to set: ( block# ) m o d 4 \ (\text{block\#}) \bmod 4 ( block# ) mod 4 ; LRU within each set.
× × × × × × × × ✓ ✓ × ✓ ✓ ✓ ✓ × × ✓ ✓ ✓ 2 3 5 7 1 4 6 9 2 3 5 3 5 4 6 8 0 2 9 7 ⟶ 11 misses \begin{array}{cccccccccccccccccccc}
\color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{red}{\times} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{red}{\times} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{red}{\times} & \color{red}{\times} & \color{blue}{\checkmark} & \color{blue}{\checkmark} & \color{blue}{\checkmark} \\
2 & 3 & 5 & 7 & 1 & 4 & 6 & 9 & 2 & 3 & 5 & 3 & 5 & 4 & 6 & 8 & 0 & 2 & 9 & 7
\end{array}
\;\longrightarrow\; \textbf{11 misses} × 2 × 3 × 5 × 7 × 1 × 4 × 6 × 9 ✓ 2 ✓ 3 × 5 ✓ 3 ✓ 5 ✓ 4 ✓ 6 × 8 × 0 ✓ 2 ✓ 9 ✓ 7 ⟶ 11 misses
Assume that main memory accesses take 70 ns and that memory accesses are 36% of all instructions. The following table shows data for the L1 cache attached to processor P1.
Processor L1 Miss Rate L1 Hit Time P1 8.0% 0.66 ns
Assume that the L1 hit time determines the cycle time for the processor. What is the clock rate?
Solution
Clock rate = 1 0.66 ns ≈ 1.52 GHz \text{Clock rate} = \frac{1}{0.66\text{ ns}} \approx 1.52\text{ GHz} Clock rate = 0.66 ns 1 ≈ 1.52 GHz
What is the Average Memory Access Time for the processor (in ns)?
Solution
AMAT = 0.66 ns + 0.08 × 70 ns = 6.26 ns \text{AMAT} = 0.66\text{ ns} + 0.08 \times 70\text{ ns} = 6.26\text{ ns} AMAT = 0.66 ns + 0.08 × 70 ns = 6.26 ns
Use the AMAT from above to find the average number of cycles for a memory access.
Solution
6.26 ns 0.66 ns ≈ 9.48 cycles \frac{6.26\text{ ns}}{0.66\text{ ns}} \approx 9.48\text{ cycles} 0.66 ns 6.26 ns ≈ 9.48 cycles
Assuming a base CPI of 1.0 without any memory stalls (for the rest of the instruction types in the program), what is the total average CPI?
Solution
Average CPI = 0.64 × 1 + 0.36 × 9.48 = 4.05 \text{Average CPI} = 0.64 \times 1 + 0.36 \times 9.48 = 4.05 Average CPI = 0.64 × 1 + 0.36 × 9.48 = 4.05
We will consider the addition of an L2 cache; on a miss, P1 will now first check L2 cache, and only if that is a miss, will then need a main memory access. The L2 miss rate is 50%, and L2 hit time is 5.62ns. What is the AMAT and average CPI with the addition of this L2 cache?
Solution
AMAT = L1 Hit Time + L1 Miss Rate × ( L2 Hit Time + L2 Miss Rate × Main Memory Access Time ) = 0.66 ns + 0.08 × ( 5.62 ns + 0.50 × 70 ns ) = 0.66 ns + 0.08 × 40.62 ns = 3.91 ns \begin{aligned}
\text{AMAT} &= \text{L1 Hit Time} + \text{L1 Miss Rate} \times (\text{L2 Hit Time} + \text{L2 Miss Rate} \times \text{Main Memory Access Time}) \\
&= 0.66\text{ ns} + 0.08 \times (5.62\text{ ns} + 0.50 \times 70\text{ ns}) \\
&= 0.66\text{ ns} + 0.08 \times 40.62\text{ ns} \\
&= 3.91\text{ ns}
\end{aligned} AMAT = L1 Hit Time + L1 Miss Rate × ( L2 Hit Time + L2 Miss Rate × Main Memory Access Time ) = 0.66 ns + 0.08 × ( 5.62 ns + 0.50 × 70 ns ) = 0.66 ns + 0.08 × 40.62 ns = 3.91 ns
3.91 ns 0.66 ns ≈ 5.92 cycles \frac{3.91\text{ ns}}{0.66\text{ ns}} \approx 5.92\text{ cycles} 0.66 ns 3.91 ns ≈ 5.92 cycles
Average CPI = 0.64 × 1 + 0.36 × 5.92 = 2.77 \text{Average CPI} = 0.64 \times 1 + 0.36 \times 5.92 = 2.77 Average CPI = 0.64 × 1 + 0.36 × 5.92 = 2.77
CPI improved from 4.05 to 2.77 with the L2 cache added.