# Patent

## Title
Physically-tagged cache with virtually-tagged fill buffers

## Abstract

A virtually indexed, physically-tagged cache is combined with one or more virtually-tagged fill-buffers.

## Background
Digital processors have cache memories for storing data and instructions. These memories use fast memories as compared to slow memories used for the computer's main memory. Through use of replacement algorithms, a relatively small cache memory compared to the size of the main memory provides a relatively high hit rate and consequently speeds up the flow of instructions to the execution unit of the computer. It would be beneficial to provide faster cache accesses and related power improvements in processors.



BRIEF DESCRIPTION OF THE DRAWINGS
The subject matter regarded as the invention is particularly pointed out and distinctly claimed in the concluding portion of the specification. The invention, however, both as to organization and method of operation, together with objects, features, and advantages thereof, may best be understood by reference to the following detailed description when read with the accompanying drawings in which:
FIG. 1 illustrates a device having a direct-mapped, physically-tagged cache in accordance with the present invention; and
FIG. 2 is a diagram that highlights features of the cache in accordance with an embodiment of the present invention.
FIG. 3 represents features of providing a virtual address to the virtually indexed physically-tagged cache.



It will be appreciated that for simplicity and clarity of illustration, elements illustrated in the figures have not necessarily been drawn to scale. For example, the dimensions of some of the elements may be exaggerated relative to other elements for clarity. Further, where considered appropriate, reference numerals have been repeated among the figures to indicate corresponding or analogous elements.
DETAILED DESCRIPTION
In the following detailed description, numerous specific details are set forth in order to provide a thorough understanding of the invention. However, it will be understood by those skilled in the art that the present invention may be practiced without these specific details. In other instances, well-known methods, procedures, components and circuits have not been described in detail so as not to obscure the present invention.
In the following description and claims, the terms “coupled” and “connected,” along with their derivatives, may be used. It should be understood that these terms are not intended as synonyms for each other. Rather, in particular embodiments, “connected” may be used to indicate that two or more elements are in direct physical or electrical contact with each other. “Coupled” may mean that two or more elements are in direct physical or electrical contact. However, “coupled” may also mean that two or more elements are not in direct contact with each other, but yet still co-operate or interact with each other.
FIG. 1 illustrates a wireless device 10 that includes a direct-mapped, physically-tagged cache 16 in accordance with the present invention. In this embodiment, an RF transceiver 14 receives and transmits modulated signals from one or more antennas. RF transceiver 14 may be a stand-alone Radio Frequency (RF) integrated analog circuit, or alternatively, be embedded with a processor 12 as a mixed-mode integrated circuit. The received modulated signals are frequency down-converted, filtered, and then converted to a baseband digital signal.
An Operating System (OS) may manage the limited physical memory present on processor 12, dividing the physical memory among many processes that may be running simultaneously and allocating each process an appropriate memory share. The OS may rely on hardware support from a memory controller 18 to manage the memory and export functions that other subsystems and applications may use to interact with the memory. Caching is a basic technique of computer architecture, used for many different purposes. Generally speaking, cache 16 is a dedicated memory which tries to hold a working set of program data, program instructions, address translations, branch predictions or memory dependence predictions in a limited space. A mass storage device 20 may also be connected to processor 12.
Although the present invention is shown embedded in a wireless device 10, it should be understood that other applications and products may make use of the invention. Accordingly, the claimed subject matter may be incorporated into a variety of applications and included in microcontrollers, general-purpose microprocessors, Digital Signal Processors (DSPs), among other electronic components. In particular, the present invention may be used in smart phones, communicators and Personal Digital Assistants (PDAs), medical or biotech equipment, automotive safety and protective equipment, and automotive infotainment products. However, it should be understood that the scope of the present invention is not limited to these examples.
FIG. 2 is a block diagram that illustrates a virtually-indexed physically-tagged direct mapped cache 16. The direct mapped cache allows faster use of stored information irrespective of whether the cache stores data or instructions. Direct-mapped cache 16 includes a cache data storage RAM 200, a cache physical tag storage RAM 202 and a Translation Lookaside Buffer (TLB) 204 that each receive virtual address bits.
Cache 16 includes fill buffers 206 and 212 that are virtually-tagged and in one embodiment may be fully-associative, but in other embodiments may be set-associative, direct-mapped, etc. Fill buffer 206 includes a fill buffer Content Addressable Memory (CAM) 208 and a fill buffer data storage 210, while fill buffer 212 includes a fill buffer CAM 214 and a fill buffer data storage 216. For simplicity of illustration two fill buffers are described in the embodiment illustrated in FIG. 2, however, it should be understood that the number of fill buffers is not limiting to the present invention. Thus, any number of virtually-tagged fill buffers may be used. Fill buffers 206 and 212 may use “lazy retirement” which is used herein to mean that the content stored in fill buffer data storage 210 and 216 is not transferred to the cache until a new fill request is made.
Fill buffer CAM 208 and fill buffer CAM 214 generate a HIT(1) signal and a HIT(2) signal, respectively, when a stored data value matches the virtual address. An OR-gate 218 receives the HIT(1) and HIT(2) signals from the fill buffers and generates the FBHIT signal that may be used to inhibit the firing of the sense amps (SAen signal) within cache data storage RAM 200 and cache physical tag storage RAM 202, although inhibiting the sense amps is not a requirement of the present invention. A multiplexer 220 is connected to fill buffer data storage 210 and fill buffer data storage 216 and provides a FBDATA output, providing stored data from the fill buffer CAM 208 when HIT(1) is asserted and providing stored data from the fill buffer CAM 214 when HIT(2) is asserted. Note that the FBDATA output may be set to zero if neither HIT(1) nor HIT(2) is asserted. Alternatively, the FBDATA output may be set to provide stored data from either fill buffer, noting that the stored data at the FBDATA output is not selected by multiplexer 222 if the FBHIT signal is not asserted.
Multiplexer 222 is connected to receive the data word CDATA from cache data storage RAM 200 and the data word FBDATA from multiplexer 220 in providing a cache INSTRUCTION. A compare circuit 224 provides a comparison of the CPTAG [31:12] bits from cache physical tag storage RAM 202 with the PA[31:12] bits generated by TLB 204. A HIT signal is generated by OR-gate 226 when either compare circuit 224 matches the PA[31:12] bits with the CPTAG[31:12] bits or when the FBHIT signal is asserted.
In operation, virtual address VA[31:0] bits are provided 300 to cache 16, with cache data storage RAM 200 receiving virtual address bits [11:2], cache physical tag storage RAM 202 receiving virtual address bits [11:6]310, TLB 204 receiving virtual address bits [31:12] and virtually-tagged fill buffers 206 and 212 each receiving virtual address bits [31:2]320. Cache data storage RAM 200, cache physical tag storage RAM 202, TLB 204 and virtually-tagged fill buffers 206 and 212 initiate operations in parallel starting at the beginning of a clock cycle 310, 320.
If the data or instruction being sought is stored in either of fill buffers 206 or 212, then the appropriate HIT(1) or HIT(2) is signaled and the desired information is read out of the corresponding fill buffer data storage as FBDATA. OR-gate 218 receives the HIT(1) or HIT(2) signals and generates the FBHIT signal that again may be used to inhibit the sense amp enable signal (SAen), which disenables cache data storage RAM 200 and cache physical tag storage RAM 202 from providing output data. Note that fill buffers 206 and 212 are virtual, allowing a hit in the fill buffers to be determined prior to the completion of the VA-to-PA translation by TLB 204. This provides a power savings by preventing the unnecessary firing of the sense amps in the main array of cache 16. If the data or instruction being sought is stored in either of fill buffers 206 or 212, that requested information FBDATA is routed from the fill buffer storage through multiplexers 220 and 222 to the next stage (INSTRUCTION output).
The “lazy retirement” of the fill buffers significantly reduces the risk of pathological behavior in direct mapped cache 16, especially when the cache is used as an instruction cache. “Pathological behavior” refers to a condition of direct mapping that accounts for the worst possible behavior out of the cache. The “lazy retirement” used by fill buffer CAM 208 and fill buffer CAM 214 means that most entries in the fill buffers will usually be valid.
Alternatively, the data or instruction being sought may not be stored in either fill buffer 206 or fill buffer 212. Accordingly, the candidate tag CPTAG is read out of cache physical tag storage RAM 202 and the data (CDATA) is read out of the cache data storage RAM 200. Note that operation on the data (e.g. decoding an instruction) begins at the beginning of the clock cycle, even though it is not certain that the cache physical tag storage RAM 202 has the requested data. The candidate tag CPTAG is compared to the requested address PA[31:12] by compare circuit 224. If the tag and address match, OR-gate 226 generates a HIT and CDATA from cache data storage RAM 200 is provided as the INSTRUCTION out of cache 16. If the tag and address do not match, the operation on the data is canceled and a fill request for the requested data is made to the outer-next level of the memory hierarchy.
A fill request triggers the fill-buffer management logic (not shown). If fill buffer 206 or 212 is empty, that fill buffer is allocated to the fill request and data is placed in the allocated buffer. If neither fill buffer 206 nor 212 is empty, then one of the well-known replacement algorithms may be used to determine a fill buffer to replace the corresponding entry in the direct-mapped cache or the entry will be invalidated.
By now it should be apparent that the direct mapped cache may be used in processor cores to provide faster cache access within processors and is especially applicable to instruction caches. Whereas other processors may use virtually-tagged fill buffers associated with virtually-tagged caches or physically-tagged fill buffers associated with physically-tagged caches, the present invention incorporates a physically-tagged direct-mapped cache with virtually-tagged fill buffers. The embodiment illustrated in FIG. 2 provides the ability to use the data before the cache tag compare is complete. The pathological behavior of direct-mapped cache may be reduced using features of the present invention. Further, power may be saved by not firing the sense amps in the physically-tagged cache when a hit in the fill buffers occurs.
While certain features of the invention have been illustrated and described herein, many modifications, substitutions, changes, and equivalents will now occur to those skilled in the art. It is, therefore, to be understood that the appended claims are intended to cover all such modifications and changes as fall within the true spirit of the invention.

## Claims

1. A cache, comprising:
a virtually indexed physically-tagged cache; and
a virtually-tagged fill buffer.

2. The cache of claim 1, wherein the virtually-tagged fill buffer includes:
a fill buffer Content Addressable Memory (CAM) and a fill buffer data storage.

3. The cache of claim 2, wherein the fill buffer CAM generates a hit signal that is used to enable the virtually indexed physically-tagged cache to provide output data.

4. The cache of claim 1, wherein the virtually indexed physically-tagged cache is direct mapped.

5. The cache of claim 1, wherein the virtually-tagged fill buffer is fully-associative.

6. The cache of claim 1, wherein the virtually-tagged fill buffer is set-associative.

7. The cache of claim 1, wherein the virtually indexed physically-tagged cache includes a cache data storage RAM and a cache physical tag storage RAM.

8. The cache of claim 7, further including a Translation Lookaside Buffer (TLB) to initiate a virtual address to physical address translation.

9. The cache of claim 8, further including a compare circuit having inputs coupled to the TLB and the cache physical tag storage RAM.

10. A cache comprising:
a physically-tagged direct-mapped cache with a first virtually-tagged fill buffer.

11. The cache of claim 10 further comprising a second virtually-tagged fill buffer coupled to receive a virtual address in common with the first virtually-tagged fill buffer.

12. The cache of claim 10 wherein the first and second virtually-tagged fill buffers each include a fill buffer Content Addressable Memory (CAM) and a fill buffer data storage.

13. The cache of claim 12 further including a logic gate having inputs coupled to an output of each fill buffer CAM and generating a hit signal.

14. The cache of claim 13 wherein the hit signal inhibits data from being provided by the physically-tagged direct-mapped cache.

15. The cache of claim 10 further including a Translation Lookaside Buffer (TLB) to perform a virtual address to physical address translation.

16. The cache of claim 15 further including a compare circuit to receive the physical address from the TLB to compare against a physical tag provided by the physically-tagged direct-mapped cache.

17. A method, comprising:
providing a virtual address to a virtually indexed physically-tagged cache; and a virtually-tagged fill buffer at a clock edge.

18. The method of claim 17 further including:
coupling a Translation Lookaside Buffer (TLB) to receive the virtual address at the clock edge.

19. The method of claim 18 further including: operating on data received from the virtually-tagged fill buffer before comparing a tag of the virtually indexed physically-tagged cache with the TLB is complete.

20. The method of claim 17 further including:
disabling sense-amps in the virtually indexed physically-tagged cache on a fill buffer hit.

21. A system, comprising:
a processor coupled to receive modulated signals from first and second antenna; and
a physically-tagged direct-mapped cache with a virtually-tagged fill buffer to store data or instructions executed by the processor.

22. The system of claim 21 wherein the physically-tagged direct-mapped cache further includes a Translation Lookaside Buffer (TLB) to receive a virtual address.

23. The system of claim 21 further including another virtually-tagged fill buffer coupled to receive a virtual address in common with the first virtually-tagged fill buffer.