When the L2 cache 430 is in the idle state (step S520 being positive, YES branch), the control circuit 432 determines whether the buffer circuit 434 is empty (step S550). If the buffer circuit 434 does not store any data (i.e., step S550 being positive, YES branch), the flow returns to step S520. If the buffer circuit 434 is not empty (i.e., step S550 being negative, NO branch), the control circuit 432 searches the storage circuit 436 for a storage space (step S560), then reads the target data from the buffer circuit 434, and writes the target data to the storage circuit 436. (Step S570). In other words, step S560 and step S570 aim to move the target data from the buffer circuit 434 to the storage circuit 436. After being moved, the target data exists only in the storage circuit 436, and the buffer circuit 434 does not contain the target data. In other words, the buffer circuit 434 and the storage circuit 436 do not store a same line data at the same time. After step S570 is completed, the control circuit 432 finishes the process of writing the target data to the L2 cache 430 (step S580), and the flow returns to step S520.
In step S560, the storage space may be an unoccupied space or a space occupied by data to be evicted. By using algorithms such as the least recently used (LRU) algorithm and referring to the tags in storage circuit 436, the control circuit 432 can locate the data to be evicted.