Abstract:
A computer system has a memory which holds a computer program consisting of a sequence of program instructions. The format of the program instructions depends on an instruction mode of the computer system. A decoder is arranged to receive and decode program instructions. A microinstruction generator is responsive to information from the decoder to generate microinstructions according to a predetermined microinstruction format which is independent of the instruction mode of the computer system. The computer system has a plurality of parallel execution units for receiving and executing the microinstructions.

Description:
FIELD OF THE INVENTION 
     The present invention relates to a method of executing a computer program and to a computer system. 
     BACKGROUND TO THE INVENTION 
     A computer system is described which comprises a plurality of parallel execution units which are responsible for carrying out the operations defined in a computer program. The computer program consists of a sequence of program instructions. In the computer system described herein, the format of the program instructions is selectable in dependence on an instruction mode of the computer system. The computer system can operate in a number of different instruction modes (three in the described example). It is desirable however that the execution units can execute instructions independently of the operational mode of the computer system. 
     SUMMARY OF THE INVENTION 
     To achieve this, the present invention provides a computer system comprising: a memory holding a computer program consisting of a sequence of program instructions, the format of the program instructions being selectable in dependence on an instruction mode of the computer system; a decoder arranged to receive and decode program instructions from the memory; a microinstruction generator responsive to information from the decoder to generate microinstructions according to a predetermined microinstruction format having a plurality of fields of respectively fixed lengths allocated to hold certain data derived from the program instructions, the microinstruction format being independent of the instruction mode of the computer system; and a plurality of parallel execution units for receiving and executing said microinstructions. 
     Another aspect of the invention provides a method of executing a computer program consisting of a sequence of program instructions held in a memory of a computer system, wherein the format of the program instructions is selectable in dependence on an instruction mode of the computer system, the method comprising: decoding said program instructions; generating microinstructions responsive to information from the decoded program instructions according to a predetermined microinstruction format having a plurality of fields of respectively fixed length allocated to hold certain data derived from the program instructions, the microinstruction format being independent of the instruction mode of the computer system; and supplying said microinstructions to one or more of a plurality of parallel execution units for receiving and executing said microinstructions. 
     In the particular computer system described herein, the execution units comprise a first set of execution pipelines for use in executing microinstructions needed for memory access operations and a second set of execution pipelines arranged to carry out arithmetic operations thereby providing decoupling of memory access operations from arithmetic operations. This is particularly suited to provide a high digital signal processing performance. 
     Preferably there is a first microinstruction format for use for microinstructions supplied to the first set of execution pipelines and a second microinstruction format for use for microinstructions supplied to the second set of execution pipelines. 
     The microinstructions sent to the execution units have a plurality of different fields of respectively fixed lengths. 
     These fields hold data derived from the program instructions, including for example register names and their validity bits, opcodes, source guards, destination guards etc. Source guards and destination guards relate to a mechanism for executing guarded instructions which is not described further herein. 
     Some program instructions include an immediate value, which in an actual embodiment can be up to 25 bits for address unit instructions and 16 bits for data unit instructions. In many cases, these immediate values need to be supplied to the execution units for use in execution of the microinstructions. Prior to execution by the execution units, the microinstructions can be held in instruction queues associated respectively with the execution units. The size of the queues depends on the size of the microinstructions. If the microinstructions had a field specifically allocated to receive the immediate value, and had the maximum length possible for the immediate value, then the size of these queues, and also the size of the silicon needed to implement the computer system, would increase. Moreover, for much of the time these fields would remain unused. 
     Therefore, an additional aspect of the present invention is to provide that the microinstruction generator locates the immediate value in the microinstructions in one or more of said fixed length fields in place of the data normally allocated to the fields. In a program instruction using an immediate value, this immediate value takes the place of other data in the program instruction, for example register values. Thus, these fields of the microinstruction become available for holding the immediate value. Valid fields of the microinstruction never contain an immediate value. 
     The computer system can operate in one of a number of instruction modes, as mentioned above. The number of microinstructions generated in each machine cycle varies in dependence on the instruction mode of the computer system. In a computer system having four parallel execution units, a maximum of four microinstructions is generated per machine cycle. 
     The computer system can have a prefetcher for fetching instructions from the memory and supplying them to the decoder. The prefetcher is controlled so that the number and length of instructions fetched from the memory in each machine cycle depends on the instruction mode of the computer system. 
     For a better understanding of the present invention and to show how the same may be carried into effect, reference will now be made by way of example to the accompanying drawings. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram of a computer system; 
     FIG. 2 illustrates three different instruction modes; 
     FIG. 3 illustrates different formats for instructions in GP 32  mode; 
     FIG. 4 illustrates different formats for instructions in GP 16  mode; 
     FIG. 5 illustrates formats for microinstructions for the data units and address units; 
     FIG. 6 illustrates how immediate values are hidden in a data unit microinstruction format; and 
     FIG. 7 illustrates how immediate values are hidden in an address unit microinstruction format. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENT 
     FIG. 1 illustrates relevant components of a computer system arranged for the parallel execution of a plurality of instructions and particularly suited to provide a high digital signal processing (DSP) performance. A program memory  2  holds instructions in one of a number of different instruction formats. The instruction formats are described in more detail in the following, but, in brief, program code can be written in instructions of any one or a combination of GP 16  format, GP 32  format and Very Long Instruction Word (VLIW) format. Thus, individual instructions in the program memory  2  can have a length of 16 bits or 32 bits. The computer system supports three different instruction modes as described with reference to FIG. 2 later. The instruction mode of the computer system is held in a process status register (PSR)  4  and is used to control operations of a prefetch buffer  6  and a decoder  8 . A bypass mechanism  9  allows instructions to be supplied directly from the program memory  2  to the decoder  8  in some circumstances. 
     According to the instruction mode of the system, a number ( 2  or  4 ) of instructions are fetched from the program memory  2  either directly or via the prefetch buffer  6  and supplied to the decoder  8 . Decoded instructions are supplied through a microinstruction generator  10  which generates microinstructions for a plurality of parallel execution units which are labelled EXU 1 , EXU 2 , EXU 3 , EXU 4  and EXU 5  in FIG.  1 . Each execution unit is arranged as an execution pipeline and are arranged to have particular functions as follows. Execution units EXU 1 ,EXU 2  are data units which are arranged to execute microinstructions carrying arithmetic operations. They are also labelled DU 1  and DU 0  for reasons which are explained later. They share a common data register file  12 . The execution units EXU 3 ,EXU 4  are address units and are used to execute microinstructions for memory accesses to a data memory (not shown). They are also labelled AU 1 ,AU 0  for reasons which are explained later. The address units share a common pointer register file  14 . The remaining execution unit EXU 5  is a general unit (GU) which share some resources with the address units but which includes its own control register file  16 . A load data queue LDQ and pointer data queue PDQ provides a queuing mechanism for data and pointers from the data memory to the register files  12 ,  14 ,  16 . A store address/data queue SAQ/SDQ provides a queuing mechanism for data and addresses awaiting access to memory. A data data queue DDQ allows queuing of data being transferred between the register files  12 ,  14 ,  16 . 
     The data units, address units and general unit are fed from instruction queues which receive microinstructions from the microinstruction generator  10 . Microinstructions are generated μslot  0 , μslot  1  for the data units DU 0 ,DU 1  respectively and these microinstructions are held in the instruction data queue D-IDQ in readiness for supply to the pipelined units DU 0 ,DU 1 . Likewise, microinstructions are generated in μslot  0  and μslot  1  for the address units and general unit AU 1 , AU 0 , GU. These microinstructions are held in an instruction data queue A-IDQ for the address units. 
     The prefetch buffer  6 , decoder  8 , microinstruction generator  10  and instruction queues D-IDQ, A-IDQ constitute a control unit for the computer system which operates in a pipelined manner. The stages of the pipeline are marked using dotted lines in FIG.  1  and are denoted as follows: 
     AL—align stage 
     DE—decode stage 
     DP—dispatch stage. 
     Similarly, each of the execution units are pipelined, although the details of the pipelining are not given here. The first stage in each pipeline however is an operand fetch (OF) stage which provides operands for use by the instructions in execution by the execution units. 
     The microinstruction generator  10  dispatches microinstructions to the queues D-IDQ, A-IDQ in a format which depends on the execution unit for which the microinstructions are intended. Thus, there is a microinstruction format for the data units, a microinstruction format for the address units and a microinstruction format for the general unit. In the present case, the format for the address unit and general unit are sufficiently similar that they are described as a common format herein. Microinstructions are generated in these formats, independently of the instruction mode used to write the program code. In order to understand this, the three different instruction modes of the machine will firstly be described with reference to FIG.  2 . 
     According to a first instruction mode, a pair of 16 bit instructions are supplied during each machine cycle to the decoder  8  from the prefetch buffer  6 . This pair is denoted slot 0 ,slot 1  in bit sequences w 0 ,w 1  etc. This is referred to herein as GP 16  superscalar mode. 
     According to a second instruction mode, two instructions each having a length of 32 bits are supplied to the decoder from the prefetch buffer in each machine cycle, for example w 0 ,w 1  in CYCLE  0 . This mode is referred to herein as GP 32  superscalar mode. 
     According to a third instruction mode, four instructions w 0 ,w 1 ,w 2 ,w 3  each of 32 bits in length are supplied to the decoder in each machine cycle. This is referred to herein as VLIW mode. 
     In all modes, each fetch operation initiated to the program memory  2  retrieves an instruction word of 128 bits in length. Thus, in GPl 6  mode, the instruction word comprises eight 16 bit instructions, paired as slot 0 ,slot 1  for each machine cycle. In GP 32  and VLIW mode, the instruction word comprises four 32 bit instructions. 
     Thus, decoded instructions supplied from the decoder  8  to the microinstruction generator  10  are supplied by four possible channels, labelled slot 0 ,slot 1 ,slot 2  and slot 3 . Slot 2  and slot 3  will only be used in VLIW mode. It will be appreciated that each program instruction can give rise to a number of microinstructions depending on the nature of the program instruction. Moreover, a single program instruction can give rise to microinstructions for both the data unit(s) and the address unit(s)/general units. 
     In GP 16  and GP 32  mode, only slot 0  and slot 1  are used during each machine cycle. These are used to generate microinstructions in μslot  0  and μslot  1  of either the data units or the address units/general unit. An instruction in slot  0  can give rise to a microinstruction in μslot  0  of the data units and/or μslot  0  of the address units. Similarly, an instruction in slot  1  can give rise to instructions in μslot  1  of the data units and/or address units. An exception to this general principle are expanded instructions (discussed later) which can generate a series of microinstructions on both slots. 
     In VLIW mode, slots  0  and  1  are used to generate microinstructions for μslot  0  and μslot  1  of either the A-IDQ or the load/store part of the D-IDQ, and slots  2  and  3  are used to generate microinstructions for μslot  0  and μslot  1  of the operative part of the D-IDQ. For programs written in VLIW mode, a grammar has to be followed such that only certain 32 bit instructions can be placed as part of the combination of four instructions to be fetched and decoded simultaneously. Thus, it is not possible to generate from a single VLIW word of four 32 bit instructions four instructions requiring use of the data unit. The most microinstructions that can be generated from a single VLIW word are two microinstructions requiring the parallel data units and two microinstructions requiring the parallel address units or general unit. 
     Table I gives some examples of types of operations defined by program instructions and the nature of microinstructions that are generated for the data units, address units and general unit to implement those instructions. 
     
       
         
               
               
             
               
               
               
               
               
               
             
           
               
                   
                 TABLE I 
               
             
             
               
                   
                   
               
               
                   
                 Microinstruction 
               
             
          
           
               
                 Operation 
                 Instruction 
                 Explanation 
                 DU 
                 AU 
                 GU 
               
               
                   
               
               
                 Data unit 
                 DUop 
                 DUop requires only DU 
                 DUop 
                 — 
                 — 
               
               
                 operation 
               
               
                 Address unit/ 
                 PRArith 
                 PRArith requires only AU 
                 — 
                 PRArith 
                 — 
               
               
                 General unit 
                 branch 
                 branch requires only GU 
                 — 
                 — 
                 branch 
               
               
                 operation 
               
               
                 Load operation 
                 Load DR 
                 AU send the effective address 
                 read LDQ 
                 EA→DMC 
                 — 
               
               
                   
                   
                 to the Data Memory Interface. 
                 RN  = LDQ 
               
               
                   
                   
                 DU read the returned data from 
               
               
                   
                   
                 the LDQ and update the Data 
               
               
                   
                   
                 Register. 
               
               
                   
                 Load PR/CR 
                 AU send the effective address to 
                 — 
                 EA→DMC 
               
               
                   
                   
                 the Data  Memory Interface. 
                 — 
                 PR/CR=LDQ 
                 — 
               
               
                   
                   
                 Then, AU read the  returned data 
               
               
                   
                   
                 from the LDQ and update the 
               
               
                   
                   
                 Pointer Register. 
               
               
                 Store operation 
                 Store DR 
                 Au send the effective address to 
                 Rn→SDQ 
                 EA,BE→SAQ 
                 — 
               
               
                   
                   
                 the Data Memory Interface. 
               
               
                   
                   
                 DU send  the  data to the SDQ. 
               
               
                   
                 Store PR/CR 
                 AU send the effective address to 
                 — 
                 PR/CR→SDQ 
                 — 
               
               
                   
                   
                 the Data Memory Interface. 
               
               
                   
                   
                 AU send the data from the SDQ. 
               
               
                 Register to 
                 Pm=Rn 
                 AU send the Data to the DDQ 
                 Rn→DDQ 
                 Pm=DDQ 
               
               
                 Register Move 
                   
                 AU read the data from the DDQ 
               
               
                   
                   
                 and update the Pointer Register 
               
               
                   
                 Rm=Pn 
                 AU send the Data to the PDQ. 
                 Rm=PDQ 
                 Pn→PDQ 
               
               
                   
                   
                 DU read the data from the PDQ 
               
               
                   
                   
                 and update the Data Register 
               
               
                   
               
             
          
         
       
     
     FIG. 3 illustrates three exemplary formats for instructions in GP 32  mode. Each instruction has a length of 32 bits, and a number of different fields depending on the format type. The three format examples are labelled F 1 ,F 2  and F 3  in FIG.  3 . All the formats share an 8 bit opcode field at bits 0 to 7. The formats F 1 ,F 2  and F 3  each have a field for holding a so-called immediate value IMM. The immediate value IMM can have a variable length, as indicated for example as 5 bits in format F 1 , 15 bits in format F 2  and 21 bits in format F 3 . The length of the immediate value is held in the opcode or subopcode. Depending on the length of the immediate value, remaining fields denote for example destination and source registers, Ra,Rb and additional sub-op fields SOP for holding additional parts of the opcode of the instruction beyond that which can be held in the 8 bit field at bits 0 to 7. Bits 28 to 31 hold guard values for use in guarded instruction execution which is not discussed herein. 
     FIG. 4 illustrates three exemplary instruction formats F 4 ,F 5  and F 6  for GP 16  mode. The formats share a 6 bit opcode field at bits 0 to 5. An immediate value IMM of varying length can be accommodated by the different formats, as illustrated in formats F 4 ,F 5 . In addition there are fields for defining source and destination registers Ra,Rb,Rc for example, and additional sub-op fields SOP for expanding the opcode of the instruction, labelled SOP. 
     FIG. 5 illustrates formats for the data unit microinstruction and address unit microinstruction. As already mentioned, the format for the address unit microinstruction is very similar to that of the general unit microinstruction, the latter not therefore being described further herein. 
     The data unit microinstruction has a length of 86 bits containing a plurality of different fields of fixed length. Reading from right to left in FIG. 5, the first, second, seventh and ninth fields hold parameters relating to guarded instruction execution which is not discussed herein. The third field is a 7 bit field holding a register value Sreg 0 . The fourth and fifth fields are each 8 bit fields holding register values Sreg 1 ,Sreg 2  respectively. Each of these three fields can effectively define source registers for the microinstruction. The sixth field is a 6 bit field defining a data register. The eighth field is a 15 bit field holding the opcode defining the nature of the microinstruction. This has a separately definable subop section having a length of 9 bits. The last field is a load/store field which is 16 bits long and which identifies criteria for performing load or store operations as outlined in Table I. 
     Note that the data unit microinstruction has no dedicated field for holding the size and signage of an immediate value IMM. These parameters are held in the opcode and subopcode fields. 
     The address unit microinstruction AUμinst similarly has fixed length (7 bits) fields for defining two source registers Sreg 0 ,Sreg 1  and an 8 bit field defining a data register dreg. A 19 bit opcode field includes a fixed length (10 bits) separately identifiable sub-opcode field SUBOP. The remaining fields relate to guarded instruction execution. Also, the first two bits of the microinstruction indicates whether it is an address unit or general unit microinstruction. These bits are labelled au and gu in FIG.  5 . The address unit microinstruction format has a dedicated fixed length field (IMM—5 bits) for holding bits identifying the size and signage of an immediate value. Note there are no fields uniquely dedicated to holding the immediate value itself. 
     The decoder  8  receives instructions in GP 16 , GP 32  or VLIW mode and decodes them to supply data to the microinstruction generator  10 . The microinstruction generator  10  uses this data to fill the fields according to the predetermined microinstruction formats illustrated in FIG. 5 to generate microinstructions for μslot  0 , μslot  1  of the data units or address units/general unit respectively. As mentioned earlier, each program instruction can give rise to one or more microinstruction. Moreover, the microinstruction format is the same regardless of the instruction mode. 
     In determining the format for the microinstructions for the data units, address units and general unit, it is undesirable to allocate fields for immediate values which allow the maximum immediate value length to be accommodated. In many cases these fields would be unused, and their presence would increase the size of the queues A-IDQ,D-IDQ. Therefore, in the present computer system immediate values contained in instruction formats in the program memory  2  are “hidden” in fields within the microinstructions which are unused for performing the particular operation required by the program instruction. 
     An immediate value may be a numerical value of an operand for arithmetical operations which is sent directly from the microinstruction to the execution units. 
     Reference is now made to FIG. 6 by way of illustration of this principle. FIG. 6 illustrates formats F 1  and F 2  of GP 32  (or VLIW) mode. The data unit microinstruction format is also illustrated. As illustrated by the arrows in FIG. 6, a 5 bit immediate value IMM[14:0] is “hidden” in the field Sreg 1  and Subop of the data unit microinstruction. For the format F 2 , a 15 bit immediate value IMM[14:0] is “hidden” in fields Sreg 1 ,Sreg 2  and Subop. The allocation of certain bits of immediate values to predetermined fields in the data unit microinstruction format is predetermined so that the execution unit can always locate the full immediate value in a microinstruction. The allocation of bits of the immediate value to fields of the microinstruction formats is made by using fields of the microinstruction format that would not be filled by information in the particular instruction itself, because that field has been rendered redundant by use of the immediate value. Although not illustrated in FIG. 6, immediate values held in GP 16  format instructions of the type illustrated in FIG. 4 can likewise be “hidden” in fields of the data unit microinstruction. 
     FIG. 7 illustrates examples of immediate values being “hidden” in an address unit microinstruction format. The bits of the 15 bit immediate value of format F 2  are held in the sub-op, opcode and gmi fields. The first 15 bits of a 20 bit immediate value are held in these fields. The remaining bits of the 21 bit immediate value held in the format F 3  are held in the Sreg 1  and Sreg 0  fields. The 11 bit immediate value held in the GP 16  format F 4  is held in the sub-op field and the Sreg 1  field. 
     In this way, it is possible to pass on immediate values held in program memory in the microinstructions which are supplied to the execution unit, notwithstanding a predetermined format for the data unit and address unit microinstructions which does not have specific fields for an immediate value.