A method and apparatus for detecting a cache wrap condition in a computing
environment having a processor and a cache. A cache wrap condition is
detected when the entire contents of a cache have been replaced, relative
to a particular starting state. A set-associative cache is considered to
have wrapped when all of the sets within the cache have been replaced.
The starting point for cache wrap detection is the state of the cache
sets at the time of the previous cache wrap. The method and apparatus is
preferably implemented in a snoop filter having filter mechanisms that
rely upon detecting the cache wrap condition. These snoop filter
mechanisms requiring this information are operatively coupled with cache
wrap detection logic adapted to detect the cache wrap event, and perform
an indication step to the snoop filter mechanisms. In the various
embodiments, cache wrap detection logic is implemented using registers
and comparators, loadable counters, or a scoreboard data structure.