-2
$\begingroup$

A computer has a 32K main memory and a 4K fully associative cache memory. The block size is 8 words. The access time for main memory is 10 times that of main memory.

a. What is the size of tag field b. If direct mapping scheme was used instead what will be the size of the tag field?

$\endgroup$
  • 2
    $\begingroup$ What did you try? Where did you get stuck? We're happy to help with conceptual questions but we're not here to answer homework-style exercises. $\endgroup$ – David Richerby Oct 22 '16 at 14:45
0
$\begingroup$

Main memory bits = $log_2(32k)$ = 15 bits
Cache size = 4k
Block size = 8 words

Associate mapping:

The data from any location in RAM can be stored in any location in cache.

Associate mapping addressing will be in the form:

\begin{array} {|r|r|} \hline Tag &Offset\\ \hline \end{array}

where,
offset bit = $log_2(block size)$
Tag = Main memory address bit - offset bit

Here,
Offset = $log_28$ = 3 bits
Tag = 15 - 3 =12 bits

\begin{array} {|r|r|} \hline 12 &3\\ \hline Tag &Offset\\ \hline \end{array}

Direct mapping:

Each location in RAM has one specific place in cache where the data will be held.

Direct mapping addressing will be in the form:

\begin{array} {|r|r|} \hline Tag &line &Offset\\ \hline \end{array}

where,
offset bit = $log_2(block size)$
line bit = $log_2(cache size/block size)$
Tag = Main memory address bit - (line bit + offset bit)

Here,
Offset = $log_28$ = 3 bits line = $log_2(4k/8)$ = 9 bits Tag = 15 - (9+3) = 3 bits

\begin{array} {|r|r|} \hline 3 &9 &3\\ \hline Tag &line &Offset\\ \hline \end{array}

Answer:
(a) 12 bits
(b) 3 bits

Recommended lecture notes on cache memory addressing by:

University of Washington
University of Minnesota
North Carolina A&T State University

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.