Chapter 4
-
- The length of a block is 8 bytes = \(2^3\), so the byte portion is 3 bits long.
There are 32 lines = \(2^5\), so the line portion is 5 bits long.
The rest is the tag portion, 8 bits.
0001 0001 0001 1011 falls in line 00011 = 3
1100 0011 0011 0100 falls in line 00110 = 6
1101 0000 0001 1100 falls in line 00011 = 3
1010 1010 1010 1010 falls in line 10101 = 21
-
The line containing the byte with address 0001 1010 0001 1010
contains all the bytes with addresses 0001 1010 0001 1000 through
0001 1010 0001 1111. (All possible values in the byte portion of
the address.)
-
(8 bytes/line)*(32 lines) = 256 bytes.
-
The block stored in line Y could be any block whose address has line
portion Y, with any possible value in the tag portion. Hence to distinguish
which one of the 256 possiblities are in the line, we keep the tag
portion of the address in the cache.
-
First find the number of memory access: the range 63-70 [8 bytes] is
accessed once and the ranges 15-32 [18 bytes] and 80-95 [16 bytes]
[total of 34 bytes] are accessed 10 times; the total is 348 accesses
- Let's create a table of the page references:
Line | Addresses | | | | | |
1 | 00-15,64-79 | | 1* | 0* | | 0 |
2 | 16-31,80-95 | | | 0* | 1* | 0*
|
3 | 32-47 | | | 0* | | 0 |
4 | 48-63 | 0* | | | | |
| | done once | 1st iteration of loop | other 9 iterations |
(The numbers 0 and 1 in the table are the address group the address falls into = the tag number; the stars
are the page faults, either because the line has not yet been used or because the prev tag is not the needed tag.)
Counting the stars: there are 2 faults in the initial section, 4 faults in the 1st iteration of the loop, and
2 faults in each of the next 9 loop iterations; total of 24 page faults. Hence the other 348 - 24 = 324 references
are cache hits, the the hit ratio is 324/348 = 93.10%.
- Let's create a table of the page references:
Set | Addresses | | | | | |
1 | 00-15,32-47,64-79 | | 2* | | 1* | 1 |
| | 0* | | 0 |
2 | 16-31,48-63,80-95 | | | 2* | | 2
|
1* | | 0* | | 0 |
| | done once | 1st iteration of loop | other 9 iterations |
(The numbers 0, 1, and 2 in the table are the address group the address falls into = the tag number; the stars
are the page faults, either because the line has not yet been used or because the prev tag is not the needed tag.)
Counting the stars: there are 2 faults in the initial section, 4 faults in the 1st iteration of the loop, and
0 faults in each of the next 9 loop iterations; total of 6 page faults. Hence the other 348 - 6 = 342 references
are cache hits, the the hit ratio is 342/348 = 98.28%.
-
- Cost = 1 Mbyte * \(10^6 {\hbox{bytes}\over\hbox{Mbyte}}\) * \(8 {\hbox{bit}\over\hbox{byte}}\) * \(10^{-5} {$\over\hbox{bit}}\)
= $80.00
- Cost = 1 Mbyte * \(10^6 {\hbox{bytes}\over\hbox{Mbyte}}\) * \(8 {\hbox{bit}\over\hbox{byte}}\) * \(10^{-4} {$\over\hbox{bit}}\)
= $800.00
- \(T_{eff} = H * T_c + (1 - H) * T_m\)
Substituting: (1 + .10) * 100 ns = H * 100 ns + (1 - H) * 1200 ns
Solving for H: H = .9909 = 99.09%
Chapter 5
-
We notice that if there are 256 rows and 64K = 65,536 = \(2^{16}\) cells,
there must be 256 = 65536/256 columns.
- All the rows must be refreshed in the 4ms span. There are 256 rows.
Thus the time between the refresh for successive rows must be
\(4 * 10^{-3}s / 256 = 15.625\mu s\).
- The refresh counter must count the rows. There are 256 rows, therefore
there must be \(\log_2 256 = 8\) bits in this counter.