A caching device using an N-way replacement mechanism is disclosed. The
replacement mechanism comprises at least one replacement order list with N
positions, with the first-to-replace position at one end and the
last-to-replace position at the opposite end, each position containing a
way number, N way comparators, a control unit, a replacement order
generator, and receiving a hit signal and, in case of a hit, a hit way
number. A system and method in accordance with the present invention
provides a programmable replacement mechanism applicable to caching
devices, such as instruction and data caches and TLBs (translation
lookaside buffers) in processors or texture map caches in graphics
systems, that use set associative or fully associative organization. A
replacement order list is maintained that specifies the order of which the
elements in a set are to be selected for replacement.