The Memory System 211
cache miss. In that case, a complete address is sent to the main memory controller, which reads the main
memory and releases its data. This data are sent to processor and also stored within the cache and the cache
directory is properly updated for future use. Note that A5 – A1 of address bits [Figure 7.6 (a)] are sent to
cache memory to store the new line at its correct location. A5 − A3 are used to target the entry of cache
directory and A2 − A1 are used to target the line-representing bit of cache directory, for updating it.
If the processor offers the cache facility, like Intel 80486, then the cache controller is a part of the
processor and the designer need not worry about the hardware interfacing. At the most some initializa-
tion commands are necessary to organize the in-built cache controller. However, for processors like
8086 or 80386, external cache controller, like 82385, would be necessary to be interfaced with the pro-
cessor. The salient points regarding direct mapped cache are presented below.
R The main memory to be divided into few pages, pages to be divided into several sets and each
set is to be composed of several lines. Generally, a line contains multiple bytes.
R During main memory transactions, always one line would be transacted. Depending upon the
processor, the line may have one or multiple bytes.
R The size of cache should be equal to the size of any one page of main memory.
R When any line is copied from main memory to cache memory, the storage line number in cache
must be the same line number as that of main memory.
R Every set is represented by one entry in cache directory with its least signi cant bits represent-
ing concerned line numbers.
R The page addressing part of the released address from processor is the TAG-address.
R Set addressing part of target address (released from processor) is used to target the correct entry
point of cache directory.
R Both TAG-address including the tag-valid bit as well as the line number must be matched within
cache directory for a cache-hit.
We now solve a few examples to be more familiar with direct mapping technique.
7.4.10 Solved Examples
Problem 7.1
In the same imaginary hardware con guration as explained through Figures 7.5 and 7.6 , assuming the
processor has sent out the 13-bit address of 1 0010 1110 1011B [ Figure 7.7 (a)] for the rst time and
another 13-bit address of 0 1010 0110 0010B [Figure 7.7 (b)] for the second time and the present condi-
tion of cache directory (TAG-RAM) is as shown in Figure 7.7 (c), identify whether these two are cases
of cache-hit or cache-miss.
Solution
In the rst case, the 13-bit address from the processor is 1 0010 1110 1011B, as shown in Figure 7.7 (a).
In the scheme,
Tag address is A12-A6, that is 1001011
Set select bits are A5-A3, that is 101 (set 5), and
Line select bits are A2-A1, which are 01, that is line number 1.
From Figure 7.7 (c), we observe that the current entry at set 5 of cache directory is 1001 0111 0010B.
Its most signi cant seven bits are tag bits, which are 1001 011B, which matches perfectly with the
M07_GHOS1557_01_SE_C07.indd 211M07_GHOS1557_01_SE_C07.indd 211 4/29/11 5:12 PM4/29/11 5:12 PM