13.07.2015 Views

The Midterm Solution - Suraj @ LUMS - Lahore University of ...

The Midterm Solution - Suraj @ LUMS - Lahore University of ...

The Midterm Solution - Suraj @ LUMS - Lahore University of ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Q 23. [15 marks] A microprocessor has an on-chip 2-way set associative cache with a totalcapacity <strong>of</strong> 8 kByte. Each line in cache can store sixteen 8-bit words. It has a totaladdressable space <strong>of</strong> 16 MBytes.Consider the following CPU instruction:Load AB1234ha) Which set number will this request be stored in cache? [2]Number <strong>of</strong> lines in a set (k) = 2Total capacity <strong>of</strong> the cache = 8 k ByteBlock size = 2 w = line size = sixteen 8 bit words = 16 bytesNumber <strong>of</strong> sets (v) = 2 d = Total capacity /( k x line size) = 256Total addressable space = = 2 s+w = 16 M bytesAddress length = (s + w) bits = 24 bitsThus, in the main memory address:Size <strong>of</strong> set = d = 8 bitsSize <strong>of</strong> a word = w = 4 bitsSize <strong>of</strong> a tag = (s-d) bits = 12 bits<strong>The</strong>refore, Load AB1234h will store the result in set number:23 hb) What will be its corresponding tag number? [2]<strong>The</strong> corresponding tag number will be : AB1 hIf the microprocessor had a direct mapped cache with half the capacity <strong>of</strong> the setassociative cache. <strong>The</strong>n,c) Which line number would the request be saved in? [2]If a microprocessor had a direct mapped cache with half the capacity <strong>of</strong> the set <strong>of</strong>the two –way set associative cache, then it would have a capacity <strong>of</strong> 4 kbytes andeffectively the same number <strong>of</strong> lines as the number <strong>of</strong> sets in the set associativecache, i.e.Number <strong>of</strong> lines in cache = m = 2 r = 256Thus, in the main memory address:Size <strong>of</strong> a line = r = 8 bitsSize <strong>of</strong> a word = w = 4 bitsSize <strong>of</strong> a tag = (s- r) bits = 12 bits<strong>The</strong>refore, Load AB1234h will store the result inline number:23 hPage 10 <strong>of</strong> 16

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!