CS 3853 Computer Architecture Virtual Memory Review

Review of Virtual Memory



Example:
Suppose virtual addresses are 32 bits, physical addresses are 35 bits, and the page size is 4K.
A 16K 4-way set associative cache with a block size of 32 bytes is used.
A logical address looks like:
     ------------------------------------------------------------
    |         page number:20 bits        |  page offset: 12 bits |
     ------------------------------------------------------------
and a physical address looks like:
     ----------------------------------------------------------------
    |        frame number:23 bits            | frame offset: 12 bits |
     ----------------------------------------------------------------
The cache has 16K/32 = 512 blocks and 128 sets, so the physical address also looks like:
                                                 index    block offset
     -----------------------------------------------------------------
    |         tag: 23 bits                   |   7 bits   | 5 bits   |
     -----------------------------------------------------------------
Since the page offset and the frame offset are identical, the index can be determined before the address translation is done.
The first step of the cache lookup can be done in parallel with the accessing of the TLB to do the address translation.