CDA3101 Homework 3 Due April 22

advertisement
CDA3101 Homework 3
Due April 22
Submissions are due by noon on the specified due date. You may either hand in the homework to me
directly, slip it under my office door, or place it in my mailbox. Handwritten or typed solutions are
acceptable. If you do write your solutions by hand, be sure to write clearly. If the grader cannot read
your answer, they cannot give you the points. Late submissions will NOT be accepted for this
homework. You must show how you arrived at the answer or no credit will be given.
1. (6 pts) Consider a direct-mapped cache with 256 blocks and a block size of 4 words. To what set
does byte address 1208 map?
2. (8 pts) Consider a processor with a single data cache. What is the average memory access time for
the processor with a clock period of 1ns, a miss penalty of 25 clock cycles, a miss rate of .05, and a
cache access time (or hit time) of 1 clock cycle? Assume read and write miss penalties are the same
and ignore other write stalls.
3. (20 pts) Assume a cache with 8K blocks, a 4-word block size, and a 32-bit address. Find the total
number of sets and the total number of tag bits for:
a. Direct-mapped
b. Two-way set associative
c. Four-way set associative
d. Fully-associative
4. (36 pts) Assume a 2-way set-associative cache with 32 cache sets, 4 words per block, and an LRU
replacement policy. For both a write-through, no write-allocate and a write-back, write-allocate
cache, fill in the appropriate information for the following memory references (see slide 65 of
Lecture 11).
W
R
R
W
R
R
1840
1844
304
308
820
824
Homework 3 continues on the next page.
5. The following is a stream of virtual addresses as seen on a system. Assume 4KB pages, a four-entry
full associative TLB and true LRU replacement. The initial states of the TLB and Page Table are
shown below.
4095, 31272, 15789, 7193, 4096, 8912
Valid
1
1
1
0
TLB
Page Table
Tag
11
7
3
4
Valid
1
0
0
1
1
1
0
1
0
0
1
1
Physical Page Number
12
4
6
9
Physical Page Number or Disk
5
Disk
Disk
6
9
11
Disk
4
Disk
Disk
3
12
a. (18 pts) For each reference, indicate whether it was a hit in the TLB, a hit in the page table, or a page
fault and what the physical page number is. If pages must be brought in from disk, assign the
next largest physical page number. In other words, fill out the following table:
Virtual Addr
Virtual Page #
Page Offset
TLB Tag
4095
31272
15789
7193
4096
8912
b. (12 pts) Show the final state of the TLB and Page Table.
TLB Result
Page Table
Result
Physical Page #
Download