WO2005050455A1 - キャッシュメモリ及びその制御方法 - Google Patents

キャッシュメモリ及びその制御方法 Download PDF

Info

Publication number
WO2005050455A1
WO2005050455A1 PCT/JP2004/016272 JP2004016272W WO2005050455A1 WO 2005050455 A1 WO2005050455 A1 WO 2005050455A1 JP 2004016272 W JP2004016272 W JP 2004016272W WO 2005050455 A1 WO2005050455 A1 WO 2005050455A1
Authority
WO
WIPO (PCT)
Prior art keywords
cache
order
data
flag
cache entry
Prior art date
Application number
PCT/JP2004/016272
Other languages
English (en)
French (fr)
Inventor
Hazuki Okabayashi
Ryuta Nakanishi
Tetsuya Tanaka
Shuji Miyasaka
Original Assignee
Matsushita Electric Industrial Co., Ltd.
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Matsushita Electric Industrial Co., Ltd. filed Critical Matsushita Electric Industrial Co., Ltd.
Priority to EP04799475A priority Critical patent/EP1686485A4/en
Priority to JP2005515574A priority patent/JP4008946B2/ja
Priority to US10/577,133 priority patent/US7984243B2/en
Publication of WO2005050455A1 publication Critical patent/WO2005050455A1/ja
Priority to US13/075,523 priority patent/US20110179227A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/12Replacement control
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/12Replacement control
    • G06F12/121Replacement control using replacement algorithms
    • G06F12/126Replacement control using replacement algorithms with special data handling, e.g. priority of data or instructions, handling errors or pinning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/12Replacement control
    • G06F12/121Replacement control using replacement algorithms

Definitions

  • the present invention relates to a cache memory for speeding up memory access of a processor and a control method therefor.
  • a small-capacity, high-speed cache memory such as a static random access memory (SRAM) is arranged inside or near the microprocessor, and a part of data is stored in the cache memory.
  • SRAM static random access memory
  • a freeze function is provided in the cache memory.
  • the freeze function is a function that copies a program that requires little access but needs to be processed at high speed once activated in the cache memory in advance, and prohibits the area from being rewritten. .
  • the computer system can read out the program from the cache memory and execute it when necessary, thereby shortening the execution time.
  • the purge function releases programs and data that are accessed frequently but whose execution speed is not so demanding, without storing them in the cache memory.
  • the cache memory can be spared, and other programs and data with high priority can be loaded into the cache memory, thereby improving the use efficiency of the cache memory and improving the overall execution time. Is shortened.
  • Patent Document 1 Japanese Patent Application Laid-Open No. 2003-200221
  • freeze function and the purge function have been used, it is possible to keep frequently accessed data in the cache memory or to purge data from the cache memory when the access frequency is low. There is a problem that a complicated circuit is required for controlling the function.
  • the cache memory of the present invention holds order data indicating an access order for each cache entry holding unit data of a cache, and replaces the cache entry indicating the oldest order.
  • the cache memory includes a modifying unit for modifying the order data against an actual access order, and a selecting unit for selecting a cache entry to be replaced based on the modified order data.
  • the altering means comprises: a specifying means for specifying a cache entry holding data belonging to a specified address range of the processor; and an ordering data of the specified cache entry, which is contrary to an actual access order. It may be configured to include the oldest means for old age.
  • the cache entry is selected as the replacement target first. As a result, it is possible to reduce the frequency of access, and reduce the occurrence of cache misses due to data remaining in the cache memory.
  • the specifying means converts the start address into a start line address indicating a start line included in the address range.
  • the start line address may include a determination unit that determines whether there is a cache entry holding data corresponding to each line address up to the end line address.
  • the processor can specify any address (or any size) from any address regardless of the line size of the cache memory and the address of the line boundary as the address range. it can. That is, it is not necessary for the processor to manage the line size and the address of the line boundary of the cache memory, so that the load for managing the cache memory can be eliminated.
  • the oldest means may add an oldest flag indicating that the access order is the oldest to the order data.
  • the access order is modified by indirectly adding the W flag without directly modifying the order data indicating the access order in the LRU scheme. This can be realized without adding.
  • the selecting means selects the cache entry as a replacement target, If there is no cache entry to which the oldest flag is added, a cache entry to be replaced may be selected according to the order data.
  • the cache entry has, as the order data, a 1-bit order flag indicating whether the access order is old or new, and the selecting means includes a cache to which an oldest flag is added. If the entry does not exist, a configuration may be adopted in which a cache entry indicating that the order flag is old is selected as a replacement target.
  • the order data can be a 1-bit order flag! Since the data amount of the access order data is small and updating is easy, the hardware scale can be reduced. it can.
  • the altering means alters the order data so that the access order of one cache entry is Nth, and N is a number indicating that (a) the access order is the oldest order , (B) a number indicating that the access order is the newest, (c) a number indicating that the access order is the oldest, and (d) a number indicating that the access order is also the Nth. It may be configured to be one of the numbers.
  • the altering means includes an instruction detecting means for detecting that a memory access instruction with an access order alteration instruction has been executed, and writes order data to a cache entry accessed by the instruction. It may be configured to include a rewriting means for changing
  • the altering means includes: holding means for holding an address range designated by a processor; searching means for searching for a cache entry holding data corresponding to the address range held by the holding means; Rewriting means for rewriting the order data so that the access order of the cache entry searched by the means is Nth.
  • the cache memory control method of the present invention has the same means and operation as described above.
  • data with a low access frequency can be replaced with data with higher priority than other data with a high access frequency. It is possible to prevent data that is frequently accessed from being replaced.
  • the cache entry is selected as a replacement target first. As a result, it is possible to reduce the frequency of access and reduce the possibility of cache misses caused by data remaining in the cache memory.
  • the load for managing the cache memory in the processor can be eliminated.
  • FIG. 1 is a block diagram showing a schematic configuration of a system including a processor, a cache memory, and a memory according to a first embodiment of the present invention.
  • FIG. 2 is a block diagram showing a configuration example of a cache memory.
  • FIG. 3 shows a detailed bit configuration of a cache entry.
  • FIG. 4 is a block diagram showing a configuration of a control unit.
  • FIG. 5 is a block diagram showing a configuration example of a W flag setting unit.
  • FIG. 6A shows an example of an instruction for writing a start address to a start address register.
  • FIG. 6B shows an example of an instruction for writing a size to the size register.
  • FIG. 6C shows an example of an instruction for writing a command to the command register.
  • FIG. 6D shows an example of the command.
  • FIG. 7 is an explanatory diagram of a start aligner and an end aligner.
  • FIG. 8 is a flowchart showing a W flag setting process in a flag rewriting unit.
  • FIG. 9 is a flowchart showing a replacement process in a replacement unit.
  • FIG. 10 is a block diagram showing a configuration of a cache memory according to Embodiment 2 of the present invention.
  • FIG. 11 shows a bit configuration of a cache entry.
  • FIG. 12 is a block diagram showing a configuration of a control unit.
  • FIG. 13 shows an example of updating a use flag by a replacement unit.
  • FIG. 14B is an explanatory diagram showing a role of a weak flag W in a replacement process.
  • FIG. 15 is a flowchart showing a U flag updating process in a flag updating unit.
  • FIG. 16 is a flowchart showing a replacement process in a replacement unit. [17]
  • FIG. 17 is a diagram illustrating another configuration example of the W flag setting unit.
  • FIG. 18 is a diagram showing yet another configuration example of the W flag setting unit.
  • FIG. 1 is a block diagram showing a schematic configuration of a system including a processor 1, a cache memory 3, and a memory 2 according to Embodiment 1 of the present invention. As shown in the figure, a cache memory 3 of the present invention is provided in a system having a processor 1 and a memory 2.
  • the cache memory 3 is premised on replacement control for replacing a cache entry with an old access order by a so-called LRU method.
  • the cache memory 3 according to the present embodiment replaces a cache entry holding data with a low access frequency by modifying order data indicating an access order for determining a replacement target against the access order. It is configured to be evicted from the cache memory.
  • the order data is indirectly modified by adding a weak flag W to the cache entry indicating that the access order is considered to be the oldest. This eliminates the need for complicated circuits that directly modify the order data.
  • FIG. 2 is a block diagram showing a configuration example of the cache memory 3.
  • the cache memory 3 has an address register 20, a memory IZF21, a decoder 30, four ways 31a to 31d (hereinafter abbreviated as ways 0 to 3), four comparators 32a to 32d, and four AND circuits. 33a-33d, OR circuit 34, selectors 35 and 36, demultiplexer 37, and control unit 38.
  • the address register 20 is a register that holds an access address to the memory 2. This access address shall be 32 bits. As shown in the figure, the access address includes a 21-bit tag address, a 4-bit set index (SI in the figure), and a 5-bit word index (WI in the figure) in order from the most significant bit.
  • the tag address indicates the area in the memory that is mapped to the way (the size is the number of sets X blocks). The size of this area is determined by the address bits (A10—AO) that are lower than the tag address, that is, 2 kbytes, and is also the size of one way.
  • the set index (SI) refers to one of multiple sets spanning ways 0-3. Since the number of sets is set index power bit, there are 16 sets.
  • the cache entry specified by the tag address and the set index is a replacement unit, and when stored in the cache memory, is called line data or line.
  • the size of the line data is the size determined by the address bits lower than the set index, that is, 128 bytes. If one word is 4 bytes, one line data is 32 words.
  • the word index (WI) indicates one word among a plurality of words constituting the line data.
  • the two least significant bits (Al, AO) in address register 20 are ignored during word access.
  • the memory IZF 21 is an IZF for accessing the memory 2 from the cache memory 3 such as writing back data from the cache memory 3 to the memory 2 and loading data into the cache memory 3.
  • the decoder 30 decodes 4 bits of the set index, and crosses over four ways 0-3.
  • the four ways 0-3 are four ways having the same configuration and have a capacity of 4 x 2k bytes. Each way has 16 cache entries.
  • FIG. 3 shows a detailed bit configuration in one cache entry. As shown in the figure, one cache entry 1 has a NORD flag V0-V3, a 21-bit tag, 128 Knots of line data, a weak flag W, and a dirty flag DO-D3.
  • a tag is a copy of a 21-bit tag address.
  • Line data is a copy of the 128-byte data in the block specified by the tag address and the set index, and consists of four 32-byte sub-lines.
  • the NORD flag VO-V3 corresponds to four sub-lines and indicates whether the sub-line is valid.
  • the dirty flag DO-D3 corresponds to the four sub-lines, and the processor power is written to those sub-lines. That is, the cached data exists in the sub-line but differs from the data in the memory due to the write. This indicates whether writing back to memory is necessary.
  • the comparator 32a compares the tag address in the address register 20 with the tag of the way 0 among the four tags included in the set selected by the set index. The same applies to the comparators 32b-32c except that they correspond to the bays 31b-31d.
  • the AND circuit 33a compares the NORD flag with the comparison result of the comparator 32a to determine whether or not the forces match. Let hO be the result of this comparison. If the comparison result hO is 1, it means that line data corresponding to the tag address and the set index in the address register 20 exists, that is, a hit has occurred in way 0. If the comparison result hO is 0, it means that a miss has occurred. The same applies to AND circuits 33b-33d except that they correspond to ways 31b-31d. The comparison result hi-h3 means the force that hit or missed way 1-13.
  • the OR circuit 34 takes the OR of the comparison result hO—h3. Let the result of this OR be hit. hit is
  • the selector 35 selects the line data of the hit way from the line data of the ways 0-3 in the selected set.
  • the selector 36 selects one word indicated by the word index out of the 32-word line data selected by the selector 35.
  • the demultiplexer 37 When writing data to the cache entry, the demultiplexer 37 outputs the write data to one of the ways 0-3. This write data may be in word units.
  • the control unit 38 controls the entire cache memory 3. In particular, it sets the W flag and performs replacement control according to the W flag.
  • FIG. 4 is a block diagram showing a configuration of the control unit 38. As shown in the figure, the control unit 38 includes a rib race unit 39 and a W flag setting unit 40.
  • the W flag setting unit 40 sets the weak flag W according to a command from the processor 1.
  • the processor 1 issues a command for setting the weak flag W to the cache memory 3 for a cache entry that is no longer written or read.
  • FIG. 5 is a block diagram showing a configuration example of the W flag setting unit 40.
  • the W flag setting unit 40 includes a command register 401, a start address register 402, and a size register 40.
  • An adder 404, a start aligner 405, an end aligner 406, and a flag rewriting unit 407 are provided.
  • the command register 401 is a register directly accessible from the processor 1, and holds the W flag setting command written by the processor 1.
  • FIG. 6C shows an example of an instruction for writing a command to the command register 401. This instruction is a normal transfer instruction (mov instruction), in which a command is used as a source operand and a command is used as a destination operand. Command register (CR) is specified.
  • FIG. 6D shows an example of the command. This command is a specific code indicating the W flag setting command. The W flag setting command sets the W flag for the cache entry that holds data corresponding to the address range of the size held in the size register 403 from the start address held in the start address register 402. It is a command to instruct.
  • the start address register 402 is a register directly accessible from the processor 1, and holds the start address written by the processor 1. This start address indicates the start position of the address range in which the W flag should be set.
  • FIG. 6A shows an example of an instruction for writing a start address to the start address register 402. This instruction is also a normal transfer instruction (mov instruction) as in FIG. 6 (c).
  • the size register 403 is a register directly accessible from the processor 1, and holds the size written by the processor 1. This size indicates the address range from the start address.
  • FIG. 6B shows an example of an instruction for writing the size in the size register 403. This instruction is also a normal transfer instruction (mov instruction) as in FIG. 6 (c).
  • the unit of the size may be the number of bytes or the number of lines (the number of cache entries) as long as it is a predetermined unit! ,.
  • the calorie calculator 404 adds the start address held in the start address register 402 and the size held in the size register 403.
  • the addition result is an end address indicating the end position of the address range.
  • the adder 404 may add the value as a byte address when the size is designated by the number of bytes, and add it as a line address when the size is designated by the number of lines.
  • the start aligner 405 adjusts the start address to the position of the line boundary. With this adjustment, the processor 1 can specify an arbitrary address as the start address regardless of the line size and the line boundary.
  • the end aligner 406 adjusts the end address to the position of the line boundary. By this adjustment, the processor 1 can specify any size as the above-mentioned size regardless of the line size and the line boundary.
  • FIG. 7 is an explanatory diagram of the start aligner 405 and the end aligner 406. Smell
  • the start address specified by processor 1 indicates an arbitrary position in the middle of line N.
  • the start aligner 405 adjusts to point to the beginning of the next line (N + 1), and outputs the adjusted address as an align start address.
  • the line indicated by the line start address is called the start line.
  • the end address indicates an arbitrary position in the middle of the line M.
  • the end aligner 406 adjusts to point to the head of the immediately preceding line (M-1), and outputs the adjusted address as an align end address.
  • the line indicated by the line end address is called an end line.
  • the W flag is set for each line (cache entry) from the start line (line (N + 1)) to the end line (line (M-1)).
  • the start aligner 405 and the end aligner 406 are aligned inside the address range from the start address to the end address specified by the processor 1 only in the portions outside the line N and the line M. This is because writing or reading from the processor 1 may occur.
  • the flag rewriting unit 407 controls the cache memory from the line card indicated by the line start address to the line indicated by the line end address (in the example of Fig. 7, the line (N + 1) force and the line (M-1)). If it is entered in 3! /, The W flag is set to 1.
  • FIG. 8 is a flowchart illustrating an example of the W flag setting process in the flag rewriting unit 407.
  • the flag rewriting unit 407 When the W flag setting command is held in the command register 401, the flag rewriting unit 407 outputs the line addresses from the start line card to the end line in order, and performs the processing of loop 1 (S82— S86). Since the flag rewriting unit 407 performs the same processing for each line, the processing for one line will be described here.
  • the flag rewriting unit 407 outputs the line address to the address register 20 (S83), and outputs the tag address of the address register 20 and the tag of the cache entry. Are compared with the comparators 32a-32d, and it is determined whether or not there is a hit (S84). Further, the flag rewriting unit 407 sets the W flag to 1 for the hit cache entry in the case of a hit (S85), and None has been entered in the cache memory.
  • the W flag is set to 1 when each line up to the start line force and the end line has been entered in the cache memory 3.
  • FIG. 9 is a flowchart showing the replacement process in the replacement unit 39.
  • the replacement unit 39 replaces one of the cache entries of the selected way in the set (step S96), and initializes the weak flag W of the cache entry to 0 after the replacement (step S97). At this time, the NORD flag V and the Dirty flag D are each initialized to 0.
  • the order data indicating the access order in the conventional LRU method is directly modified. Since the access order is modified by indirectly adding the w flag, it can be realized without adding a complicated hardware circuit.
  • cache memory of the present invention is not limited to the configuration of the above-described embodiment, and various modifications can be made. Hereinafter, some of the modified examples will be described.
  • the order data is indirectly modified by the addition of the W flag.
  • the order data may be directly modified.
  • the weak flag W indicates that the access order is the oldest, but the weak flag W may indicate that the access order is not the latest or the oldest.
  • the control unit 38 further includes an instruction detection unit for detecting a special store instruction.
  • a flag setting unit for setting W l when writing by the store instruction.
  • a 4-way 'set' associative cache memory has been described as an example, but the number of ways may be any number. Further, in the above embodiment, an example in which the number of sets is 16 has been described, but the number of sets may be shoes.
  • each cache entry 1 may hold the same number of knowledge flags and dirty flags as the number of sublines.
  • the first embodiment has described the configuration in which the access order is set to the oldest by the weak flag W on the premise of the normal LRU method.
  • a pseudo LRU method in which order data indicating an access order is represented by a 1-bit flag, and a cache memory that performs the oldest dating using a weak flag are described below. Will be explained.
  • FIG. 10 is a block diagram showing a configuration of a cache memory according to Embodiment 2 of the present invention.
  • the cache memory shown in the figure is different from the configuration shown in FIG. 2 in that ways 131a-131d are provided instead of ways 31a-31d, and that a control unit 138 is provided instead of the control unit 38.
  • ways 131a-131d are provided instead of ways 31a-31d
  • a control unit 138 is provided instead of the control unit 38.
  • description of the same points will be omitted, and different points will be mainly described.
  • the way 131a is different from the way 31a in that the use flag U is added in each cache entry.
  • Ways 131b-131d are similar.
  • the use flag U is provided in place of the order data indicating the access order among the four ways, and is a flag that expresses the access order with 1 bit.
  • FIG. 11 shows a bit configuration of a cache entry.
  • the bit configuration in the figure is different from that in FIG. 3 in that a use flag U is added.
  • the use flag U indicates whether or not the cache entry has been accessed, and is used instead of the access order data in the four-way cache entry at the time of replacement due to a mishit in the LRU method. More precisely, a use flag U of 1 means that an access has been made, and 0 does not. However, it is reset to 0 when the use flags of the four ways in one set all become 1. In other words, the usage flag U indicates the relative state of the access, old or new. In other words, a cache entry with a use flag U of 1 means that a cache entry with a use flag of 0 is more recently accessed.
  • the control unit 138 is different from the control unit 38 in that instead of the access order information in the LRU scheme, In that replacement control is performed using the use flag u.
  • FIG. 12 is a block diagram showing a configuration of the control unit 138.
  • the control unit 138 shown in the drawing is different from the control unit 38 in that a replace unit 139 is provided instead of the replace unit 39, and that a flag update unit 41 is added.
  • the replacement unit 139 performs a replacement process at the time of a cache miss by a pseudo LRU method using the use flag U as an access order. At that time, the replacement unit 139 treats the cache entry with the weak flag W as the oldest cache entry and selects the cache entry as the replacement target first.
  • the flag updating unit 41 updates the use flag U when the cache memory is accessed.
  • FIG. 13 shows an example of updating the use flag by the replacement unit 139.
  • the upper, interrupted, and lower rows of the figure show the cache entries of the four ways that make up the set N that spans ways 0-3. 1 or 0 at the right end of each of the four cache entries is the value of the use flag.
  • These four use flags U are described as UO-U3.
  • the replacement unit 139 determines one of the ways 1 and 3 as the replacement target in the upper part of FIG. 5, determines the way 3 as the replacement target in the middle part of FIG. 5, and determines the way 0-2 in the lower part of FIG. One of them is determined as a replacement target.
  • FIG. 14 (a) is a comparative example when it is assumed that a weak flag does not exist, and is a diagram showing a state where a cache entry is replaced.
  • This figure also shows four cache entries that constitute a set N that spans layers 0 to 3 as in FIG. The 1 or 0 at the right end of each of the four cache entries is the value of the use flag.
  • only data E is data with low access frequency
  • data A, B, C, and D are data with high access frequency.
  • data E that is not frequently used is not selected as a replacement target and remains in the cache memory.
  • the access frequency (in the normal LRU method!), Low, the data E may cause a worst case of four cache misses in the case of 4-way.
  • FIG. 14B is an explanatory diagram showing the role of the weak flag W in the replacement process.
  • FIG. 15 is a flowchart showing the U flag updating process in the flag updating unit 41.
  • the use flag U of the cache entry whose the NORD flag is 0 (invalid) has been initialized to 0.
  • the flag update unit 41 sets the use flag U of the hit way in the set selected by set indices to 1 (step S62).
  • the use flag U of the other way is read (step S63), and it is determined whether or not the read use flag U is all 1 (step S64). If it is, reset all use flags U of other ways to 0 (Step S65).
  • the flag updating unit 41 updates the use flag U as in the update examples shown in Figs. 13 and 14 (a) and (b). [0100] ⁇ Replacement processing>
  • FIG. 16 is a flowchart showing the replacement process in the replacement unit 139.
  • the replacement unit 139 replaces the cache entry of the selected way in the set (step S96), and after the replacement, sets the use flag U of the cache entry to 1 and the weak flag W to 0. (Step S97). At this time, the normal flag V and the dirty flag D are initialized to 1 and 0, respectively.
  • the pseudo LRU scheme using a 1-bit use flag instead of the data indicating the access order in the conventional LRU scheme is adopted. Since a 1-bit flag can be used as the access order data, the hardware size can be reduced because the data amount of the access order data is small and the update is easy.
  • the processor 1 executes a load Z store instruction (hereinafter abbreviated as W-LZS instruction) for accessing data while setting the weak flag W to 1, and executes the control unit 38 or the control unit 138. May detect the execution of a W-LZS instruction and set the W flag to 1 immediately after the access by the W-LZS instruction.
  • FIG. 17 shows a configuration example of the W flag setting unit 40a provided in the control unit 38 or 138 in that case.
  • the W flag setting unit 40a includes an LDZST instruction detecting unit 410, a weak instruction detecting unit 411, an AND circuit 412, and a flag rewriting unit 413.
  • LDZST instruction detecting section 410 detects that processor 1 has executed a load Z store instruction.
  • the weak instruction detecting unit 411 detects whether a weak instruction is output from the processor 1 at the time of executing the load Z store instruction.
  • the weak instruction can be detected, for example, by a signal line from the processor 1.
  • the AND circuit 412 notifies the flag rewriting section 413 of the detection of the W-LZS instruction.
  • the flag rewriting unit 413 sets the weak flag W to 1 for the cache entry holding the data accessed by the W-LZS instruction.
  • the order data indicating the access order is directly transmitted instead of the weak flag W.
  • the configuration may be modified.
  • the weak instruction detecting unit 411 detects a number (Nth) indicating the access order to be set from the processor 1 executing the load Z store instruction with the access order to be set.
  • the first may be any of the fourth (or 0 to 3).
  • the flag rewriting unit 413 changes the order data of the cache entry holding the data accessed by the load Z store instruction with the access order designation to Nth.
  • any order data can be directly
  • the configuration may be changed to N.
  • the W flag setting unit 40 shown in FIG. 5 may be replaced with a W flag setting unit 40b shown in FIG.
  • the W flag setting unit 40b has a configuration in which a comparator 408 is added to the W flag setting unit 40, and a flag rewriting unit 407a is provided instead of the flag rewriting unit 407.
  • the comparator 408 determines whether the line address of the end line output from the adder 404 matches the line address output from the flag rewriting unit 407a for setting a wick flag and held in the tag address register 20. ⁇ judge whether or not.
  • This comparator 408 is used to determine the end address in loop 1 during the W flag setting process shown in FIG. That is, when the flag rewriting unit 407a determines that the comparator 408 matches, the flag rewriting unit 407a ends the setting of the quick flag.
  • FIGS. 6 (a), (b) and (c) may be inserted into the program by the compiler.
  • the compiler inserts the above-mentioned instructions at the program position without writing any more, such as writing array data or writing block data when decoding compressed moving image data. Just fine.
  • the present invention is suitable for a cache memory for performing high-speed memory access, for example, an on-chip cache memory, an off-chip cache memory, a data cache memory, an instruction cache memory, and the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

 本発明のキャッシュメモリは、キャッシュの単位データを保持するキャッシュエントリー毎にアクセス順序を示す順序データを、実際のアクセス順序に反して改変するWフラグ設定部40と、改変後の順序データに基づいてリプレースすべきキャッシュエントリーを選択してリプレースするリプレース部39とを備える。     

Description

明 細 書
キャッシュメモリ及びその制御方法
技術分野
[0001] 本発明は、プロセッサのメモリアクセスを高速化するためのキャッシュメモリおよびそ の制御方法に関する。
背景技術
[0002] 近年のマイクロプロセッサでは、例えば、 SRAM (Static Random Access Mem ory)等力 成る小容量で高速なキャッシュメモリをマイクロプロセッサの内部、もしくは その近傍に配置し、データの一部をキャッシュメモリに記憶することによって、マイクロ プロセッサのメモリアクセスを高速化させて 、る。
[0003] 上記コンピュータシステムでは、中央処理装置力 キャッシュメモリへのリードァクセ スまたはライトアクセスがミスヒットした場合に、主記憶装置から新たに読み出したデー タの一部が、エントリ(登録項目)としてキャッシュメモリの空きブロックに格納される。こ の時、空きブロックが存在しない場合には、複数のブロックの何れか 1つを選択し、選 択されたブロックに格納されているエントリを主記憶装置に戻してブロック内を空き状 態にし、この空きブロックに新たに読み出したデータを格納するエントリ置換処理が 必要になる。上記エントリ置換処理では、最も以前に参照したデータを格納している ブロックを選択する手法、すなわち、 LRU (Least Recently Used)デコード方式が 一般的に採用されて 、る。この LRUデコード方式によってキャッシュメモリの使用効 率が向上し、その結果、マイクロプロセッサの実行速度が向上する。
[0004] マイクロプロセッサが処理するプログラムの中には、アクセス頻度は少な!/、ものの、 ひとたび起動された場合には高速に処理しなければならな 、ような特殊な処理と、ァ クセス頻度は多 ヽが、実行速度がそれほど要求されな ヽような処理とが存在する。
[0005] そこで、これに対応するために例えば特許文献 1等の従来技術では、キャッシュメ モリにフリーズ機能を設けている。フリーズ機能は、アクセスは少ないものの、ひとた び起動された場合には高速に処理しなければならないようなプログラムを予めキヤッ シュメモリ内にコピーしておき、その領域を書き換え禁止にしておく機能である。この 機能を有することで、コンピュータシステムは、必要な時にプログラムをキャッシュメモ リから読み出して実行することができ、これにより実行時間が短縮する。また、パージ 機能は、アクセス頻度は多いが、実行速度がそれほど要求されないようなプログラム やデータをキャッシュメモリ内に保存しておくことなく、その領域を解放する機能であ る。この機能を有することで、キャッシュメモリに余裕ができ、優先度の高い他のプログ ラムやデータをキャッシュメモリに取り込むことができ、これにより、キャッシュメモリの 利用効率が向上し、総合的な実行時間が短縮する。
特許文献 1:特開 2003—200221号公報
発明の開示
発明が解決しょうとする課題
[0006] し力しながら、フリーズ機能もパージ機能も、アクセス頻度の高いデータをキャッシュ メモリに留めたり、アクセス頻度の低 、データをキャッシュメモリから追い出すことを可 能としているが、フリーズ機能及びパージ機能の制御のために複雑な回路を必要と するという問題がある。
[0007] 本発明は、複雑な回路を設けることなく、アクセス頻度の低 、データを他のアクセス 頻度の高いデータよりも優先的にリプレース対象とするキャッシュメモリを提供すること を目的とする。
課題を解決するための手段
[0008] 上記目的を達成するため本発明のキャッシュメモリは、キャッシュの単位データを保 持するキャッシュエントリー毎にアクセス順序を示す順序データを保持し、最も古 ヽ順 序を示すキャッシュエントリーをリプレースするキャッシュメモリであって、前記順序デ ータを実際のアクセス順序に反して改変する改変手段と、改変後の順序データに基 づいてリプレースすべきキャッシュエントリーを選択する選択手段とを備える。
[0009] この構成によれば、例えば、アクセス頻度の低 、データの順序データをアクセス順 序が最も古 、ように改変することにより、アクセス頻度の低 、データを他のアクセス頻 度の高いデータよりも優先的にリプレース対象とすることができ、アクセス頻度の高い データの順序データをアクセス順序が最新又は最も古くな 、ことを示すように改変す ることにより、アクセス頻度の高いデータがリプレースされることを防止することができ る。
[0010] ここで、前記改変手段は、プロセッサ力 指定されたアドレス範囲に属するデータを 保持するキャッシュエントリーを特定する特定手段と、特定されたキャッシュエントリー の順序データを実際のアクセス順序に反して最古ィヒする最古ィヒ手段とを備える構成 としてちよい。
[0011] この構成によれば、プロセッサ力 これ以上読み出しも書き込みもなされないキヤッ シュエントリーのアクセス順序を最古にすれば、当該キャッシュエントリ一は真っ先に リプレース対象として選択される。これによりアクセス頻度の低 、データがキャッシュメ モリに居残ることによるキャッシュミスの誘発を低減することができる。
[0012] ここで、前記特定手段は、前記アドレス範囲の先頭アドレスがラインデータの途中を 指す場合、当該先頭アドレスを、前記アドレス範囲に含まれる先頭のラインを指すス タートラインアドレスに変換する第 1変換手段と、前記アドレス範囲の末尾アドレスがラ インデータの途中を指す場合、当該末尾アドレスを、前記アドレス範囲に含まれる末 尾のラインを指すエンドラインアドレスに変換する第 2変換手段と、前記スタートライン アドレス力 エンドラインアドレスまでの各ラインアドレスに対応するデータを保持する キャッシュエントリーがある力否かを判定する判定手段とを備える構成としてもよい。
[0013] この構成によれば、プロセッサは、前記アドレス範囲として、キャッシュメモリのライン サイズ及びライン境界のアドレスとは無関係に任意のアドレスから任意のアドレス(又 は任意のサイズ)を指定することができる。つまり、プロセッサにおいてキャッシュメモリ のラインサイズ及びライン境界のアドレスを管理する必要がな 、ので、キャッシュメモリ 管理のための負荷を解消することができる。
[0014] ここで、前記最古化手段は、アクセス順序が最も古 ヽことを示す最古化フラグを順 序データに付加する構成としてもょ ヽ。
[0015] この構成によれば、 LRU方式におけるアクセス順序を示す順序データを直接改変 することなく、間接的に Wフラグを付加することによってアクセス順序を改変して 、る ので、複雑なハードウェア回路を追加することなく実現することができる。
[0016] ここで、前記選択手段は、キャッシュミス時に、最古ィ匕フラグが付加されたキャッシュ エントリーが存在する場合、そのキャッシュエントリーをリプレース対象として選択し、 最古ィ匕フラグが付加されたキャッシュエントリーが存在しない場合、順序データに従 つてリプレース対象とすべきキャッシュエントリーを選択する構成としてもよい。
[0017] ここで、前記キャッシュエントリ一は、アクセス順序が古いか新しいかを示す 1ビット の順序フラグを前記順序データとして有し、前記選択手段は、最古ィ匕フラグが付加さ れたキャッシュエントリーが存在しな 、場合、順序フラグが古 、ことを示すキャッシュ エントリーをリプレース対象として選択する構成としてもよい。
[0018] この構成によれば、順序データが 1ビットの順序フラグでよ!、ので、アクセス順序デ ータのデータ量が少ないこと及び更新が簡単であることからハードウェア規模を小さく することができる。
[0019] ここで、前記改変手段は、 1つのキャッシュエントリーのアクセス順序を N番目にする よう前記順序データを改変し、前記 Nは、(a)アクセス順序が最も古い順であること示 す番号、(b)アクセス順序が最も新しいことを示す番号、(c)アクセス順序が最も古い 順序力も N番目であることを示す番号、(d)アクセス順序が最も新しい順序力も N番目 であることを示す番号の何れかであるように構成してもよ 、。
[0020] ここで、前記改変手段は、アクセス順序の改変指示付きメモリアクセス命令が実行さ れたことを検出する命令検出手段と、当該命令によってアクセスがなされたキャッシュ エントリーに対して順序データを書き替える書き換え手段とを備える構成としてもよい
[0021] ここで、前記改変手段は、プロセッサ力 指定されたアドレス範囲を保持する保持 手段と、保持手段に保持されたアドレス範囲に対応するデータを保持するキャッシュ エントリーを探索する探索手段と、探索手段により探索されたキャッシュエントリーの アクセス順序を N番目とするよう順序データを書き換える書き換え手段とを備える構 成としてもよい。
[0022] また、本発明のキャッシュメモリの制御方法についても上記と同様の手段、作用を 有する。
発明の効果
[0023] 以上のように本発明のキャッシュメモリによれば、アクセス頻度の低 、データを他の アクセス頻度の高いデータよりも優先的にリプレース対象とすることができ、また、ァク セス頻度の高いデータがリプレースされることを防止することができる。
[0024] 例えば、プロセッサ力もこれ以上読み出しも書き込みもなされないキャッシュエントリ 一のアクセス順序を最古にすれば、当該キャッシュエントリ一は真っ先にリプレース対 象として選択される。これによりアクセス頻度の低 、データがキャッシュメモリに居残る ことによるキャッシュミスの誘発を低減することができる。
[0025] また、プロセッサにおいてキャッシュメモリのラインサイズ及びライン境界のアドレス を管理する必要がないので、プロセッサにおけるキャッシュメモリ管理のための負荷を 解消することができる。
図面の簡単な説明
[0026] [図 1]本発明の実施の形態 1におけるプロセッサ、キャッシュメモリ、メモリを含むシス テムの概略構成を示すブロック図である。
[図 2]キャッシュメモリの構成例を示すブロック図である。
[図 3]キャッシュエントリーの詳細なビット構成を示す。
[図 4]制御部の構成を示すブロック図である。
[図 5]Wフラグ設定部の構成例を示すブロック図である。
[図 6A]スタートアドレスレジスタにスタートアドレスを書き込む命令の一例を示す。
[図 6B]サイズレジスタにサイズを書き込む命令の一例を示す。
[図 6C]コマンドレジスタにコマンドを書き込む命令の一例を示す。
[図 6D]コマンドの一例を示す。
[図 7]スタートァライナ及びエンドアライナの説明図を示す。
[図 8]フラグ書換部における Wフラグ設定処理の示すフローチャートである。
[図 9]リプレース部におけるリプレース処理を示すフローチャートである。
[図 10]本発明の実施の形態 2におけるキャッシュメモリの構成を示すブロック図である
[図 11]キャッシュエントリーのビット構成を示す。
[図 12]制御部の構成を示すブロック図である。
[図 13]リプレース部による使用フラグの更新例を示す。
[図 14A]ウィークフラグが存在しない場合にキャッシュエントリーがリプレースされる様 子を示す図である。
[図 14B]リプレース処理におけるウィークフラグ Wの役割を示す説明図である。
[図 15]フラグ更新部における Uフラグ更新処理を示すフローチャートである。
[図 16]リプレース部におけるリプレース処理を示すフローチャートである。 圆 17]Wフラグ設定部の他の構成例を示す図である。
[図 18]Wフラグ設定部のさらに他の構成例を示す図である。
符号の説明
1 プロセッサ
2 メモリ
3 キャッシュメモリ
20 アドレスレジスタ
20 タグアドレスレジスタ
21 メモリ IZF
30 デコーダ
31a-一 31d ウェイ
32a- 32d 比較器
33a-一 33d アンド回路
34 オア回路
35 セレクタ
36 セレクタ
37 デマルチプレクサ
38 制御部
39 リプレース部
40 Wフラグ設定部
41 フラグ更新部
131a- - 131d ウェイ
138 制御部
139 リプレース部 401 コマンドレジスタ
402 スタートアドレスレジスタ
403 サイズレジスタ
404 加算器
405 スタートァライナ
406 エンドアライナ
407 フラグ書換部
407a フラグ書換部
408 比較器
410 LDZST命令検出部
411 ウィーク指示検出部
412 アンド回路
413 書き換え部
発明を実施するための最良の形態
[0028] (実施の形態 1)
<全体構成 >
図 1は、本発明の実施の形態 1におけるプロセッサ 1、キャッシュメモリ 3、メモリ 2を 含むシステムの概略構成を示すブロック図である。同図のように、本発明のキャッシュ メモリ 3は、プロセッサ 1およびメモリ 2を有するシステムに備えられる。
[0029] キャッシュメモリ 3は、いわゆる LRU方式によってアクセス順序の古いキャッシュェン トリーをリプレースするリプレース制御を前提として 、る。本実施の形態のキャッシュメ モリ 3は、リプレース対象を決定するためのアクセス順序を示す順序データを、ァクセ ス順序に反して改変することにより、アクセス頻度の低いデータを保持するキャッシュ エントリーをリプレース対象としてキャッシュメモリから追い出すよう構成されている。具 体的には、アクセス順序が最古であるとみなすことを示すウィークフラグ Wをキヤッシ ュエントリーに付加することによって、順序データを間接的に改変している。これにより 順序データを直接改変する複雑な回路を不要としている。
[0030] くキャッシュメモリの構成 > 以下、キャッシュメモリ 3の具体例として、 4ウェイ 'セット'ァソシエイティブ方式のキヤ ッシュメモリに本発明を適用した場合の構成について説明する。
[0031] 図 2は、キャッシュメモリ 3の構成例を示すブロック図である。同図のように、キヤッシ ュメモリ 3は、アドレスレジスタ 20、メモリ IZF21、デコーダ 30、 4つのウェイ 31a— 31 d (以下ウェイ 0— 3と略す)、 4つの比較器 32a— 32d、 4つのアンド回路 33a— 33d、 オア回路 34、セレクタ 35、 36、デマルチプレクサ 37、制御部 38を備える。
[0032] アドレスレジスタ 20は、メモリ 2へのアクセスアドレスを保持するレジスタである。この アクセスアドレスは 32ビットであるものとする。同図に示すように、アクセスアドレスは、 最上位ビットから順に、 21ビットのタグアドレス、 4ビットのセットインデックス(図中の SI )、 5ビットのワードインデックス(図中の WI)を含む。ここで、タグアドレスはウェイにマ ッビングされるメモリ中の領域 (そのサイズはセット数 Xブロックである)を指す。この領 域のサイズは、タグアドレスよりも下位のアドレスビット (A10— AO)で定まるサイズつ まり 2kバイトであり、 1つのウェイのサイズでもある。セットインデックス(SI)はウェイ 0— 3に跨る複数セットの 1つを指す。このセット数は、セットインデックス力 ビットなので 1 6セットある。タグアドレスおよびセットインデックスで特定されるキャッシュエントリ一は 、リプレース単位であり、キャッシュメモリに格納されている場合はラインデータ又はラ インと呼ばれる。ラインデータのサイズは、セットインデックスよりも下位のアドレスビット で定まるサイズつまり 128バイトである。 1ワードを 4バイトとすると、 1ラインデータは 3 2ワードである。ワードインデックス (WI)は、ラインデータを構成する複数ワード中の 1 ワードを指す。アドレスレジスタ 20中の最下位 2ビット(Al、 AO)は、ワードアクセス時 には無視される。
[0033] メモリ IZF21は、キャッシュメモリ 3からメモリ 2へのデータのライトバックや、メモリ 2 力 キャッシュメモリ 3へのデータのロード等、キャッシュメモリ 3からメモリ 2をアクセス するための IZFである。
[0034] デコーダ 30は、セットインデックスの 4ビットをデコードし、 4つのウェイ 0— 3に跨る 1
6セット中の 1つを選択する。
[0035] 4つのウェイ 0— 3は、同じ構成を有数する 4つのウェイであり、 4 X 2kバイトの容量を 有する。各ウェイは、 16個のキャッシュエントリーを有する。 [0036] 図 3に 1つのキャッシュエントリーにおける詳細なビット構成を示す。同図のように、 1 つのキャッシュエントリ一は、ノ リツドフラグ V0— V3、 21ビットのタグ、 128ノイトのラ インデータ、ウィークフラグ W、ダーティフラグ DO— D3を有する。
[0037] タグは 21ビットのタグアドレスのコピーである。
ラインデータは、タグアドレスおよびセットインデックスにより特定されるブロック中の 128バイトデータのコピーであり、 32バイトの 4つのサブラインからなる。
[0038] ノ リツドフラグ VO— V3は、 4つのサブラインに対応し、サブラインが有効か否かを示 す。
[0039] ウィークフラグ Wは、当該キャッシュエントリーのアクセス順序が最も古いものとみな すためのフラグである。つまり、 W= lのとき、プロセッサ 1からは当該キャッシュェント リーにこれ以上読み出しも書き込みもなされな 、こと、あるいはアクセス頻度が低 、こ とを意味する。また、 W= lのとき、キャッシュメモリ 3においては、リプレース制御に関 してアクセス順序が最古であると取り扱うこと、つまり、最弱(ウィーク)のキヤシユエント リーであることを意味する。 W=0のとき、そうでないことを意味する。
[0040] ダーティフラグ DO— D3は、 4つのサブラインに対応し、そのサブラインにプロセッサ 力 書き込みがあつたか否力、つまりサブライン中にキャッシュされたデータが存在す るが書き込みによりメモリ中のデータと異なるためメモリに書き戻すことが必要力否か を示す。
[0041] 比較器 32aは、アドレスレジスタ 20中のタグアドレスと、セットインデックスにより選択 されたセットに含まれる 4つのタグ中のウェイ 0のタグとがー致する力否かを比較する。 比較器 32b— 32cについても、ゥヱイ 31b— 31dに対応すること以外は同様である。
[0042] アンド回路 33aは、ノ リツドフラグと比較器 32aの比較結果とがー致する力否かを比 較する。この比較結果を hOとする。比較結果 hOが 1である場合は、アドレスレジスタ 2 0中のタグアドレスおよびセットインデックスに対応するラインデータが存在すること、 つまりウェイ 0においてヒットしたことを意味する。比較結果 hOが 0である場合は、ミスヒ ットしたことを意味する。アンド回路 33b— 33dについても、ウェイ 31b— 31dに対応 すること以外は同様である。その比較結果 hi— h3は、ウェイ 1一 3でヒットしたかミスし た力を意味する。 [0043] オア回路 34は、比較結果 hO— h3のオアをとる。このオアの結果を hitとする。 hitは
、キャッシュメモリにヒットしたか否かを示す。
[0044] セレクタ 35は、選択されたセットにおけるウェイ 0— 3のラインデータのうち、ヒットした ウェイのラインデータを選択する。
[0045] セレクタ 36は、セレクタ 35により選択された 32ワードのラインデータにうち、ワードィ ンデッタスに示される 1ワードを選択する。
[0046] デマルチプレクサ 37は、キャッシュエントリーにデータを書き込む際に、ウェイ 0— 3 の 1つに書き込みデータを出力する。この書き込みデータはワード単位でよい。
[0047] 制御部 38は、キャッシュメモリ 3の全体の制御を行う。特に、 Wフラグの設定と Wフラ グに従うリプレース制御を行う。
[0048] <制御部の構成 >
図 4は、制御部 38の構成を示すブロック図である。同図のように、制御部 38は、リブ レース部 39と Wフラグ設定部 40とを含む。
[0049] リプレース部 39は、キャッシュミスによるリプレースに際して、 W= lが設定されてい るキャッシュエントリーが存在すれば、当該キャッシュエントリーのアクセス順序が最も 古!、とみなしてリプレース対象として選択し、リプレースを行う。
[0050] Wフラグ設定部 40は、プロセッサ 1からのコマンドに応じてウィークフラグ Wを設定 する。プロセッサ 1は、もはや書き込みも読み出しもしないキャッシュエントリーについ てウィークフラグ Wの設定を指示するコマンドをキャッシュメモリ 3に対して発行する。
[0051] <Wフラグ設定部の構成 >
図 5は、 Wフラグ設定部 40の構成例を示すブロック図である。同図のように Wフラグ 設定部 40は、コマンドレジスタ 401、スタートアドレスレジスタ 402、サイズレジスタ 40
3、加算器 404、スタートァライナ 405、エンドアライナ 406、フラグ書換部 407を備え る。
[0052] コマンドレジスタ 401は、プロセッサ 1から直接アクセス可能なレジスタであり、プロセ ッサ 1により書き込まれた Wフラグ設定コマンドを保持する。図 6 (c)に、コマンドレジス タ 401にコマンドを書き込む命令の一例を示す。この命令は、通常の転送命令 (mov 命令)であり、ソースオペランドとしてコマンドを、デスティネーションオペランドとしてコ マンドレジスタ(CR)を指定している。図 6 (d)に、コマンドの一例を示す。このコマンド は、 Wフラグ設定コマンドを示す特定のコードである。 Wフラグ設定コマンドは、スタ ートアドレスレジスタ 402に保持されたスタートアドレスからサイズレジスタ 403に保持 されたサイズのアドレス範囲に対応するデータを保持するキャッシュエントリーに対し て、 Wフラグを設定することを指示するコマンドである。
[0053] スタートアドレスレジスタ 402は、プロセッサ 1から直接アクセス可能なレジスタであり 、プロセッサ 1により書き込まれたスタートアドレスを保持する。このスタートアドレスは Wフラグを設定すべきアドレス範囲の開始位置を示す。図 6 (a)に、スタートアドレスレ ジスタ 402にスタートアドレスを書き込む命令の一例を示す。この命令も、図 6 (c)と同 様に通常の転送命令 (mov命令)である。
[0054] サイズレジスタ 403は、プロセッサ 1から直接アクセス可能なレジスタであり、プロセッ サ 1により書き込まれたサイズを保持する。このサイズは、スタートアドレスからのァドレ ス範囲を示す。図 6 (b)に、サイズレジスタ 403にサイズを書き込む命令の一例を示 す。この命令も、図 6 (c)と同様に通常の転送命令 (mov命令)である。なお、サイズの 単位は、バイト数であっても、ライン数 (キャッシュエントリー数)であってもよぐ予め定 められた単位であればよ!、。
[0055] カロ算器 404は、スタートアドレスレジスタ 402に保持されたスタートアドレスとサイズ レジスタ 403に保持されたサイズとを加算する。加算結果は、アドレス範囲の終了位 置を指すエンドアドレスである。加算器 404は、サイズがバイト数指定の場合はバイト アドレスとして加算し、サイズがライン数指定の場合はラインアドレスとして加算すれ ばよい。
[0056] スタートァライナ 405は、スタートアドレスをライン境界の位置に調整する。この調整 によりプロセッサ 1はラインサイズ及びライン境界とは無関係に任意のアドレスをスタ ートアドレスとして指定することができる。
[0057] エンドアライナ 406は、エンドアドレスをライン境界の位置に調整する。この調整によ りプロセッサ 1はラインサイズ及びライン境界とは無関係に任意の大きさを上記サイズ として旨定することができる。
[0058] 図 7に、スタートァライナ 405及びエンドアライナ 406の説明図を示す。同図におい て、プロセッサ 1から指定されたスタートアドレスはライン Nの途中の任意の位置を指 す。スタートァライナ 405は、次のライン (N+ 1)の先頭を指すよう調整し、調整後の アドレスをァラインスタートアドレスとして出力する。ァラインスタートアドレスが指すライ ンをスタートラインと呼ぶ。
[0059] また、エンドアドレスはライン Mの途中の任意の位置を指す。エンドアライナ 406は 、直前のライン (M— 1)の先頭を指すよう調整し、調整後のアドレスをァラインエンドア ドレスとして出力する。ァラインエンドアドレスが指すラインをエンドラインと呼ぶ。
[0060] この場合、スタートライン (ライン (N+ 1) )からエンドライン (ライン (M— 1) )までの各 ライン (キャッシュエントリー)に Wフラグが設定されることになる。このように、スタート ァライナ 405及びエンドアライナ 406がプロセッサ 1から指定されたスタートアドレスか らエンドアドレスまでのアドレス範囲よりも内側にァラインしているのは、ライン Nとライ ン Mの外側の部分にはプロセッサ 1から書き込み又は読み出しが発生する可能性が あるからである。
[0061] フラグ書換部 407は、ァラインスタートアドレスが指すラインカもァラインエンドアドレ スが指すラインまで(図 7の例ではライン (N+ 1)力もライン (M— 1)まで)、キャッシュメ モリ 3にエントリーされて!/、れば Wフラグを 1に設定する。
[0062] <Wフラグ設定処理 >
図 8は、フラグ書換部 407における Wフラグ設定処理の一例を示すフローチャート である。
[0063] フラグ書換部 407は、コマンドレジスタ 401に Wフラグ設定コマンドが保持されてい る場合、スタートラインカゝらエンドラインまでの各ラインアドレスを順に出力しながらル ープ 1の処理(S82— S86)を行う。フラグ書換部 407は、各ラインについて同じ処理 を行うので、ここでは 1ライン分の処理について説明する。
[0064] すなわち、フラグ書換部 407は、キャッシュメモリ 3がプロセッサ 1からアクセスされて いない間に、ラインアドレスをアドレスレジスタ 20に出力し(S83)、アドレスレジスタ 20 のタグアドレスとキャッシュエントリーのタグとを比較器 32a— 32dに比較させ、ヒットす るかどうかを判定する(S84)。さらにフラグ書換部 407は、ヒットした場合には、ヒットし たキャッシュエントリーに対して Wフラグを 1にセットし (S85)、ミスヒットした場合には、 キャッシュメモリにエントリーされて ヽな ヽのでなにもしな 、。
[0065] これにより、スタートライン力 エンドラインまでの各ラインについて、キャッシュメモリ 3にエントリーされている場合には、 Wフラグが 1に設定される。
[0066] <リプレース処理 >
図 9は、リプレース部 39におけるリプレース処理を示すフローチャートである。同図 においてリプレース部 39は、メモリアクセスがミスしたとき (ステップ S91)、セットインデ ックスにより選択されたセットにおける、 4つウェイのウィークフラグ Wを読み出し (ステ ップ S92)、 4つのウィークフラグの論理和が 1であるか否かつまり W= 1のウェイが存 在すれか否かを判定する (ステップ S93)。 W= 1のウェイが存在すると判定された場 合、当該キャッシュエントリーのアクセス順序が最も古いとみなして W= 1のウェイを 1 つ選択し (ステップ S94)、 W= lのウェイが存在しないと判定された場合、通常の LR U方式によりウェイを 1つ選択する(ステップ S95)。このとき、ウィークフラグ Wが 1にな つているウェイが複数存在する場合は、リプレース部 39はランダムに 1つを選択する。
[0067] さらに、リプレース部 39は、当該セットにおける選択されたウェイのキャッシュエントリ 一を対象にリプレースし (ステップ S96)、リプレース後に当該キャッシュエントリーのゥ ィークフラグ Wを 0初期化する(ステップ S97)。なお、このときノ リツドフラグ V、ダーテ ィフラグ Dは、それぞれ 0に初期化される。
[0068] このように、 W= 1のウェイが存在しな!、場合、リプレース対象は、通常の LRU方式 により選択される。また、 W= lのウェイが存在する場合、リプレース対象は、 W= lの ウェイのアクセス順序が最も古いものと取り扱われる結果、 W= lのウェイのキャッシュ エントリーが選択される。これにより、アクセス頻度の低い W= lのデータがキャッシュ メモリに存在するために生じるキャッシュミスを低減することができる。
[0069] 以上説明してきたように、本実施の形態におけるキャッシュメモリによれば、ウィーク フラグ W= 1のラインは、プロセッサ力 これ以上読み出しも書き込みもなされないラ インであり、そのアクセス順序が最古として取り扱われる結果、真っ先にリプレース対 象として選択される。これによりアクセス頻度の低いデータによるキャッシュミスの誘発 を低減することができる。
[0070] また、従来の LRU方式におけるアクセス順序を示す順序データを直接改変するこ となぐ間接的に wフラグを付加することによってアクセス順序を改変して 、るので、 複雑なハードウェア回路を追加することなぐ実現することができる。
<変形例>
なお、本発明のキャッシュメモリは、上記の実施の形態の構成に限るものではなぐ 種々の変形が可能である。以下、変形例のいくつかについて説明する。
(1)使用フラグ Uを用いる擬似 LRUの代わりに、 4つのウェイのアクセス順序を示す 順序データをキャッシュエントリー毎に保持及び更新して、従来通りの LRU方式でリ プレース対象を選択する構成としてもよい。この場合も、 W= lのキャッシュエントリー を、
アクセス順序に関わらず、真っ先にリプレース対象として選択するようにすればよい。 さらに、上記実施の形態では、 Wフラグの付カ卩により間接的に順序データを改変して いるが、順序データを直接改変する構成としてもょ 、。
(2)上記実施の形態では、ウィークフラグ Wによりアクセス順序が最古であることを示 しているが、アクセス順序が最新又は最古でないことを示すものとしてもよい。この場 合、リプレース部 39は、 W= lのキャッシュエントリ一は最古でないとみなして、リプレ ース対象として選択せず、他のキャッシュエントリーを選択する構成とすればよい。最 古でな 、ことを示すウィークフラグ Wを、アクセス頻度の高 、データある 、はアクセス 頻度が中くら 、のデータを保持するキャッシュエントリ一に付加することにより、無駄リ プレースを防止することができる。
(3)プロセッサ 1が、ウィークフラグ W= lの設定とデータの書き込みとを命令する特 別なストア命令を実行し、制御部 38は、さらに、特別なストア命令を検出する命令検 出部と、当該ストア命令による書き込みの際に W= lに設定するフラグ設定部とを備 える構成としてちよい。
(4)上記実施の形態では、 4ウェイ 'セット'ァソシエイティブのキャッシュメモリを例に 説明したが、ウェイ数は、いくつでもよい。また、上記実施の形態では、セット数が 16 である例を説明したが、セット数は 、くつでもよ 、。
(5)上記実施の形態では、セット'ァソシエイティブのキャッシュメモリを例に説明した 1S フル'ァソシエイティブ方式のキャッシュメモリであってもよい。 (6)上記実施の形態では、サブラインのサイズをラインのサイズの 1Z4としているが、 1/2、 1/8、 1/16等他のサイズでもよい。その場合、各キャッシュエントリ一は、サ ブラインと同数のノ リツドフラグおよびダーティフラグをそれぞれ保持すればよい。
[0072] (実施の形態 2)
実施の形態 1では、通常の LRU方式を前提としてウィークフラグ Wによってアクセス 順序を最古ィ匕する構成について説明した。本実施の形態では、通常の LRU方式と は異なりアクセス順序を示す順序データを 1ビットのフラグで表した擬似的な LRU方 式と、ウィークフラグによる最古ィ匕とを行うキャッシュメモリにつ 、て説明する。
[0073] <キャッシュメモリの構成 >
図 10は、本発明の実施の形態 2におけるキャッシュメモリの構成を示すブロック図 である。同図のキャッシュメモリは、図 2の構成と比較して、ウェイ 31a— 31dの代わり にウェイ 131a— 131dを備える点と、制御部 38の代わりに制御部 138を備える点とが 異なっている。以下、同じ点は説明を省略して、異なる点を中心に説明する。
[0074] ウェイ 131aは、ウェイ 31aと比べて、各キャッシュエントリ一中に、使用フラグ Uが追 カロされている点が異なる。ウェイ 131b— 131dも同様である。使用フラグ Uは、 4つの ウェイ間でのアクセス順序示す順序データの代わりに設けられ、アクセス順序を 1ビッ トで表現するフラグである。
[0075] 図 11に、キャッシュエントリーのビット構成を示す。同図のビット構成は、図 3と比較 して、使用フラグ Uが追加されている点が異なる。
[0076] 使用フラグ Uは、そのキャッシュエントリーにアクセスがあつたか否かを示し、 LRU 方式におけるミスヒットによるリプレースに際して 4つのウェイのキャッシュエントリーに おけるアクセス順序データの代わりに用いられる。より正確には、使用フラグ Uの 1は 、アクセスがあったことを、 0はないことを意味する。ただし、 1つのセット内の 4つウェイ の使用フラグが全て 1になれば、 0にリセットされる。別言すれば、使用フラグ Uは、ァ クセスされた時期が古いか新しいか 2つの相対的な状態を示す。つまり、使用フラグ Uが 1のキャッシュエントリ一は、使用フラグが 0のキャッシュエントリーよりも新しくァク セスされたことを意味する。
[0077] 制御部 138は、制御部 38と比べて、 LRU方式におけるアクセス順序情報の代わり に使用フラグ uを用いてリプレース制御する点が異なる。
[0078] <制御部の構成 >
図 12は、制御部 138の構成を示すブロック図である。同図の制御部 138は、制御 部 38と比較して、リプレース部 39の代わりにリプレース部 139を備える点と、フラグ更 新部 41が追加された点とが異なる。
[0079] リプレース部 139は、使用フラグ Uをアクセス順序とする擬似的な LRU方式によりキ ャッシュミス時にリプレース処理を行う。その際、リプレース部 139は、ウィークフラグ W 力 のキャッシュエントリーがあれば、最古のキャッシュエントリ一として扱い、真っ先に リプレース対象として選択する。
[0080] フラグ更新部 41は、キャッシュメモリがアクセスされたとき使用フラグ Uの更新処理 を行う。
[0081] く使用フラグ Uの説明 >
図 13は、リプレース部 139による使用フラグの更新例を示す。同図の上段、中断、 下段は、ウェイ 0— 3に跨るセット Nを構成する 4つのウェイのキャッシュエントリーを示 している。 4つのキャッシュエントリー右端の 1又は 0は、それぞれ使用フラグの値であ る。この 4つの使用フラグ Uを UO— U3と記す。
[0082] 同図上段では(UO— U3) = (1、 0、 1、 0)であるので、ウェイ 0、 2のキャッシュェント リーはアクセスがあったことを、ウェイ 1、 3のキャッシュエントリ一はアクセスがないこと を意味する。
[0083] この状態で、メモリアクセスがセット N内のウェイ 1のキャッシュエントリーにヒットした 場合、同図中段に示すように、(UO— U3) = (1、 1、 1、 0)に更新される。つまり、実 線に示すようにウェイ 1の使用フラグ U1が 0から 1に更新される。
[0084] さらに、同図中段の状態で、メモリアクセスがセット N内のウェイ 3のキャッシュェント リーにヒットした場合、同図下断に示すように、(UO— U3) = (0、 0、 0、 1)に更新さ れる。つまり、実線に示すようにウェイ 3の使用フラグ U1が 0から 1に更新される。加え て、破線に示すようにウェイ 3以外の使用フラグ UO— U2が 1から 0に更新される。こ れにより、ウェイ 3のキヤシュエントリ一力 ウェイ 0— 2の各キャッシュエントリーよりも新 しくアクセスされたことを意味することになる。 [0085] リプレース部 139は、キャッシュミス時に W= lのキャッシュエントリーが存在しなけ れば、使用フラグに基づいてリプレース対象のキャッシュエントリーを決定してリプレ ースを行う。例えば、リプレース部 139は、図 5上段では、ウェイ 1とウェイ 3の何れかを リプレース対象と決定し、図 5中段ではウェイ 3をリプレース対象と決定し、図 5下段で はウェイ 0— 2の何れかをリプレース対象と決定する。
[0086] <ウィークフラグ Wの説明 >
図 14 (a)ウィークフラグが存在しないと仮定した場合の比較例であり、キャッシュェ ントリーがリプレースされる様子を示す図である。同図においても、図 13と同様にゥェ ィ 0— 3に跨るセット Nを構成する 4つのキャッシュエントリーを示している。、 4つのキ ャッシュエントリー右端の 1又は 0は、それぞれ使用フラグの値である。また、データ E のみアクセス頻度の低いデータを、データ A、 B、 C、 Dはアクセス頻度の高いデータ とする。
[0087] 同図(a)の第 1段目の状態で、プロセッサ 1がデータ Eにアクセスすると、キャッシュミ スが発生する。このキャッシュミスにより、例えば、 U = 0のキャッシュエントリーの中か らアクセス頻度の高 、データ Cのキャッシュエントリーがアクセス頻度の低!、データ E にリプレースされ、第 2段目の状態となる。
[0088] 第 2段目の状態で、プロセッサ 1がデータ Cにアクセスすると、キャッシュミスが発生 する。このキャッシュミスにより、 U = 0のキャッシュエントリーであるアクセス頻度の高 V、データ Dのキャッシュエントリーがアクセス頻度の高!、データ Cにリプレースされ、第 3段目の状態となる。
[0089] 第 3段目の状態で、プロセッサ 1がデータ Dにアクセスすると、キャッシュミスが発生 する。このキャッシュミスにより、例えば、アクセス頻度の高いデータ Cのキャッシュェ ントリーがアクセス頻度の高いデータ Dにリプレースされ、第 3段目の状態となる。
[0090] 同様に、第 4段目でも、使用頻度の低いデータ Eはリプレース対象として選択されな いで、キャッシュメモリーに残っている。
[0091] 第 5段目の状態で、使用頻度の低いデータ Eは最も古い (U=0)であることから、リ プレース対象として選択されて、追い出される。
[0092] このように、擬似 LRU方式にお!、て(通常の LRU方式にお!、ても)、アクセス頻度 の低 、データ Eによって、 4ウェイの場合は最悪 4回のキャッシュミスを誘発する場合 がある。
[0093] 図 14 (b)は、リプレース処理におけるウィークフラグ Wの役割を示す説明図である。
[0094] 同図 (b)の第 1段目の状態(同図(a)の第 1段目と同じ)で、プロセッサ 1がデータ E にアクセスすると、キャッシュミスが発生する。このキャッシュミスにより、例えば、 U = 0 のキャッシュエントリーの中力もアクセス頻度の高 、データ Cのキャッシュエントリーが アクセス頻度の低いデータ Eにリプレースされる。このとき、プロセッサ 1は、データ E のキャッシュエントリーにウィークフラグ Wを 1に設定するものとする。これにより、次の キャッシュミス時にデータ Eのキャッシュエントリーが真っ先に追い出され、第 2段目の 状態となる。
[0095] 第 2段目の状態で、プロセッサ 1がデータ Cにアクセスすると、キャッシュミスが発生 する。このキャッシュミスにより、 W= lのキャッシュエントリーであるアクセス頻度の低 V、データ Eのキャッシュエントリーがリプレース対象として選択され、アクセス頻度の高 いデータ Cにリプレースされ、第 3段目の状態となる。
[0096] このように、ウィークフラグ Wを設けることにより、アクセス頻度の低いデータによるキ ャッシュミスの誘発を低減することができる。
[0097] <Uフラグ更新処理 >
図 15は、フラグ更新部 41における Uフラグ更新処理を示すフローチャートである。 同図では、ノ リツドフラグが 0 (無効)であるキャッシュエントリーの使用フラグ Uは 0に 初期化されているものとする。
[0098] 同図において、フラグ更新部 41は、キャッシュヒットしたとき(ステップ S61)、セットィ ンデッタスにより選択されたセットにおけるヒットしたウェイの使用フラグ Uを 1にセットし (ステップ S62)、そのセット内の他のウェイの使用フラグ Uを読み出し (ステップ S63) 、読み出した使用フラグ Uが全て 1であるカゝ否かを判定し (ステップ S64)、全て 1でな ければ終了し、全て 1であれば他のウェイの全ての使用フラグ Uを 0にリセットする(ス テツプ S65)。
[0099] このようにしてフラグ更新部 41は、図 13、図 14 (a) (b)に示した更新例のように、使 用フラグ Uを更新する。 [0100] <リプレース処理 >
図 16は、リプレース部 139におけるリプレース処理を示すフローチャートである。同 図においてリプレース部 139は、メモリアクセスがミスしたとき (ステップ S91)、セットィ ンデッタスにより選択されたセットにおける、 4つウェイの使用フラグ U及びウイ一クフラ グ Wを読み出し (ステップ S 92)、 W= 1のウェイが存在するか否かを判定する (ステツ プ S93)。 W= lのウェイが存在しないと判定された場合、 U=0のウェイを 1つ選択す る (ステップ S94)。このとき、使用フラグ Uが 0になっているウェイが複数存在する場 合は、リプレース部 139はランダムに 1つを選択する。また、 W= lのウェイが存在す ると判定された場合、 Uフラグの値に関わらず W= 1のウェイを 1つ選択する (ステップ S95)。このとき、ウィークフラグ Wが 1になっているウェイが複数存在する場合は、リブ レース部 139はランダムに 1つを選択する。
[0101] さらに、リプレース部 139は、当該セットにおける選択されたウェイのキャッシュェント リーを対象にリプレースし (ステップ S96)、リプレース後に当該キャッシュエントリーの 使用フラグ Uを 1に、ウィークフラグ Wを 0初期化する(ステップ S97)。なお、このとき ノ リツドフラグ V、ダーティフラグ Dは、それぞれ 1、 0に初期化される。
[0102] このように、 W= lのウェイが存在しない場合、リプレース対象は、使用フラグ Uが 0 のキャッシュエントリーの中から 1つ選択される。
[0103] また、 W= 1のウェイが存在する場合、リプレース対象は、使用フラグ Uが 0であると 1であるとを問わず、 W= lのウェイのキャッシュエントリーから 1つ選択される。これに より図 14 (a) (b)に示したように、アクセス頻度の低いデータがキャッシュメモリに残る ことによるキャッシュミスの誘発を低減することができる。
[0104] 以上説明してきたように、本実施の形態におけるキャッシュメモリによれば、従来の LRU方式におけるアクセス順序を示すデータの代わりに 1ビットの使用フラグを用い る擬似 LRU方式を採用することにより、アクセス順序データとして 1ビットのフラグでよ Vヽので、アクセス順序データのデータ量が少な 、こと及び更新が簡単であることから ハードウェア規模を小さくすることができる。
[0105] また、これ以上使用されないキャッシュエントリーに W= lが設定され、 W= lのキヤ ッシュエントリーが真っ先にリプレース対象として選択されるので、アクセス頻度の低 いデータがキャッシュメモリに残ることによるキャッシュミスの誘発を低減することがで きる。
<変形例 >
(1) 上記各実施形態において、プロセッサ 1が、ウィークフラグ Wを 1に設定しながら データをアクセスするロード Zストア命令(以下 W— LZS命令と略す)を実行し、制御 部 38又は制御部 138は、 W-LZS命令の実行を検出したときに、当該 W-LZS命 令によるアクセスの直後に Wフラグを 1に設定する構成としてもよい。図 17に、その場 合に制御部 38又は 138に備えられる Wフラグ設定部 40aの構成例を示す。
同図において Wフラグ設定部 40aは、 LDZST命令検出部 410、ウィーク指示検 出部 411、アンド回路 412、フラグ書き換え部 413とを備える。
LDZST命令検出部 410は、プロセッサ 1がロード Zストア命令を実行されたことを 検出する。ウィーク指示検出部 411は、ロード Zストア命令の実行時にプロセッサ 1か らウィーク指示が出力されているかどうか検出する。ウィーク指示は、例えば、プロセッ サ 1がからの信号線により検出することができる。アンド回路 412は、ロード Zストア命 令の実行が検出され、かつ、ウィーク指示が検出されたとき、フラグ書き換え部 413に 、 W— LZS命令の検出を通知する。フラグ書き換え部 413は、 W— LZS命令が検出 されたとき、当該 W— LZS命令によりアクセスされたデータを保持するキャッシュェン トリーに対してウィークフラグ Wを 1に設定する。
(2) また、上記(1)において Wフラグ設定部 40aは、実施の形態 1における制御部 3 8に設けられる場合には、ウィークフラグ Wの代わりに、アクセス順序を示す順序デー タを直接に改変する構成としてもよい。その場合、ウィーク指示検出部 411は、設定 すべきアクセス順序の指定付きロード Zストア命令を実行するプロセッサ 1から、設定 すべきアクセス順序を示す番号 (N番目)を検出する。 N番目は、 4ウェイセットァソシ エイティブの場合 1番カも 4番(又は 0から 3)の何れかでよい。例えば、プロセッサ 1は 、アクセス頻度の低いデータに対しては最古の N=4とし、アクセス頻度の低いデータ に対しては N= l又は 2番などを指定することができる。フラグ書き換え部 413は、ァク セス順序の指定付きロード Zストア命令によりアクセスされたデータを保持するキヤッ シュエントリーの順序データを N番に改変する。このように、順序データを直接に任意 の N番に改変する構成としてもょ 、。
(3)図 5に示した Wフラグ設定部 40の代わりに図 18に示す Wフラグ設定部 40bを備 える構成としてもよい。 Wフラグ設定部 40bは、 Wフラグ設定部 40に対して比較器 40 8を追加し、フラグ書換部 407の代わりにフラグ書換部 407aを備える構成となって ヽ る。比較器 408は、加算器 404から出力されるエンドラインのラインアドレスと、ウイ一 クフラグ設定のためにフラグ書換部 407aから出力され、タグアドレスレジスタ 20に保 持されたラインアドレスとが一致するカゝ否かを判定する。この比較器 408は、図 8に示 した Wフラグ設定処理中のループ 1におけるエンドアドレスの判定に用いられる。す なわち、フラグ書換部 407aは、比較器 408がー致すると判定した場合、ウイ一クフラ グの設定を終了する。
(4)図 6 (a) (b) (c)に示した各命令は、コンパイラによりプログラム中に挿入してもよ い。その際、コンパイラは、例えば配列データの書き込みや、圧縮動画データをデコ ードする際のブロックデータの書き込み等、これ以上書き込みをしな 、プログラム位 置に、上記各命令を挿入するようにすればよい。
産業上の利用可能性
本発明は、メモリアクセスを高速ィ匕するためのキャッシュメモリに適しており、例えば 、オンチップキャッシュメモリ、オフチップキャッシュメモリ、データキャッシュメモリ、命 令キャッシュメモリ等に適して 、る。

Claims

請求の範囲
[1] キャッシュの単位データを保持するキャッシュエントリー毎にアクセス順序を示す順 序データを保持し、最も古 、順序を示すキャッシュエントリーをリプレースするキヤッシ ュメモリであって、
前記順序データを実際のアクセス順序に反して改変する改変手段と、
改変後の順序データに基づいてリプレースすべきキャッシュエントリーを選択する選 択手段と、
を備えることを特徴とするキャッシュメモリ。
[2] 前記改変手段は、
プロセッサ力 指定されたアドレス範囲に属するデータを保持するキャッシュエントリ 一を特定する特定手段と、
特定されたキャッシュエントリーの順序データを実際のアクセス順序に反して最古 化する最古化手段と
を備えることを特徴とする請求の範囲第 1項に記載のキャッシュメモリ。
[3] 前記特定手段は、
前記アドレス範囲の先頭アドレスがラインデータの途中を指す場合、当該先頭アド レスを、前記アドレス範囲に含まれる先頭のラインを指すスタートラインアドレスに変 換する第 1変換手段と、
前記アドレス範囲の末尾アドレスがラインデータの途中を指す場合、当該末尾アド レスを、前記アドレス範囲に含まれる末尾のラインを指すエンドラインアドレスに変換 する第 2変換手段と、
前記スタートラインアドレス力 エンドラインアドレスまでの各ラインアドレスに対応す るデータを保持するキャッシュエントリーがあるか否かを判定する判定手段と を備えることを特徴とする請求の範囲第 2項に記載のキャッシュメモリ。
[4] 前記最古化手段は、アクセス順序が最も古 、ことを示す最古ィ匕フラグを順序データ に付加する
ことを特徴とする請求の範囲第 3項に記載のキャッシュメモリ。
[5] 前記選択手段は、キャッシュミス時に、最古ィ匕フラグが付加されたキャッシュエントリ 一が存在する場合、そのキャッシュエントリーをリプレース対象として選択し、最古ィ匕 フラグが付加されたキャッシュエントリーが存在しな 、場合、順序データに従ってリブ レース対象とすべきキャッシュエントリーを選択する
ことを特徴とする請求の範囲第 4項に記載のキャッシュメモリ。
[6] 前記キャッシュエントリ一は、アクセス順序が古 、か新 、かを示す 1ビットの順序フ ラグを前記順序データとして有し、
前記選択手段は、最古ィ匕フラグが付加されたキャッシュエントリーが存在しな 、場 合、順序フラグが古 、ことを示すキャッシュエントリーをリプレース対象として選択する ことを特徴とする請求の範囲第 5項に記載のキャッシュメモリ。
[7] 前記改変手段は、 1つのキャッシュエントリーのアクセス順序を N番目にするよう前 記順序データを改変し、
前記 Nは、(a)アクセス順序が最も古い順であること示す番号、(b)アクセス順序が最 も新 ヽことを示す番号、(c)アクセス順序が最も古 、順序カゝら N番目であることを示 す番号、(d)アクセス順序が最も新しい順序カゝら N番目であることを示す番号の何れ かである
ことを特徴とする請求の範囲第 1項に記載のキャッシュメモリ。
[8] 前記改変手段は、
アクセス順序の改変指示付きメモリアクセス命令が実行されたことを検出する命令 検出手段と、
当該命令によってアクセスがなされたキャッシュエントリーに対して順序データを書 き替える書き換え手段と
を備えることを特徴とする請求の範囲第 1項に記載のキャッシュメモリ。
[9] 前記改変手段は、
プロセッサカゝら指定されたアドレス範囲を保持する保持手段と、
保持手段に保持されたアドレス範囲に対応するデータを保持するキャッシュエントリ 一を探索する探索手段と、
探索手段により探索されたキャッシュエントリーのアクセス順序を N番目とするよう順 序データを書き換える書き換え手段と を備えることを特徴とする請求の範囲第 1項に記載のキャッシュメモリ。
キャッシュの単位データを保持するキャッシュエントリー毎にアクセス順序を示す順 序データを保持し、最も古 、順序を示すキャッシュエントリーをリプレースするキヤッシ ュメモリの制御方法であって、
前記順序データを実際のアクセス順序に反して改変する改変ステップと、 改変後の順序データに基づいてリプレースすべきキャッシュエントリーを選択する選 択ステップと
を有することを特徴とする制御方法。
PCT/JP2004/016272 2003-11-18 2004-11-02 キャッシュメモリ及びその制御方法 WO2005050455A1 (ja)

Priority Applications (4)

Application Number Priority Date Filing Date Title
EP04799475A EP1686485A4 (en) 2003-11-18 2004-11-02 CACHE MEMORY AND ASSOCIATED CHECK
JP2005515574A JP4008946B2 (ja) 2003-11-18 2004-11-02 キャッシュメモリ及びその制御方法
US10/577,133 US7984243B2 (en) 2003-11-18 2004-11-02 Cache memory and method for cache entry replacement based on modified access order
US13/075,523 US20110179227A1 (en) 2003-11-18 2011-03-30 Cache memory and method for cache entry replacement based on modified access order

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2003387351 2003-11-18
JP2003-387351 2003-11-18

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US13/075,523 Continuation US20110179227A1 (en) 2003-11-18 2011-03-30 Cache memory and method for cache entry replacement based on modified access order

Publications (1)

Publication Number Publication Date
WO2005050455A1 true WO2005050455A1 (ja) 2005-06-02

Family

ID=34616158

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2004/016272 WO2005050455A1 (ja) 2003-11-18 2004-11-02 キャッシュメモリ及びその制御方法

Country Status (7)

Country Link
US (2) US7984243B2 (ja)
EP (1) EP1686485A4 (ja)
JP (1) JP4008946B2 (ja)
KR (1) KR100801814B1 (ja)
CN (1) CN100424658C (ja)
TW (1) TW200530818A (ja)
WO (1) WO2005050455A1 (ja)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008211681A (ja) * 2007-02-27 2008-09-11 Kyocera Corp 情報機器および同機器における復号化処理方法
US7953935B2 (en) 2005-04-08 2011-05-31 Panasonic Corporation Cache memory system, and control method therefor

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9003125B2 (en) * 2012-06-14 2015-04-07 International Business Machines Corporation Cache coherency protocol for allowing parallel data fetches and eviction to the same addressable index
US10248422B2 (en) * 2016-07-02 2019-04-02 Intel Corporation Systems, apparatuses, and methods for snooping persistent memory store addresses

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5119453A (en) * 1974-08-08 1976-02-16 Fujitsu Ltd Patsufua memoriseigyohoshiki
JPS61290555A (ja) * 1985-06-19 1986-12-20 Toshiba Corp キャッシュシステム
JPH06348595A (ja) * 1993-06-07 1994-12-22 Hitachi Ltd キャッシュ装置
US20020152361A1 (en) 2001-02-05 2002-10-17 International Business Machines Corporation Directed least recently used cache replacement method

Family Cites Families (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4835686A (en) * 1985-05-29 1989-05-30 Kabushiki Kaisha Toshiba Cache system adopting an LRU system, and magnetic disk controller incorporating it
US5043885A (en) * 1989-08-08 1991-08-27 International Business Machines Corporation Data cache using dynamic frequency based replacement and boundary criteria
US5497477A (en) * 1991-07-08 1996-03-05 Trull; Jeffrey E. System and method for replacing a data entry in a cache memory
JP3146380B2 (ja) * 1991-07-26 2001-03-12 コニカ株式会社 ハロゲン化銀カラー写真感光材料の処理方法
US5375216A (en) 1992-02-28 1994-12-20 Motorola, Inc. Apparatus and method for optimizing performance of a cache memory in a data processing system
JPH0869417A (ja) 1994-08-29 1996-03-12 Sanyo Electric Co Ltd 計算機システム
US6266742B1 (en) * 1997-10-27 2001-07-24 International Business Machines Corporation Algorithm for cache replacement
US6105115A (en) * 1997-12-31 2000-08-15 Intel Corporation Method and apparatus for managing a memory array
US6202129B1 (en) * 1998-03-31 2001-03-13 Intel Corporation Shared cache structure for temporal and non-temporal information using indicative bits
US6393525B1 (en) * 1999-05-18 2002-05-21 Intel Corporation Least recently used replacement method with protection
US6397298B1 (en) * 1999-07-30 2002-05-28 International Business Machines Corporation Cache memory having a programmable cache replacement scheme
US6516384B1 (en) * 1999-12-30 2003-02-04 Intel Corporation Method and apparatus to perform a round robin and locking cache replacement scheme
US6738865B1 (en) * 2000-06-09 2004-05-18 International Business Machines Corporation Method, system, and program for demoting data from cache based on least recently accessed and least frequently accessed data
EP1182566B1 (en) 2000-08-21 2013-05-15 Texas Instruments France Cache operation based on range of addresses
US6487638B2 (en) * 2001-01-26 2002-11-26 Dell Products, L.P. System and method for time weighted access frequency based caching for memory controllers
JP3946515B2 (ja) 2001-12-27 2007-07-18 株式会社アマダエンジニアリングセンター 折り曲げ加工装置
JP2003223360A (ja) 2002-01-29 2003-08-08 Hitachi Ltd キャッシュメモリシステムおよびマイクロプロセッサ
EP1684180A4 (en) * 2003-11-12 2008-10-29 Matsushita Electric Ind Co Ltd CACHE MEMORY AND CONTROL PROCEDURE THEREFOR

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5119453A (en) * 1974-08-08 1976-02-16 Fujitsu Ltd Patsufua memoriseigyohoshiki
JPS61290555A (ja) * 1985-06-19 1986-12-20 Toshiba Corp キャッシュシステム
JPH06348595A (ja) * 1993-06-07 1994-12-22 Hitachi Ltd キャッシュ装置
US20020152361A1 (en) 2001-02-05 2002-10-17 International Business Machines Corporation Directed least recently used cache replacement method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7953935B2 (en) 2005-04-08 2011-05-31 Panasonic Corporation Cache memory system, and control method therefor
JP2008211681A (ja) * 2007-02-27 2008-09-11 Kyocera Corp 情報機器および同機器における復号化処理方法

Also Published As

Publication number Publication date
EP1686485A1 (en) 2006-08-02
TW200530818A (en) 2005-09-16
US7984243B2 (en) 2011-07-19
JP4008946B2 (ja) 2007-11-14
US20080168232A1 (en) 2008-07-10
CN1853172A (zh) 2006-10-25
US20110179227A1 (en) 2011-07-21
KR100801814B1 (ko) 2008-02-11
KR20060087579A (ko) 2006-08-02
EP1686485A4 (en) 2008-10-29
JPWO2005050455A1 (ja) 2007-12-06
CN100424658C (zh) 2008-10-08

Similar Documents

Publication Publication Date Title
JP4044585B2 (ja) キャッシュメモリおよびその制御方法
US11416253B2 (en) Multiple-table branch target buffer
US7321954B2 (en) Method for software controllable dynamically lockable cache line replacement system
JP5536655B2 (ja) キャッシュメモリ、メモリシステム及びデータコピー方法
KR100837479B1 (ko) 캐시 메모리 및 그 제어 방법
KR100826757B1 (ko) 캐시 메모리 및 그 제어 방법
US20080301372A1 (en) Memory access control apparatus and memory access control method
US20020161976A1 (en) Data processor
US5926841A (en) Segment descriptor cache for a processor
JP3973129B2 (ja) キャッシュメモリ装置及びそれを用いた中央演算処理装置
US20110179227A1 (en) Cache memory and method for cache entry replacement based on modified access order
WO1997034229A9 (en) Segment descriptor cache for a processor
US8214601B2 (en) Purging without write-back of cache lines containing spent data
US7376797B2 (en) Cache memory system and method using reference bits
JPH0659977A (ja) 明示的なライン置換え操作が可能なキャッシュメモリとその制御方法
JPH0784886A (ja) キャッシュメモリ制御方法およびキャッシュメモリ制御装置
JP2004326187A (ja) 情報処理装置およびその制御方法
JPH06282487A (ja) キャッシュ装置

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 200480027116.9

Country of ref document: CN

AK Designated states

Kind code of ref document: A1

Designated state(s): AE AG AL AM AT AU AZ BA BB BG BR BW BY BZ CA CH CN CO CR CU CZ DE DK DM DZ EC EE EG ES FI GB GD GE GH GM HR HU ID IL IN IS JP KE KG KP KR KZ LC LK LR LS LT LU LV MA MD MG MK MN MW MX MZ NA NI NO NZ OM PG PH PL PT RO RU SC SD SE SG SK SL SY TJ TM TN TR TT TZ UA UG US UZ VC VN YU ZA ZM ZW

AL Designated countries for regional patents

Kind code of ref document: A1

Designated state(s): BW GH GM KE LS MW MZ NA SD SL SZ TZ UG ZM ZW AM AZ BY KG KZ MD RU TJ TM AT BE BG CH CY CZ DE DK EE ES FI FR GB GR HU IE IS IT LU MC NL PL PT RO SE SI SK TR BF BJ CF CG CI CM GA GN GQ GW ML MR NE SN TD TG

121 Ep: the epo has been informed by wipo that ep was designated in this application
WWE Wipo information: entry into national phase

Ref document number: 2005515574

Country of ref document: JP

WWE Wipo information: entry into national phase

Ref document number: 1020067005718

Country of ref document: KR

WWE Wipo information: entry into national phase

Ref document number: 2004799475

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 10577133

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

WWW Wipo information: withdrawn in national office

Ref document number: DE

WWP Wipo information: published in national office

Ref document number: 2004799475

Country of ref document: EP

Ref document number: 1020067005718

Country of ref document: KR