DATA PROCESSING SYSTEM

Abstract: An instruction having two operands including a field (Sz2) specifying the bit length of a source operand and a field (Sz1) specifying the bit length of data to be operated by the execution unit. Based on size information stored in these fields (Sz1, Sz2), the operand bit length is modified, which unnecessitates the modification of the bit length of an operand by use of a macro instruction Consequently, the program execution speed can be improved.

Description: BACKGROUND OF THE INVENTION The present invention relates to a data processing technique, and in particular, to a technique especially effective when applied to an instruction format in a system of a program control type, for example, to a technique effectively applicable to a configuration method of a two-operand instruction using two operands at execution of an instruction. Conventionally, a set of microinstructions of the microprocessors such as HD68000 produced by Hitachi Ltd. is classified into three kinds of instruction formats: (1) no-operand instruction (for which no operand is required), (2) one-operand instruction, and (3) 2-operand instruction. FIG. 2 is a schematic diagram illustrating the configuration of the 2-operand instruction. Namely, a 2-operand instruction comprises an operation code field OP, a size field Sz specifying the operand size (bit length such as 8, 16, or 32 bits), source side operand Dn, and an effective address field EA2 indicating the operand location on the destination side. (Refer to "Hitachi Microcomputer, Semiconductor Data Book, 8/16 Bit Microcomputer", pp. 945-952; Hitachi, Ltd.; Sep. 1982.) As described above, the two-operand instruction of the conventional microprocessors of the 6800 family has only one size field Sz. In this case, for example, an addition instruction specified in mnemonic codes as ADD Do, x cannot be executed if the source operand Do and the destination opeand x are not of the same bit length. Consequently, to execute the ADD operation with the size of the source operand Do set to 8 bit and with the size of the destination operand x set to 32 bits, an adjusting instruction is required to beforehand adjust the size of the source operand Do from 8 bits to 32 bits. Namely, an instruction which adds three bytes of "0" to the 8-bit operand as the first portion thereof must be executed before the ADD operation is implemented. As a result, the steps of a macro program is increased. In addition, to store an operand (in a case of the 8-bit length) for which only one byte is required, a memory area equivalent to two words become necessary. Consequently, the execution speed of program is lowered depending on the instruction format; moreover, the fact that the memory utilization ratio is also deteriorated has been found by the inventors of the present invention. A data processing system with the features included in the first part of claim 1 and a method with the features included in the first part of claim 4 are known from US-A-4,456,955. In this prior art, although the two operands on which the operation is to be effected may have different lengths, data of equal lengths are fetched from a memory and supplied to an execution unit. Prior to effecting the operation, one of the two operands may be shifted to have its decimal point at the same location as the other operand. In another data processing system known from EP-A-0 138 419 a data path width can be specified in accordance with a size information, but the specified path width is maintained during a full execution sequence. SUMMARY OF THE INVENTION It is an object of the present invention to provide a data processing system and method which permit increasing the execution speed and improving the memory utilization ratio. This object is met by the system defined in claim 1 and the method defined in claim 4. According to the present invention as claimed, in an instruction having two operands, an operation word includes a field specifying the size of the source operand and a field specifying the size of the operation so as to change the operand bit length based on the size information; consequently, the bit length of an operand need not be changed by use of a macro instruction. The program execution speed is therefore increased. Furthermore, two operands can be respectively stored in a memory or a register with their original bit lengths, the memory utilization ratio is improved. BRIEF DESCRIPTION OF THE DRAWINGS The present invention will be apparent from the following detailed description taken in conjunction with the accompanying drawings in which: FIGS. 1A-1C are explanatory diagrams illustrating examples of the two-operand instruction according to the present invention; FIG. 2 is a schematic diagram depicting the format of a two-operand instruction in the conventional microprocessor; FIG. 3 is a block diagram showing a configuration example of a microprocessor enabling to execute a two-operand instruction according to the present invention; and FIG. 4 is a schematic block diagram illustrating another configuration example of a microprocessor enabling to execute the two-operand instruction according to the present invention. DESCRIPTION OF THE PREFERRED EMBODIMENTS Referring to FIGS. 1A-1C, there are shown examples of the format of the new two-operand instruction proposed by the present invention. As shown in FIG. 1A, an operation code field OP is followed by an operation size field Sz₁ specifying the size of the operation, namely, the bit length used to execute the instruction such as an operation. The size field Sz₁ is followed by an effective address field EAd specifying the location of the destination operand. The effective address field EAd is further followed by a source size field Sz₂, which is followed by an effective address field EAs indicating the location of the source operand. The effective address fields EAd and EAs each comprise, for example, three addressing mode bits specifying an addressing mode and four register designation bits designating a register. In the instruction format, the size field Sz₁ is so configured not to specify the size of the destination operand but to specify the operation size, namely, the length of data to be subjected to the operation for the following reasons. That is, the problem associated with an operation execution is the length of the data on which the operation is conducted. For example, data items having different bit lengths cannot be subjected to an addition or a substraction in an arithmetic logic unit (ALU) or the like. Ordinarily, the operation size is identical to the size of the destination operand; consequently, if the operation size is specified, the operation in the ALU or the like can be executed without any trouble. In addition to Sz₁, if a field for specifying the size of the destination operand is allocated, this field may be used to store only a portion of data after the processing of the operation is completed. In a 16-bit microprocessor, since it is only necessary to be capable of discriminating whether the size of the operation and the size of the source operand is represented with a byte length (8 bits) or a word length (16 bits), the size fields Sz₁ and Sz₂ of FIG. 1A each need only be configured with two bits. The fields of the two-operand instruction according to the present invention is not restricted by those shown in FIG. 1A, but each field may be arranged in an arbitrary configuration. For example, as shown in FIG. 1B, the operation size field Sz₁ may be followed by the source operand effective address field EAs and the destination operand effective address field EAd. In addition, depending on the addressing mode, extension fields are required to be added to the effective address fields EAd and EAs. In this case, the format of the two-operand instruction is configured as shown in FIG. 1C. The extension field includes, depending on the addressing mode, a 1-4 byte displacement d (offset value), a 1-4 byte immediate data #, a 1-4 byte absolute address @, or an index register byte x. Referring now to FIG. 3, a description will be given of an example of the hardware configuration of a microprocessor which enables to execute the two-operand instruction in the format described above. The microprocessor of this embodiment includes a controller of the microprogram control type. Namely, an LSI chip 1 constituting the microprocessor comprises a micro ROM (read-only memory) in which microprograms are stored. A micro ROM 2 is accessed from a micro address decoder 5 and sequentially outputs microinstructions constituting the microprograms. A micro address generator 4 generates an address to be supplied to the micro address decoder 5 based on the operation code of the macro instruction fetched into an instruction register 3. The micro address decoder 5 then decodes the address. In response to the decode operation, the first instruction of a sequence of microinstructions for the macro instruction is read from the micro ROM 2. According to the microinstruction code, control signals are formed for an execution unit 6 comprising various temporary registers REG₁ to REG n , a data buffer DB, and an ALU. Among the micro instructions corresponding to the macro instruction, the second and subsequent microinstructions are executed when the code of the next address field of the microinstruction previously read is supplied to the micro address decoder 5, for example. That is, based on the next address in the previous microinstruction and the address supplied from the micro address generator 4, the second or subsequent microinstruction is read out. A series of microinstructions are thus read out and the execution unit 6 is controlled by the control signals formed as described above, thereby executing a macro instruction such as ADD. There is provided a memory access controller 7 having a function to read data from or to write data in an external memory, an internal register, or the like in byte, word, or long word units when required. The instruction register 3 is constituted from, but not limited to, a first-in first-out (FIFO) memory. A macro instruction stored in an external memory is read in byte units when the memory access controller 7 accesses an address bus 8, and the data is supplied via a data bus 9 to the FIFO memory 3. A plurality of operation codes and operands are thus fetched into the FIFO memory 3 in advance. If a macro instruction fetched into the FIFO memory 3 is a two-operand instruction as shown in FIG. 1A, a corresponding microinstruction is read out according to the operation code OP and the content of the operation size field Sz₁ in the first eight bytes. The microinstruction causes the flag FLG of the size field Sz₁ of FIG. 3 to be set to an appropriate value. Depending on the status of the flag FLG, the ALU in the execution unit 6 is instructed to effect an operation with 8, 16, or 32 bits. Subsequently, when the FIFO memory 3 supplies the source operand effective address EAs and the source operand size code Sz₂ to the micro address generator 4, a corresponding microinstruction is read from the micro ROM 2 and a part thereof is fed to the memory access control circuit 7. This causes the memory access control circuit 7 to read a source operand beginning from the address indicated by the effective address EAs in the byte, word, or long word units according to the operand size Sz₂. The obtained source operand is fetched into a data buffer DB, and then the source size of the operand is converted into the specified operation size Sz₁ by an appropriate circuit and is supplied to the ALU. Consequently, an instruction for adjusting the size need not be separately provided. In a case of an instruction of (EAs) ⊕ (EAd) → (EAd), a code indicating the effective address EAd of the destination operand is supplied to the micro address generator 4 after the source operand so as to read a corresponding microinstruction. Depending on the size information held in the flag FLG, the memory access controller 7 in turn reads an operand with the same size as the operation size beginning from the position indicated by the effective address EAd and delivers the operand to the ALU. When the operation is completely processed by the ALU, the operation data is stored in the position of the destination operand, thereby completing the execution of the macro instruction. Referring next to FIG. 4 a description will be given of another example of a hardware which enables to execute the two-operand instruction configured according to the instruction format of the present invention. Since the basic configuration of the microprocessor of this embodiment is substantially identical to that of the system shown in FIG. 3, the same reference numerals are assigned to the circuits having the same functions and hence the description thereabout will be omitted. In the microprocessor of FIG. 3, the codes of operand size fields Sz₁ and Sz₂ are supplied to the micro address generator 4 so as to be used to generate a micro address of the micro ROM 2. A microinstruction read by use of the micro address is changed and information about the operation size Sz₁ is supplied to the flag FLG by a microinstruction. In contrast, the microprocessor of FIG. 4 is provided with two flags FLG₁ and FLG₂ for keeping the codes directly moved from the size fields Sz₁ and Sz₂ of the macroinstruction fetched into the FIFO memory 3. The ALU and the like in the execution unit 6 are so controlled according to the information about the operation size Sz₁ held in the flag FLG₁ to effect an operation in byte, word, or long word units. On the other hand, based on the information about the source operand size stored in the second flag FLG₂, the memory access controller 7 reads an operand from an external memory, an internal register, or the like in byte, word, or long word units and latches the operand into the data buffer DB. The operand latched into the data buffer DB is modified according to the operation size indicated by the first flag FLG₁ and the resultant data is supplied to the ALU and the like. The subsequent operations are the same as those of the microprocessor of FIG. 3. Although the microprocessor of the configuration of FIG. 4 requires an additional 2-bit flag as compared with the microprocessor of FIG. 3, the operand size information is directly incorporated in the flag, which leads to an advantage to facilitate the microprogram. Only the operation size Sz₁ or Sz₂ may be stored directly in the flag. As described above, the format configuration of the two-operand instruction includes a field specifying the operation size in addition to the field specifying the source operand size as shown in the embodiment, which unnecessitates such a change required for the two-operand instruction in the conventional format as to modify the bit length of the source operand to be equal to that of the destination operand in advance. Namely, an operand with 8- or 16-bit length can be stored in a memory or the like in the original form so as to be read out later. For the operand read out, the bit length is automatically changed to be a desired bit length in the execution unit and the resultant data is used for the operation. As a result, the macro instruction to modify the operand length becomes unnecessary and hence the program execution speed is increased. In addition to the fact that such a macro instruction is unnecessary, an operand having a short length can be stored in the memory in its original form; consequently, the memory utilization ratio is improved. Although the embodiment has been described in conjunction with a case where a two-operand instruction such as (EAs) ⊕ (EAd) → (EAd) is executed, it is also possible to execute an instruction having two source operands and one destination operand such as (EAs₁) ⊕ (EAs₂) → (EAd). Although the present invention of the inventors has been concretely described with reference to the embodiments, the present invention is not restricted by the embodiments. It should be appreciated that those skilled in the art can change or modify the embodiments without departing from the scope of the present invention as claimed. For example, in the embodiments, the two-operand instruction includes a source operand size field and an operation size field; however, in a system in which the destination operand size is always identical to the operation size, the destination operand size field may be assigned in place of the operation size field. The present invention has been described in conjunction with an application in which the invention of the inventors is applied to the utilization field, namely, a microprocessor which is the background of the invention, the present invention is not restricted by the case but it can be generally applied to data processing systems of the program control type such as a computer and a mini-computer.

Claims: A data processing system comprising an execution unit (6) for effecting an operation according to an instruction, wherein the instruction includes (a) operation code designation information (OP) specifying an operation to be performed by said execution unit (6) on at least two operands, (b) first address designation information (EAd) specifying an address of a first operand, (c) second address designation information (EAs) specifying an address of a second operand, (d) first bit length designation information (Sz1), and (e) second bit length designation information (Sz2) specifying the bit length of said second operand, and a memory access control circuit (7) for reading said operands from a memory, characterized in that said first bit length designation information (Sz1) specifies the bit length of data to be operated upon by said execution unit (6), and that said execution unit (6) includes means for changing the bit length of the second operand, previously read by said memory access control circuit (7), according to said first bit length designation information (Sz1) before effecting an operation on said first and second operands. The system of claim 1, wherein said memory access control circuit (7) is controlled by said second bit length designation information (Sz2) for reading an operand of specified bit length from said memory as said second operand. The system of claim 1 or 2, further comprising an instruction register (3) for storing a macro instruction which includes the information (a) to (e), and a micro ROM (2) for outputting to said execution unit (6) a micro instruction according to a macro instruction delivered from said instruction register (7). A method of controlling a micro processor by means of an instruction which includes an operation code (OP), first and second operand address information (EAd, EAs) and first and second size information (Sz1, Sz2), comprising the steps of reading a first operand from a memory in response to the first operand address information (EAd), reading a second operand from said memory in response to said second operand address information (EAs), and effecting an operation on said first and second operands, characterized in that the bit length of said second operand is changed in response to said first size information (Sz1) before said operation is effected. The method of claim 4, wherein said second operand is read from said memory with a length specified by said second size information (Sz2). The method of claim 4 or 5, wherein the result of said operation is written into said memory in response to said first operand address information (EAd).

Inventors: BABA, SHIRO, KURAKAZU, KEIICHI
Applicants: HITACHI, LTD.
Application year: 1986
Main classification: G06F9
IPC codes: G06F9, G06F7