The Gateway to Computer Science Excellence
0 votes
A computer uses a 2-way set associative cache of size 128 KBytes with block (line) size of 32 Bytes. The cache accepts 32 bit addresses of the form $b_{31}b_{30} \dots b_2b_1b_0$ where $b_{31}$ is the most significant address and $b_0$ is the least significant address bit. Which bits are used by the cache controller for indexing into the cache directory?
in CO and Architecture by Veteran
retagged by | 176 views

1 Answer

+1 vote

block size = 32B

cache size = 128KB

number of cache lines = cache size/ block size

                                      = 128kb/32b= 4096

number of cache sets = number of cache lines/p-way

                                  s = 4096/2 = 2048

 tag           s           block size          

16 bits   11 bits    5bits

       tag                                                                      s                     block size

b31b30 b29 b28 b27 b26 b25 b24 b23 

b22 b21 b20 b19 b18 b17 b16

            b15 b14 b13 b12 b11 b10 bb8 b7 b6b5                                                     b4  b3  b2 b1 b0
 A method of addressing a cache directory, comprising:
computing a parity of an address tag field within a presented address;
computing an index including:
the computed parity within a bit of the index; and
an index field within the presented address within remaining bits of the index.
The index field of an address maps to low order cache directory address lines. The remaining cache directory address line, the highest order line, is indexed by the parity of the address tag for the cache entry to be stored to or retrieved from the corresponding cache directory entry. Thus, even parity address tags are stored in cache directory locations with zero in the most significant index/address bit, while odd parity address tags are stored in cache directory locations with one in the most significant index/address bit. The opposite arrangement (msb 1=even parity; msb 0=odd parity) may also be employed, as may configurations in which parity supplies the least significant bit rather than the most significant bit.

now in the set (s) field msb is used as a parity bit the remaining set field bits are used for indexing...along with parity bit

so clearly b15 b14 b13 b12 b11 b10 bb8 b7 b6b5 are used for indexing 

by Boss
edited by
can u give an tag bits are used for indexiing
Tag is like a name. It is used for identification purpose - not for indexing purpose. Indexing works as in an array. We need to go to a particular index. Now, in that particular index, we use tag bits to check if the data is the required one.
thank you sir...i have updated
what is the use of parity?
sir plz check now

Related questions

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
52,218 questions
59,856 answers
118,103 users