The present invention provides a cache replacement
system based on
instruction stream and memory access mode learning, including a
branch prediction module, which predicts the
instruction stream and writes it into an instruction fetch address
queue; a memory access instruction recording module, which sequentially records the information of the submitted memory access instructions and writes it into its memory access
instruction buffer; and simultaneously obtains the memory access
instruction sequence through query; a memory access mode learning module, which records the memory access
instruction sequence in its memory
access history buffer, learns the memory access mode accordingly, and then predicts the memory access
physical address of the memory access instruction and writes it into the memory access address
queue; a cache replacement decision module, which receives the
physical address of the cache replacement candidate and uses it to retrieve the instruction fetch address
queue or the memory access address queue, and selects a cache replacement candidate as a kick-out item according to the obtained reuse distance and feeds it back to the first-level cache. The present invention also provides a corresponding method. The cache replacement
system of the present invention can avoid the interference of out-of-order execution and cache prefetch, and improve the accuracy of memory access
sequence prediction.