1 / 15

Memory Hierarchy

CDA 3101 Discussion Section 10. Memory Hierarchy. Question 1. Assume the word address is 8-bits, calculate the length of tag index and block offset of the following cache: C1: block size = 1 word, 4 blocks, direct-mapped; C2: block size = 1 word, 8 blocks, direct-mapped;

burt
Download Presentation

Memory Hierarchy

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CDA 3101 Discussion Section 10 Memory Hierarchy

  2. Question 1 • Assume the word address is 8-bits, calculate the length of tag index and block offset of the following cache: • C1: block size = 1 word, 4 blocks, direct-mapped; • C2: block size = 1 word, 8 blocks, direct-mapped; • C3: block size = 1 word, 8 blocks, 2-way set associative; • C4: block size = 2 words, 4 blocks, direct-mapped; • C5: block size = 2 words, 4 blocks, fully associative;

  3. Question 1 (cont) • (Block size) = 2(# of offset bits) • (Number of sets) = 2(# of index bits) • (# of tag bits) = (# of memory address bits)  (# of index bits)  (# of offset bits) • Block size =1 => No offset bits • Sets =1 (fully associative) => No index bits

  4. Question 1 (cont) • C1: block size = 1 word, 4 blocks, direct-mapped; • Block size =1 ->Offset bits :0; • 4 blocks direct-mapped -> 4 sets -> index bits =2; • Tag bits = 8-2-0 =6.

  5. Question 1 (cont) • C2: block size = 1 word, 8 blocks, direct-mapped; • Block size =1 ->Offset bits :0; • 8 blocks direct-mapped -> 8 sets -> index bits =3; • Tag bits = 8-3-0 =5.

  6. Question 1 (cont) • C3: block size = 1 word, 8 blocks, 2-way set associative; • Block size =1 ->Offset bits :0; • 8 blocks 2-way set associative -> 4 sets -> index bits =2; • Tag bits = 8-2-0 =6.

  7. Question 1 (cont) • C4: block size = 2 words, 4 blocks, direct-mapped; • Block size =2 ->Offset bits :1; • 4 blocks direct-mapped -> 4 sets -> index bits =2; • Tag bits = 8-2-1 =5.

  8. Question 1 (cont) • C5: block size = 2 words, 4 blocks, fully associative; • Block size =2 ->Offset bits :1; • fully associative -> 1 set -> index bits =0; • Tag bits = 8-0-1 =7.

  9. Question 2 • Mapping the following word addresses to the corresponding cache block: • Address: 2 3 6 7 11 15 26 43: • C1: block size = 1 word, 4 blocks, direct-mapped; • C2: block size = 1 word, 8 blocks, direct-mapped; • C3: block size = 1 word, 8 blocks, 2-way set associative; • C4: block size = 2 words, 4 blocks, direct-mapped; • C5: block size = 2 word, 4 blocks, fully associative;

  10. Question 2 (cont) • 2 = 0000 0010 • 3 = 0000 0011 • 6 = 0000 0110 • 7 = 0000 0111 • 11 = 0000 1011 • 15 = 0000 1111 • 26 = 0001 1010 • 43 = 0010 1011

  11. Question 2 (cont) • C1: block size = 1 word, 4 blocks, direct-mapped; • 2 = 0000 0010 block 2 • 3 = 0000 0011 block 3 • 6 = 0000 0110 block 2 • 7 = 0000 0111 block 3 • 11 = 0000 1011 block 3 • 15 = 0000 1111 block 3 • 26 = 0001 1010 block 2 • 43 = 0010 1011 block 3

  12. Question 2 (cont) • C2: block size = 1 word, 8 blocks, direct mapped; • 2 = 0000 0010 block 2 • 3 = 0000 0011 block 3 • 6 = 0000 0110 block 6 • 7 = 0000 0111 block 7 • 11 = 0000 1011 block 3 • 15 = 0000 1111 block 7 • 26 = 0001 1010 block 2 • 43 = 0010 1011 block 3

  13. Question 2 (cont) • C3: block size = 1 word, 8 blocks, 2-way set associative; ->4 sets • 2 = 0000 0010 set 2: block 4 5 • 3 = 0000 0011 set 3 : block 6 7 • 6 = 0000 0110 set 2 : block 4 5 • 7 = 0000 0111 set 3 : block 6 7 • 11 = 0000 1011 set 3 : block 6 7 • 15 = 0000 1111 set 3 : block 6 7 • 26 = 0001 1010 set 2 : block 4 5 • 43 = 0010 1011 set 3 : block 6 7

  14. Question 2 (cont) • C4: block size = 2 words, 4 blocks, direct-mapped; • 2 = 0000 0010block 1 1st word • 3 = 0000 0011block 1 2nd word • 6 = 0000 0110block 3 1st word • 7 = 0000 0111block 3 2nd word • 11 = 0000 1011block 1 2nd word • 15 = 0000 1111block 3 2nd word • 26 = 0001 1010block 1 1st word • 43 = 0010 1011block 1 2nd word

  15. Question 2 (cont) • C5: block size = 2 word, 4 blocks, fully associative; • 2 = 0000 0010any block 1st word • 3 = 0000 0011any block 2nd word • 6 = 0000 0110any block 1st word • 7 = 0000 0111any block 2nd word • 11 = 0000 1011any block 2nd word • 15 = 0000 1111any block 2nd word • 26 = 0001 1010any block 1st word • 43 = 0010 1011any block 2nd word

More Related