Apparatus and Method for Supporting Simultaneous Storage of Trace and Standard Cache Lines

Abstract
A single unified level one instruction cache in which some lines may contain traces and other lines in the same congruence class may contain blocks of instructions consistent with conventional cache lines. A mechanism is described for indexing into the cache, and selecting the desired line. Control is exercised over which lines are contained within the cache. Provision is made for selection between a trace line and a conventional line when both match during a tag compare step.
Description

BRIEF DESCRIPTION OF DRAWINGS

Some of the purposes of the invention having been stated, others will appear as the description proceeds, when taken in connection with the accompanying drawings, in which:



FIG. 1 is a schematic representation of the operative coupling of a computer system central processor and layered memory which has level 1, level 2 and level 3 caches and DRAM;



FIG. 2 is a schematic representation of the organization of a L1 cache instruction cache; and



FIG. 3 is a flow chart depicting the processes involved in the operation of a level 1 instruction cache in accordance with this invention.





DETAILED DESCRIPTION OF INVENTION

While the present invention will be described more fully hereinafter with reference to the accompanying drawings, in which a preferred embodiment of the present invention is shown, it is to be understood at the outset of the description which follows that persons of skill in the appropriate arts may modify the invention here described while still achieving the favorable results of the invention. Accordingly, the description which follows is to be understood as being a broad, teaching disclosure directed to persons of skill in the appropriate arts, and not as limiting upon the present invention.


The term “programmed method”, as used herein, is defined to mean one or more process steps that are presently performed; or, alternatively, one or more process steps that are enabled to be performed at a future point in time. The term programmed method contemplates three alternative forms. First, a programmed method comprises presently performed process steps. Second, a programmed method comprises a computer-readable medium embodying computer instructions which, when executed by a computer system, perform one or more process steps. Third, a programmed method comprises a computer system that has been programmed by software, hardware, firmware, or any combination thereof to perform one or more process steps. It is to be understood that the term programmed method is not to be construed as simultaneously having more than one alternative form, but rather is to be construed in the truest sense of an alternative form wherein, at any given point in time, only one of the plurality of alternative forms is present.


For a L1 Instruction cache coupled to a computer system processor as shown in FIG. 1 and which has 2L bytes per line, M ways per congruence class, and 2N congruence classes, the instruction address presented to the cache subsystem (FIG. 2) (branch target or flow-through from previous cache line) will be partitioned into the following fields:


Least significant L bits (address byte within line)


Next N bits (index into a specific congruence class)


Most significant bits


A typical implementation might have L=6 (16 instructions or 64 bytes per line), M=4 ways per congruence class, and N=7 (128 congruence classes), for a total cache size of 32 KBytes. A typical implementation might also partition each cache line into multiple segments. For instance, a 64 byte line might be made up of data from 4 different arrays (16 bytes or 4 instructions per array). The motivation for this partitioning is that in some cases the required data can be accessed without powering up the entire cache line, thus saving power.


It is to be noted that the cache subsystem elements illustrated in FIG. 2 include the tag array, the data array and control logic operatively associated with the two arrays. In accordance with this invention, the control logic circuitry implements the activity of the level one cache as described here. The two arrays are generally similar to prior cache subsystems, and will be understood by persons of skill in the applicable arts. Attention will now be turned to the control logic and the operation of the cache subsystem contemplated by this invention.


The process for accessing the cache then includes the following steps as illustrated in the flow chart of FIG. 3:


Take the N bits in the middle partition of the target instruction address for use as an index into the tag array.


For each of the M entries in the tag array from the congruence class selected in step 1, compare the tag field with the full target instruction address.


If match is found, is it a trace line?


If it is a trace line, check the trace length parameter in the tag. Enable only the partitions in the data array required to access the trace contents.


Access cache line from data array and forward trace to execution pipelines and exit process. (Only one cache line is allowed in cache with the same starting address. This may be either a trace line or conventional cache line. In the case of a conventional cache line, it is found during this step only if the target instruction address points to the first instruction of the cache line.)


If no match is found, mask off (to zeros) the L least significant bits of the target instruction address.


Repeat the compare with the tags within the selected congruence class. If a match is found, validate that it is a conventional cache line (i.e. with execution starting somewhere other than the first instruction). Note that if it is a trace line with a starting address with zeros in least-significant bits, it is not the trace line that matches the branch target, and can't be used.


Access cache line from data array. Use least significant L bits from the target instruction address to select only the target partition of the data array. This skips groups of instructions with addresses lower than the branch instruction in increments equal to the data array partition size (e.g. 4 instructions).


Overlay instructions to the left of the branch target instruction (within the same partition as the branch target) with an indication of invalid instruction (force to NOP). Then forward instructions to execution pipelines. If no match is found, declare a miss in the L1 cache, and fetch the target address from the L2 cache.


Then build a new trace line, select a match or least recently used (LRU), and replace the selected line.


In order to insure proper operation, certain rules must be enforced when adding a line (either conventional or trace) to the cache:


If the address of the first instruction in the line to be added matches the tag of a line already in the cache, that matching line must be removed in order to add the new line. This insures that a tag will be unique. If there is no match in tags, then the least recently used line (as indicated by LRU or pseudo-LRU) is replaced by the new line.


In the drawings and specifications there has been set forth a preferred embodiment of the invention and, although specific terms are used, the description thus given uses terminology in a generic and descriptive sense only and not for purposes of limitation.

Claims
  • 1. Apparatus comprising: a computer system central processor; andlayered memory operatively coupled to said central processor and accessible thereby, said layered memory having a level one cache;said level one cache storing in interchangeable locations both standard cache lines and trace lines.
  • 2. Apparatus according to claim 1 wherein said level one cache has a predetermined capability for data storage and further wherein said storage capability parses data by the number of bytes stored per cache line; the number of linkages per congruence class; and the number of congruence classes.
  • 3. Apparatus according to claim 2 wherein an instruction address presented to said level one cache is partitioned into fields corresponding to an address byte within a cache line; an index into a specific congruence class; and the most significant bits.
  • 4. Apparatus according to claim 2 wherein data stored within each cache line is partitioned into a plurality of segments drawn from differing arrays.
  • 5. Apparatus according to claim 1 wherein said level one cache comprises a tag array, a data array, and control logic operatively associated with said tag and data arrays and controlling the retrieval from interchangeable locations of both standard cache lines and trace lines.
  • 6. Apparatus according to claim 5 wherein said control logic performs successive comparisons of an instruction address presented to said level one cache with entries in said tag array and distinguishes between a retrieved cache line which is a trace line and a retrieved cache line which is a standard cache line.
  • 7. Apparatus comprising: a computer system central processor and layered memory coupled to and accessible by the central processor, the layered memory including a level one cache;control logic circuitry associated with said level one cache which controls the selective storing in interchangeable locations of the level one cache of the layered memory both standard cache lines and trace lines;said control logic circuitry partitioning an instruction address presented to the level one cache; indexing the instruction address into a tag array of the level one cache; and comparing the instruction address with the tag array a first time to determine whether a match is found; andif a match is found on the first comparison, then determining whether the match is a trace line;if the match is a trace line, checking the trace address, accessing the required partitions, and forwarding the instruction for execution by the central processor.
  • 8. Method comprising: coupling together a computer system central processor and layered memory accessible by the central processor; andselectively storing in interchangeable locations of a level one cache of the layered memory both standard cache lines and trace lines.
  • 9. Method according to claim 8 wherein the level one cache has a predetermined capability for data storage and further comprising parsing data moving to and from the cache by the number of bytes stored per cache line; the number of linkages per congruence class; and the number of congruence classes.
  • 10. Method according to claim 9 further comprising partitioning an instruction address presented to the level one cache into fields corresponding to an address byte within a cache line; an index into a specific congruence class; and the most significant bits.
  • 11. Method according to claim 9 further comprising partitioning an instruction address presented to the level one cache into a plurality of segments drawn from differing arrays.
  • 12. Method according to claim 9 wherein the selective storing of standard cache lines and trace lines is controlled by control logic associated with tag and data arrays.
  • 13. Programmed method comprising: coupling together a computer system central processor and layered memory accessible by the central processor, the layered memory including a level one cache;selectively storing in interchangeable locations of the level one cache of the layered memory both standard cache lines and trace lines;partitioning an instruction address presented to the level one cache;indexing the instruction address into a tag array of the level one cache;comparing the instruction address with the tag array a first time to determine whether a match is found;if a match is found on the first comparison, then determining whether the match is a trace line;if the match is a trace line, checking the trace address, accessing the required partitions, and forwarding the instruction for execution by the central processor.
  • 14. Programmed method according to claim 13 wherein: if no trace line is found on the first comparison, then checking the target address, accessing the required partitions, forcing the leading instruction to NOP, and forwarding the instruction to execution by the central processor, thenbuilding a new trace line, selecting a cache line to be replaced and replacing the selected cache line with the new trace line.
  • 15. Programmed method according to claim 13 wherein: if no match is found on the first comparison, then masking the least significant bits of the instruction address; andcomparing the masked instruction address with the tag array a second time to determine whether a match is found;if a match is found on the second comparison; then if the match is trace line, declaring a miss in the level one cache and fetching instructions from a further level cache, forwarding the instruction for execution by the central processor, building a new trace line, selecting a cache line to be replaced and replacing the selected cache line.
  • 16. Programmed method according to claim 15 wherein: if the match found on the second comparison is not a trace line, checking the trace address, accessing the required partitions, forcing the leading instruction to NOP,and forwarding the instruction for execution by the central processor; thenbuilding a new trace line, selecting a cache line to be replaced and replacing the selected cache line with the new trace line.
  • 17. Programmed method comprising: coupling together a computer system central processor and layered memory accessible by the central processor, the layered memory including a cache;selectively storing in interchangeable locations of the cache of the layered memory both standard cache lines and trace lines;partitioning an instruction address presented to the cache;indexing the instruction address into a tag array of the cache;comparing the instruction address with the tag array a first time to determine whether a match is found;if a match is found on the first comparison, then determining whether the match is a trace line;if the match is a trace line, checking the trace address, accessing the required partitions, and forwarding the instruction for execution by the central processor;if no trace line is found on the first comparison, then checking the target address, accessing the required partitions, forcing the leading instruction to NOP, and forwarding the instruction to execution by the central processor, thenbuilding a new trace line, selecting a cache line to be replaced and replacing the selected cache line with the new trace line.;if no match is found on the first comparison, then masking the least significant bits of the instruction address; andcomparing the masked instruction address with the tag array a second time to determine whether a match is found;if a match is found on the second comparison; then if the match found on the second comparison is a trace line, declaring a miss in the cache and fetching instructions from a further level memory, forwarding the instruction for execution by the central processor, building a new trace line, selecting a cache line to be replaced and replacing the selected cache line;if the match found on the second comparison is not a trace line, checking the trace address, accessing the required partitions, forcing the leading instruction to NOP,and forwarding the instruction for execution by the central processor; thenbuilding a new trace line, selecting a cache line to be replaced and replacing the selected cache line with the new trace line.