Abstract:
A design structure embodied in a machine readable storage medium for designing, manufacturing, and/or testing a design for 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 is provided. 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:
CROSS-REFERENCE TO RELATED APPLICATION 
       [0001]    This application is a continuation-in-part of co-pending U.S. patent application Ser. No. 11/538,445, filed Oct. 4, 2006, which is herein incorporated by reference. 
     
    
     BACKGROUND OF THE INVENTION 
     Field of the Invention 
       [0002]    This invention generally relates to design structures, and more specifically, design structures for a mechanism for indexing into a cache, and selecting a desired line of the cache. 
         [0003]    Traditional processor designs make use of various cache structures to store local copies of instructions and data in order to avoid lengthy access times of typical DRAM memory. In a typical cache hierarchy, caches closer to the processor (L 1 ) tend to be smaller and very fast, while caches closer to the DRAM (L 2  or L 3 ) tend to be significantly larger but also slower (longer access time). The larger caches tend to handle both instructions and data, while quite often a processor system will include separate data cache and instruction cache at the L 1  level (i.e. closest to the processor core). As is understood by those familiar with cache organization and operation, the processor core will issue requests which are handled, if possible, in the closest cache within which responsive data is found (a “cache hit”), with requests being “handed down” from one layer to the next as there may be cache misses. 
         [0004]    All of these caches typically have similar organization, with the main difference being in specific dimensions (e.g. cache line size, number of ways per congruence class, number of congruence classes). In the case of an L 1  Instruction cache, the cache is accessed either when code execution reaches the end of the previously fetched cache line or when a taken (or at least predicted taken) branch is encountered within the previously fetched cache line. In either case, a next instruction address is presented to the cache. In typical operation, a congruence class is selected via an abbreviated address (ignoring high-order bits), and a specific way within the congruence class is selected by matching the address to the contents of an address field within the tag of each way within the congruence class. Addresses used for indexing and for matching tags can use either effective or real addresses depending on system issues beyond the scope of this disclosure. Typically, low order address bits (e.g. selecting specific byte or word within a cache line) are ignored for both indexing into the tag array and for comparing tag contents. This is because for conventional caches, all such bytes/words will be stored in the same cache line. 
         [0005]    Recently, Instruction Caches that store traces of instruction execution have been used, most notably with the Intel Pentium 4. These “Trace Caches” typically combine blocks of instructions from different address regions (i.e. that would have required multiple conventional cache lines). The objective of a trace cache is to handle branching more efficiently, at least when the branching is well predicted. The instruction at a branch target address is simply the next instruction in the trace line, allowing the processor to execute code with high branch density just as efficiently as it executes long blocks of code without branches. Just as parts of several conventional cache lines may make up a single trace line, several trace lines may contain parts of the same conventional cache line. Because of this, the tags must be handled differently in a trace cache. In a conventional cache, low-order address lines are ignored, but for a trace line, the full address must be used in the tag. 
         [0006]    A related difference is in handling the index into the cache line. For conventional cache lines, the least significant bits are ignored in selecting a cache line (both index &amp; tag compare), but in the case of a branch into a new cache line, those least significant bits are used to determine an offset from the beginning of the cache line for fetching the first instruction at the branch target. In contrast, the address of the branch target will be the first instruction in a trace line. Thus no offset is needed. Flow-through from the end of the previous cache line via sequential instruction execution simply uses an offset of zero since it will execute the first instruction in the next cache line (independent of whether it is a trace line or not). The full tag compare will select the appropriate line from the congruence class. In the case where the desired branch target address is within a trace line but not the first instruction in the trace line, the trace cache will declare a miss, and potentially construct a new trace line starting at that branch target. 
         [0007]    One limitation of trace caches is that branch prediction must be reasonably accurate before constructing traces to be stored in a trace cache. For most code execution, this simply means delaying construction of traces until branch history has been recorded long enough to insure accurate prediction. However, some code paths contain branches that are inherently not predictable. For example, dynamic data may determine whether a specific branch is taken or not. Some implementations add a conventional L 1  Instruction cache in addition to an L 1  Instruction trace cache in order to better handle code that doesn&#39;t execute predictably. This is not a very efficient implementation since the trace cache must be sized to handle all desired trace lines and the conventional cache must be sized to handle all instructions that don&#39;t execute predictably. Since the balance between these two resources may be different for different applications, such a design will typically not achieve full utilization of both resources. 
       SUMMARY OF THE INVENTION 
       [0008]    One purpose of this invention is to achieve a flexible balance of resources by handling both predictable and non-predictable code in a single unified instruction cache. Thus, some lines may contain traces and other lines in the same congruence class may contain blocks of instructions consistent with conventional cache lines. One aspect of this invention is the mechanism for indexing into the cache, and selecting the desired line. Another aspect of this invention is control of which lines are contained within the cache. Another aspect is selection between a trace line and a conventional line when both match during the tag compare. 
         [0009]    In one embodiment, a design structure embodied in a machine readable storage medium for at least one of designing, manufacturing, and testing a design is provided. The design structure generally includes an apparatus. The apparatus generally includes a computer system central processor, and layered memory operatively coupled to said central processor and accessible thereby, wherein the layered memory has a level one cache, and wherein the level one cache stores in interchangeable locations for both standard cache lines and trace lines. 
         [0010]    In another embodiment, a design structure embodied in a machine readable storage medium for at least one of designing, manufacturing, and testing a design is provided. The design structure generally includes an apparatus. The apparatus generally includes a computer system central processor and layered memory coupled to and accessible by the central processor. The layered memory generally includes 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 for both standard cache lines and trace lines. The control logic circuitry partitions an instruction address presented to the level one cache, indexes the instruction address into a tag array of the level one cache, and compares 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 can be determined whether the match is a trace line. On the other hand, if the match is a trace line, the control logic circuitry checks the trace address, accesses the required partitions, and forwards the instruction for execution by the central processor. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS  
         [0011]    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: 
           [0012]      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; 
           [0013]      FIG. 2  is a schematic representation of the organization of a L 1  cache instruction cache; and 
           [0014]      FIG. 3  is a flow chart depicting the processes involved in the operation of a level  1  instruction cache in accordance with this invention. 
           [0015]      FIG. 4  is a flow diagram of a design process used in semiconductor design, manufacture, and/or test. 
       
    
    
     DETAILED DESCRIPTION OF THE INVENTION  
       [0016]    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. 
         [0017]    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. 
         [0018]    For a L 1  Instruction cache coupled to a computer system processor as shown in  FIG. 1  and which has 2 L  bytes per line, M ways per congruence class, and 2 N  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: 
         [0019]    a. Least significant L bits (address byte within line) 
         [0020]    b. Next N bits (index into a specific congruence class) 
         [0021]    c. Most significant bits 
         [0022]    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. 
         [0023]    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. 
         [0024]    The process for accessing the cache then includes the following steps as illustrated in the flow chart of  FIG. 3 : 
         [0025]    Take the N bits in the middle partition of the target instruction address for use as an index into the tag array. 
         [0026]    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. 
         [0027]    If match is found, is it a trace line? 
         [0028]    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. 
         [0029]    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.) 
         [0030]    If no match is found, mask off (to zeros) the L least significant bits of the target instruction address. 
         [0031]    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&#39;t be used. 
         [0032]    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). 
         [0033]    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 L 1  cache, and fetch the target address from the L 2  cache. 
         [0034]    Then build a new trace line, select a match or least recently used (LRU), and replace the selected line. 
         [0035]    In order to insure proper operation, certain rules must be enforced when adding a line (either conventional or trace) to the cache: 
         [0036]    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. 
         [0037]      FIG. 4  shows a block diagram of an exemplary design flow  400  used for example, in semiconductor design, manufacturing, and/or test. Design flow  400  may vary depending on the type of IC being designed. For example, a design flow  400  for building an application specific IC (ASIC) may differ from a design flow  400  for designing a standard component. Design structure  420  is preferably an input to a design process  410  and may come from an IP provider, a core developer, or other design company or may be generated by the operator of the design flow, or from other sources. Design structure  420  comprises the circuits described above and shown in  FIGS. 1 and 2  in the form of schematics or HDL, a hardware-description language (e.g., Verilog, VHDL, C, etc.). Design structure  420  may be contained on one or more machine readable medium. For example, design structure  420  may be a text file or a graphical representation of a circuit as described above and shown in  FIGS. 1 and 2 . Design process  410  preferably synthesizes (or translates) the circuits described above and shown in  FIGS. 1 and 2  into a netlist  480 , where netlist  480  is, for example, a list of wires, transistors, logic gates, control circuits, I/O, models, etc. that describes the connections to other elements and circuits in an integrated circuit design and recorded on at least one of machine readable medium. For example, the medium may be a storage medium such as a CD, a compact flash, other flash memory, or a hard-disk drive. The medium may also be a packet of data to be sent via the Internet, or other networking suitable means. The synthesis may be an iterative process in which netlist  480  is resynthesized one or more times depending on design specifications and parameters for the circuit. 
         [0038]    Design process  410  may include using a variety of inputs; for example, inputs from library elements  430  which may house a set of commonly used elements, circuits, and devices, including models, layouts, and symbolic representations, for a given manufacturing technology (e.g., different technology nodes, 32 nm, 45 nm, 90 nm, etc.), design specifications  440 , characterization data  450 , verification data  460 , design rules  470 , and test data files  485  (which may include test patterns and other testing information). Design process  410  may further include, for example, standard circuit design processes such as timing analysis, verification, design rule checking, place and route operations, etc. One of ordinary skill in the art of integrated circuit design can appreciate the extent of possible electronic design automation tools and applications used in design process  410  without deviating from the scope and spirit of the invention. The design structure of the invention is not limited to any specific design flow. 
         [0039]    Design process  410  preferably translates a circuit as described above and shown in  FIGS. 1 and 2 , along with any additional integrated circuit design or data (if applicable), into a second design structure  490 . Design structure  490  resides on a storage medium in a data format used for the exchange of layout data of integrated circuits (e.g. information stored in a GDSII (GDS2), GL1, OASIS, or any other suitable format for storing such design structures). Design structure  490  may comprise information such as, for example, test data files, design content files, manufacturing data, layout parameters, wires, levels of metal, vias, shapes, data for routing through the manufacturing line, and any other data required by a semiconductor manufacturer to produce a circuit as described above and shown in  FIGS. 1 and 2 . Design structure  490  may then proceed to a stage  495  where, for example, design structure  490 : proceeds to tape-out, is released to manufacturing, is released to a mask house, is sent to another design house, is sent back to the customer, etc. 
         [0040]    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.