Processor-processor synchronization

Abstract: For synchronizing the operations of a processor (PU) with a co-processor (CP) a special branch instruction (BPT) is used which combines a test on the co-pro­ cessor's busy status with a test on an exceptional situation of the CP and which executes both tests during a time period not longer than the time period required for executing a single test. Moreover, the tests on said conditions require only one instruction bit pattern.

Description: The invention relates to a method of and an arrangement for synchronizing two asynchronously operating processing units said synchronization being performed by means of a branch instruction which is handled by one of the processors. In operating computer systems having a co-processor, the (main-) processor normally enters a waiting state immediately after the sequence of commands, instructions and data was transferred to the co-processor until the result is produced by the co-processor. Instead, the processor should advantageously execute a sequence of instructions of his own which of course are independent of the co-processor result. This means that the time at which the operations of both processors should become synchronized can be selected at random in the program of the processing unit. Hitherto known methods and arrangements do not seem to be very effective with respect to the handling of branch instructions for synchronizing processor to processor communications as loops have to be completely processed to their end, even when the co-processor has finished its operation. This results in a loss of time. An example of such a known processor-co-processor operation is described in "Electrical Design News", vol. 31, no. 2, 23rd January 1986, pages 175-192, Boston, Massachusetts, US; S. Harris et al.: "Software links math chip to 68000-family µPs", wherein the issuing computer tests the busy/ready flag bit CA of the other processor in a null-come-again loop. After it completes a task, the other processor resets the CA bit, letting the computer go to the next program step. In addition to the CA bit, the response register contains information that alerts the computer to error conditions in the other processor. Therefore, it is an object of the invention as claimed to present a solution for a more effective handling of a special branch instruction for synchronizing two asynchronously operating processing units with slight hardware modifications of the standard control arrangement of one of the processors. Accordingly, a method of and an arrangement for synchronizing a processor to processor operation is disclosed where a conditional branch instruction to the non-busy status of the other processor is made which forces the issuing processor to wait for the occurrence of a special status of the other processor (e.g. the result of a floating point operation when the other processor is used as a floating point co-processor) when there are no further instructions which can be performed by the issuing processor independently. A further test has to be made to detect whether an exceptional status has occurred (e.g. overflow) or not. In the last named case the one processor can continue its sequential program flow which it must leave in the first case. According to the invention as claimed the above said two tests are combined by a single instruction (branch on pattern) which executes both tests during a time period not longer than the time period required for executing a single test. In addition to that the tests for both conditions require only one instruction bit pattern from the totality of the instruction bit patterns provided for conditional branches. The above described features result in the advantage of an effective handling of conditional branches for synchronizing processor to processor communications with only slight modifications of the standard control hardware of a processor. A complete understanding of the present invention may be obtained by reference to the accompanying drawings in which: Fig. 1 is a schematic block diagram showing the general structure of a two processor arrangement; Fig. 2 is a schematic block diagram showing the circuitry necessary for a branch on pattern instruction for a processor to processor synchronization; Fig. 3 is a schematic block diagram showing the flow of instructions and control signals in the processor arrangement; Figs. 4 and 5 are schematic block diagrams showing various control signals with respect to time. Referring now to Fig. 1, there is shown a block diagram of a conventional data processing system having various complex components which are interconnected by busses. A processor bus (P-bus) 4 connects the central control component, the processing unit (PU) 1 to a main memory (MM) 3, to a co-processor (CP) 2 and to an input/output processor (IOP) 6 or vice versa. Most of the computer systems are provided with an arbitration unit (ARB) 5 which grants bus access to the units on the base of their priority classes. The I/O devices 7 communicate via an I/O bus (I/O-bus) 8 with the input/output processor 6 which is connected to the processor bus 4. In systems similar to the one shown in Fig. 1 one or more co-processors might be used, depending on the degree of universality of the tasks to be executed by a particular computer system. Co-processors are widely known as having special abilities which support various additional functions, e.g. in the arithmetic, graphics, etc. domain. By way of example it is assumed that the co-processor 2 of Fig. 1 supports floating point operations on a high level of accuracy. Normally, the processing unit-co-processor communication is initiated by one or more PU commands sent over the processor bus 4. The co-processor receives data which are required for performing the various operations via the processor bus 4, either directly from the PU (immediate operands) or from the main memory 3. The reading of data from memory is initiated by the PU (Fetch instruction F). When the memory data are available on the processor bus a signal on the DT line 9 is activated which in turn causes the data to be stored in the internal registers of the co-processor. Result data are sent either to the PU or to the main memory. In operating computer systems having a co-processor, the (main-) processor normally enters a waiting state immediately after the sequence of commands, instructions and data was transferred to the co-processor until the result is produced by the co- processor. Instead of waiting, the processor should advantageously execute a sequence of instructions of his own which of course are independent of the co-processor results. This means that the time at which the operations of both processors have to become synchronized can be selected at random in the program of the PU. The best way to do this is a conditional branch instruction to the co- processor busy status which forces the PU to wait for the co-processor result (by a conditional branch instruction loop). After completion of the co-processor busy status a further conditional branch instruction is necessary to test the result as whether it is within a defined and permissible numerical range or not (e.g. overflow). In the first case the program sequence of the PU can be continued but in the second case it must leave the linear flow of instructions and branch to a subroutine for generating a message to the operating system of the computer system. The aim of the invention as claimed is to combine the above said two tests by a single instruction (BPT = BRANCH ON PATTERN) which execute both tests during a time period not longer than the time period required for executing a single test. In addition to that the tests for both conditions require only one instruction bit pattern (code point) from the totality of the instruction bit patterns provided for conditional branches. The implementation of the invention requires a hardware modification of the standard control arrangement, i.e. for the control store address register 21 (Fig. 2), the instruction register 22 and the cycle counter 24 which is required for processors in which at least one type of instruction is used, the execution of which can not be completed within one cycle. The hardware modification comprises only a few additional control gates: AND gate 32 and OR gates 33, 34 and 35. The implementation of the invention requires low additional expenditures for processors in which hold conditions are implemented for the above named components, e.g. because there is a wait cycle necessary for a storage access. In most cases exceptional situations are handled by micro code rather than by hardware. Situation or event dependent signals are generated which represent in a unique way the respective exceptional situation. These exceptional situations activate hardware controls by which the address of the next instruction is called for from a different source (register, hardware forced indirect branch). The new address points to the begin (the first address) of a sub-routine which is used for handling the exception. Fig. 3 shows in principal a method of operation by which for each PU-CP synchronization two conditional branches are linked to form a single instruction with respect to storage space and execution time. The scheme in Fig. 3 shows on the left hand side a poole or stock 39 of instructions which are processed serially. The second instruction from the top is a command which starts the co-processor CP, e.g. for processing a floating point operation. Both processors handle their instructions and functional steps in parallel but asynchronously. During the time period T in which the co-processor is calculating the result of the floating point operation, the processing unit PU processes a plurality of instructions of its own (e.g. those which are independent from the co-processor) until it needs the result of the floating point operation for further processing. The PU has to wait until the result is available from the co-processor or it may directly proceed if the co-processor was fast enough. When the floating point operation is completed the co-processor transfers a ready signal CPB to the processing unit which is shown in Fig. 3 schematically by an AND-function 36. This And-function blocks the final execution of the test instruction if the ready signal is not active. In the next step 37, reached when the co-processor was signalled 'ready', a test on the co-processor status is performed whereby the status pattern is available on line 42 to the processing unit. When the patterns match the next sequential instruction can be performed by the PU. If the test results in a mismatch a branch 38 has to be taken to a routine handling the exceptional situation of the co-processor operation which is identified by its status. In the above table 1 an example is given of a micro instruction sequence (execution phases only) for the execution of one or more particular machine instructions. Table 1 shows for each micro instruction the instruction address, the cycles required, the operation code (OP-code) and, where necessary special conditions or bit patterns. The table, however, shows only a section of a micro instruction sequence. The TCTRL micro instruction sends a command, e.g. out of a work register, to the co-processor CP. The next micro instruction F reads the necessary data, out of memory or from a work register in the PU, onto the P-Bus, and the CP receives these data from the P-Bus when the signal on DT goes active and starts the operation. The next two ADD micro instructions are used to increment the addresses of a first and second operand. As table 1 shows, further micro instructions are serially executed in the PU, while the CP is executing its set up operation. If there are no further PU micro instructions in the sequence which can be executed without having the CP result available, the next micro instruction in the sequence must be a branch on pattern (BPT) micro instruction which is designed to perform the previously mentioned, combined test on whether the CP is still busy or not and as next whether an exception handling routine is necessary which depends on a match or mismatch of the patterns to be tested. The example of table 1 shows that the co-processor is still busy for 2 cycles (T0, first T1) after execution begin of the BPT micro instruction which means in connection with Fig. 3, that the AND-condition 36 is not met. So, the next test on pattern 37 is delayed for one T1 cycle until the busy signal CPB dropps. In the example of table 1, MV is assumed to be the next sequential micro instruction (NSI) after the BPT instruction (No branch). For the micro instruction sequence shown in table 1 Fig. 4 represents the curves of the various control signals with respect to time which control the arrangement of Fig. 2. In the first line the cycles Ti of the cycle counter 24 (CYCL-CNT) are shown. The next line below shows the micro instructions by its op code and for how many cycle times they are present in the instruction register (INSTR-REG) 22. It can be seen, that the various micro instruction need a different number of cycle times for their execution. The ADD, MV, MVI micro instructions need only one cycle time. The TCTRL and F micro instruction require two cycle times and the BPT needs in the non-wait and non-branch situation two cycle times whereas in the non-wait but branch situation three cycles are necessary. The co-processor receives its starting command during the first cycle time but it can not become busy because the necessary data on which the operations should be performed are not yet present. These data will be received at the end of the third cycle time at the earliest so that the co-processor busy signal CPB rises at the end of the third cycle determined by the cycle counter. At the same time the inverse signal CPB which was active from the beginning becomes inactive. The next line below shows the period CP-OP during which the co-processor is operational. This signal starts with the end of the first ADD micro instruction and it is completed at the end of the third BPT micro instruction cycle. As table 1 and Fig. 4 show an exceptional situation has not occured which means that no exception handling routine has to be performed. Therefore, the PU can proceed with the next sequential instruction. The EXH signal on the bottom line on Fig. 4 remains in its down-level. As already mentioned the signals represented in Fig. 4 control the arrangement of Fig. 2. The micro instructions are read from control store 20 into the instruction register 22. The instructions are decoded in a decoder 23 and executed in the processor under clock and cycle control. When a branch on pattern micro instruction BPT is decoded by decoder 23 a signal is sent over line BPTL to AND-gate 32 which generates a hold signal when the CPB signal is present at its input 11 which means that the co-processor is still busy and the PU has to wait until the co-processor operation is completed. The hold signal blocks loading of the instruction register 22 with a new micro instruction via OR-gate 34. At the same time the control store address register 21 is blocked by the hold signal from AND-gate 32 via OR-gate 33. The above described blocking situation will continue until the co-processor result is available which means that the CPB signal will be removed from input 11 of AND-gate 32 so that the hold condition is not longer present at the instruction register 22, the cycle counter 24 and the control store address register 21. Now, the instruction register 22 can be loaded with the next sequential micro instruction NSI and the sequence or flow of micro instructions from the stock 39 of instructions will be continued. The next example which is shown in the above table 2 differs slightly from the example in table 1. When the branch on pattern (BPT) micro instruction was read with an address X0111 from control store 20 into the instruction register 22 the co-processor was still busy as also can be seen in Fig. 5 where the respective signal CPB is its up level. Therefore, the address mechanism 21, 26, 27 and 30 of the control store 20 is still blocked and the PU idles on this instruction address until the co-processor result is available. From this moment the blocking condition of the cycle counter 24 is suspended in this example. The PU had to wait for two wait cycles before it could initiate status testing and the branch to an exception handling routine. The test on pattern 37 (Fig. 3) discovers the pattern which is part of the status indication of the last functional step of a sequence of functional steps which the co-processor had to perform for handling the co-processor operation (e.g. a floating point operation) which was started by a command from the PU. The branch address BA which is part of the micro instruction in the instruction register 22 and which is decoded by operation decoder 23 is sent via transmission gate 30 to the control store address register 21. With a signal EXH on line 10 and a signal on the BPTL line in the up-level AND-gate 31 generates the control signal S-BR which controls transmission gate 30. With reference to the example in table 2 the branch address is X1100 which is the address of the first instruction SNS of the exception handling routine. The last micro instruction of this routine contains the return address which is X1111, the address of the next sequential micro instruction MV. As all the blocking conditions in this part of the processing unit PU are suspended, the PU continues with the micro instruction sequence which is contained in its poole 39. The OR-gates 33, 34 and 35 have a second input which is controlled from other instructions FOI when different blocking actions have to be set-up.

Claims: Method of synchronizing two asynchronously operating processing units (1,2), said synchronization being performed by one of the processors (1 or 2) by means of a branch instruction and tests for a busy and exceptional state of the other processor (2 or 1), characterized in that when synchronism is required said one processor (1 or 2) issues a single branch on pattern (BPT) instruction by which in combination a conditional branch is made to perform a first test on a specific condition (e.g. result available) of the other processor (2 or 1), which causes said one processor to wait until said condition is met, after said condition is met a second test is made on an exceptional status (e.g. overflow) which might be caused in said other processor during its operation, and if the second test results in a non-exceptional status, said one processor proceed with its next sequential instructions (NSI), but when an exceptional status is detected, said one processor branches to a sub-routine which is provided for handling said exceptional status. Method of claim 1, characterized in that for performing a branch on pattern (BPT) instruction the present address in said one processor's (1 or 2) addressing means (21,26,30), the present instruction in its instruction register (22) and the present instruction cycle in its instruction cycle means (24,25,29) are blocked until the other processor (2 or 1) has arrived at said specific condition (e.g. result available), if an exceptional status is not detected the said blocked components are de-blocked so that the next sequential instruction (NSI) can be processed, but when an exceptional status is detected the said blocked components are de-blocked and a branch address (BA) which is the address of the first instruction of the exception handling sub-routine is sent to the said addressing means so that the first instruction of the said sub-routine can be performed. Method of claim 1 and/or 2, characterized in that said branch on pattern instruction (BPT) carries in its instruction format the patterns which are tested on. Arrangement for carrying out the method of claims 1, 2 and/or 3, characterized in that in the one processor (1 or 2) additional OR-gates (33,34,35) are provided which are used to increase the number of the hold inputs of the addressing means (21,26,30), the instruction register (22) and the instruction cycle means (24,25,29), said hold inputs being known per se, to allow the passage of hold signals (HOLD) generated by an additional AND-gate (32) when the operation decoder (23) has identified a branch on pattern (BPT) instruction (signal on line BPTL) in said instruction register and at the same time the other processor (2 or 1) is busy (signal CPB on line 11), whereby the address in the said address means, the instruction in the said instruction - register and the instruction cycle in the said instruction cycle means are held and a further AND-gate (31) is provided in the one processor (1 or 2) which generates a control signal (S-BR) for the said addressing means when a signal (EXH) indicating an exceptional status of the other processor and simultaneously a signal indicating a branch on pattern instruction in the said instruction register are present so that a branch address (BA) can be sent from the said operation decoder to said addressing means via said AND-gate and a control gate (30), being part of said addressing means.

Inventors: BOCK DIETRICH DIPL-ING, KUMPF WOLFGANG, RUDOLPH PETER, SCHULZE-SCHOELLING HERMANN DIP, BOCK, DIETRICH, DIPL.-ING., KUMPF, WOLFGANG, RUDOLPH, PETER, SCHULZE-SCHOELLING, HERMANN, DIPL.-ING., Schulze-Schölling, Hermann, Dipl.-Ing.
Applicants: IBM, INTERNATIONAL BUSINESS MACHINES CORPORATION
Application year: 1988
Main classification: G06F9
IPC codes: G06F15, G06F9