# If direct mapping scheme was used instead what will be the size of the tag field?

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?

• 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. – David Richerby Oct 22 '16 at 14:45

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}