BACKGROUND OF THE INVENTIONThe present invention relates to a data processing unit with pipeline control, and more particularly to a data processing unit which executes variable length instructions having operand specifiers for specifying addressing modes of operands issued independently from operation codes for ascertaining operations.
In a variable length instruction architecture, the instruction length varies even if the length of the operation code is fixed. The leading field of the instruction is an operation code but the other fields have various meanings. Accordingly, the meanings of the fields in the instruction are not uniquely defined. Furthermore, since the operand specifiers in the instruction have variable lengths depending on the addressing mode, the instruction length is variable even if the operation code is fixed.
In an instruction decoding unit which handles such variable length instruction architecture, if an instruction is fetched and decoded parallelly, a large scale hardware is required and a complex control is necessary.
In a system in which an instruction is fetched and decoded one or a plurality of predetermined lengths of units at a time, a long time is required to decode the instruction and hence high speed processing can not be attained. For example, if a basic unit comprises eight bits (byte), a basic instruction has a three to seven-byte length. If the instruction is decoded in synchronism with a machine cycle, the machine cycles which are equal in number to the number of bytes of the instruction are necessary to decode the instruction.
Thus, in the data processing unit which handles the variable length instruction architecture, it is an important factor to increase the speed of the processing of the instruction decoding operation to attain an efficient pipeline processing.
SUMMARY OF THE INVENTIONIt is an object of the present invention to provide a data processing unit which can carry out the decoding of the variable instructions at a high speed.
It is another object of the present invention to provide a data processing unit which can carry out the decoding of the instructions regardless of the number of operand specifiers the instructions may have.
It is a further object of the present invention to provide a pipeline controlled data processing unit which prepares one operand per machine cycle regardless of the length of the operand specifier.
It is a still further object of the present invention to provide a data processing unit in which if the addressing mode of the last operand specifier in an instruction is a register mode, the operand specifier of the last operand is also decoded in the decode cycle for the operand specifier of the operand immediately preceding to the last operand so that the instructions are executed at a high speed.
According to one aspect of the present invention, there is provided a data processing unit for executing variable length instructions in which the operand specifiers for specifying the addressing modes of operands are independent from the operation codes for ascertaining operations, and in which not only the instructions but also the operands of the respective instructions are pipeline-controlled.
In accordance with another aspect of the present invention, if the last operand specifier of an instruction is the register mode, the operand specifier of the last operand is decoded in the decode cycle for the operand specifier of the operand immediately preceding to the last operand.
In accordance with a further aspect of the present invention, at least one operand specifier of an operand is decoded in each machine cycle to prepare different operands in order to process a plurality of operands in pipeline.
BRIEF DESCRIPTION OF THE DRAWINGSThe other objects and features of the present invention will be apparent from the following description on preferred embodiments when taken in conjunction with the accompanying drawings, in which:
.[.FIGS. 1 to 3.]. .Iadd.FIGS. 1A to 1D, 2A to 2F, and 3A to 3F .Iaddend.show examples of formats of operand specifiers of variable length instructions used in the present invention,
FIG. 4 shows a block diagram of one embodiment of a data processing unit constructed in accordance with the present invention.
FIGS. 4A to 4E show block diagrams illustrating exemplary details of the respective blocks shown in FIG. 4,
FIG. 5 shows a chart for explaining functions of signals in the circuit shown in FIG. 4B,
FIGS. 6 and 7 show flow charts for the operation of the data processing unit shown in FIG. 4,
FIG. 8 shows a chart for illustrating a signal for a specific instruction in the circuit shown in FIG. 4B, and
FIGS. 9 and 10 show flow charts for the operation for a specific instruction in the data processing unit shown in FIG. 4.
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTSBefore explaining the embodiments of the present invention, an instruction set having variable length operand specifiers is first explained. Such an instruction set has been known. The following are two representative examples thereof.
One is an instruction format for a Burroughs Corp. computer B1700 implemented for a COBOL/RPG architecture. It is disclosed in "B1700 COBOL/RPG-S-Language" 1058823-015, Copyright 1973, Burroughs Corp.
The other is an instruction architecture having variable length operand specifiers for a Digital Equipment Corp. computer VAX 11/780. It is disclosed in "VAX 11 Architecture Handbook" Copyright 1979, and U.S. Pat. No. 4,241,399.
FIGS. 1A to 1D show four representative addressing modes in the example of the Burrough Corp. B1700.
FIG. 1A shows an operand specifier for specifying an operand for the short literal mode. A Type field specifies the type of data (presence or absence of sign and identification of basic length of a Literal Value field (4 bits or 8 bits)), and a Length field together with the Type field specifies the length of the Literal Value field. Thus, the Literal Value field length may vary from 4 bits to a maximum of 56 bits (when the Type field specifies 8 bits with sign and the Length field is 7).
FIG. 1B shows an operand specifier which specifies an operand for the long literal mode. It is used to produce a literal data having a length longer than that specified by the short literal mode.
FIG. 1C shows an operand specifier which specifies an operand address for the descriptor index mode. The data at an address specified by an index value from an entry address of a descriptor table is used as an operand.
FIG. 1D shows an operand specifier for specifying an operand address for the inline descriptor mode. The data at an address specified by a Descriptor field is used as an operand.
It should be understood that the four addressing modes described above are only representative examples and other modes also exist.
As shown in FIGS. 1A to 1D, the operand specifiers have variable lengths. In the short literal mode of FIG. 1A, the length l (bits) occupied by the instruction field of the operand specifier is 1+2+3+"Length"×4 (or 8), and in the long literal mode of FIG. 1B, the length l is 1+2+3+8+"Length"×4 (or 8), and in the descriptor index mode of FIG. 1C, the length l is 6, and in the inline descriptor mode of FIG. 1D, the length l is 63.
In the instruction architecture described above, the portion which specifies the type of operand or the addressing mode is defined by the operand specifier and it is independent from the operation code. While only the literal modes and the descriptor modes are considered in the above instruction architecture, any other addressing modes may be included.
FIGS. 2A to 2F show formats of operand specifiers for six representative addressing modes in the example of theDEC VAX 11. FIG. 2A shows a format of an operand specifier for the literal mode. The six-bit data in a Literal field is used as an operand. FIG. 2B shows the format of an operand specifier for the register mode. Four bits in an Rn field specify an address of a register used as an operand. FIG. 2C shows the format of an operand specifier for the displacement mode. The data at a memory address equal to the sum of the content of a register specified by an Rn field and a displacement specified by a Displacement field is used as an operand. The length of the displacement may be 8-bits as shown in FIG. 2C or it may be 16 bits or 32 bits. FIG. 2D shows an operand specifier for displacement with index mode in which an index modifier is added to the addressing mode of FIG. 2C. A register at an address specified by an Rx field is used as an index register the content of which is added to an address when it is calculated. FIG. 2E shows the format of an operand specifier for the relative mode. The data at an address equal to a sum of the content of the program counter and a displacement specified by a Displacement field is used as an operand. FIG. 2F shows the format of an operand specifier for the absolute mode. An Absolute field specifies a memory address at which an operand is located.
TheVAX 11 Architecture is characterized in the fact that the length of the operand specifiers are multiples of a basic length of 8 bits (byte).
As a repertoire of the addressing modes, the B1700 is suitable for COBOL or like languages and theVAX 11 is suitable for FORTRAN and PL/1. FIGS. 3A to 3F show examples of instruction formats which adopt the repertoire of the addressing modes of theVAX 11 and which have bit-variable operand specifier lengths in order to enhance the efficiency of the operand specifiers.
FIGS. 3A and 3B show formats of operand specifiers when operands are presented by literal data. When the literal data is no longer than five bits, a short literal format as shown in FIG. 3A is used, and when the literal data is no shorter than six bits, a long literal format as shown in FIG. 3B is used.
FIG. 3C shows the format of an operand specifier for the register mode. A register at an address specified by an Rn field presents an operand. FIG. 3D shows the format of an operand specifier for the displacement mode. It comprises a register at an address specified by an Rn field, a Displacement Length field for specifying the length of displacement and a Displacement field. FIG. 3E shows the format of an operand specifier for the relative mode. It comprises a Displacement Length field and a Displacement field. FIG. 3F shows the format of an operand specifier for the absolute mode. An Absolute field specifies a memory address at which an operand is located.
The formats of the operand specifiers shown in FIGS. 3A to 3F are only examples of a number of addressing modes and many other operand specifiers exist although they are not explained here because they are not necessary to the understanding of the present invention.
In the instruction formats shown in FIGS. 1 to 3, since the addressing mode is defined for each operand, the independency of the addressing mode is maintained for the operation code and the respective operands. However, the limitation to the access type of the operand such as read operand, write operand or read and write operand is defined by the operation code (dependency to the operation code). Accordingly, the operand must be an addressing mode which satisfies the dependency to the operation code. It should be understood that other access types than the read, write and read and write operands exist.
The length of the operand (data length) may be considered to depend on the operation code or it may be considered to be specified by the operand specifier. Since the difference therebetween does not affect the present invention, the handling of the data length is not explained here.
An embodiment of the present invention is now explained in detail. While a bit is used as a minimum unit to access a memory in the following description, it should be understood that the unit of access may be four bits (nibble) or either bits (byte).
FIG. 4 shows a block diagram of one embodiment of a pipeline controlled data processing unit which embodies the present invention. Abbreviations shown in FIG. 4 and their formal names are listed below.
______________________________________ Reference Abbrevia- Numerals Formal Names tions ______________________________________ 301Main memory MM 302 Memorycontrol unit MCU 303 High speed buffer memory BM.sub.1 304 High speed buffer memory BM.sub.2 400 Instruction fetchunit IFU 500 Instructiondecode unit DU 600 Addresscalculation unit AU 700 Operand fetchunit OFU 800 Execution unit EU ______________________________________
In FIG. 4, the main memory (MM) 301 stores variable length instructions and operands to be executed by the instructions, and it exchanges data with the high speed buffer memories (BM1, BM2) 303 and 304 under the control of the memory control unit (MCU) 302.
TheMCU 302 provides addresses through signal lines 320 and transfers data through signal lines 321. Signal lines 340 form an address bus among theMCU 302 and theBM1 303 and theBM2 304, and signal lines 341 form a data bus. TheBM1 303 provides addresses to the address bus 340 through signal lines 323 and transfer data through signal lines 324.
TheBM2 304 provides addresses to the address bus 340 through signal lines 342 and transfers data through signal lines 343. Serially connected blocks from the instruction fetch unit (IFU) 400 up to the execution unit (EU) 800 constitute the pipeline controlled data processing unit.
The instruction fetch unit (IFU) 400 provides instruction addresses to theBM1 303 through signal lines 327 and receives read-out instructions through signal lines 328 to prefetch the instructions. Signal lines 326 are interface signal lines for control signals between theIFU 400 and theBM1 303.
The instruction decode unit (DU) 500 receives instructions fetched by theIFU 400 and decodes them for each operation code and each operand specifier.Signal lines 329 are interface signal lines between theDU 500 and theIFU 400.
The address calculation unit (AU) 600 calculates an effective address of an operand in accordance with an operation code decoded by theDU 500 and decoded information of an operand specifier and provides the effective address to the operand fetch unit (OFU) 700.Signal lines 336 are interface signal lines between theDU 500 and theAU 600.
TheOFU 700 provides the operand address presented by theAU 600 to theBM2 304 through a signal line 330 and receives a corresponding operand through a signal line 335, a data bus 334 and signal lines 331.Signal lines 332 are interface signal lines for control signals between theOFU 700 and theBM2 304.
When theBM2 304 contains data on the address presented by theOFU 700, it immediately provides the corresponding data to a data bus 334 through the signal lines 335 and theOFU 700 receives the data on the data bus 334 through the signal lines 331. When theBM2 304 does not contain the data on the corresponding address, it accesses theMM 301 through theMCU 302 to read out the data on that address and presents it to theOFU 700.
The construction and the function of the high speed buffer memory are known, for example, see "A Guide to the IBM System/370 Model 168", copyright 1972, International Business Machines Corp.
The execution unit (EU) 800 receives the operands from theOFU 700 to execute the instructions. Signal lines 338 are interface signal lines between theEU 800 and theOFU 700 for transferring the operands.
An interunit bus 410 is a data transfer bus between theunits IFU 400,DU 500,AU 600 andEu 800. It is connected with theIFU 400 through signal lines 344, with theDU 500 through signal lines 345, with theAU 600 through signal lines 346 and with theEU 800 through signal lines 347.
Those units operate essentially independently to carry out pipelined processing of the operands.
Specific embodiments of the respective units of the data processing unit shown in FIG. 4 are explained with reference to FIGS. 4A to 4E.
FIG. 4A shows the configuration of theIFU 400. Abbreviations shown therein and their formal names are listed below.
______________________________________ Reference Abbrevia- Numerals Formal Names tions ______________________________________ 401Instruction buffer IB 402Instruction aligner ALIG 403 Control circuit IF-CONT 404 Fetchpointer FP 405Selector SEL 406 Incrementer INC ______________________________________
The fetch pointer (FP) 404 points to an address of an instruction to be fetched from theBM1 303.
The instruction buffer (IB) 401 stores prefetched data.
The control circuit (IF-CONT) 403 controls the memory access to theBM1 303 through signal lines 326, instructs write locations in the IB401 of the data fetched from theBM1 303 and permission or inhibition of writing, through a signal line 21A, and indicates if all data to be decoded in theDU 500 have been fetched to theIB 401, through the signal line 12A.
The incrementer (INC) 406 is used to update the content of theFP 404.
The selector (SEL) 405 selects data to be loaded to theFP 404. The output 23A of theSEL 405 provides the output 22A of theINC 406 when the instruction is to be prefetched and provides a branch address on signal lines 344 connected with an interunit bus 410 when a branch address is to be loaded during the execution of a branch instruction.
The instruction aligner (ALIG) 402 functions to align the operand specifier bit by bit in a sequence of decode by the address 11A. It may comprise a multi-bit shifter which can shift a plurality of bits simultaneously.
Numeral 14A denotes signal lines which provides the output of theALIG 402 to theDU 500. It has a signal line width equal to the number of bits which includes at least one set of operand specifiers and one set of operation codes and one set of the operand specifiers for the register mode.
Numeral 13A denotes signal lines which carry the number of bits of data necessary to decode in theDU 500.
Those are major elements of theIFU 400. It should be understood that many other elements are included.
FIG. 4B shows the specific configuration of the instruction decode unit (DU) 500. The abbreviations used therein and their formal names are listed below.
______________________________________ Reference Abbrevia- Numerals Formal Names tions ______________________________________ 501 Microprogram address genera-ECSAG tion circuit 502 Selector SEL 503 Operand information memory DCS 504 Control data generation circuit ACIG 505 Operand specifier decoder OS-DEC 506 Register mode detector RD-DEC 507 Number of decode bits DBNC calculator 508 Data aligner D-ALIG 509 Control circuit D-CONT 510Decode pointer DP 511Selector SEL 512Incrementer INC 513 Number of necessary decodeNBNC bits calculator 514 Address calculation program TPCC counter value calculator ______________________________________
The microprogram address generation circuit (EC-SAG) 501 generates a leading microprogram address 10B to be executed in theEU 800 by an operation code provided from theIFU 400 through thesignal lines 14A.
The operand information memory (DCS) 503 stores informtion on operands in an operation code provided from thesignal lines 14A through the selector (SEL) 502.
The operand specifier decoder (OS-DEC) 505 decodes an operand specifier in thesignal lines 14A.
The control data generation circuit (ACIG) 504 generates a control data 18B for calculating an address of an operand in the address calculation unit (AU) .[.301.]. .Iadd.600 .Iaddend.by the output 20B of the DCS 503 and the output 23B of the OS-DEC 505.
The register mode detector (RD-DEC) 506 detects if an operand specifier (OS) immediately following the operand specifier (OS) decoded by the OS-DEC 505 is the register mode or not. If it is the register mode and the signal lines 34B permits the simultaneous decode of two operand specifiers, the RD-DEC 506 loads the address 12B of that register to a register (ARR) 610 in theAU 600 to be described later and informs it to the D-COUNT 509, theECSAG 501 and theDBNC 507 through the signal lines 26B.
The number of decode bits calculator (DBNC) 507 receives the output 25B of the OS-DEC 505, the output 26B of the RD-DEC 506 and the output 21B of the DCS 503 and calculates the number of bits which are to be read out of theIB 401 and decoded in the same cycle.
The data aligner (D-ALIG) 508 receives the output 29B of the OS-DEC 505, theoutput 14A of theALIG 402 and the output 21B of the DCS 503 and realigns the literal data, the displacement field or an absolute address if it is included in the OS to be decoded.
The control circuit (D-CONT) 509 receives the signal 12A from the IF-CONT 403, the output 21B of the DCS 503, the output 26B of the RD-DEC 506 and the output 15B of theA-DEC 603 to control the overall operation of theDU 500.
The decode pointer (DP) 510 points to a leading address to be decoded in that machine cycle.
The selector (SEL) 511 selects data to be loaded to theDP 510. In the execution of a branch instruction, when a branch address is set, a branch address provided on the interunit bus 410 is loaded to theDP 510 through theSEL 511.
The incrementer (INC) 512 adds to the content 11A of theDP 510 the number of bits 17B of the instruction decoded in that cycle to produce a leading address 33B to be decoded in the next sequential machine cycle.
The number of necessary decode bits calculator (NBNC) 513 receives the output 24B of the OS-DEC 505 and the outputs 21B and 34B of the DCS 503 and calculates the number of bits which must have been fetched in theIB 401 to be decoded in that cycle and provides the result to the IF-CONT 403 through thesignal lines 13A.
The address calculation program counter value calculator (TPCC) 514 receives the output 21B of the DCS 503 and the output 24B of the OS-DEC 505 to calculate a value of the program counter to use the effective address calculation in the addressing mode corresponding to the program counter (the value of the program counter indicating a next sequential address to that of the operand specifier for which the address is to be calculated) and loads the result to a register (TPC) 613 through the signal lines 16B.
FIG. 4C shows the configuration of the address calculation unit (AU) 600 shown in FIG. 4. The abbreviations used therein and their formal names are listed below.
______________________________________ Reference Abbrevia- Numerals Formal Names tions ______________________________________ .Iadd.601 .Iaddend..[.610.].Register AER 602Register ACR 603 Decoder A-DEC604 Flag ACVF 605Register ARAR 606Register file ARF 607Selector SEL 608Selector SEL 609Adder A-ADR 610Register ARR611 Register DR 612Bus driver DV 613 Register TPC ______________________________________
In FIG. 4C, the register (AER) 601 retains a leading address 10B of a microprogram generated in theECSAG 501 of FIG. 4B.
The register (ACR) 602 retains control data 18B which is the output of the ACIG 504 of FIG. 4B.
The decoder (A-DEC) 603 controls the overall operation of theAU 600 by the combination of the outputs of theACR 602 and the flag (ACVF) 604.
The flag (ACVF) 604 functions to indicate the excution of the operation of theAU 600. The ACVF 604 is set when a decoded result is presented to theAU 600 by the output 14B of the D-CONT 509 and is reset by the output 22C of theA-DEC 603 when the address calculation based on the decoded result is completed.
The register (ARAR) 605 stores an address 11B of a register to be referred to when the operand address is calculated.
The register file (ARF) 606 is a group of registers to be referred to when the operand address is calculated. The output 24C which is the output ofARF 606 corresponding to the address output 23C from theARAR 605 is supplied to the selectors (SEL) 607 and 608.
The selectors (SEL) 607 and 608 select inputs to the adder (A-ADR) 609.
The adder (A-ADR) 609 calculates the address of the operand based on the signals selected by theSEL 607 and 608 and loads the result to a register (MAR) 705 through the signal lines 14C or provides the result to the interunit bus 410 through the bus driver (DV) 612.
The register (ARR) 610 retains the address 12B of the register which is contained in the operand specifier (OS).
The register (DR) 611 retains the displacement, absolute address or literal data which is contained in the operand specifier (OS), and presents it to theSEL 608 through the signal lines 26C.
The register (TPC) 613 retains the value of the program counter to be used in the relative addressing mode, and supplies the output 25C to theSEL 607 corresponding to the program calculated.
FIG. 4D shows the configuration of the operand fetch unit (OFU) shown in FIG. 4. The abbreviations used therein and their formal names are listed below.
______________________________________ Reference Abbrevia- Numerals Formal Names tions ______________________________________ 701 Register .[.OER.]. .Iadd.DER.Iaddend.702 Register OPCR703 Flag OFCVF 704 Decoder OF-DEC 705Register MAR 706Selector SEL 707Register OBR 708 Data Aligner OALIG 709 Register ORR ______________________________________
In FIG. 4D, the register .[.(OER).]. .Iadd.(DER) .Iaddend.701 retains a leading address 10C of a microprogram.
The register (OFCR) 702 retains the output 11C of theA-DEC 603 of FIG. 4C.
The flag (OFCVF) 703 indicates the execution of the operation of theOFU 700. It is set by the output 12C of theA-DEC 603 when the result of the address calculation is presented to theOFU 700 and reset by the output 22D of the OF-DEC 704 when the operation of theOFU 700 to the address is completed.
The decoder (OF-DEC) 704 controls the overall operation of theOFU 700 by the combination of the output 20D of theOFCR 702 and the output 21D of theOFCVF 703. When all operands have been fetched, it provides the signal 13D to theexecution unit 800.
The register (MAR) 705 retains the address 14C of the operand and provides the address to theBM2 304 through the signal line 330.
The selector (SEL) 706 selects data to be loaded to the register (OBR) 707 which retains the operand 23D to be loaded through theSEL 706.
The data aligner (OALIG) 706 receives the data 24D from theOBR 707 and aligns it to generate the data format 14D.
The register (ORR) 709 retains the address 13C of the register provided from theARR 610 of FIG. 4C.
FIG. 4E shows the configuration of the execution unit (EU) 800 shown in FIG. 4. The abbreviations used therein and their formal names are listed below.
______________________________________ Reference Abbrevia- Numerals Formal Names tions ______________________________________ 801Microprogram controller MPC 802Microprogram memory ECS 803 Microinstruction register MIR 804 Selector SEL 805 Selector SEL 806 ALU EALU 808 Memory data registerMDR 809 Bilateral bus driver BDV 812 General purpose register file ERF 813 Register ERAR 814 Selector SEL ______________________________________
FIG. 4E shows only major elements of theEU 800 and many other elements are included therein although they are not explained here because they are immaterial to an understanding of the present invention.
In FIG. 4E, the microprogram controller (MPC) 801 controls the memory address of the microprogram memory (ECS) 802, which .[.receives.]. .Iadd.provides .Iaddend.themicroprogram 20E from theaddress 21E specified by theMPC 801 and loads it to the microinstruction register (MIR) 803.
The outputs of theMIR 803 are provided to the OF-DEC 704 of FIG. 4D through the signal lines 12D, to theMPC 801 through the signal lines 22E and to the selectors 804 and 814 through the signal lines 23E and .[.23E,.]. .Iadd.24E, .Iaddend.respectively. The outputs of theMIR 803 are also provided to many other elements although they are not shown nor explained here because they are immaterial to an understanding of the present invention.
The selectors 804 and 805 select input data to the ALU (EALU) 806.
The memory data register (MDR) 808 temporarily stores the data 35E from the bus 25E and provides it to theBM2 304 through the signal lines 333, the bus 334 and the signal lines 335.
The general purpose register file (ERF) 812 is a group of general purpose registers used by the EALU 806. It provides data read out by the address from the output 33E of the SEL 814 to the SEL 804 and 805 through the signal lines 28E.
The register (ERAR) 813 retains the register address 11D which is transferred from the ORR 709 of FIG. 4D.
The selector (SEL) 814 selects either the output 32E of the ERAR 813 or the output 24E of theMIR 803 and provides it to the ERF 812 through the signal line 33E. The bilateral bus driver (BDV) 809 functions to interconnect the internal bus 25E of theEU 800 and the interunit bus 410, transfer the data generated in theEU 800 to the other unit and provide the data transferred from the other unit to theEU 800.
An example of an instruction execution sequence in accordance with the present embodiment is now explained with respect to a basic instruction.
TheIFU 400 accesses theBM1 303 by the address contained in theFP 404 to prefetch the instruction. If theIB 401 has a vacant area to accommodate the data read out of theBM1 303, it reads in the data. If it has no vacant area, it neglects the data. The presence or absence of the vacant area is determined by the IF-CONT 403 by the content 327 of theFP 404 and the output 11A of theDP 510. In the present embodiment, the data read out fromBM1 303 is stored in theIB 401 when theIB 401 has a larger area than the readout width of the data from theBM1 303.
TheALIG 402 aligns the data in theIB 401 in the sequence of address with the position at the corresponding address of theIB 401 being at the top while using the output 11A of theDP 510 as the address. In the present embodiment, the data is aligned bit by bit although it may be aligned byte by byte when the basic length of the instruction is a byte. In the first decode cycle of the instruction, theDP 510 indicates the address of the operation code. Accordingly, the leading data from theALIG 402 corresponds to the operation code field and the operand specifier of the next sequential first operand is read. In the intermediate decode cycle of the instruction, theDP 510 may indicate the address of the operand specifier. In this case, a series of data with the operand specifier corresponding to said address being at the top is read. Theoutput 329 from theALIG 402 has a width wide enough to accommodate at least one set of operand specifiers and an operation code.
TheDU 500 decodes the instructions provided by theALIG 402. TheDU 500 always decodes theoutput 329 of theALIG 402. Conditions for completing the decoding are explained below.
The effective data length to be available to decode in theIB 401 is determined by a difference between theFP 404 and theDP 510. TheFP 404 indicates an address to be read from the memory at the next memory access, and theDP 510 indicates a head memory address to be decoded. Thus, theFP 404 is equal to or in advance of theDP 510. When theDP 510 is equal to theFP 404, there is no effective data in theIB 401. When theDP 510 is not equal to theFP 404, the difference between theFP 404 and theDP 510 indicates the effective data length. TheDU 500 calculates the length necessary for decoding by theNBNC 513 and informs the result to the IF-CONT 403 in theIFU 400 through thesignal lines 13A. The IF-CONT 403 compares the content on thesignal lines 13A with the difference betweenFP 404 and theDP 510, and when the former is equal to or smaller than the latter it determines that the length necessary for decoding is contained in theIB 401 and informs this to the D-CONT 509 in theDU 500 through the signal lines 12A. When the D-CONT 509 is informed through the signal lines 12A that the necessary data for decoding is contained in theIB 401 and is informed through the signal lines 15B that theAU 600 is ready to receive the decode result, it presents the decode result of theDU 500 to theAU 600 to complete the operation of the decode cycle. If the data necessary for decoding is not contained in theIB 401, or if theAU 600 is not ready to receive the decoded result, the D-CONT 509 invalidates the process in that decode cycle and repeats the same process in the next sequential cycle.
The output 17B of theDBNC 507 is represented by a formula (1):
17B=α+β+γ (1)
and theoutput 13A of theNBNC 513 is represented by a formula (2):
13A=α+β+δ (2)
where α and β are defined as follows:
(i) When theDP 510 indicates the address of the operation code,
α=the number of bits of the operation code
β=the number of bits of the leading operand specifier following said operation code.
(ii) When theDP 510 indicates the address of the operand specifier,
α=0
β=the number of bits of said operand specifier, γ is defined as follows:
(i) When two operand specifiers are simultaneously decoded,
γ=the number of bits of the operand specifier for the register mode
(ii) When only one operand specifier is decoded,
γ=0
δ is defined as follows:
(i) When simultaneous decoding of two operand specifiers is permitted (as indicated) by the output 34B of the DCS 503),
δ=the number of bits of the operand specifier for the register mode
(ii) When simultaneous decoding of two operand specifiers is not permitted,
γ=0
In the first decode cycle of the instruction, a leading field provided from theALIG 402 corresponds to the operation code. Thus, the leading field is used as the address of the DCS 503 in accessing to the DCS 503.
In the DCS 503, a one-word address is allocated to one operand specifier of each instruction. As shown in FIG. 5, each one-word in the DCS 503 comprises a field (AD) indicating a type of access (read, write or read and write) of one of a plurality of operand specifiers defined by the operation code of the instruction, a field (DL) indicating the data length, a field (JA) indicating an address in the DCS 503 corresponding to the operand specifier following said operand specifier if it is included, a field (E) indicating the last operand specifier of the instruction and a field (RD) indicating the permission for simultaneous decoding of two operand specifiers. Other fields are also included but they are not explained here because they are not directly related to the present invention. A number of words in the DCS 503 equal to the number of operand specifiers contained in each instruction are allotted to each instruction. For example, three words are allotted to a three-operand instruction. It is possible to reduce the memory size of the DCS 503 by sharing the same address by different instructions if such sharing is permitted. In a first decode cycle (t1) of an instruction, the operation code is used as the address of the DCS 503, and a first operand information specified by the operation code, an address (JA) on the DCS 503 of a second operand and other information are read out of the DCS 503. The operand specifier of the first operand is read out from theIB 401 by theALIG 402 and decoded by the OS-DEC 505. If the operand specifier includes a displacement, an absolute address or literal data, the D-ALIG 508 reads them out and aligns the data format, which is then stored in theDR 611. TheDU 500 loads the decoded results to the registers in theAU 600 and sets the ACVF 604 to start the address calculation for the operand specified by the operand specifier in accordance with the decoded result. The number of bits of the instructions decoded in that cycle (the number of bits of the operation codes and the operand specifiers for the first operands) is calculated by theDBNC 507 and it is added to the content of theDP 510 by theINC 512 to update the content of theDP 510.
When the instruction has two or more operand specifiers, the information of the second operand specified by the operation code is read out of the DCS 503 in the next cycle (t2) to the first decode cycle (t1) for the instruction while using the field JA in the information read out of the DCS 503 in the cycle t1 as an address. Simultaneously, the operand specifier for the second operand is read out of theIB 401 by theALIG 402 and it is decoded by the OS-DEC 505 in a similar procedure to that of decoding of the operand specifier for the first operand. If the AU .[.310.]. .Iadd.600 .Iaddend.has received the decoded result of the operand specifier for the first operand and completed the address calculation for the operand by that time and is ready to accept the address calculation for the next address, theDU 500 loads the decoded result of the operand specifier for the second operand to the registers in theAU 600 and sets the ACVF 604 to cause theAU 600 to start the address calculation of the operand specified by the operand specifier for the second operand. The number of bits of the instruction decoded in that cycle (the number of bits of the operand specifier for the second operand) is calculated by theDBNC 507 and it is added to the content of theDP 510 to update the content of theDP 510.
As is apparent from the above description, theDU 500 decodes one operand specifier in each machine cycle and loads the decoded result to the registers in theAU 600 and instructs theAU 600 to calculate the address of the operand based on the decoded result. In the first decode cycle of the instruction, the operation code is used as the address of the DCS 503 and in the subsequent cycles the information specified by the operation code is read out. The leading address of the microprogram is determined by theECSAG 501 based on the operation code and it is loaded to theAER 601.
When the decoded result for the operand specifier is loaded to the registers in theAU 600 from theDU 500 and the ACVF 604 is set, theAU 600 calculates the address of the operand based on the decoded result, loads the calculated operand address to theMAR 705 in theOFU 700, loads the operation control information for theOFU 700 to theOFCR 702, and sets theOFCVF 703 to cause theOFU 700 to start the memory access to the address specified by theMAR 705. When the address calculation of the operand specifier for the operand has been completed, theAU 600 receives the next operand specifier following said operand specifier from theDU 500 and calculates the address of the next operand specifier. In this manner, theAU 600 sequentially calculates the addresses of the operands specified by the operand specifiers, one operand specifier at a time. The address calculation for each operand specifier is not always completed in one machine cycle, but it may sometimes take a plurality of machine cycles. After the address calculation for one operand specifier is completed, the address calculation for the next operand specifier is carried out. It is not necessary that the next operand specifier belong to the same instruction as that of the foregoing operand specifier. When the address calculation for the leading (first) operand specifier in the instruction is completed, theAU 600 transfers the leading address of the microprogram of the instruction stored in theAER 601 to the .[.OER.]. .Iadd.DER .Iaddend.701 of theOFU 700.
In order to transfer the address calculated by theAU 600 to theOFU 700, theOFU 700 must be ready to receive the data from theAU 600. TheOFU 700 indicates through the signal line 15C if it is ready to receive the data from theAU 600. In the data transfer cycle to theOFU 700, theAU 600 checks the signal line 15C and only when it determines that the OFU is ready, theAU 600 loads the data generated therein to the registers in theOFU 700. When theOFU 700 is not ready to receive the data, theAU 600 invalidates the process of that cycle and repeats the same process in the next cycle.
TheOFU 700 starts its operation when the calculated address of the operand specifier is loaded to theMAR 705 from theAU 600, the operation control signal for theOFU 700 is loaded to theOFCR 702 and theOFCVF 703 is set.
A primary function of theOFU 700 is to access the memory based on the address presented by theAU 600 to fetch the operand. In an addressing mode (e.g. immediate mode or literal mode) in which the operand has been prepared by theAU 600, the operand (to be presented to the MAR 705) is loaded to theOBR 707 through theSEL 706 and the memory is not accessed.
In several modes which need the memory access, theBM2 304 is accessed through the signal lines 332. The data read out of theBM2 304 is loaded to theOBR 707 through theSEL 706. The operands in theOBR 707 are aligned by theOALIG 708 and then transferred to theEU 800.
In the memory access or transfer of the leading (first) operand specifier of the instruction, the leading address of the microprogram stored in theOER 701 is transferred to theMPC 801.
In order to load the operand prepared in theOFU 700 to theOBR 707, theOBR 707 must contain no data prior to said operand, that is, theOBR 707 must be vacant. TheEU 800 indicates through the signal line 12D if the operand in theOBR 707 has been used. In the loading cycle of the operand to theOBR 707, theOFU 700 determines if theOBR 707 is ready to receive the operand. If it is ready, theOFU 700 loads the operand, and if it is not ready theOFU 700 invalidates the process of that cycle and repeats the same process in the next cycle.
As described above, the information (operation code and operand specifier) on the instruction decoded by theDU 500 is transferred to theEU 800 through theAU 600 and theOFU 700.
TheEU 800 accesses theECS 802 by the leading address of the microprogram presented to theMPC 801 to fetch the microprogram to initiate the execution of the instruction. The operand specified by the operand specifier is presented from theOBR 707, or from the ERAR 813 as a register address. If the operand is a destination, the address of that operand is loaded to theMAR 705. TheEU 800 executes the instruction using the operands presented from theOFU 700. When the result is to be stored in a register, it is stored in the ERF 812 through the bus 25E and the signal lines 29E. When the result is to be stored in a memory, it is temporarily stored in the MDR 808 and supplied to theBM2 304 through the signal lines 333. When the operands presented by theOFU 700 have been processed, it is indicated to theOFU 700 through the signal line 12D to make theOFU 700 ready for the receipt of the next operand.
FIG. 6 shows a stage flow illustrating an instruction flow and a process for executing the instructions, in which three instructions I(1), I(2) and I(3) are shown. Each of the instructions I(1) to I(3) has two operand specifiers. In the first cycle (t1), the instruction I(1) is fetched (IF.sup.(1)). In the next cycle (t2), the operation code and the operand specifier of the first operand are decoded (D.sup.(1) 1). In the next cycle (t3), the effective address of the first operand is calculated (A.sup.(1) 1) in accordance with the decode result and the operand specifier of the second operand is decoded (D.sup.(1) 2). In the next cycle (t4), the first operand is fetched (OF.sup.(1) 1) and the effective address of the second operand is calculated (A.sup.(1) 2). In the same cycle, the operation code and the operand specifier of the first operand of the instruction I(2) are decoded (D.sup.(2) 1). In the next cycle, (t5), the second operand of the instruction I(1) is fetched (OF.sup.(1) 2) and the effective address of the first operand of the instruction I(2) is calculated (A.sup.(2) 1) and the operand specifier of the second operand of the instruction I(2) is decoded (D.sup.(2) 2). In the next cycle (t6), the instruction I(1) is executed (E.sup.(1)), and the first operand of the instruction I(2) is fetched (OF.sup.(2) 1), the effective address of the second operand is calculated (A.sup.(2) 2) and the operation code and the operand specifier of the first operand of the instruction I(3) are decoded (D.sup.(3) 1). Similar processes are carried out in the cycles .[.t7 -t11..]. .Iadd.t7 -t10. .Iaddend.The fetches (IF.sup.(2), IF.sup.(3)) of the instructions I(2) and I(3) shown by broken lines in FIG. 6 indicate that instruction prefetches are carried out even when vacant areas in theIB 401 exceed a predetermined number of bits.
While FIG. 6 shows an example where the effective address calculation cycle for the operand and the operand and fetch cycle are completed in one cycle, respectively, the effective address calculation cycle may not be completed in one cycle depending on the addressing mode, or the operand may be fetched by twice referring to the memory in the indirect addressing mode (in which an operand is presented by the first memory reference). Accordingly, the instruction flow and the execution vary depending on the addressing mode.
FIG. 7 shows a stage flow illustrating an instruction flow and the execution of the instructions when three-operand instructions are sequentially executed, in which three instructions I(1), I(2) and (3) are shown, as in the case of FIG. 6. The execution of the instructions in each cycle is similar to that for the sequential two-operand instructions explained in FIG. 6. In the three-operand instruction, however, the third operand is not fetched because it is usually not a source operand but a destination operand. A stage flow for the instructions having more than three operands is essentially the same as the stage flows for the two-operand and three-operand instructions described above in connection with FIGS. 6 and 7. A combination of instructions having different numbers of operand specifiers may also be executed in a similar manner.
While the two-operand and three-operand instructions have been illustrated, it should be understood that the stage flows for one-operand instructions and the instructions having more than three operands are essentially the same as those shown in FIGS. 6 and 7.
The simultaneous decoding process for two operand specifiers and subsequent processes in an instruction which permits simultaneous decoding of the two operand specifiers are now explained.
The simultaneous decoding of the two operand specifiers is carried out only for the instruction which permits the simultaneous decoding of the two operand specifiers although it may be carried out for all of the instructions.
The simultaneous decoding of the two operand specifiers is carried out on condition that the addressing mode of the last operand specifier is the register mode when an operand specifier preceding the last operand specifier is decoded. If the addressing mode is not the register mode, the simultaneous decoding is not carried out but only the operand specifier preceding the last operand specifier is decoded. As an example, an add instruction having two operand specifiers is explained. In the add instruction, the content of the first operand is added to the content of the second operand and the sum of them is stored at the location of the second operand. Thus, the first operand is a read operand and the second operand is a read and write operand. Patterns of the DCS 503 for the add instruction are shown in FIG. 8, in which information of the first operand and the address of the second operand on the DCS 503 are contained at the address of the DCS 503 corresponding to the content of the operation code. Since the first operand is the operand preceding the last operand, the field RD of the DCS 503 contains "1" (indicating the permission of the simultaneous decode of the two operand specifiers). Information of the second operand is stored at the address of the DCS 503 for the second operand and the field E contains "1" indicating that the second operand is the last operand of the instruction. FIG. 9 shows a stage flow when add instructions having the same type of operand specifiers are sequentially executed and the second operands are of the register mode. When the second operands are not of the register mode, the stage flow is not as shown in FIG. 9, but the stage flow is similar to that shown in FIG. 6.
Referring to FIG. 9, the execution of the instructions is explained. In the first cycle (t1), the data (instruction) on the address containing the instruction I(1) is fetched (IF.sup.(1)). In the next cycle (t2), the operation code and the operand specifier of the first operand of the instruction I(1) are decoded. If the field RD of the DCS 503 contains "1" and the RD-DEC 506 in theDU 500 detects that the addressing mode of the operand specifier of the second operand following the operand specifier of the first operand is the register mode, the RD-DEC 506 reads out a register address from the operand specifier of the second operand and loads it to theARR 610 in theAU 600 to simultaneously decode the two operand specifiers (D1 & D2.sup.(1)). In the next cycle, (t3), theAU 600 calculates the address of the first operand of the instruction I(1) (A1.sup.(1)) based on the decoded result and transfers the calculated address to theOFU 700 and transfers a register address of the second operand of the instruction I(1) to the ORR 709 in theOFU 700. In the same cycle t3, theDU 500 decodes the instruction I(2) (D1 & D2.sup.(2)) in the same manner as in the cycle t2. In the next cycle (t4), theOFU 700 fetches the first operand of the instruction I(1) (OF1.sup.(1)) and transfers the register address of the second operand of the instruction I(1) to theEU 800. In the same cycle t4, theAU 600 calculates the address of the first operand of the instruction I(2) (A1.sup.(2)) and transfers the address to theOFU 700 and transfers the register address of the second operand of the instruction I(2) to theOFU 700. In the same cycle t4, theDU 500 decodes the instruction I(3) (D1 & D2.sup.(3)) in the same manner as in the decode for the instruction I(1) in the cycle t2. In the next cycle (t5), theEU 800 receives the register addresses of the first operand of the instruction I(1) and the second operand of the instruction I(1) from theOFU 700 to execute the instruction I(1) (E.sup.(1)). In the same cycle t5, theOFU 700 fetches the first operand of the instruction I(2) (OF1.sup.(2)) and transfers the register address of the second operand of the instruction I(2) to theEU 800. In the same cycle t5, theAU 600 calculates an address of the first operand of the instruction I(3) (A1.sup.(3)) and transfers the address to theOFU 700 and transfers a register address of the second operand of the instruction I(3) to theOFU 700. In the following cycles t6 and t7, similar processes are carried out. While the effective address calculation cycle of the operand and the operand fetch cycle are completed in one cycle, respectively, in the example of FIG. 9, the effective address calculation cycle may not be completed in one cycle depending on the addressing mode or a plurality of cycles may be required when the required data is not contained in theBM2 304 in the operand fetch cycle and it has to be fetched from theMM 301. Accordingly, various instruction flows and execution processes may be included.
FIG. 10 shows a stage flow illustrating an instruction flow and the execution of the instructions when same type of three-operand instructions are sequentially executed. Similar to FIG. 9, three instructions I(1), I(2), and I(3) are shown in FIG. 10. Also similar to FIG. 9, each of the instructions permits simultaneous decoding of two operand specifiers in a decode cycle of an operand preceding the last operand when the last operand is of the register mode. FIG. 10 shows the stage flow when the last operand (which corresponds to the third operand) is of the register mode. When the third operand is not of the register mode, the stage flow is not the same as shown in FIG. 10, but the stage flow is similar to that shown in FIG. 7. In the two operand instructions shown in FIG. 9, two operand specifiers are decoded in the decode cycle for the operand specifier of the first operand, but in the three-operand instructions shown in FIG. 10, two operand specifiers are decoded in the decode cycle for the operand specifier of the second operand. This difference is due to the fact that the operand preceding the last operand is the first operand in the two-operand instructions while it is the second operand in the three-operand instructions, and it is not an essential difference.
While the processes for the two-operand instructions and the three-operand instructions have been shown in FIGS. 9 and 10, respectively, it should be understood that for the instructions having four or more operands the two operand specifiers can be simultaneously decoded in the decode cycle of the operand specifier of the operand preceding the last operand of the instruction when the last operand is of the register mode. A combination of instructions having different numbers of operands may be similarly executed.