Pipeline data processor

Abstract: The data processor for executing in a pipeline system instructions controlled by wired logic control includes a plurality of instruction registers (104, 105; 3204 -3207) and arithmetic operation units (110, 112; 3214, 3215, 3217, 3218) of the same number. A plurality of instructions read in the instruction registers in one machine cycle at a time are processed in parallel by the plurality of arithmetic operation units.

Description: BACKGROUND OF THE INVENTION This invention relates to CPUs such as in minicomputers or microcomputers, and particularly to a data processor suitable for use in high speed operation. Hitherto, various means have been devised for the high speed operation of computers. The typical one is a pipeline system. The pipeline system does not complete the processing of one instruction before the next instruction is started to execute, but makes the execution of instructions in such a bucket-relay manner that when the execution of one instruction which is divided into a plurality of stages is going to enter into the second stage, the first stage of the next instruction which is similarly divided into a plurality of stages is started to execute. This system is described in detail in the book "ON THE PARALLEL COMPUTER STRUCTURE", written by Shingi Tomita, published by Shokodo, pages 25 to 68. By use of the n-stage pipeline system, it is possible to execute n instructions along all stages at a time and complete the processing of one instruction at each pipeline pitch though one instruction is processed at each pipeline stage. EP-A-0 101 596 describes a data processor comprising an instruction storage unit, a decode and distribution unit and two pipeline-controlled instruction units for reading out the instructions, decoding the type of instruction, reading out registers required for the execution of operation and controlling the execution by two operation units. The first operation unit is dedicated to add/substract instructions and logical operation instructions. The second operation unit is dedicated to multiply instructions and logical operation instructions. Detectors are provided which detect an operand conflict between a second instruction and a preceding instruction to be executed by the first or the second operation unit respectively. It is well known that the instruction architecture of a computer has a large effect on the processing method and the process performance. From the instruction architecture point of view, the computer can be grouped into the CISC (Complex Instruction Set Computer) and the RISC (Reduced Instruction Set Computer). The CISC processes complicated instructions by use of microinstructions, while the RISC treats simple instructions, and instead makes high speed computation using the hard wired logic control without use of microinstructions. Now, we will describe the summary of the hardware and the pipeline operation of both the conventional CISC and RISC. Fig. 2 shows the general construction of the CISC-type computer. There are shown a memory interface 200, a program counter (PC) 201, an instruction cache 202, an instruction register 203, an instruction decoder 204, an address calculation control circuit 205, a control storage (CS) 206 in which microinstructions are stored, a microprogram counter (MPC) 207, a microinstruction register 208, a decoder 209, a register MDR (Memory Data Register) 210 which exchanges data with the memory, a register MAR (Memory Address Register) 211 which indicates the operand address in the memory, an address adder 212, a register file 213, and an ALU (Arithmetic Logical Unit) 214. The operation of the construction will be mentioned briefly. The instruction indicated by the PC 201 is taken out by the instruction cache and supplied through a signal 217 to the instruction register 203 where it is set. The instruction decoder 204 receives the instruction through a signal 218 and sets the head address of the microinstruction through a signal 220 in the microprogram counter 207. The address calculation control circuit 205 is ordered through a signal 219 to process the way to calculate the address. The address calculation control circuit 205 reads the register necessary for the address calculation, and controls the address adder 212. The contents of the register necessary for the address calculation is supplied from the register file 213 through buses 226, 227 to the addres adder 212. On the other hand, the microinstruction is read from the CS 206 at every machine cycles, and decoded by the decoder 209 and used to control the ALU 214 and the register file 213. In this case, a control signal 224 is supplied thereto. The ALU 214 calculates data fed from the register through buses 228, 229, and again makes it be stored in the register file 213 through a bus 230. The memory interface 200 is the circuit for exchanging with the memory such as fetching of instructions and operands. The pipeline operation of the computer shown in Fig. 2 will be described with reference to Figs. 3, 4 and 5. The pipeline is formed of six stages. At the IF (Instruction Fetch) stage, an instruction is read by the instruction cache 202 and set in the instruction register 203. At the D (Decode) stage, the instruction decoder 204 performs decoding of the instruction. At A (Address) stage, the address adder 212 carries out the calculation of the address of the operand. At the OF (Operand Fetch) stage, the operand of the address pointed by the MAR 211 is fetched through the memory interface 200 and set in the MDR 210. At the EX (Execution) stage, data is read by the register file 213 and the MDR 210, and fed to the ALU 214 where it is calculated. At the last W (Write) stage, the calculation result is stored through the bus 230 in one register of the register file 213. Fig. 3 shows the continuous processing of add instruction ADDs as one basic instruction. At each machine cycle, one instruction is processed, and the ALU 214 and address adder 212 operate in parallel. Fig. 4 shows the processing of the conditional branch instruction BRAcc. A flag is produced by the TEST instruction. Fig. 4 shows the flow at the time when the condition is met. Since the flag is produced at the EX stage, three-cycles waiting is necessary until the jumped-to-instruction is fetched, the more the number of stages is increased, the waiting cycle count is increased the more, resulting in the neck in the performance enhancement. Fig. 5 shows the execution flow of a complicated instruction. The instruction 1 is the complicated instruction. The complicated instruction requires a great number of memory accesses as is the string copy and is normally processed by extending the EX stage many times. The EX stage is controlled by the microprogram. The microprogram is accessed to once per machine cycle. In other words, the complicated instruction is processed by reading the microprogram a plurality of times. At this time, since one instruction is processed at the EX stage, the next instruction (the instruction 2 shown in Fig. 5) is required to wait. In such case, the ALU 214 operates at all times, and the address adder 212 idles. The RISC-type computer will hereinafter be described. Fig. 6 shows the general construction of the RISC-type computer. There are shown a memory interface 601, a program counter 602, an instruction cache 603, a sequencer 604, an instruction register 605, a decoder 606, a register file 607, an ALU 608, an MDR 609, and an MAR 610. Fig. 7 shows the process flow for the basic instructions. At the IF (Instruction Fetch) stage, the instruction pointed by the program counter 602 is read by the instruction cache and set in the instruction register 605. The sequencer 604 controls the program counter 602 in response to an instruction signal 615 and a flag signal 616 from the ALU 608. At the R (Read) stage, the contents of the instruction pointer register is transferred through buses 618, 619 to the ALU 608. At the E (Execution) stage, the ALU 608 makes arithmetic operation. Finally at the W (Write) stage, the calculated result is stored in the registor file 607 through a bus 620. In the RISC-type computer, the instruction is limited only to the basic instruction. The arithmetic operation is made only between the registors, and the instruction including operand fetch is limited to the load instruction and the store instruction. The complicated instruction can be realized by a combination of basic instructions. Without use of the microinstruction, the contents of the instruction registor 605 is decoded directly by the decoder 606 and used to control the ALU 608 and so on. Fig. 7 shows the process flow for registor-registor arithmetic operation. The pipeline is formed of four stages since the instruction is simple. Fig. 8 shows the process flow for the time of conditional branch. As compared with the CISC-type computer, the number of pipeline stages is small, and thus the waiting cycle is only one cycle. In this case, in addition to the inter-register operation, it is necessary to load the operand from the memory and store the operand in the memory. In the CISC-type computer, the loading of the operand from the memory can be performed in one machine cycle because of the presence of the address adder, while in the RISC-type computer shown in Fig. 6, the load instruction requires two machine cycles because it is decomposed into the address calculation instruction and the load instruction. The problems with the above-mentioned prior art will be described briefly. In the CISC-type computer, although the memory-register instruction can be executed in one machine cycle because of the presence of the address adder, the overhead at the time of branching is large because of large number of pipeline stages. Moreover, only the E stage is repeated when a complicated instruction is executed, and as a result the address adder idles. In the RISC-type computer, the overhead at the time of branching is small because of small number of pipeline stages. However, for the memory-register operation without use of the address adder, two instructions are required of the load instruction and the inter-register operation instruction. SUMMARY OF THE INVENTION Accordingly, it is a first object of this invention to provide a data processor capable of making effective use of a plurality of arithmetic operation units to enhance the processing ability. It is a second object of this invention to provide a data processor capable of reducing the overhead at the time of branching. It is a third object of this invention to provide a data processor capable of reducing the processing time for a complicated instruction for the memory-register operation. The above objects can be achieved by providing a plurality of arithmetic operation units sharing the register file, simplifying the instructions to decrease the number of pipeline stages and reading a plurality of instructions in one machine cycle to control the plurality of arithmetic operation units. The invention is set out in claims 1 and 10. According to the preferred embodiments of this invention, the complex instruction is decomposed into basic instructions, and a plurality of instructions are read at a time in one machine cycle and executed, so that the plurality of arithmetic operation units can be simultaneously operated thereby to enhance the processing ability. Moreover, since the function of the instruction is simple, and since the number of pipeline stages can be decreased, the overhead at the time of branching can be reduced. Furthermore, since the plurality of arithmetic operation units are operated in parallel, the processing time for the complicated instruction can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS Fig. 1 is a block diagram of the whole construction of one embodiment of this invention. Fig. 2 is a block digram of the whole construction of a conventional example. Figs. 3 to 5 are timing charts for the operation thereof. Fig. 6 is a block diagram of the whole construction of another conventional example. Figs. 7 and 8 are timing charts for the operation thereof. Fig. 9 shows the list of instructions to be used in one embodiment of this invention. Fig. 10 shows the format of the instruction associated with the embodiment of this invention. Figs. 11 to 14 are timing charts for the operation of the embodiment of this invention. Fig. 15 is a timing chart for the operation of the conventional example. Figs. 16 to 18 are timing charts for the operation of the embodiment of this invention. Fig. 19 is a construction diagram of the first arithmetic operation unit 110 in Fig. 1. Fig. 20 is a construction diagram of the second arithmetric unit 112 in Fig. 1. Fig. 21 is a construction diagram of the register file 111 in Fig. 1. Figs. 22 to 25 are diagrams useful for explaining the embodiment of this invention shown in Fig. 1. Fig. 26 is a construction diagram of the instruction unit 103 in Fig. 1. Fig. 27 is a diagram useful for explaining the operation thereof. Fig. 28 is a construction diagram of the cache 2301 in Fig. 26. Fig. 29 is another construction diagram of the instruction unit 103 in Fig. 1. Fig. 30 is a timing chart for the operation of the embodiment of this invention. Figs. 31A and 31B show the instruction formats. Fig. 32 is a block diagram of the whole construction of another embodiment of this invention. Figs. 33 to 36 are diagrams of other embodiments of this invention, which make simultaneous partial processing of a plurality of instructions. DESCRIPTION OF THE PREFERRED EMBODIMENTS One embodiment of this invention will be described. Fig. 9 is the list of instructions to be executed by the processor of this embodiment. The basic instructions are all executed by the inter-register operation. The branch instructions include four branch instructions: an unconditional branch instruction BRA, a conditional branch instruction BRAcc (cc indicates the branch condition), a branch-to-subroutine instruction CALL, and a return-from-subroutine instruction RTN. In addition to these instructions, a load instruction LOAD and a store instruction STORE are provided. although, for convenience of explanation, the data format is only 32 bits whole number, it is not limited thereto. The address has 32 bits (4 bytes) for each instruction. For the sake of simplicity, the number of instructions are limited as above, but may be increased as long as the contents can be processed in one machine cycle. Fig. 10 shows the instruction format. The instructions all have a fixed length of 32 bits. The F, S1, S2, and D field of the basic instruction are, respectively, the bit or bits indicating whether the arithmetic operation result should be reflected on the flag, the field for indicating the first source register, the field for indicating the second source register, and the field for indicating the destination register. Fig. 1 shows the construction of this embodiment. There are shown a memory interface 100, a 32-bit program counter 101, a sequencer 102, an instruction unit 103, a 32-bit first instruction register 104, a 32-bit second instruction register 105, a first decoder 106, a second decoder 107, an MDR 108, an MAR 109, a first arithmetic operation unit 110, a register file 111, and a second arithmetic operation unit 112. In this emodiment, two instructions are read and executed in parallel in one machine cycle. Figs. 11 to 14 show the pipeline processing in this embodiment. The pipeline comprises four stages of the IF (Instruction Fetch), R (Read), EX (Execution), W (Write). The operation of this embodiment will be described with reference to Fig. 1. At the IF stage, two instructions pointed by the program counter are read, and set in the first and second instruction registers 104 and 105 through buses 115 and 117, respectively. When the contents of the PC is even, the instruction at PC address is stored in the first instruction register and the instruction at PC + 1 address is stored in the second instruction register. When the PC indicates odd, the NOP instruction is set in the first instruction register, and the instruction at PC address is set in the second instruction register. The sequencer 102 is the circuit for controlling the program counter. When the first and second instruction registers both indicate no branch instruction, the program counter is incremented to the previous count + 2. At the time of branching, the branch address is computed and set in the program counter. When the conditional branch occurs, decision is made of whether the branch should be made or not on the basis of the flag information, 123 from the first arithmetic operation unit and the flag information, 124 from the second arithmetic operation unit. The signal 116 fed from the instruction unit is the conflict signal indicative of various different conflicts between the first and second instructions. When the conflict signal is asserted, the conflict is controlled to be avoided by the hardware. The method of avoiding conflicts will be described in detail later. The operation of the R stage at the time of processing the basic instruction will be mentioned below. At the R stage, the contents of the first instruction register 104 is decoded by the first decoder 106, and the contents of the second instruction register 105 is decoded by the second decoder 107. As a result, the contents of the register pointed by the first source register field S1 of the first instruction register 104 is fed to the first arithmetic operation unit 110 through a bus 125, and the contents of the register pointed by the second source register field S2 is fed through a bus 126 thereto. Moreover, the contents of the register pointed by the first source register field S1 of the second instruction register is fed through a bus 127 to the second arithmetic operation unit 112, and the contents of the register pointed by the second source register field S2 is fed through a bus 128 thereto. The operation of the EX stage will hereinafter be described. At the EX stage, the first arithmetic operation unit 110 makes an arithmetic operation for the data fed through the buses 125 and 126 in accordance with the contents of the OP code of the first instruction register. At the same time, the second arithmetic operation unit 112 makes an arithmetic operation for the data fed through the buses 127 and 128 in accordance with the contents of the OP code of the second instruction register 105. Finally, the operation of the W stage will be mentioned below. At the W stage, the result of the arithmetic operation of the first arithmetic operation unit 110 is stored through a bus 129 in the register pointed by the destination field D of the first instruction register. Also, the result of the arithmetic operation of the second operation unit 112 is stored through a bus 131 in the register pointed by the destination field D of the second instruction register. Fig. 11 shows the flow chart for the continuous processing of basic instructions. Two instructions are processed at a time in one machine cycle. In this example, the first arithmetic operation unit and the second arithmetic operation unit are always operated in parallel. Fig. 12 is the flow chart for the continuous processing either load or store instruction as a first instruction, and the basic instruction as a second instruction. When the load instruction is executed, at the R stage the contents of the register specified by the S2 field of the first instruction register is transferred through the bus 126 to the MAR 109. At the EX stage, the operand is fetched through the memory interface 100. Finally, the operand fetched at the W stage is stored through the bus 129 in the register specified by the destination field D of the first instruction register. At the EX stage, the operand can be fetched in one machine cycle if a high speed cache is provided in the memory interface. Particularly, it can be easily made if the whole computer shown in Fig. 1 is integrated in a semiconductor substrate with the instruction cache and data cache provided on the chip. Of course, when the cache is mis-hitted, the operand fetch cannot be finished in one machine cycle. In such case, the system clock is stopped, and the EX stage is extended. This operation is also performed in the conventional computer. When the store instruction is executed, at the R state the contents of the register pointed by the first source register field S1 of the first instruction register is transferred as data through the bus 125 to the MDR 108. At the same time, the contents of the register pointed by the second source register field S2 of the first instruction register is transferred as address through the bus 126 to the MAR 109. At the EX stage, the data within the MDR 108 is written in the address pointed by the MAR 109. As shown in Fig. 12, even if the load instruction or the store instruction is the first instruction, two instructions can be processed at a time in one machine cycle. The case where the load instruction or the store instruction appears as the second instruction will be mentioned in detail later. Fig. 13 shows the process flow for the execution of the unconditional jump BRA instruction as the second instruction. When the BRA instruction is read, at the R stage the sequencer 102 makes the addition between the displacement field d and the program counter, and set it in the program counter 101. During this time, the instruction next to the address of the BRA instruction and the further next instruction are read (the instructions 1 and 2 shown in Fig. 13). In the next cycle, two instructions at the addresses to which the program has been jumped are read. In this embodiment, the hardware is able to execute the instructions 1 and 2. In other words, no waiting cycle occurs even at the time of processing the jump instruction. this approach is called the delay branch, and used in the conventional RISC-type computer. However, in the conventional RISC-type computer, only one instruction can be executed during the computation of the address of the jump instruction. In this embodiment, two instructions can be executed at a time during the computation of the address of the jump instruction, thus having a higher processing ability. The same is true for the processing flow of the CALL instruction and the RTN instruction. The compiler produces the codes so that as effective instructions as possible can be executed during the computation of the address of the branch instruction, but when there is nothing to do, the instructions 1 and 2 shown in Fig. 13 are made NOP instructions. At this time, substantially one machine cycle waiting occurs. However, since the number of pipeline stages is small, the overhead at the time of branching can be reduced as compared with the CISC-type computer mentioned in the conventional example. Fig. 14 shows the processing flow of the conditional branch instruction BRAcc. The flag is set by the instruction indicated by ADD, F, and the decision of whether the branch condition is met or not is made according to the result. At this time, similarly as at the time of the unconditional branch instruction processing mentioned with reference to Fig. 13, the instruction next to the address of the BRAcc instruction, the instruction 1 in Fig. 14, the next instruction, and the instruction 2 in Fig. 14 are read and processed. However, at the W stage during the processing flow of the two instructions, the result of the arithmetic operation is weritten in the register file only when the branch condition of the BRAcc instruction is not satisfied. In other words, when the branch instruction is satisfied, the result of the computation is suppressed from being written. Thus, as shown in Figs. 11 to 14, this embodiment processes two instructions at a time during one machine cycle, thus having the merit that the processing ability is enhanced to the double, maximum. Moreover, since simple instructions are used and the number of pipeline stages is as small as 4 under the control of the wired logic, the overhead at the time of branching can be reduced to one machine cycle, maximum. In addition, if the delay branch is optimized by the compiler, the overhead can be eliminated. Moreover, since even complicated processings can be executed by a combination of simple instructions, the parallel operations of the first arithmetic operation unit 110 and the second arithmetic operation unit 112 in Fig. 1 can be performed with less idling as compared with that of the address adder and ALU by the parallel pipeline in the conventional CISC-type computer. This aspect will be mentioned a little more. When the load from the memory to the register is repeated, the conventional CISC-type computer, as shown in Fig. 15, is able to load a piece of data at a time during one machine cycle. On the contrary, this embodiment takes two instructions of the address computation ADD instruction and the LOAD instruction using the address for loading a piece of data, but is able to execute two instructions at a time during one machine cycle as shown in Fig. 16, thus still being able to load one piece of data at a time during one machine cycle. From the viewpoint of the parallel operation of arithmetic operation units, both operate two arithmetic operation units in parallel and thus are the same. Figs. 17 and 18 show the comparison of further complicated processings. The instruction 1 which, as shown in Fig. 17, takes 6-cycles processing at the EX stage in the conventional CISC-type computer can be executed in 3 cycles in this embodiment as shown in Fig. 18. This is because in the conventional CISC-type computer, the operation of the address adder is stopped during the execution of the instruction 1, while in this embodiment, two arithmetic operation units can be operated in parallel in each cycle. Fig. 19 shows the construction of the first arithmetic operation unit 110 shown in Fig. 1. There are shown an ALU 1500, a barrel shifter 1501, and a flag generation circuit 1502. The data transferred through the buses 125 and 126 are processed by the ALU 1500 for the addition, subtraction, and logic operation and by the barrel shifter for the SFT instruction. The result of the processing is transmitted to the bus 130. A flag is produced from the flag generation circuit 1502 on the result of the arithmetic operation and fed as the signal 123. Fig. 20 shows one example of the construction of the second arithmetic operation unit 112 in Fig. 1. There are shown an ALU 1600, and a flag generation circuit 1601. The second arithmetic operation unit is different from the first arithmetic operation unit in that it has no barrel shifter. This is because the SFT instruction occurs less frequently than the arithmetic logic oepration instruction. Thus, two SFT instructions cannot be executed in one machine cycle, but there is the merit that the amount of hardware can be reduced. The control method to be used when two SFT instructions appear will be described later. Of course, the second arithmetic unit 112 may be the unit shown in Fig. 19. Fig. 21 shows the construction of the register file 111 in Fig. 1. There are shown registers 1708, and bus switches 1700 to 1709. Each register has four read ports and two write ports. The bus switch is used to bypass the register file when the register specified by the destination field of the previous instruction is immediately used for the next instruction. For example, the bus switch 1702 is the bypass switch from the bus 129 to the bus 127, and opens when the destination register field D of the first instruction coincides with the first source register field S1 of the second instruction. The method of eliminating the conflict between the first and second instructions will be described with reference to figs. 22 to 29. Both instructions cannot sometimes be executed at a time depending on a combination of the first and second instructions. This is called the conflict. The conflict occurs in the following cases. (1) Load or store instruction appears as the second instruction. (2) SFT instruction appears as the second instruction. (3) The register pointed by the destination register field D of the first instruction coincides with the register specified by the first source register field S1 of the second instruction or with the register pointed by the second source register field S2 of the second instruction. The above cases (1) and (2) in which the conflict occurs are the problems peculiar to this embodiment which are caused when the load, store instruction and the SFT instruction cannot be processed by the second arithmetic operation unit. If in Fig. 1 the second MDR is added to the bus 127, the second MAR is added to the bus 128, and two pieces of data are accessed to in one machine cycle through the memory interface, then the conflict condition (1) can be eliminated. Moreover, if the barrel shifter is provided in the second arithmetic operation unit, the conflict condition (2) can be elimianted. In this embodiment, the conflict condition occurs because of hardware reduction. In such case, since the conflict can be easily eliminated as described later, only the hardware associated with the instructions to be executed at a time is doubled in accordance with the necessary performance and the allowable amount of hardware and thus the hardware is reduced with substantially no reduction of performance. The control method to be used when the SFT instruction appears as the second instruction will be mentioned with reference to Fig. 22. The upper part of Fig. 22 shows the case where the SFT instruction is located in the address "3" for the second instruction. The lower part of Fig. 22 shows the instructions to be stored in the first and second instruction registers at the time of excution. When the program counter is 2, the hardware detects that the second instruction is the SFT instruction, and the instruction at the address 2 is set in the first instruction register, the NOP instruction being set in the second instruction register. In the next machine cycle, the program counter is incremented by "1", or address 3 is set in the program counter. Moreover, the SFT instruction at the address 3 is set in the first instruction register, and the NOP instruction in the second instruction register. Thus, the processing can be correctly made in two separate machine cycles. Of course, optimization is made by the compiler so that if possible, the SFT instruction is preferably prevented from appearing. Another method of eliminating the conflict will be described with reference to Fig. 23. The SFT instruction is prevented from being stored in the odd address for the second instruction, and when there is no instruction to be executed, the NOP instruction is stored therein. Thus, the program size is slightly increased, but the hardware for the elimination of the conflict can be omitted. Fig. 24 shows the processing method to be used when the load instruction appears as the second instruction. The load instruction is stored in the address 3. The processing method is the same as for the SFT instruction. Fig. 25 shows the processing method to be used when the register conflict occurs. The instruction at the address 2 is stored in the number-8 register, and the instruction at the address 3 reads the same number-8 register. In this case, it is executed in two separate machine cycles as is the SFT instruction. As to the load, store instruction and register conflict, too, it can be inhibited from being stored in the odd addresses for the purpose of eliminating the conflict. The effect is the same as described for the SFT instruction. A description will be made of the hardware system for realizing the processing system mentioned with reference to Figs. 22 to 25. Fig. 26 shows the construction of the instruction unit 103 in Fig. 1. There are shown a conflict detection circuit 2300, a cache memory 2301, a first mask circuit 2302, and a second mask circuit 2303. The contents of the program counter is, normally, inputted through the bus 113, and the instruction pointed by the program counter and the instruction at the next address are fed to buses 2305 and 2306. At the time of cache mis-hitting, the instruction is fetched through the memory interface 100, and written through the bus 113 in the cache 2301. At this time, the conflict detection circuit checks if the conflict is present between the first and second instructions. If the conflict is present, the conflict signal 2304 is asserted. In the cache are provided bits each indicating the conflict condition of two instructions. At the time of cache mis-hitting, the conflict signal 2304 is stored therein. The first mask circuit receives the first instruction, the second instruction, the conflict bit, and the least significant bit of the program counter, and controls the signal 115 to the first instruction register 104 as shown in Fig. 27. The second mask circuit receives the second instruction, the conflict bit and the least significant bit of the program counter, and still supplies the signal 117 to the second register 105 as shown in Fig. 27. When as shown in Fig. 27 the conflict bit and the least significant bit of the PC are both 0, the first instruction is fed to the first instruction register, and the second instruction to the second instruction register. This operation is in the normal case. When the conflict bit is 1, and the least significant bit of the PC is 0, the first instruction is fed to the first instruction register, and the NOP instruction to the second instruction register. This operation is the processing in the first machine cycle at the time of processing the conflict instruction. When the conflict bit is 1, and the least significant bit of the PC is 1, the second instruction is fed to the first instruction register, and the NOP instruction to the second instruction register. This operation is the processing in the second machine cycle at the time of processing the conflict instruction. Thus, the process flow of the conflict instruction mentioned with reference to Figs. 22, 23, and 25 can be realized by the processing. When the branch instruction is branched into an odd address, as shown in Fig. 27 only the second instruction is made effective irrespective of the conflict bit and thus correct processing is possible. The cache is read in each cycle, but it is written when the cache is mis-hitted, in which case it is made over several machine cycles. Thus, if the conflict detection circuit is operated at the time of writing the cache so that the conflict bit is ketp in the cache, the machine cycle can be effectively shorted. Fig. 28 shows the construction of the instruction cache 2301 in Fig. 26. There are shown a directory 2500, a data memory 2501, a selector 2502, an address register 2503, a write register 2504, a comparator 2505, and a cache control circuit 2506. The cache in Fig. 28 has substantially the same construction as the normal cache, but it is different in that the data memory 2501 has provided therein a conflict bit holding field for each 2-instruction 8 bytes, and that at the time of reading the cache, the least significant bit (0 bit) of the PC is neglected so that the first instruction 2305, the second instruction 2306 and the conflict signal 116 are fed. In Fig. 28, the data memory is of 8 K words, and the block size is 32 bytes (8 words). The signal 113 fed from the program counter is set in the address register 2503. The outputs of the directory 2500 and data memory 2501 are indicated by 3 to 12 bits of the address. The comparator 2505 compares the output of the directory and the bits 13 to 31 of the address register. If the result of the comparison is not coincident, a signal 2508 is supplied to the cache control circuit 2506. The cache control circuit 2506 reads a block including an instruction mis-hit from the main memory, and sets it in the data memory 2501. The selector 2502 receives the first and second bits of the address register, and selects two necessary instructions from the block. The first and second instructions are sure to be within the same block, and only one of them is never mis-hitted. Fig. 29 shows another construction of the instruction unit 103 in Fig. 1. There are shown a cache memory 2600, a conflict detection circuit 2604, a first mask circuit 2302, and a second mask circuit 2303. The construction shown in Fig. 29 is different from that shown in Fig. 26 in that the cache has no field for holding the conflict bit and that the first instruction 2601 and the second instruction 2602 of the cache output are monitored by the cycle conflict detection circuit 2604. The operations of the first mask circuit 2302 and the second mask circuit 2303 is the same as those in Fig. 26. According to this embodiment, since the each-cycle conflict detection circuit is operated after reading the cache, the machine cycle is extented, but the conflit bit field may be absent within the cache. Moreover, according to this invention, by making effective use of the fact that two instructions are processed at a time in one machine cycle, it is possible to more fast process the conditional branch instruction in a special case. That is, when in the conditional branch instruction, the destination of the branching when the condition is satisfied is the next, and next instruction (instruction 2 in Fig. 30), the instructions 2 and 3 are executed irrespective of whether the condition is satisfied or not, and whether the W stage of the instruction 1 is suppressed or not is controlled by the satisfaction or not of the condition, so that when the condition is met, the waiting cyle can be eliminated. In this case, however, the conditional branch instruction is sure to be provided on the first instruction side. In the normal conditional branching, one waiting cycle occurs when the condition is satisfied, as described with reference to Fig. 14. In other words, since in this invention, two instructions are processed in one machine cycle at a time, the execution of instructions on the second instruction side can be controlled by whether the condition of the conditional branch instruction on the first instruction side is satisfied or not, without no effect on the instruction process flow of two-instruction units. Moreover, in this embodiment, by making effective use of the processing of two instructions in one machine cycle at a time, it is possible to realize the "atomic" processing with ease. The atomic processing is the processing which is always made in a sequence, and which is used for the synchronization between processes. Fig. 31A shows the processing in the conventional computer, and Fig. 31B shows that in this embodiment. In Fig. 31A, there is a possibility that an interruption enters between the instructions, while in Fig. 31B no interruption occurs between the instructions 1 and 2, and between the instructions 3 and 4. Thus, in Fig. 31A a program for other processes may enter between arbitrary instructions, while in Fig. 31B there is the merit that the instructions 1 and 2 or the instructions 3 and 4 are sure to be executed in a sequence. Fig. 32 shows the construction of another embodiment of this invention. In this embodiment, 4 instructions can be processed in one machine cycle at a time. There are shown a memory interface 3200, a program counter 3201, a sequencer 3202, an instruction unit 3203, first to fourth instruction registers 3204 to 3207, first to fourth decoders 3208 to 3211, an MDR 3212, an MAR 3213, first to fourth arithmetic operation units 3214, 3215, 3217 and 3218, and a register file 3216. Each arithmetic operation unit shares the register file 3216. The operation of each portion is the same as in the embodiment shown in Fig. 1, and thus will not be described. Simialrly, the degree of parallel can be further increased, but since there is a program in which one branch instruction is present in each several intructions, extrme increase of the degree of parallel in such program will not be much effective. It is preferable to process about 2 to 4 instructions at a time. If the degree of parallel is further increased in the program with a few branches and a few conflicts, the performance is effectively increased. Moreover, if the degree of parallel is selected to be 2 n (n is a natural number), the instruction unit can easily be controlled. Still another embodiment of this invention will be mentioned. In the above embodiments described so far, a plurality of instructions are always processed at a time. It is also possible to obtain a profit by normally processing one instruction in one machine cycle and at some case, processing a plurality of instructions at a time. Fig. 33 shows three examples. In the example of Fig. 33a, the first instruction is stored in a main memory, and the second instruction is stored only on the head portion of the address space and stored in an ROM. In the example of Fig. 33b, the first and second instructions are stored in the head portion of the address space and stored in an ROM, and in the other portions of the main memory is stored only the first instruction. In the example of Fig. 33c which is substantially the same as that of Fig. 33a, the second instruction to be stored in an ROM is written in the intermediate portion of the address space. The whole construction of the computer is the same as in Fig. 1, and only the instruction unit 103 is required to be changed. In the ROM portion, is written a program with a high frequency of usage and with a high degree of parallel, which program is executed by a subroutine call from a routine. Since the ROM portion may be of a low capacity, a most suitable program can be produced by an assembler even without any compiler. Fig. 34 shows the construction of the instruction unit 103 in Fig. 1 which construction is for realizing the example of Fig. 33a. There are shown a cache 2900, a 4 K words ROM 2901, a mask circuit 2903, and a mask circuit control circuit 2902. The mask circuit control circuit always monitors the address 113. Only when the more significant bits 12 to 31 of the address are all zero, an effective signal 2904 is asserted. The mask circuit 2903, only when the effective signal 2904 is asserted, supplies a ROM output 2905 to the second register as an output 117. In the other time, the NOP instruction is fed. In order to realize the example of Fig. 33c, the mask circuit control circuit 2902 shown in Fig. 34 is required to be constructed as shown in Fig. 35. There are shown a comparator 3000, and a base register 3001. When the more significant bits 12 to 31 of the base register are coincident with the more significant bits 12 to 31 of the address 113, the comparator 3000 asserts the effective signal 2904. In order to realize the example of Fig. 33b, the instruction unit 103 shown in Fig. 1 is required to be constructed as shown in Fig. 36. The functions of the ROM 2901, mask circuit control circuit 2902, and mask circuit 2903 are the same as those represented by the same numbers in Fig. 29. In Fig. 36, there are shown a cache 3100, a 4 K word ROM 3101, a selector control circuit 3102, and a selector 3107. The selector control circuit 3102 always monitors the more significant bits 12 to 31 of the address 113. Only when all the bits are 0, an ROM selection signal 3105 is asserted. The selector 3107, only when the ROM selection circuit 3105 is asserted, supplies an ROM output signal 3104 to the first instruction register as the output 115. In the other time, the cache output 3103 is supplied. As described with reference with Figs. 33 to 36, the hardware can be reduced by simultaneously processing a plurality of instructions for some portion, and forming that portion as an ROM. Also, since only for the ROM portion, most suitable design can be achieved by assembler, there is the merit that it is not necessary to develop the compiler considering the simultaneous processing of a plurality of instructions. Moreover, by rewriting the ROM portion, it is possible to realize the high speed operation for each application and suitable for each application. According to this invention, since a complicated instruction is decomposed into basic instructions, and a plurality of instructions are read and executed at a time in one machine cycle, a plurality of arithmetic operation units can be operated at a time, and thus increase the processing ability. Moreover, since the instructions have simple functions, and thus the number of pipeline stages can be decreased, the overhead upon branching can be made small. Furthermore, since a plurality of arithmetic operation units are operated in parallel, the processing time for a complicated process can be decreased.

Claims: Data processor comprising an instruction unit (103) receiving instructions from a memory interface (100), a sequencer (102) for controlling a program counter (101) in order to read instructions from the instruction unit (103), at least two instruction registers (104, 105) for storing first and second instructions being read out from the instruction unit (103), and at least two arithmetic operation units (110, 112) for carrying out parallel arithmetic operations in accordance with instructions read from the instruction registers (104, 105), the instruction unit (103) being provided with detection means (2300) for generating information used for determining whether the instructions can be processed in parallel, with a cache memory (2301) for storing the instructions and the information generated by the detection means (2300) and with means (2302, 2303) being responsive to the information output from the cache memory (2301) along with the instructions for controlling the sequence of execution by the arithmetic operation units (110, 112). Data processor according to claim 1, further comprising detection means (2300) provided between the memory interface (100) and the cache memory (2301). Data processor according to claim 1 or 2, further comprising that the cache memory (2301) outputs at least two instructions in the same machine cycle, wherein, when the detection means (2300) detects a conflict, one instruction is executed as a NOP instruction. Data processor according to at least one of claims 1 to 3, further comprising that the detection means (2300) is constructed to access only once to a memory in one machine cycle and detects said conflict by deciding whether each of one instruction and a subsequent instruction is a load instruction or a store instruction. Data processor according to at least one of claims 1 to 4, further comprising that the detection means (2300) detects the conflict on the basis of the fact that some of the at least one arithmetic operation units (110, 112) have a barrel shifter (1501), that at least one of said one instruction and said subsequent instruction is a bit shift instruction, and that the arithmetic operation unit (110, 112) for processing said bit shift instruction has no barrel shifter (1501). Data processor according to at least one of claims 1 to 5, further comprising that the detection means (2300) includes means for writing a conflict bit indicating said conflict at every m instructions which are read at a time, within the cache memory (2301). Data processor according to claim 6, further comprising that an instruction for altering a status flag and a branch instruction with a satisfied branch condition is included in the m instructions read by the program counter (101) and means are provided for detecting the presence of a conditional branch instruction at a predetermined address to suppress execution of instructions after a corresponding address of the m instructions when the condition is satisfied. Data processor according to at least one of claims 1 to 7, further comprising that a part (2401) of the memory in which instructions are stored is formed of a ROM. Data processor according to at least one of claims 1 to 8, further comprising that any interrupt is inhibited between the m instructions which are read at a time. Method for processing data, comprising the steps of receiving instructions from a memory interface (100) by an instruction unit (103), controlling a program counter (101) by a sequencer (102) in order to read instructions from the instruction unit (103), storing first and second instructions being read out from the instruction unit (103) in at least two instruction registers (104, 105), and carrying out parallel arithmetic operations in accordance with instructions read from the instruction registers (104, 105) by at least two arithmetic operation units (110, 112), generating information by detection means (2300) used for determining whether the instructions can be processed in parallel, storing the instructions and the information generated by the detection means (2300) in a cache memory (2301), controlling the sequence of execution of the instructions based on the information output from the cache memory (2301) and parallel processing the instructions, when the information output along with the instructions indicates that the instructions can be processed in parallel without conflict. Method according to claim 10, further comprising that the detection means (2300) is provided between the memory interface (100) and the cache memory (2301). Method according to claim 10 or 11, further comprising that the cache memory (2301) outputs at least two instructions in the same machine cycle, wherein, when the detection means (2300) detect a conflict, one instruction is executed as a NOP instruction.

Inventors: HOTTA TAKASHI, MAEJIMA HIDEO, TANAKA SHIGEYA, HOTTA, TAKASHI, MAEJIMA, HIDEO, TANAKA, SHIGEYA
Applicants: HITACHI LTD, HITACHI, LTD.
Application year: 1989
Main classification: G06F9
IPC codes: G06F12, G06F9