PROCESSOR WITH AN INSTRUCTION CACHE

Abstract: An instruction cache has an input bus and an output bus, the input bus receiving bits of an instruction for storage in the instruction cache, the output bus comprising a set of parallel lines for outputting the bits of an instruction in parallel. To simplify the layout of the cache, the output order of the bits of the instruction on the set of parallel lines differs from a logical order of receiving the bits via the input bus. The bits of instruction words are shuffled prior to loading into the cache. Then when the words are read out of cache, the read lines need not cross.

Description: Processor with an instruction cache. The invention relates to a computer processor with an instruction cache and a method of generating instructions for such a computer processor. The invention relates more in particular to VLIW (Very Long Instruction Word) processors and in particular to instruction formats for such processors and an apparatus and method for processing such instruction formats. VLIW processors have instruction words including a plurality of issue slots. The processors also include a plurality of functional units. Each functional unit is for executing a set of operations of a given type. Each functional unit is RISC-like in that it can begin an instruction in each machine cycle in a pipe-lined manner. Each issue slot is for holding a respective operation. All of the operations in a same instruction word are to be begun in parallel on the functional unit in a single cycle of the processor. Thus the VLIW implements fine-grained parallelism. Thus, typically an instruction on a VLIW machine includes a plurality of operations. On conventional machines, each operation might be referred to as a separate instruction. However, in the VLIW machine, each instruction is composed of operations or no-ops (dummy operations). Like conventional processors, VLIW processors use a memory device, such as a disk drive to store instruction streams for execution on the processor. A VLIW processor can also use caches, like conventional processors, to store pieces of the instruction streams with high bandwidth accessibility to the processor. The instruction in the VLIW machine is built up by a programmer or compiler out of these operations. Thus the scheduling in the VLIW processor is software- controlled. The VLIW processor can be compared with other types of parallel processors such as vector processors and superscalar processors as follows. Vector processors have single operations which are performed on multiple data items simultaneously. Superscalar processors implement fine-grained parallelism, like the VLIW processors, but unlike the VLIW processor, the supei scalar processor schedules operations in hardware. W 7/ 2 Because of the long instruction words, the VLIW processor has aggravated problems with cache use. In particular, large code size causes cache misses, i.e. situations where needed instructions are not in cache. Large code size also requires a higher main memory bandwidth to transfer code from the main memory to the cache. Further information about technical background to this application can be found in a co-pending patent application by the inventors of the present patent application and assigned to the same applicant (applicant's reference PHA 23122) incorporated herein by reference and in the following prior applications, which are incorporated herein by reference: - US Application Ser. No. 998,090, filed December 29, 1992 (PHA 21,777), which shows a VLIW processor architecture for implementing fine-grained parallelism; US Application Ser. No. 142,648 filed October 25, 1993 (PHA 1205), which shows use of guard bits; and - US Application Ser. No. 366,958 filed December 30, 1994 (PHA 21,932) which shows a register file for use with VLIW architecture. It is an object of the invention to simplify cache layout. It is another object of the invention to provide a method of producing a shuffled bit stream, which bit stream allows for a simplified cache layout. The invention provides for a computer processor as set forth in Claim 1. This makes it possible to lay-out the input bus and the output bus independently in order to satisfy the requirements of the connections to main memory and the processing unit respectively. Thus a shuffled bit stream is used which simplifies cache layout. The cache stores a shuffled instruction stream and multiplexes bits from storage means onto a bus so that the bits are deshuffled. A multiplicity of lines leading f τom the storage means to the bus. The lines do not cross each other. The invention also relates to a method as set forth in Claim 7. A compiled and linked object module produced by a compiler and/or linker and code is received for swizzling the compiled and linked software to produce a second object module. The second object module is suitable for being deswizzled upon reading from a cache memory using a cache structure whose output bus wires are not crossed. BRIEF DESCRIPTION OF THE DRAWING The invention will now be described by way of non-limitative example with reference to the following figures: Fig. la shows a processor for using the compressed instruction format of the invention. Fig. lb shows more detail of the CPU of the processor of Fig. la. Figs. 2a-2e show possible positions of instructions in cache. Fig. 3 illustrates compilation and linking of code according to the invention. Fig. 4 is a flow chart of compression and shuffling modules. Fig. 5 expands box 902 of Fig. 4. Fig. 6a is a schematic showing the functioning of instruction cache 103 on input. Fig. 6b is a schematic showing the functioning of a portion of the instruction cache 103 on output. Fig. 7 is a schematic showing the functioning of instruction cache 104 on output. Fig. 8 illustrates the decompression process. Fig. la shows the general structure of a processor according to the invention. A microprocessor according to the invention includes a CPU 102, an instruction cache 103, and a data cache 105. The CPU is connected to the caches by high bandwidth buses. The microprocessor also contains a memory 104 where an instruction stream is stored. The cache 103 is structured to have 512 bit double words. The individual bytes in the words are addressable, but the bits are not. Bytes are 8 bits long. Preferably the double words are accessible as a single word in a single clock cycle. The instruction stream is stored as instructions in a compressed format. The compressed format is used both in the memory 104 and in the cache 103. Fig. lb shows more detail of the VLIW processor according to the invenuon. The processor includes a multiport register file 150, a number of functional units 151, 152, 153, ..., and an instruction issue register 152. The multiport register file stores results from and operands for the functional units. The instruction issue register includes a plurality of issue slots for containing operations to be commenced in a single clock cycle, in parallel, on the functional units 151 , 152, 153, ...τ A decompression unit 155, converts the compressed instructions from the instruction cache 103 into a form usable by the IIR 154. Briefly, a compressed instruction contains a format field which specifies which issue slots are to be used by the compressed instruction. For retrieval efficiency, format bits are stored in the instruction preceding the instruction to which the format bits relate. This allows pipelining of instruction retrieval. There are 2*N format bits for an N- issue slot machine, organized as N groups of 2 bits, each group corresponding to an issue slot. The bits in a group specify whether the correspond issue slot is to be used and the operation length occupied by the operation for that issue slot in the instruction. Fig. 3 shows a diagram of how source code becomes a loadable, compressed object module. First the source code 801 must be compiled by compiler 802 to create a first set of object modules 803. These modules are linked by linker 804 to create a second type of object module 805. This module is then compressed and shuffled at 806 to yield loadable module 807. Any standard compiler or linker can be used. Object modules II contain a number of standard data structures. These include: a header; global & local symbol tables; reference table for relocation information; a section table; and debug information, some of which are used by the compression and shuffling module 807. The object module II also has partitions, including a text partition, where the instructions to be processed reside, and a source partition which keeps track of which source files the text came from. A high level flow chart of the compression and shuffling module is shown at Fig. 4. At 901, object module II is read in. At 902 the text partition is processed. At 903 the other sections are processed. At 904 the header is updated. At 905, the object module is output. Fig. 5 expands box 902. At 1001, the reference table, i.e. relocation information is gathered. At 1002, the branch targets are collected, because these are not to be compressed. At 1003, the software checks to see if there are more files in the source partition. If so, at 1004, the portion corresponding to the next file is retrieved. Then, at 1005, that portion is compressed. At 1006, file information in the source partition is updated. At 1007, the local symbol table is updated. Once there are no more files in the source partition, the global symbol table is updated at 1008. Then, at 1009, address references in the text section are updated. Then at 1010, 256-bit shuffling is effected. Motivation for such shuffling will be discussed below. Fig. 8 expands box 1005. First, it is determined at 1101 whether there are more instructions to be compressed. If so, a next instruction is retrieved at 1102. Subsequently each operation in the instruction is compressed at 1103 and a scatter table is updated at 1108. The scatter table is a new data structure, used as a result of compression and shuffling, which will be explained further below. Then, at 1104, all of the operations in an instruction and the format bits of a subsequent instruction are combined. Subsequently the relocation information in the reference table must be updated at 1105, if the current instruction contains an address. At 1106, information needed to update address references in the text section is gathered. At 1107, the compressed instruction is appended at the end of the output bit string and control is returned to box 1101. When there are no more instructions, control returns to box 1006. The scatter table, which is used as a result of the compression and shuffling of the invention, can be explained as follows. The reference table contains a list of locations of addresses used by the instruction stream and corresponding list of the actual addresses listed at those locations. When the code is compressed, and when it is loaded, those addresses must be updated. Accordingly, the reference table is used at these times to allow the updating. However, when the code is compressed and shuffled, the actual bits of the addresses are separated from each other and reordered. Therefore, the scatter table lists, for each address in the reference table, where EACH BIT is located. In the preferred embodiment the table lists, a width of a bit field, an offset from the corresponding index of the address in the source text, a corresponding offset from the corresponding index in the address in the destination text. When object module III is loaded to run on the processor, the scatter table allows the addresses listed in the reference table to be updated even before the bits are deshuffled. In order for the VLIW processor to process the instructions compressed as described above, the instructions must be decompressed. After decompression, the instructions will fill the instruction register, which has N issue slots, N being 5 in the case of the preferred embodiment. Fig. 9 is a schematic of the decompression process. Instructions come from memory 1201, i.e. either from the main memory 104 or the instruction cache 105. The instructions must then be deshuffled 1201, which will be explained further below, before being decompressed 1203. After decompression 1203, the instructions can proceed to the CPU 1204. BIT SWIZZLING Where instructions are long, e.g. 512 bit double words, cache structure becomes complex. It is advantageous to swizzle the bits of the instructions in order to simplify the layout of the chip. Herein, the words swizzle and shuffle are used to mean the same thing. The following is an algorithm for swizzling bits, for (k=0; k<4; k=k+l) for (i=0; i< 8; i=i+l) for (j=0; j < 8; j=j + l) begin word_shuffled[k*64+j*8+i] = word_unshuffled[(4*i+k)*8+ j] end where i, j, and k are integer indices; word_shuffled is a matrix for storing bits of a shuffled word; and word_unshuffled is matrix for storing bits of an unshuffled word. In this way, index at which a bit is written in the array "word_shuffled" is a 3- bit logical rotation of the index at which the bit is read from the array "word_unshuffled". (In an n-bit logical rotation the bits of the index are shifted by n-bits to more significant positions and the n most significant bits of the index are placed at the n least significant positions). The particular choice of a n= 3-bit rotation is selected for the case described hereinbelow where spatial order of reading bits from the cache is a cyclical interleaving of bits from 8 (=2 n n=3) different memory banks. CACHE STRUCTURE Fig. 6a shows the functioning on input of a cache structure which is useful in efficient processing of VLIW instructions. This cache includes 16 banks 601-616 of 2k bytes each. These banks share an input bus 617. The caches are divided into two stacks. The stack on the left will be referred to as "low" and the r .ck on the right will be referred to as "high". The cache can take input in only one bank at a ume and then only 4 bytes at a time. Addressing determines which 4 bytes of which bank are being filled. For each 512 bit word to be stored in the cache, 4 bytes are stored in each bank. A shaded portion of each bank is illustrated indicating corresponding portions of each bank for loading of a given word. These shaded portions are for illustration only. Any given word can be loaded into any set of corresponding portions of the banks. After swizzling according to the- algorithm indicated above, sequential 4 byte portions of the swizzled word are loaded into the banks in the following order 608, 616, 606, 614, 604, 612, 602, 610, 607, 615, 605, 613, 603, 611, 601, 609. The order of loading of the 4 byte sections of the swizzled word is indicated by roman numerals in the boxes representing the banks. Fig. 6b shows how the swizzled word is read out from the cache. Fig. 6b shows only the shaded portions of the banks of the low stack. The high portion is analogous. Each shaded portion 601a-608a has 32 bits. The bits are loaded onto the output bus, called bus2561ow, using the connections shown, i.e. in the following order: 608a - bitO, 607a - bit 0, ..., 601a - bit 0; 608a - bit 1, 607a - bitl, ..., 601a -- bit 1; ...; 608a - bit 31, 607a - bit 31, ..., 601a - bit 31. Using these connections, the word is automatically de- swizzled back to its proper bit order. The bundles of wires, 620, 621, ..., 622 together form the output bus256 low. These wires pass through the cache to the output without crossing On output, the cache looks like Fig. 7. The bits are read out from stack low 701 and stack high 702 under control of control unit 704 through a shift network 703 which assures that the bits are in the output order specified above. In this way the entire output of the 512 bit word is assured without bundles 620, 621, ... 622 and analogous wires crossing. Summarizing: the invention provides an instruction cache for use in a computer processor comprising means for storing respective bits of an instruction stream, which bits are preshuffled; and means for multiplexing bits from the storage means onto a bus so that the bits are deshuffled, which multiplexing means comprises a multiplicity of lines leading from the storage means to the bus, which lines do not cross each other. Preferably the instruction stream is in double word format; and the cache comprises a first stack for storing first words from the double word format and a second stack for storing second words from the double word format. Preferably, the stacks are organized into banks and there is one bank for each bit of an output byte on the output bus. Multiplexer means is operative to transfer one bit from each bank in order to create an output byte. Preferably, the cache is for storing n instructions, where n is an integer variable, and each bank contains at least one respective bit from each of the n instructions. Each bank contains a RAM column for each byte of an output word. The RAM columns are organized into m groups, where m is an integer representing a number of bytes in the output word, each respective group containing a respective RAM column for each bit of the output word, no two RAM columns in a single group being in a same bank. The multiplexer means comprises m column multiplexers, each column multiplexer being operative to multiplex a bit from each RAM column in the respective group into the output word. In an embodiment the instruction cache comprises first and second stacks of eight banks, each bank comprising 8 RAM columns of 1-bit 64 RAM cells, the RAM columns being organized into groups of 8 RAM columns, the first stack being for storing lower order bits of a double-word output, the second stack being for storing higher order bits of the double word output. The multiplexing means is operative to multiplex a bit from each RAM column in each respective group into the output word. Preferably, the cache of comprises first and second buses, the first bus being for outputting lower order bits of an output word and the second bus being for outputting higher order bits of an output word. As a result of the shuffling of the bits the lines of the first and second buses can lie in a same plane of the processor without crossing. In order to generate an instruction stream for the computer processor, computer software is provided, stored in a computer storage medium, for generating swizzled instructions comprising: code for receiving a compiled and linked object module produced by a compiler and/or linker, which object module is stored in a computer storage medium; and code for swizzling the compiled and linked software to produce a second object module which second object module is suitable for being deswizzled upon reading from a cache memory using a cache structure whose output bus wires are not crossed. Preferably the code for swizzling generates a scatter table, stored in a computer storage medium, for storing positions of bits of shuffled instructions relative to the instructions which the bits are from. In this way the invention provides for a bit stream stored in a computer storage medium which bit stream includes at least a portion of an instruction for execution on a computer processor and stored in a computer storage medium, the portion including a multiplicity of bits, which bits are in a shuffled order, which shuffled order allows a simplified chip layout of the computer processor. The instruction has 512 bits by way of example.

Claims: CLAIMS: 1. A computer processor comprising - an instruction cache having an input bus and an output bus, the input bus receiving bits of an instruction for storage in the instruction cache, the output bus comprising a set of lines for outputting the bits of an instruction in parallel, a spatial output order of the bits of the instruction on the set of lines differing from a input order of receiving the bits via the input bus - a processing unit with an instruction input coupled to the output bus for receiving the bits of the instruction. 2. A computer processor according to claim 1 , wherein the instruction cache comprises a set of banks of storage, the instruction comprising words of bits, the input bus being for inputting respective words in one bank at a time, and wherein respective lines on which the output bus outputs successive bits from a word of an instruction from a bank of the set of banks are interleaved by lines on which the output bus outputs corresponding bits from other words of the instruction from the other banks of the set of banks. 3. A computer processor according to claim 2, wherein the instruction comprises a number of output bytes, successive output bytes being output on spatially successive groups of lines from the set of parallel lines, and wherein each bit of an output byte is supplied by a different bank. 4. A computer processor according to Claim 3, wherein each bank comprises a RAM column for each output byte, the RAM columns being organized into m groups, where m is an integer representing a number of bytes in an output word, no two columns in a single group being in a same bank. 5. A computer processor according to Claim 4, comprising m column multiplexers, each column multiplexer being operative to multiplex a bit from each RAM column in the respective group into the output word. 6. A computer processor according to any one of Claim 2 to 5, wherein the instruction cache is for storing n instructions, where n is an integer variable, each bank containing at least one respective bit from each of the n instructions. 7. Method of generating instructions for a computer processor according to any one of Claims 1 to 6, the method comprising the steps of receiving a compiled and linked object module produced by a compiler and/or linker, shuffling the compiled and linked object module to produce a second object module for writing into the instruction cache so that the bits of the second object module appear on the set of parallel lines successively in the order in which these bits appear in the compiled and linked object module. 8. Method according to Claim 7, a number of banks in the set of banks being a power of two, wherein in said shuffling step each bit from the compiled and linked object module having a respective first bit address in the compiled and linked object module is placed at a respective second bit address in the second object module, the respective second bit address being a logical rotation of the respective first bit address by a number of bit places corresponding to said power. 9. Method according to Claim 7 or 8 comprising the step of writing the second object module into the instruction store. 10. Method according to Claim 7, 8 or 9, the instruction store comprising a main memory and a cache memory, the set of banks being contained in the cache memory. 11. Computer software stored on a computer readable medium for executing the method of any one of Claims 7 to 10. 12. Computer programmed to execute the method according to any one of claims 7 to 10. 13. A computer processor according to any one of Claims 2 to 6, wherein the instruction is in double word format, the instruction cache comprising a further set of banks organized in the same way as the set of banks, both the set of banks and the further set of banks being layed out in a stack, for outputting first and second words of the double word format respectively.

Inventors: ANG MICHAEL, HAMPAPURAM HARI, JACOBS EINO, LEE YEN C, ANG, MICHAEL, HAMPAPURAM, HARI, JACOBS, EINO, LEE, YEN, C.
Applicants: PHILIPS ELECTRONICS NV, PHILIPS NORDEN AB, PHILIPS ELECTRONICS N.V.
Application year: 1997
Main classification: G06F13
IPC codes: G06F9, G06F12