GATE CSE
First time here? Checkout the FAQ!
x
+3 votes
74 views

Consider a computer with a 4-ways set-associative mapped cache of the following characteristics: a total of 256 MB of main memory, a word size of 1 byte, a line size of 128 words and a cache size of 512 KB.
While accessing the memory location FC23CDEH by the CPU, then the value of  [(((TAG)10)217 mod 17)/6]217   ,where TAG field is the content  of the corresponding cache line.

(a) 3

(b) 0

(c) 1

(d) 2

asked in CO & Architecture by Loyal (2.6k points)  
recategorized by | 74 views

Your parenthesis is not clear. 

Tag for (FC23CDE)H will be 2017

so, {((2017)217mod 17)/6}217

Tag = 11 bit

SO = 10 bit.

Word = 7 bit.

1 Answer

+1 vote
Best answer

Cache size 512 KB 

Block size:128 words 

Number of Block= 4K

Number of sets= 1K

Main memory address= 28 bits 

Word=7 bit

Set = 10 bit

Tag= 28-10-7=11bit

Tag=11 Set=10 Word=7

Value of Tag is $\left ( 11111100001 \right )_{2}=\left ( 2017 \right )_{10}$

$\left ( \left ( \left ( 2017 \right )^{217}mod17 \right )/6 \right )^{217}$

$2017^{217}mod17=6$

https://www.mtholyoke.edu/courses/quenell/s2003/ma139/js/powermod.html

$(6/6)^{2017}=1$

 

answered by Boss (7.8k points)  
selected by
Cache size = 512 KB 


Block size = 128 words 


Number of Blocks = 512KB/ 128 = 4K


Since it is 4-way set associative, there are 4 blocks in each set

Number of sets= 4k/4 = 1K

No. of bits needed to get the set number = 10.


Since main memory is of size 256MB, Main memory address= 28 bits 


Since block is of 128 words, block offset =7 bits


So, out of 28 bits of address 10 bits are needed for set number and 7 bits are needed for block offset.

So the no. of bits for Tag= 28-10-7 = 11bits



Tag Bits(11)

Set Number(10)

Block offset(7)




The given memory location FC23CDEH can be written as 1111 1100 0010 0011 1100 1101 1110. The last H is to say that this is hexa decimal number.


From this the most significant 11 bits are tag bits.. (1111 1100 001)  its decimal value is 2017.


To calculate the required expression we need to find 2017^217 mod 17 , its value is 6. Then (2017^217 mod 17 / 6) = 1. 

The final value is 1^217 = 1.


Top Users Sep 2017
  1. Habibkhan

    7096 Points

  2. Warrior

    2574 Points

  3. Arjun

    2412 Points

  4. rishu_darkshadow

    2402 Points

  5. A_i_$_h

    2204 Points

  6. nikunj

    1980 Points

  7. manu00x

    1846 Points

  8. makhdoom ghaya

    1760 Points

  9. Bikram

    1744 Points

  10. SiddharthMahapatra

    1718 Points


26,115 questions
33,691 answers
79,843 comments
31,098 users