A method and device for adaptive fusion of address and instruction cache
Through the adaptive fusion method of address and instruction cache, the adaptive fusion of cache is realized, solving the problem of complementary CACHE and TLB size requirements of different applications, improving the comprehensive cache hit rate, and reducing power consumption and area waste.
Patent Information
- Application Number
- CN202111417859.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-25
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2041-11-25
AI Technical Summary
The prior art is difficult to dynamically adjust the size of cache (CACHE) and conversion detection buffer (TLB) according to the needs of different applications, resulting in waste of power and area.
Adaptive fusion method of address and instruction cache is adopted, and the fusion cache is connected to N-channel groups, combined with the label array and data array of split structures to realize the adaptive fusion of caches. The fusion cache also has the function of cache instruction information and address translation information. , and determine whether backfilling is required by using the recent use of replacement strategy and miss counter.
The comprehensive cache hit rate per unit power consumption and area is improved, and the power consumption and area waste caused by separate designs is reduced.
Smart Images

Figure CN114116537B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a high-speed cache optimization technology in a processor, and in particular to a method and a device for adaptively fusing address and instruction caches. Background Art
[0002] In order to compensate for the difference in main memory speed, cache (CACHE) came into being and became a key component to reduce the average time required for computer processors to access memory. The translation check buffer (TLB), also a kind of cache, is used in memory management to improve the speed of conversion from virtual address to physical address. It can be said that TLB is a CACHE for page table. The introduction of TLB can reduce the performance degradation of processor caused by MMU. Therefore, both CACHE and TLB play a vital role in improving processor performance. In addition, power consumption and area parameters are increasingly becoming important performance indicators for the development of contemporary processors. As application scenarios become more and more complex, processors generally increase the size of CACHE and TLB to improve the hit rate of each of them, thereby ensuring the performance of the processor. However, for different applications, their requirements for the size of CACHE and TLB show complementary characteristics. Some applications are more sensitive to the size of TLB, while some programs are more sensitive to the size of CACHE. How to dynamically adjust the size of the two according to the needs of the application has become an urgent problem to be solved. Summary of the invention
[0003] Technical problem to be solved by the present invention: In view of the above-mentioned problems in the prior art, a method and device for adaptive fusion of address and instruction cache are provided. The present invention can enable a cache to have the function of caching instruction information and address translation information at the same time, and through the adaptive fusion method, the comprehensive cache hit rate per unit power consumption and area is improved, which can reduce the waste of power consumption and area caused by separate design.
[0004] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0005] A device for adaptively fusing address and instruction cache comprises a fused cache connected in an N-way group, the fused cache comprises a tag array and a data array of a split structure, the first column of the tag array and the data array are fixed as table entries of TLB attributes, and the last column is fixed as instruction cache table entries, each table entry in the tag array carries a flag bit TF, and the first list item is fixed as a table entry of the effective bit VA of the TLB table entry and the flag bit TF is 1, the last list item is fixed as an instruction cache table entry and the flag bit TF is 0, and the remaining table items are fused table items supporting TLB table items and instruction cache table items, the flag bit TF of the fused table items is used for read judgment, and the value of the flag bit TF is 1 for TLB table items, and the value is 0 for instruction cache table items; the first list item of the data array is fixed as the PA of the TLB table item.
[0006] Optionally, a TLB flag register WTF with an N-bit flag FLAG is provided for each way in the tag array, and the TLB flag register WTF is used for write judgment. The value of the flag FLAG is 1, indicating a TLB table entry, and the value of the flag FLAG is 0, indicating an instruction cache table entry.
[0007] In addition, the present invention also provides an application method of the above-mentioned device for adaptively fusing address and instruction cache, including:
[0008] 1) Determine the type of data request. If the data request is an instruction address access request, jump to step 2); if the data request is an address translation request, jump to step 3);
[0009] 2) Parse and obtain the tag tag and index index of the address translation request, match the index index with the effective bit VA of the TLB table entry to obtain the matching table entry, and then search the PA of the matching TLB table entry in the data array through the tag tag for the matching table entry. If the PA of the matching TLB table entry is found, the PA of the matching TLB table entry is returned, otherwise it is determined that the instruction cache table entry does not hit, and the value of the flag bit TF of the matching table entry is inverted; jump to execute step 1);
[0010] 3) Parse and obtain the tag tag, index index and offset offset of the instruction address access request; obtain the matching table entry by matching the index index and the tag tag, and obtain the required data in the data array according to the offset offset for the matching table entry. If the required data is successfully obtained, the required data is obtained and returned, otherwise it is determined that the instruction cache table entry does not hit, and the value of the flag bit TF of the matching table entry is inverted; jump to execute step 1).
[0011] Optionally, after determining that the instruction cache entry misses in step 2) and determining that the instruction cache entry misses in step 3), it also includes: determining whether the fusion cache needs to be backfilled. If backfilling is required, combining the last replacement strategy LRU used recently, selecting a table entry that is considered invalid due to inconsistent flag TF under a certain way with consistent flag FLAG under the TLB flag register WTF for replacement, and after completion, modifying the flag FLAG of the selected TLB flag register WTF to the opposite value.
[0012] Optionally, the condition for determining whether the fusion cache needs to be backfilled is: waiting for n clock cycles to obtain the current instruction cache entry miss count P n , TLB entry miss count Q n ; Calculate the number of misses P of the current instruction cache entry n , the number of instruction cache entry misses last time P n-1 The difference P between the number of instruction cache entry misses n-(n-1) , and calculate the current TLB entry miss count Q n , the last TLB entry miss count Q n-1 The difference in the number of TLB entry misses between n-(n-1) ; According to the instruction cache entry miss count difference P n-(n-1) The value of determines the direction and trend of instruction cache entry miss changes, and the difference Q of the number of TLB entry misses is used to determine the direction and trend of instruction cache entry miss changes. n-(n-1) The value of determines the direction and trend of the TLB entry miss change; if the instruction cache entry miss change is reverse increase, the TLB entry miss change is reverse decrease, and the instruction cache entry miss number difference P n-(n-1) , TLB table entry miss count difference Q n-(n-1) All exceed the preset threshold T n , then it is determined that the fusion cache needs to be backfilled; if the instruction cache entry miss change is positively increasing, the TLB entry miss change is positively decreasing, and the instruction cache entry miss difference P n-(n-1) , TLB table entry miss count difference Q n-(n-1) All exceed the preset threshold T n , it is determined that the fusion cache needs to be backfilled; otherwise, it is determined that the fusion cache does not need to be backfilled.
[0013] Optionally, the calculation of the current instruction cache entry miss count P n , the number of instruction cache entry misses last time P n-1 The difference P between the number of instruction cache entry misses n-(n-1) , and calculate the current TLB entry miss count Q n , the last TLB entry miss count Qn-1 The difference in the number of TLB entry misses between n-(n-1) When waiting for the first n clock cycles, the number of instruction cache entry misses P last time n-1 , the last TLB entry miss count Q n-1 The initial value is 0.
[0014] Optionally, the n clock cycles are between 3×10 10 -3×10 11 between.
[0015] Optionally, the determination of whether the fusion cache needs to be backfilled is implemented by a fusion condition determination device, which includes a miss counter and a comparison component, and uses a register form to store and calculate data; the miss counter waits for n clock cycles to obtain the current instruction cache entry miss count P n , TLB entry miss count Q n The comparison component is used to calculate the current instruction cache entry miss count P n , the number of instruction cache entry misses last time P n-1 The difference P between the number of instruction cache entry misses n-(n-1) , and calculate the current TLB entry miss count Q n , the last TLB entry miss count Q n-1 The difference in the number of TLB entry misses between n-(n-1) , and according to the instruction cache entry miss count difference P n-(n-1) The value of determines the direction and trend of instruction cache entry miss changes, and the difference Q of the number of TLB entry misses is used to determine the direction and trend of instruction cache entry miss changes. n-(n-1) The value of determines the direction and trend of the TLB table entry miss change, and writes the direction and trend into the specified flag bit in the register.
[0016] Optionally, before step 1), the step further includes dividing all fusion entries in the column where the fusion entry is located into instruction cache entries and TLB entries according to a specified ratio, and modifying the flag TF according to the structure of dividing the instruction cache entries and TLB entries.
[0017] Optionally, in step 1), dividing the instruction cache entries and the TLB entries according to a specified ratio refers to dividing the instruction cache entries and the TLB entries according to a ratio of 2:1.
[0018] Compared with the prior art, the present invention has the following advantages:
[0019] 1. The device for adaptive fusion of address and instruction cache of the present invention comprises a fusion cache connected by an N-way group, wherein the fusion cache comprises a tag array and a data array of a split structure, wherein the first column of the tag array and the data array is fixed as a table entry of TLB attributes, and the last column is fixed as an instruction cache table entry, each table entry in the tag array carries a flag bit TF, wherein the first list item is fixed as a table entry of the valid bit VA of the TLB table entry and the flag bit TF is 1, the last list item is fixed as an instruction cache table entry and the flag bit TF is 0, and the remaining table items are fusion table items supporting TLB table items and instruction cache table items, the flag bit TF of the fusion table item is used for reading judgment, and the value of the flag bit TF is 1 for TLB table items and 0 for instruction cache table items; the first list item of the data array is fixed as the PA of the TLB table item. Through the above structure, a cache can have the functions of caching instruction information and address translation information at the same time, improve the comprehensive cache hit rate per unit power consumption and area, and reduce the waste of power consumption and area caused by separate design.
[0020] 2. The method for adaptively fusing address and instruction cache of the present invention comprises judging the type of data request. If the data request is an instruction address access request, parsing and obtaining the tag tag and index index of the address translation request, matching the index index with the valid bit VA of the TLB table entry to obtain the matching table entry, and then searching the PA of the matching TLB table entry in the data array through the tag tag for the matching table entry. If the PA of the matching TLB table entry is found, the PA of the matching TLB table entry is returned. Otherwise, it is determined that the instruction cache table entry does not hit, and the value of the flag bit TF of the matching table entry is inverted. If the data request is an address translation request, parsing and obtaining the instruction The tag tag, index index and offset offset of the address access request; the matching table entry is obtained by matching the index index and the tag tag, and the required data is obtained in the data array according to the offset offset for the matching table entry. If the required data is successfully obtained, the required data is obtained and returned, otherwise it is determined that the instruction cache table entry does not hit, and the value of the flag bit TF of the matching table entry is inverted; through the above method, a cache can have the function of caching instruction information and address translation information at the same time, and through adaptive fusion, the comprehensive cache hit rate per unit power consumption and area can be improved, which can reduce the waste of power consumption and area caused by separate design. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 It is a schematic diagram of the structure of a device for adaptively fusing address and instruction caches in an embodiment of the present invention.
[0022] Figure 2 The figure is a flow chart for determining whether backfilling is required in an embodiment of the present invention.
[0023] Figure 3Schematic diagram of the structure of the fusion condition judgment device in an embodiment of the present invention. DETAILED DESCRIPTION
[0024] like Figure 1 As shown, the device for adaptive fusion of address and instruction cache in this embodiment includes a fusion cache connected in an N-way group, and the fusion cache includes a tag array and a data array of a separate structure. The first column of the tag array and its data array is fixed to a table entry of TLB attributes, and the last column is fixed to an instruction cache table entry. Each table entry in the tag array carries a flag bit TF, and the first list item is fixed to a table entry of the valid bit VA of the TLB table entry and the flag bit TF is 1, the last list item is fixed to an instruction cache table entry and the flag bit TF is 0, and the remaining table items are fusion table items that support TLB table items and instruction cache table items. The flag bit TF of the fusion table item is used for read judgment, and the value of the flag bit TF is 1 for a TLB table entry, and the value is 0 for an instruction cache table entry; the first list item of the data array is fixed to the PA of the TLB table entry. See. Figure 1 It can be seen that the fusion cache is a split structure. The structure of the fusion cache is N-way group connected. The tag array integrates the VA of the traditional TLB table entry and the address index of the traditional instruction cache, and the data array integrates the PA and other attribute bits of the traditional TLB table entry and the data of the traditional instruction cache. Among them, each table entry in the tag array has a 1-bit TF flag. Initially, the first way of the multi-way structure is fixed as the TLB table entry (indicated by the oval, the TF bit is set to 1), and the remaining ways are fixed as the instruction cache table entry (indicated by the rectangle, the TF bit is set to 0). Figure 1 In the figure, the middle dotted box is the fused table entry, and the TF bit of the table entry is variable. Since the first list item is fixed as the table entry of the effective bit VA of the TLB table entry and the flag bit TF is 1, and the last list item is fixed as the instruction cache table entry and the flag bit TF is 0, the TF values of these two columns are fixed. The input includes the TLB virtual address and the instruction cache address, ensuring that both methods have a query process and there will be no situation where there is no query at all.
[0025] like Figure 1 As shown, a TLB flag register WTF (Way TLB FLAG) having an N-bit flag FLAG is provided for each way in the tag array. The TLB flag register WTF is used for write judgment. The value of the flag FLAG is 1, indicating a TLB table entry, and the value of the flag FLAG is 0, indicating an instruction cache table entry.
[0026] In addition, this embodiment also provides an application method of the aforementioned address and instruction cache adaptive fusion device, including:
[0027] 1) Determine the type of data request. If the data request is an instruction address access request, jump to step 2); if the data request is an address translation request, jump to step 3);
[0028] 2) Parse and obtain the tag tag and index index of the address translation request, match the index index with the effective bit VA of the TLB table entry to obtain the matching table entry, and then search the PA of the matching TLB table entry in the data array through the tag tag for the matching table entry. If the PA of the matching TLB table entry is found, the PA of the matching TLB table entry is returned, otherwise it is determined that the instruction cache table entry does not hit, and the value of the flag bit TF of the matching table entry is inverted; jump to execute step 1);
[0029] 3) Parse and obtain the tag tag, index index and offset offset of the instruction address access request; obtain the matching table entry by matching the index index and the tag tag, and obtain the required data in the data array according to the offset offset for the matching table entry. If the required data is successfully obtained, the required data is obtained and returned, otherwise it is determined that the instruction cache table entry does not hit, and the value of the flag bit TF of the matching table entry is inverted; jump to execute step 1).
[0030] Refer to steps 1) to 3). For instruction address access requests, the fusion cache will find the location of the corresponding group through the index field in the address, and determine whether it hits by comparing the tag information and the TF flag of the table entry. If the tag matches, the current table entry is valid and the TF bit is 0, the data in the data array is finally found based on the offset. For address translation requests, the cache finds the location of the corresponding group through the index field in the virtual address, and determines whether it hits by comparing the tag information and the TF flag of the table entry.
[0031] In this embodiment, after determining that the instruction cache entry misses in step 2) and determining that the instruction cache entry misses in step 3), it also includes: determining whether the fusion cache needs to be backfilled. If backfilling is required, combining the most recently used last replacement strategy LRU, select a certain way with the consistent flag FLAG under the TLB flag register WTF, which is considered invalid due to inconsistent flag TF, to replace, and after completion, modify the flag FLAG of the selected TLB flag register WTF to the opposite value. In this embodiment, by utilizing the missing information of the instruction cache and the TLB cache, the attributes of each way are adaptively changed. Afterwards, according to the judgment of the WTF register, the TF flag information of the table entry in the corresponding way is changed through the backfill operation to achieve adaptive fusion, which can improve the comprehensive cache hit rate per unit power consumption and area, and reduce the waste of power consumption and area caused by separate design.
[0032] See also Figure 2 In this embodiment, the condition for determining whether the fusion cache needs to be backfilled is: wait for n clock cycles to obtain the current instruction cache entry miss count P n, TLB entry miss count Q n ; Calculate the number of misses P of the current instruction cache entry n , the number of instruction cache entry misses last time P n-1 The difference P between the number of instruction cache entry misses n-(n-1) , and calculate the current TLB entry miss count Q n , the last TLB entry miss count Q n-1 The difference in the number of TLB entry misses between n-(n-1) ; According to the instruction cache entry miss count difference P n-(n-1) The value of determines the direction and trend of instruction cache entry miss changes, and the difference Q of the number of TLB entry misses is used to determine the direction and trend of instruction cache entry miss changes. n-(n-1) The value of determines the direction and trend of the TLB entry miss change; if the instruction cache entry miss change is reverse increase, the TLB entry miss change is reverse decrease, and the instruction cache entry miss number difference P n-(n-1) , TLB table entry miss count difference Q n-(n-1) All exceed the preset threshold T n , then it is determined that the fusion cache needs to be backfilled; if the instruction cache entry miss change is positively increasing, the TLB entry miss change is positively decreasing, and the instruction cache entry miss difference P n-(n-1) , TLB table entry miss count difference Q n-(n-1) All exceed the preset threshold T n , then it is determined that the fusion cache needs to be backfilled; otherwise, it is determined that the fusion cache does not need to be backfilled. Wait for n clock cycles to obtain the current instruction cache entry miss count P n , TLB entry miss count Q n That is: Get the current instruction cache entry miss count P in the nth clock cycle n , TLB entry miss count Q n ; Get the current instruction cache entry miss count P in the 2nth clock cycle n+1 , TLB entry miss count Q n+1 The condition for determining whether the fusion cache needs to be backfilled is the execution condition of the adaptive fusion. Through the above-mentioned execution condition of the adaptive fusion, it can be achieved that when the number of instruction cache table entry misses (ICACHE miss) or the number of TLB table entry misses (TLB miss) is in an increasing state and exceeds the threshold of the number of misses in the current clock cycle, the adaptive fusion is enabled.
[0033] In this embodiment, the number of misses P of the current instruction cache entry is calculated. n , the number of instruction cache entry misses last time P n-1 The difference P between the number of instruction cache entry missesn-(n-1) , and calculate the current TLB entry miss count Q n , the last TLB entry miss count Q n-1 The difference in the number of TLB entry misses between n-(n-1) When waiting for the first n clock cycles, the number of instruction cache entry misses P last time n-1 , the last TLB entry miss count Q n-1 The initial value is 0.
[0034] In this embodiment, n clock cycles are between 3×10 10 -3×10 11 between.
[0035] In this embodiment, whether the fusion cache needs to be backfilled is determined by a fusion condition determination device, which includes a miss counter and a comparison component, and uses a register to store and calculate data; the miss counter waits for n clock cycles to obtain the current instruction cache entry miss count P n , TLB entry miss count Q n ; The comparison component is used to calculate the number of misses P of the current instruction cache entry n , the number of instruction cache entry misses last time P n-1 The difference P between the number of instruction cache entry misses n-(n-1) , and calculate the current TLB entry miss count Q n , the last TLB entry miss count Q n-1 The difference in the number of TLB entry misses between n-(n-1) , and according to the instruction cache entry miss count difference P n-(n-1) The value of determines the direction and trend of instruction cache entry miss changes, and the difference Q of the number of TLB entry misses is used to determine the direction and trend of instruction cache entry miss changes. n-(n-1) The value of determines the direction and trend of the TLB entry miss change, and writes the direction and trend into the specified flag bit in the register. Figure 2 The miss counter includes an instruction cache entry miss counter (ICACHE miss counter) and a TLB entry miss counter (TLB miss counter). The instruction cache entry miss counter (ICACHE miss counter) waits for n clock cycles to obtain the current instruction cache entry miss count P. n , the TLB entry miss counter (TLBmiss counter) waits for n clock cycles to obtain the current TLB entry miss count Q nSimilarly, the size comparison component also includes an instruction cache entry miss size comparison component (ICACHE miss size comparison component) and a TLB entry miss size comparison component (TLB miss size comparison component). The former is used to calculate the current instruction cache entry miss count P n , the number of instruction cache entry misses last time P n-1 The difference P between the number of instruction cache entry misses n-(n-1) , which is used to calculate the current TLB entry miss count Q n , the last TLB entry miss count Q n-1 The difference in the number of TLB entry misses between n-(n-1) . In this embodiment, the fusion condition decision device counts the number of TLB and ICACHE misses every n clock cycles, and the MISS counting device counts the number of TLB and ICACHE misses. After the counting is completed, the size comparison device calculates the difference between the current number of misses and the number of TLB and ICACHE counts n clock cycles ago, and determines whether the number of TLB and ICAHCE misses in the current clock cycle increases. After the size comparison is completed, the difference between the number of ICACHE and TLB misses is written into the MISS counting device, and the flag is written back to the miss counter according to the direction of change and trend information such as whether the number of misses increases (increase flag bit BIT[0]=1, decrease flag bit BIT[0]=0). See. Figure 3 The register in the instruction cache entry miss counter (ICACHE miss counter) includes the instruction cache entry miss count P n , the difference in the number of instruction cache entry misses P n-(n-1) and an increasing flag, the increasing flag is used to record the direction and trend of the change of instruction cache entry misses; the register in the TLB entry miss counter (TLB miss counter) includes the number of TLB entry misses Q n , TLB table entry miss count difference Q n-(n-1) And the rising flag bit, the rising flag bit is used to record the direction and trend of the change of TLB table entry miss.
[0036] The other columns of the cache except the first column are fused entries, and their TF bits are undetermined in the initial state. In this embodiment, before step 1), it also includes dividing all fused entries in the column where the fused entry is located into instruction cache entries and TLB entries according to a specified ratio, and modifying the flag bit TF according to the structure of the divided instruction cache entries and TLB entries, by dividing a starting entry allocation ratio, and the subsequent adaptive fusion is to dynamically adjust the ratio of the two according to the actual miss rate change.
[0037] In step 1) of this embodiment, dividing the instruction cache table entries and the TLB table entries according to the specified ratio means dividing the instruction cache table entries and the TLB table entries according to the ratio of 2:1, and registering the flag corresponding to the FLAG value in the TLB flag register WTF.
[0038] In summary, the device of this embodiment and its application method can enable a cache to have the function of caching instruction information and address translation information at the same time, and through the adaptive fusion method, the comprehensive cache hit rate per unit power consumption and area can be improved, which can reduce the waste of power consumption and area caused by separate design.
[0039] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes. The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, may be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the functions in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0040] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.
Claims
1. A device for adaptive fusion of address and instruction cache, characterized in that: The invention comprises a fusion cache connected with an N-way group, wherein the fusion cache comprises a tag array and a data array of a split structure, wherein the first column of the tag array and the data array is fixed as a table entry of a TLB attribute, and the last column is fixed as an instruction cache table entry, each table entry in the tag array carries a flag bit TF, wherein the first list item is fixed as a table entry of a valid bit VA of a TLB table entry and the flag bit TF is 1, the last list item is fixed as an instruction cache table entry and the flag bit TF is 0, and the remaining table items are fusion table items supporting TLB table items and instruction cache table items, the flag bit TF of the fusion table item is used for read judgment, and the value of the flag bit TF is 1 for a TLB table item, and the value is 0 for an instruction cache table item; the first list item of the data array is fixed as the PA of the TLB table item; a TLB flag register WTF with an N-bit flag bit FLAG is provided corresponding to each way in the tag array, the TLB flag register WTF is used for write judgment, the value of the flag bit FLAG is 1 for a TLB table item, and the value of the flag bit FLAG is 0 for an instruction cache table item.
2. An application method of the device for adaptive fusion of address and instruction cache according to claim 1, characterized in that: include: 1) Determine the type of data request. If the data request is an instruction address access request, jump to step 2); If the data request is an address translation request, jump to step 3); 2) Parse and obtain the tag and index of the address translation request, match the index with the effective bit VA of the TLB table entry to obtain the matching table entry, and then search the PA of the matching TLB table entry in the data array through the tag for the matching table entry. If the PA of the matching TLB table entry is found, the PA of the matching TLB table entry is returned, otherwise it is determined that the instruction cache table entry does not hit, and the value of the flag bit TF of the matching table entry is inverted; jump to execute step 1); 3) Parse and obtain the tag tag, index index and offset offset of the instruction address access request; obtain the matching table entry by matching the index index and tag tag, and obtain the required data in the data array according to the offset offset for the matching table entry. If the required data is successfully obtained, the required data is obtained and returned; otherwise, it is determined that the instruction cache table entry does not hit, and the value of the flag bit TF of the matching table entry is inverted; Jump to step 1).
3. The application method of the device for adaptive fusion of address and instruction cache according to claim 2 is characterized in that: After determining that the instruction cache entry misses in step 2) and determining that the instruction cache entry misses in step 3), the method further includes: determining whether the fusion cache needs to be backfilled. If backfilling is required, combining the most recently used last replacement strategy LRU, selecting a table entry that is considered invalid due to inconsistent flag bit TF under a certain way with consistent flag bit FLAG under the TLB flag register WTF for replacement, and after completion, modifying the flag bit FLAG of the selected TLB flag register WTF to the opposite value.
4. The application method of the device for adaptive fusion of address and instruction cache according to claim 3 is characterized in that: The condition for determining whether the fusion cache needs to be backfilled is: wait for n clock cycles to obtain the current instruction cache entry miss count P n , TLB entry miss count Q n ; Calculate the number of misses P of the current instruction cache entry n , the number of instruction cache entry misses last time P n-1 The difference P between the number of instruction cache entry misses n-(n-1) , and calculate the current TLB entry miss count Q n , the last TLB entry miss count Q n-1 The difference in the number of TLB entry misses between n-(n-1) ; According to the instruction cache entry miss count difference P n-(n-1) The value of determines the direction and trend of instruction cache entry miss changes, and the difference Q of the number of TLB entry misses is used to determine the direction and trend of instruction cache entry miss changes. n-(n-1) The value of determines the direction and trend of the TLB entry miss change; if the instruction cache entry miss change is reverse increase, the TLB entry miss change is reverse decrease, and the instruction cache entry miss number difference P n-(n-1) , TLB table entry miss count difference Q n-(n-1) All exceed the preset threshold T n , then it is determined that the fusion cache needs to be backfilled; if the instruction cache entry miss change is positively increasing, the TLB entry miss change is positively decreasing, and the instruction cache entry miss difference P n-(n-1) , TLB table entry miss count difference Q n-(n-1) All exceed the preset threshold T n , it is determined that the fusion cache needs to be backfilled; otherwise, it is determined that the fusion cache does not need to be backfilled.
5. The application method of the device for adaptive fusion of address and instruction cache according to claim 4, characterized in that: The calculation of the current instruction cache entry miss count P n , the number of instruction cache entry misses last time P n-1 The difference P between the number of instruction cache entry misses n-(n-1) , and calculate the current TLB entry miss count Q n , the last TLB entry miss count Q n-1 The difference in the number of TLB entry misses between n-(n-1) When waiting for the first n clock cycles, the number of instruction cache entry misses P last time n-1 , the last TLB entry miss count Q n-1 The initial value is 0.
6. The application method of the device for adaptive fusion of address and instruction cache according to claim 5, characterized in that: The n clock cycles are between 3×10 10 - 3×10 11 between.
7. The application method of the device for adaptive fusion of address and instruction cache according to claim 6, characterized in that: The judgment of whether the fusion cache needs to be backfilled is realized by a fusion condition judgment device, which includes a miss counter and a comparison component, and uses a register form to store and calculate data; the miss counter waits for n clock cycles to obtain the current instruction cache entry miss count P n , TLB entry miss count Q n The comparison component is used to calculate the current instruction cache entry miss count P n , the number of instruction cache entry misses last time P n-1 The difference P between the number of instruction cache entry misses n-(n-1) , and calculate the current TLB entry miss count Q n , the last TLB entry miss count Q n-1 The difference in the number of TLB entry misses between n-(n-1) , and according to the instruction cache entry miss count difference P n-(n-1) The value of determines the direction and trend of instruction cache entry miss changes, and the difference Q of the number of TLB entry misses is used to determine the direction and trend of instruction cache entry miss changes. n-(n-1) The value of determines the direction and trend of the TLB table entry miss change, and writes the direction and trend into the specified flag bit in the register.
8. The application method of the device for adaptive fusion of address and instruction cache according to claim 7, characterized in that: Before step 1), the process also includes dividing all fusion entries in the column where the fusion entry is located into instruction cache entries and TLB entries according to a specified ratio, and modifying the flag TF according to the structure of dividing the instruction cache entries and TLB entries.
9. The application method of the device for adaptive fusion of address and instruction cache according to claim 8, characterized in that: In step 1), dividing the instruction cache table entries and the TLB table entries according to the specified ratio means dividing the instruction cache table entries and the TLB table entries according to the ratio of 2:1.
