Strength and Weakness of Associative and Direct-Mapped Caches
Strength/weakness of
the associative cache:
Strength:
Flexible:
a slot in the
associative cache can
store
a word from
any address in memory
Weakness:
Expensive:
you need N"Eq?" compare circuits
where N = # slots
Strength/weakness of
the direct-mapped cache:
Weakness:
Inflexible:
a slot in the
direct-mapped cache can
not store
a word from
any address in memory
Entry 0 in the
direct-mapped cache can
only store
the first word in a
block Entry 1 in the
direct-mapped cache can
only store
the 2nd word in a
block
And so on
Strength:
Inexpensive to make:
you need 1"Eq?" compare circuit
and 3 Muxes
Set-associatve cache
Set-associative cache:
Set-associative cache =
a hybrid cache that
combine
the associative cache and
the direct-mapped cache
A set-associative cache consist of
Ndirect-mapped caches:
The direct-mapped caches
use the set-associative cacheparallel search
technique to
find an entry
Caching in a set-associative cache
How a
set-associative cache
store data
from memory:
Entry 0 in a
block
must be cache in
slot 0 of
any one of
the direct-mapped cache of the
set-associative cache
Entry 1 in a
block
must be cache in
slot 1 of
any one of
the direct-mapped cache of the
set-associative cache
And so on
Example:
Note:
A cache will
never store
the same memory data in
multiple cache slots
Architecture of the set-associative cache
The set-associative cache is
constructed by
combining
both techniques used in
to construct
associative cache and
direct-mapped cache: