The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+3 votes
137 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.9k points)
retagged ago by | 137 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 Veteran (10.6k 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.


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

28,946 questions
36,792 answers
91,049 comments
34,688 users