Direct-Mapped Cache as a Set-Associative Cache Origin (n Blocks)
A direct-mapped cache is a special case of a set-associative cache in which each memory block can map to exactly one cache line (no “choice” among multiple ways). In set-associative terms, that means there is exactly one way per set, i.e., it is 1-way set associative.2
A direct-mapped cache with cache blocks can be viewed as having sets, each set containing 1 line (1 way). Therefore, among the provided options, the correct originations are:
- (ii) 1-way set associative
Key terms:
- direct-mapped cache
- set-associative cache
- associativity (ways)
- cache set
Footnotes
-
Set-associative cache (Wikipedia) - Explains set-associative structure and the concept of multiple ways per set. ↩
-
Direct-mapped cache (Wikipedia) - Describes direct-mapped mapping as a special case with one cache line per memory block, consistent with 1-way set associativity. ↩
Direct-Mapped vs Set-Associative Cache (intuitive explanation)
How associativity maps to direct-mapped behavior
- 1Step 1
In a set-associative cache, the address selects a cache set using the index bits, and then the block can go into any of the lines in that set (the “ways”).2
Footnotes
-
Set-associative cache (Wikipedia) - Explains set-associative structure and the concept of multiple ways per set. ↩
-
Direct-mapped cache (Wikipedia) - Describes direct-mapped mapping as a special case with one cache line per memory block, consistent with 1-way set associativity. ↩
-
- 2Step 2
Direct-mapped means each memory block maps to exactly one cache line, so within the selected set there is no alternative choice.2
Footnotes
-
Set-associative cache (Wikipedia) - Explains set-associative structure and the concept of multiple ways per set. ↩
-
Direct-mapped cache (Wikipedia) - Describes direct-mapped mapping as a special case with one cache line per memory block, consistent with 1-way set associativity. ↩
-
- 3Step 3
If each set contains exactly one line, then there is exactly 1 way per set, i.e., the cache is 1-way set associative.2
Footnotes
-
Set-associative cache (Wikipedia) - Explains set-associative structure and the concept of multiple ways per set. ↩
-
Direct-mapped cache (Wikipedia) - Describes direct-mapped mapping as a special case with one cache line per memory block, consistent with 1-way set associativity. ↩
-
- 4Step 4
Having cache blocks implies total cache lines; under direct-mapped mapping each line forms its own set with 1 way, matching the 1-way set associative characterization.
Footnotes
-
Direct-mapped cache (Wikipedia) - Describes direct-mapped mapping as a special case with one cache line per memory block, consistent with 1-way set associativity. ↩
-
Multiple-choice clarification
Pro Tip
When you see direct-mapped, immediately translate it to “one way per set”. That’s the quickest route to the correct option.
Common confusion: interpreting “n blocks”
The phrase “with blocks” can tempt you to think associativity might be -way. Associativity (ways) is the number of lines within one set, not the total number of cache lines/blocks. For direct-mapped, ways = 1 regardless of how many total blocks you have.2
Footnotes
-
Set-associative cache (Wikipedia) - Explains set-associative structure and the concept of multiple ways per set. ↩
-
Direct-mapped cache (Wikipedia) - Describes direct-mapped mapping as a special case with one cache line per memory block, consistent with 1-way set associativity. ↩
Associativity in set-associative cache families
Direct-mapped corresponds to 1-way.
From mapping rule to the set-associative classification
Direct-mapped mapping
Rule: single locationEach memory block maps to exactly one cache line.2"
Footnotes
-
Set-associative cache (Wikipedia) - Explains set-associative structure and the concept of multiple ways per set. ↩
-
Direct-mapped cache (Wikipedia) - Describes direct-mapped mapping as a special case with one cache line per memory block, consistent with 1-way set associativity. ↩
Within-set alternatives = 1
Set selected, then no choiceSelected set contains exactly one line that can receive the block.2"
Footnotes
-
Set-associative cache (Wikipedia) - Explains set-associative structure and the concept of multiple ways per set. ↩
-
Direct-mapped cache (Wikipedia) - Describes direct-mapped mapping as a special case with one cache line per memory block, consistent with 1-way set associativity. ↩
Associativity
Ways countAssociativity = 1 → 1-way set associative.2"
Footnotes
-
Set-associative cache (Wikipedia) - Explains set-associative structure and the concept of multiple ways per set. ↩
-
Direct-mapped cache (Wikipedia) - Describes direct-mapped mapping as a special case with one cache line per memory block, consistent with 1-way set associativity. ↩
Knowledge Check
A direct-mapped cache is equivalent to which set-associative cache configuration?