Project ForgeSign up free
Computer Organization & Architecture
Memory Hierarchy & Floating Point
GATE 2013
Hard

In a k-way set associative cache, the cache is divided into v sets, each of which consists of k lines. The lines of a set are placed in sequence one after another. The lines in set s are sequenced before the lines in set (s+1). The main memory blocks are numbered 0 onwards. The main memory block numbered j must be mapped to any one of the cache lines from

  • (j mod v) × k to (j mod v) × k + (k-1)
  • B(j mod v) to (j mod v) + (k-1)
  • C(j mod k) to (j mod k) + (v-1)
  • D(j mod k) × v to (j mod k) × v + (v-1)

Explanation

Block j maps to set number (j mod v). Since the k lines of set s occupy the sequential line range s·k to s·k+(k−1), substituting s=(j mod v) gives the cache line range (j mod v)·k to (j mod v)·k + (k−1).

Source: GATE CS 2013 (2013)

This question is part of a 15-day revision cycle — sign in and Project Forge will bring it back the day before you'd forget it.

Start revising free