Microprocessor having predecoder unit and main decoder unit operating in pipeline processing manner

Abstract: Microprocessor (100) having an instruction decoding operation that is performed by a predecoder unit (130) and a main de­ coder unit (150) which operates in a pipeline manner by pro­ viding between those two units a buffer (140) for temporarily storing information from the predecoder unit (130).

Description: BACKGROUND OF THE INVENTION The present invention relates to a microprocessor and, more particularly, to an improvement in instruction decoder unit of a pipelined microprocessor. A pipelined microprocessor is constructed basically of six units: a bus control unit (BCU) for initiating a bus cycle to perform an instruction fetch operation and operand data read/write operation, an instruction prefetch unit (PFU) for requesting an instruction fetch bus cycle to BCU to prefetch instructions, an instruction decoder unit (IDU) for decoding the instruction from PFU and generating data processing information necessary for instruction execution and operand access information necessary for an operand data access, an effective address generator unit (EAG) for calculating an effective address in response to the operand access information, a memory management unit (MMU) for translating the effective address into a real address and requesting an operand data access to BCU, and an instruction execurtion unit (EXU) for executing an instruction in response to the data processing information from IDU. These units operate in parallel in a predetermined pipeline processing manner. In a recent year, a microprocess has been required to facilitate software programming. For this purpose, an abundance of instruction formats are prepared, and moreover it is supported that an independent addressing mode can be designated to respective operands. Also in the addressing mode, there are prepared a plenty of addressing modes such as direct/indirect modes, displacement modes, indexed modes and so forth. However, the support of abundant instruction formats and addressing modes causes an instruction decoding time being prolonged. Specifically, IDU decodes an instruction to be executed and generates the data processing information and the operand access information in accordance with the decoding sequence determined by the format and the operand addressing mode of that instruction. Therefore, the support of many instruction formats and operand addressing modes prolongs a time for decoding and detecting the format and the operand addressing mode of an instruction to be executed to determine the decoding sequence. The generation of the data processing information and the operand access information is thereby delayed to disturb the pipeline processing operation. The execution efficiency of the microprocessor is thus lowered. A microprocessor characterized in that an instruction decoding operation is performed by a predecoder unit and a main decoder unit which cperate in a pipeline manner by providing between those two units a buffer for temporarily storing information from the predecoder unit is disclosed in EP-A-0 336 091 (Art.54(3)). An object of the present invention is to provide a microprocessor supporting abundant instruction formats and operand addressing modes without lowering an instruction decoding speed. This object is attained by the microprocessor defined in the appended claim. The predecoder unit of the claimed microprocessor includes first and second predecoder respectively receiving an operation code (called hereinafter "OP-code") field and an addressing field of an instruction to be executed. The first predecoder predecodes the OP-code field and produces OP-code information representative of the number of bytes of the OP-code field and the number of operands to be processed. The second predecoder predecodes the addressing field and produces addressing mode information representative of the number of bytes of the operand and the addressing mode designated to the operand. The OP-code information and the addressing mode information are temporarily stored in the buffer. The buffer also stores the OP-code and addressing fields of the instruction, and further stores displacement data and immediate data of the instruction. The main decoder unit determines the decoding sequence to be preformed in response to the OP-code information and the addressing mode information from the buffer, and performs the decoding operation on other information from the buffer to generate data processing information and operand access information in accordance with the determined decoding sequence. During the decoding operation of the main decoder unit, the predecoder unit is performing the predecoding operation on a second operand or an instruction to be next executed. That is, the present invention is based upon the finding that the decoding operation on an instruction consists in general of a first operation of detecting the format and the operand addressing mode of the instruction and a second operation of generating decoded instruction information in response to the decoding sequence determined by the detected result in the first step, and thus allots the first and second steps respectively to the predecoder unit and the main decoder unit which operate in a pipelined manner. Accordingly, the first operation is performed in parallel with the second operation, so that the operation time of the predecoder unit is put out of sight by the operation time of the main decoder unit. The whole pipeline processing operation of the microprocessor is thus hardly disturbed to enhance the program execution efficiency thereof. BRIEF DESCRIPTION OF THE DRAWINGS The above and other object, advantages and features of the present invention will be more apparent from the following description taken in conjunction with the accompanying drawings, in which: Fig. 1 is a block diagram representative of an embodiment of the present invention; Fig. 2 is a block diagram representative of constructions of PFU, PDU, BFF and MDU shown in Fig. 1; Fig. 3 is a timing chart for explaining an operation of the circuit shown in Fig. 2; Fig. 4 is a block diagram representative of PFU according to another embodiment of the present invention; Fig. 5 is a timing chart for explaining an operation of the circuit shown in Fig. 4; and Figs. 6A and 6B are format diagrams indicative of two examples of instructions. DETAILED DESCRIPTION OF THE EMBODIMENTS Referring now to Fig. 1, a microprocessor 100 according to an embodiment of the present invention includes a bus control unit (BCU), 110 which initiates a bus cycle onto a system bus 190 interconnected with a memory and peripheral I/O units (not shown) and fetches instructions and reads and writes operand data. An instruction prefetch unit (PFU) 120 includes a prefetch address pointer (not shown) and issues an instruction prefetch request including the content of this pointer to BCU 110 through a bus 1201. The prefetched instructions from BCU 110 are transferred via an instruction bus 1101 to PFU 120 and temporarily stored therein. PFU 120 aligns the OP-code and the operand(s) of the prefetched instruction and outputs them onto a bus 1202. The information on the bus 1202 is supplied to a predecoder unit (PDU) 130 provided in accordance with the present invention. PDU 130 predecodes the OP-code and generates OP-code information indicative of the byte length of the OP-code and the number of operands to be processed. Moreover, PDU 130 predecodes the operand(s) and generates addressing mode information indicative of the byte length of the operand and a designated addressing mode. The OP-code information and the addressing mode information are transferred onto a bus 1302 and temporarily stored in a buffer (BFF) 140 together with other information on the bus 1202. The contents of BFF 140 are supplied to a main decoder unit (MDU) 150 via a bus 1401. MDU 150 determines decoding sequence in response to the OP-code information and the addressing mode information and performed a decoding operation in accordance with the determined decoding sequence to generate operand access information 1502 for accessing the operand and data processing information 1501 for executing the required instruction. The operand access information 1502 is supplied to an effective address generator unit (EAG) 160 which calculates and produces an effective address 1601 of the operand data. The effective address 1601 is supplied to a memory management unit (MMU) 170 and then translated into a read address. MMU 170 informs MDU 150 of the completion of the address translation through a signal 1702. MMU 170 further issues an operand access request to BCU 110 by supplying the real address. The data processing information 1501 from MDU 150 is supplied to an execution control unit (EXU) 180 which thus executes the required instruction or data process with receiving or transferring operand data from or to BCU 110 via a bus 1801. These units, BCU 110, PFU 120, PDU 130, MDU 150, EAG 160, MMU 170 and EXU 180, operates in parallel in a pipelined manner. Turning to Fig. 2, there are shown internal block constructions of PFU 120, PDU 130, BFF 140 and MDU 150. If should be noted that there are shown only parts related to the present invention in order to avoid the complication of the drawing. The instruction bus 1101 from BCU 110 has a 32-bit length (i.e., a 4-byte length), and hence the instruction data having four bytes is prefetched by one prefetch operation and then transferred onto the bus 1101. The bus 1101 is connected in common to four pockets (INSQ0 to INSQ3) 121-1 to 121-4 of an instruction queue 121, each of which has a 4-byte memory capacity. The instruction data of 4-byte from the bus 1101 is thus stored temporarily into one of the instruction queue pockets INSQ0-3 designated by queue pointer information 1241 generated by a queue controller 124. The queue pockets INSQ0-3 are designated in that order. For example, when the first queue pocket INSQ0 stores unprocessed instruction data, the instruction data on the bus 1101 is stored into the second queue pocket INSQ1. The contents of the queue pockets INSQ0-3 are tied up into instruction data 122 of a 16-byte length and then supplied to an instruction aligner 123. This aligner 123 includes an OP-code field output bus 126 of a 2-byte length, an addressing field output bus 127 of a 2-byte length and a data output bus 128 of a 4-byte length. The total byte length of one instruction including an OP-code field and an operand field is not constant, but is changed within a range from few bytes to ten and several bytes in dependence on the required data processing operation and/or the addressing mode of the operand(s). Therefore, the instruction aligner 123 responds to aligning pointer information 1251 from a aligner controller 125 and aligns the instruction data on the bus 122 such that the OP-code field, the addressing field and the displacement or immediate data of an instruction to be executed are transferred onto the buses 126, 127 and 128, respectively. These buses 126 to 128 correspond to the bus 1202 shown in Fig. 1. The OP-code data on the bus 126 and the addressing field data on the bus 127 are supplied to an OP-code field (OPF) predecoder 131 and an addressing field (AF) predecoder 132 of PDU 130, respectively. In response to the OP-code field data, OPF predecoder 131 produces OP-code information 133 representative of the byte length of the OP-code field and the number of operands to be processed. AF predecoder 132 produces addressing mode information 134 representative of the byte length of the operand and the addressing mode designated thereto in response to the addressing field. These sets of information 133 and 134 are supplied to the aligner controller 125 and the queue controller 124 of PFU 120. In response to the sets of information 133 and 134, the aligner controller 125 generates the aligning pointer information 1251 for controlling the positions and the number of the byte data to be outputted by the instruction aligner 123, and the queue controller 124 generates the queue pointer information 1241 for controlling the queue pocket INSQ into which the instruction data are stored from the bus 1101. The OP-code information 133 and the addressing mode information 134 are temporarily stored into buffer registers (BFFR1 and BFFR3) 141 and 143, respectively. The OP-code field and the addressing field outputted from the aligner 123 are further transferred to BFF 140 via branch buses 1261 and 1271 and then temporarily stored in BFFR2 and BFFR4, respectively. The displacement data or the immediate data from the aligner 123 is supplied via the bus 128 to BFF 140 and then temporarily stored in BFFR5 thereof. The buses for information 133 and 134, the branch buses 1261 and 1271 and the bus 128 correspond to the bus 1302 shown in Fig. 1. The data stored in BFFR1 and BFFR2, i.e. the CP-code information 133 and the addressing mode information 134, are supplied to a decoding sequence controller 151 of MDU 150. The controller 151 thus determines immediately the decoding sequence to be performed since the information 133 and 134 has the above-mentioned contents, and then produces the determined sequence information 1511 and 1512. The sequence information 1511 is supplied to an OPF main decoder 152 which also receives the OP-code field data from BFFR2. Accordingly, the decoder 152 generates data processing information 1501 necessary for instruction execution and supplies it to EXU 180. The addressing field data from BFFR4 is supplied to an AF main decoder 153 and the displacement or immediate data from BFFR5 is supplied to an operand access information generator 154. These units 153 and 154 operates in accordance with the addressing sequence information 1512 and thus generates the operand access information 1502 which is in turn supplied to EAG 160. As mentioned above, the whole byte length of an instruction to be executed changes in dependence on the required data processing operation and the addressing mode designated to the operand(s) to be processed. Two examples representative of different instruction formats are shown in Figs. 6A and 6B. The instruction shown in Fig. 6A is a 2-operand instruction 500 having a first operand to which a displacement mode is designated as an addressing mode and a second operand to which a displacement indexed mode is designated as an addressing mode. In detail, this instruction 500 is composed of the OP-code field 501 of 2-byte length, a first operand addressing mode (OPND1-AM) field 502 of 1-byte length, displacement data 503 of 4-byte length, a second operand (OPND2) index field 504 of 1-byte length, an AM mode field 505 of 1-byte length and displacement data 506 of 2-byte length, and thus has 11-byte length in total. The instruction shown in Figs. 6B is a 1-operand instruction 550 in which a displacement indexed mode is designated as addressing mode for one operand. This instruction 550 is composed of an OP-code field 510 of 1-byte length, an index field 511 of 1-byte length, an AM field 512 of 1-byte length and displacement data of 4-byte length, and thus has 7-byte length in total. Next, an operation will be made below with reference to Figs. 1, 2 and 6 and further to Fig. 3 showing a timing chart. Assume that the instructions 500 and 550 shown in Fig. 6 are stored into the instruction queue 121. However, since the instruction queue 121 is of 16-byte length in total, the lower order two-type data of the displacement 513 of the instruction 550 is not yet stored in the queue 121. Since the previous instruction has been already transferred PDU 130, the aligner controller 125 controls the aligning pointer information 1251 such that the instruction aligner 123 outputs the first and second byte data of 16-byte instruction data 122 onto the bus 126 and the third and fourth byte data thereof onto the bus 127. That is, the OP-code field 501 of the instruction 500 is outputted onto the bus 126 and OPND1-AM field 502 and the first byte of the displacement data 503 are outputted onto the bus 127 during a first clock 1 ○ of a system clock shown in Fig. 3. In response thereto, OPF predecoder 131 produces the OP-code information 133 and AF predecoder 132 produces the addressing mode information 134. The OP-code information 133 represents that the instruction 500 has an OP-code field of 2-byte length and two operands. The addressing mode information 134 represents that the first operand has a displacement mode addressing and the displacement data has 4-byte length. It is noted that the first byte of the displacement 503 supplied to AF predecoder 132 is ignored. In response to those contents of the information 133 and 134, the aligner controller 125 controls the content of the pointer information 1251 such that the instruction aligner 123 outputs the fourth to seventh byte of the 16-byte instruction data 122 onto the bus 128 during the next clock 2 ○, and the queue controller 124 controls the contents of the pointer information 1241 such that new instruction data are allowed to be stored into the first to third byte positions of the queue pocket INSQ0. In response to the beginning of the clock 2 ○, the information 133 and 134 and the field data 501 and 502 from PDU 130 are stored into the corresponding buffer registers BFFR of BFF 140. On the other hand, the instruction aligner 123 outputs the displacement data 503 of 4-byte length onto the bus 128. During this clock 2 ○, MDU 150 performs the decoding operation in accordance with the decoding sequence information determined by the sequence controller 151. Thus, OPF main decoder 152 produces the data processing information 1501 representative of the required operation on two operand data, and AF main decoder 153 advances the access information generating operation to a state in which only the displacement 503 is required to complete the generation of the operand access information 1502. The aligner controller 125 controls the content of the pointer information 1251 such that the instruction aligner 123 outputs the ninth and tenth byte of the instruction data 122 onto the bus 127 during a next clock 3 ○. When the clock 3 ○ appears, the displacement data 503 is stored in BFFR5, so that MDU 150 completes the generation of the operand access information 1502 for the first operand data, the information 1502 being in turn transferred to EAG 160. On the other hand, OPND2 index field data 504 and AM field data 505 are outputted onto the bus 127 from the aligner 123. Therefore, AF predecoder 132 produces the addressing mode information 134 representing that the addressing mode of the second operand is a displacement indexed mode and the displacement data has 2-byte length. In a clock 4 ○, MDU 150 starts to generate the access information for the second operand data, and the instruction aligner 123 outputs the displacement data 506 onto the bus 128. During a next clock 5 ○, the displacement data 506 is supplied to MDU 150 via BFFR5, and hence the operand access information 1502 for the second operand data is generated and supplied to EAG 160. When the instruction aligner 123 outputs the displacement data 506, the aligning operation for the instruction 500 is completed. Therefore, the aligner controller 125 controls the pointer information 1251 to cause the instruction aligner 123 to output the twelfth and thirteenth byte data of the instruction data 122 onto the bus 126 and the fourteenth and fifteenth byte data thereof onto the bus 127, respectively, during the clock 5 ○. Thus, the OP-code field 510 and the index field 511 of the instruction 510 are supplied to the OPF predecoder 131 and the AM field 512 and the first byte of the displacement 513 are supplied to AF predecoder 132. The information 133 from OPF predecoder 131 represents that the OP-code field has 1-byte length and the number of operand data is one. Accordingly, the aligner controller 125 detects that the index field 511 is not supplied to AF predecoder 132, and thus controls the pointer information 1251 to cause the instruction aligner 123 to output the fields 511 and 512 onto the bus 127 in a next clock 6 ○. On the other hand, the OPF main decoder 152 performs the decoding operation during the clock 6 ○, so that the data processing information 1501 for the instruction 550 is generated. When a next clock 7 ○ appears, the addressing mode information 134 from AF predecoder 132 and field data 511 and 512 are supplied to MDU 150. The information 134 represents that the displacement data 513 has 4-byte length. In addition, the instruction prefetch operation by PFU 120 has been performed during clocks 3 ○ to 6 ○, so that the remaining two byte data of the displacement 513 has been already stored in the first and second byte positions of the queue pocket INSQ0. Accordingly, all the four byte data of the displacement 513 are outputted from the aligner 123 during the clock 7 ○, so that the operand access information for the operand data of the instruction 550 is generated in a next clock 8 ○. Thus, although the decoding sequence and the control to the instruction aligner 123 are changed in dependence on the format and the operand addressing mode of an instruction to be executed, PDU 140 releases MDU 150 from decoding of the instruction format and the operand addressing mode and from the control of the aligner 123. Moreover, PDU 140 and MDU 150 operate in a pipelined manner by providing BFF 140 therebetween. Accordingly, the operation by PDU 140 can be put out of sight in a whole decoding operation. A high speed decoding operation is thus performed. In the above embodiment, the field data 511 and 512 of the instruction 550 are outputted twice from the instruction aligner 123, as described in the operation concerning clocks 5 ○ and 6 ○. If such a construction is realized that the decoding operation of the instruction 505 is completed by outputting the field data 511 and 512 from the aligner 123 only once, the decoding speed is further enhanced. The construction for this purpose is shown in Fig. 4 as another embodiment of the present invention, in which the same constituents as those shown in Fig. 2 are denoted by the same reference numerals to omit the further description thereof. In this embodiment, it is utilized that the first 3 bits of the OP-code of the instruction having 1-byte length OP-code are all "1". Specifically, a pattern detector 400 is provided to be connected to the instruction bus 1101. This detector 400 detects whether or not the first 3 bits of the respective byte data are all "1". When the first 3 bits are all "1", the detector 400 sets the corresponding bit of a flag register 401 to "1". On the other hand, in case where at least one of the 3 bits is "0", the detector 400 resets the corresponding bit of the register 401 to "0". The flag register 401 is thus of a 16-bit construction. The content of the register 401 is supplied to a flag aligner 402 which also receives the pointer information 1251. In response to the content of the pointer information 1251, the aligner 402 selects one bit of the register 401 and outputs the selected bit data. In other words, the flag aligner 402 outputs the data of one bit of the register 401 which bit corresponds the position of the byte data of the 16-byte data 122 outputted onto the first byte bus 126-7 of the bus 126 by the instruction aligner 123. For example, when the instruction aligner 123 outputs the twelfth byte data of the instruction data 122 onto the bus 126-1, the flag aligner 402 outputs the twelfth bit data of the flag register 401. The second byte bus 126-2 of the bus 126 and the first byte bus 127-1 of the bus 127 are coupled to a multiplexer (MPX) 404, and the first and second byte buses 127-1 and 127-2 of the bus 127 are coupled to a multiplexer (MPX) 405. The outputs from MPXs 404 and 405 are tied us as the addressing field output bus 127 coupled to PDU 130. MPXs 404 and 405 are controlled by the data 403 from the flag aligner 402. When this data 403 takes "1", MPXs 404 and 405 select the buses 126-2 and 127-1, respectively. When the data 403 is "0", the buses 127-1 and 127-2 are selected by MPXs 404 and 405, respectively. An operation timing chart according to this embodiment is shown in Fig. 5 in comparison with that shown in Fig. 3 according to the previous embodiment. When the OP-code field data 501 of the instruction 500 is outputted onto the bus 126 at the clock 1 ○, the flag aligner 402 outputs the data 403 of "0", since the OP-code field 501 has 2-byte length. Accordingly, outputted onto the bus 127 are AM field data 502 and the first byte of the displacement data 503. Thus, the aligning operation and the decoding operation with respect to the instruction 500 are identical in both embodiments. On the other hand, when the OP-code field data 510 of the instruction 550 is outputted onto the bus 126-1 at the clock 5 ○, the flag aligner 402 outputs the data 403 of "1". Accordingly, the index field data 511 on the bus 126-2 is transferred as a first byte data onto the bus 127 via MPX 404, and the AM field data 512 on the bus 127-1 is transferred as a second byte data onto the bus 127 via MPX 405. These field data 511 and 512 are thereby supplied to AF predecoder 132. As a result, the displacement data 513 is outputted from the aligner 123 at the clock 6 ○, and the decoding operation for the instruction 550 is completed at the clock 7 ○. Thus, the decoding speed is further enhanced.

Claims: A microprocessor (100) having an instruction decoder unit which decodes an instruction to be executed and generates data processing information for executing said instruction and operand access information for accessing operand data of said instruction, said instruction decoder unit comprising a predecoder unit (130) receiving data of an operation code field and an addressing mode field of said instruction and generating operation code information relative to a format of said instruction and addressing mode information relative to an addressing mode designated to operand data to be processed, buffer means (140) coupled to receive in parallel said operation code information and said addressing mode information for temporarily storing and outputting in parallel said operation code information and said addresing mode information, a main decoder unit (150) receiving in parallel information outputted in parallel from said buffer means and generating said processing information and said operand access information in response thereto, said predecoder unit and said main decoder operating in a pipelined manner, an instruction aligner (123), said instruction aligner having an input bus (122) receiving said instruction and further having first, second and third output buses (126, 127, 128), said instruction further including a constant field, said instruction aligner (123) aligning said instruction to output the data of said operation code field, the data of said addressing mode field and the data of said constant field of said instruction onto said first, second and third buses, respectively, said precoder unit including first and second decoders (131, 132), said first decoder (131) coupled to said first bus (126) for decoding the data of said operation code field to produce said operation code information (133) that represents at least the byte length of said operation code field and the number of operands to be processed, said second decoder (132) coupled to said second bus for decoding the data of said addressing mode field to produce said addressing mode information (154) that represents at least the byte length of the operand and the addressing mode designated to said operand, said buffer being coupled to said third bus to store the data of said constant field, being supplied to an aligner controller (125) controlling said instruction aligner (123) for aligning the instruction data on said input bus (122) such that said operation code field, said addressing field and said displacement or immediate data of said instruction are transferred on said first, second and third output busses (126, 127, 128) respectively.

Inventors: SUZUKI NARIKO, SUZUKI, NARIKO, SUZUKI, NARIKO, C/O NEC CORPORATION
Applicants: NIPPON ELECTRIC CO, NEC CORPORATION
Application year: 1990
Main classification: G06F9
IPC codes: G06F9