Summary of the invention
(1) technical matters that will solve
At the deficiency that above-mentioned prior art exists, a fundamental purpose of the present invention is to provide a kind of the equipment that unusual multilayer nest is handled is taken place the pre-service micro-order, and what make generation is able to orderly and correct reparation unusually.
Another fundamental purpose of the present invention is to provide a kind of the method that unusual multilayer nest is handled is taken place the pre-service micro-order, and what make generation is able to orderly and correct reparation unusually.
(2) technical scheme
For achieving the above object, technical scheme of the present invention is achieved in that
A kind of the equipment that unusual multilayer nest is handled is taken place the pre-service micro-order, this equipment comprises:
Instruction fetching component be used for taking out instruction from the command high speed buffer internal memory, and the instruction that will take out sends to decoding unit;
Decoding unit is used for the abnormal information of buffer memory is deciphered, and the microinstruction address index microinstruction storage that produces by decoding obtains unusual pre-service micro-order, and the unusual pre-service micro-order that will obtain sends to emission element and instruction resequencing buffer;
Emission element, the off-the-shelf instruction of unusual pre-service micro-order data that is used for receiving sends to execution unit;
Execution unit is used to carry out the instruction that is received from emission element, and the result that will carry out writes back to the instruction resequencing buffer;
The instruction resequencing buffer is used for preserving the status information of every instruction of computer instruction streamline, and guarantees the precise abnormal of instruction, when the instruction generation is unusual abnormal information is exported to instruction fetching component, decoding unit, emission element and execution unit;
Described instruction resequencing buffer is exported to instruction fetching component with abnormal information when the instruction generation is unusual, decoding unit, emission element and execution unit, it is invalid that instruction fetching component is changed to its instruction address register and instruction output bus after receiving this abnormal information, it is invalid that decoding unit is changed to its order register, and this abnormal information is buffered in the unusual impact damper, and to the buffering abnormal information decipher the generation microinstruction address, decoding unit obtains unusual pre-service micro-order by the microinstruction address index microinstruction storage that produces, and the unusual pre-service micro-order that will obtain is given back-end component, this back-end component comprises emission element, execution unit and instruction resequencing buffer, if it is unusual that back-end component takes place when the unusual pre-service micro-order that carry out to receive once more, then back-end component is brushed the instruction pipelining of empty computing machine, the abnormal information that the decoding unit buffer memory takes place once more, and carry out above-mentioned exception handling procedure, until no abnormal generation; Back-end component redirect and execute exception handling procedure, by the time sequencing of unusual generation by the back to first one by one to repairing unusually.
Described decoding unit comprises:
Unusual impact damper is used for the abnormal information that buffer memory is received from the instruction resequencing buffer, and according to the selection signal that is received from the microcode address maker abnormal information of buffer memory is sent to the microcode address maker;
Order register is used to deposit the current opcode byte that is executing instruction;
The microcode address maker is used for from unusual impact damper and order register selection information, and the information of selecting to obtain is deciphered the generation microinstruction address, obtains micro-order by the microinstruction address index microinstruction storage that produces;
Microinstruction storage is used to store micro-order, and according to the selection signal that is received from the micro-order selector switch micro-order that microcode address maker index obtains is sent to the micro-order selector switch;
The simple instruction code translator is used for the information of order register buffer memory is deciphered, and will decipher the micro-order that produces according to the selection signal that is received from the micro-order selector switch and send to the micro-order selector switch;
The micro-order selector switch is used for selecting micro-order from microinstruction storage and simple instruction code translator, and the micro-order of selecting to obtain is sent to the micro-order maker;
The micro-order maker is used for the micro-order that is received from the micro-order selector switch is deciphered, and the micro-order after the decoding is outputed on the decoding bus.
Described microcode address maker and micro-order selector switch are No. two selector switchs, and microcode address maker priority processing selects the information obtained, micro-order selector switch priority processing to select the micro-order of obtaining from unusual impact damper from microinstruction storage.
Described emission element further comprises rename logic, is used to eliminate writing between the register and is correlated with relevant with read-write.
The quantity of described execution unit is at least one.
A kind of the method that unusual multilayer nest is handled is taken place the pre-service micro-order, this method comprises:
A, instruction resequencing buffer are preserved the status information of every instruction in the computer instruction streamline, and guarantee the precise abnormal of instruction, take place abnormal information to be exported to instruction fetching component, decoding unit, emission element and execution unit when unusual in instruction; It is invalid that decoding unit is changed to its order register after receiving this abnormal information, and this abnormal information is buffered in the unusual impact damper, and the abnormal information of buffering is deciphered the generation microinstruction address;
B, decoding unit obtain unusual pre-service micro-order by the microinstruction address index microinstruction storage that produces, and the unusual pre-service micro-order that will obtain sends to back-end component, this back-end component comprises emission element, execution unit and instruction resequencing buffer, if it is unusual that back-end component takes place when the unusual pre-service micro-order that carry out to receive once more, then execution in step C; If do not take place unusually, then execution in step D;
C, back-end component are brushed the instruction pipelining of empty computing machine, the abnormal information that the decoding unit buffer memory takes place once more, and the abnormal information that takes place once more deciphered the generation microinstruction address, then execution in step B;
D, back-end component redirect and execute exception handling procedure, by the time sequencing of unusual generation by the back to first one by one to repairing unusually.
Described step B comprises:
B1, decoding unit obtain unusual pre-service micro-order by the microinstruction address index microinstruction storage that produces, and the unusual pre-service micro-order that will obtain sends to emission element and instruction resequencing buffer;
B2, emission element send to execution unit with the unusual pre-service micro-order of DSR, and execution unit will send to the instruction resequencing buffer to the result that unusual pre-service micro-order is carried out;
B3, instruction resequencing buffer are checked the queue heads instruction that Roq_head points to, the article one of instructing resequencing buffer to utilize Roq_head to point to buffering is not herein submitted instruction to, if it is unusual that the unusual pre-service micro-order that Roq_head points to takes place, then execution in step C; If the unusual pre-service micro-order that Roq_head points to does not take place unusually, then execution in step D.
It is to send by the sequence of addresses of micro-order that the unusual pre-service micro-order that decoding unit described in the step B1 will obtain sends to emission element.
The unusual pre-service micro-order that decoding unit described in the step B1 will obtain further comprises when sending to emission element: the unusual pre-service micro-order that decoding unit will obtain leaves in the instruction resequencing buffer by the sequence of addresses of micro-order.
The instruction pipelining of the empty computing machine of described brush is meant what ream weight ordering impact damper passed through to realize to decoding unit, emission element and execution unit output abnormality information; The abnormal information that described decoding unit buffer memory takes place once more is that the abnormal information that will take place once more is buffered in the unusual buffer zone.
Described abnormal information can have error code information, and described decoding unit further is cached to error code information in the unusual buffer zone.
Described step D comprises: the instruction resequencing buffer jumps to exception handler, re-executes time profound exception handler after the exception handler of bottommost layer time executes, and carries out the exception handler of top layer time at last.
(3) beneficial effect
From technique scheme as can be seen, the present invention has following beneficial effect:
1, utilizes the present invention, when unusual multilayer nest takes place in the pre-service micro-order, by brushing the instruction pipelining of empty computing machine, redirect and execute exception handling procedure, after executing, the inferior exception handler of bottommost layer re-executes time profound exception handler, carry out the exception handler of top layer time at last, realized the processing that unusual multilayer nest carries out is taken place the pre-service micro-order, what make generation is able to orderly and correct reparation unusually.
2, utilize the present invention, owing to realized the processing that unusual multilayer nest carries out is taken place the pre-service micro-order, what make generation is able to orderly and correct reparation unusually, so can further guarantee the correct recovery of dependence between the register, and then make processor continue execution command from breakpoint, guaranteed carrying out smoothly of instruction execution.
3, utilize the present invention, a plurality of unusual for what when carrying out many micro-orders, trigger, equally can be by the instruction pipelining of the empty computing machine of brush, redirect and execute exception handling procedure, that triggers during to many micro-orders a plurality ofly repairs unusually one by one, and then realize that to a plurality ofly handling unusually that many micro-orders trigger what make generation is able to orderly and correct reparation unusually.
Embodiment
For making the purpose, technical solutions and advantages of the present invention clearer, below in conjunction with specific embodiment, and with reference to accompanying drawing, the present invention is described in more detail.
As shown in Figure 1, Fig. 1 is for according to the structured flowchart that the pre-service micro-order is taken place the equipment that unusual multilayer nest handles provided by the invention.Provided by the invention the equipment that unusual multilayer nest handles is taken place the pre-service micro-order is a central processing unit (CPU), and this CPU comprises instruction fetching component 101, decoding unit 102, emission element 103, execution unit 104 and instruction resequencing buffer (ROQ) 105.
Wherein, instruction fetching component 101 comprises order register, command high speed buffer internal memory (cache), and the instruction bypass impact damper, branch predictors etc. are specifically formed structure and can different the work be adjusted accordingly with the complexity of the system of realization.Instruction fetching component 101 is used for taking out instruction from command cache, and the instruction that will take out sends to decoding unit 102.
Decoding unit 102 is used for after the instruction that receives instruction fetching component 101 transmissions, abnormal information to buffer memory is deciphered, the microinstruction address index microinstruction storage that produces by decoding obtains unusual pre-service micro-order, and the unusual pre-service micro-order that will obtain sends to emission element 103.The structure of decoding unit 102 will describe in further detail in Fig. 2, just repeat no more here.
The off-the-shelf instruction of unusual pre-service micro-order data that emission element 103 is used for receiving sends to execution unit 104.Emission element 103 can further include rename logic, is used to eliminate writing between the register and is correlated with relevant with read-write.
Execution unit 104 is used to carry out the instruction that is received from emission element 103, and the result that will carry out writes back to ROQ 105.Generally speaking, because CPU need carry out various instruction simultaneously, and each execution unit can only be carried out one type instruction at synchronization, so the quantity of execution unit generally is at least one.
ROQ 105 is used for preserving the status information of every instruction of computer instruction streamline, and guarantees the precise abnormal of instruction, output abnormality information when the instruction generation is unusual.Whether the status information of every instruction comprises mainly whether instruction is finished, instructs and submit to etc. in the computer instruction streamline, also has for branch instruction that branch writes back, branch triggers etc.
Based on Fig. 1 is described the structured flowchart that unusual multilayer nest carries out treatment facility is taken place in the pre-service micro-order; Fig. 2 shows the structured flowchart of decoding unit 102 among Fig. 1, and this decoding unit comprises unusual impact damper (Ex_buffer) 201, order register (Ir) 202, microcode address maker (Rom_pcgenerator) 203, microinstruction storage (uROM) 204, simple instruction code translator (Simpledecoder) 205, micro-order selector switch (Micro code selecter) 206 and micro-order maker (Uopgenerator) 207.
Wherein, Ex_buffer 201 is used for the abnormal information that buffer memory is received from ROQ 105, and according to the selection signal that is received from Rom_pc generator 203 abnormal information of buffer memory is sent to Rom_pc generator 203.
Ir 202 is used to deposit the current opcode byte that is executing instruction.
Rom_pc generator 203 is used for from Ex_buffer 201 and Ir 202 selection information, and the information of selecting to obtain is deciphered the microinstruction address of generation, obtains micro-order by the microinstruction address index uROM 204 that produces.Rom_pc generator 203 is No. two selector switchs, the information that priority processing is obtained from Ex_buffer 201.
UROM 204 is used for the buffer memory micro-order, and sends to Micro code selecter206 according to the micro-order that the selection signal that is received from Micro code selecter 206 obtains microcode address maker index.
Simple decoder 205 is used for the information of Ir 202 buffer memorys is deciphered, and will decipher the micro-order that produces according to the selection signal that is received from Micro code selecter 206 and send to Microcode selecter 206.
Micro code selecter 206 is used for selecting micro-order from uROM 204 and Simple decoder 205, and the micro-order of selecting to obtain is sent to Uop generator 207.Micro codeselecter 206 is No. two selector switchs, the micro-order that priority processing is obtained from uROM 204.
Uop generator 207 is used for the micro-order that is received from Micro code selecter 206 is deciphered, and the micro-order that generates is outputed on the decoding bus (decode bus).
Based on Fig. 1 and the described structured flowchart of Fig. 2, it is as follows that the present invention to the pre-service micro-order flow process that unusual multilayer nest handles takes place: if execution unit 104 notes abnormalities in the process of implementation, then abnormal information is sent to ROQ 105 by result bus (result bus), ROQ 105 sends to decoding unit 102 by exception bus (exception bus) with abnormal information, decoding unit 102 is received and Ir 202 is put after this abnormal information invalidly, and this abnormal information is buffered among the Ex_buffer201.Clapping Rom_pc generator 203 at next selects the abnormal information of buffer memory among the Ex_buffer 201 to decipher, generate microinstruction address urom_pc, and obtain micro-order by the urom_pc index uROM204 that generates, the micro-order of obtaining sends to Uopgenerator 207 by Micro code selecter 206, and 207 pairs of micro-orders of Uop generator are further deciphered and outputed on the decode bus.If take place nestedly unusually, abnormal information can be buffered to again among the Ex_buffer 201, and abnormality processing has begun so again.What take place in the time of just can handling the unusual pre-service of complicated order according to this decoder architecture design is nested unusually.
Based on Fig. 1 is described the structured flowchart that unusual multilayer nest carries out treatment facility is taken place the pre-service micro-order, Fig. 3 shows the synoptic diagram of ROQ 105 among Fig. 1.Micro-order among the ROQ 105 is to deposit by the sequence of addresses of micro-order, and Roq_head points to the instruction of ROQ 105 queue heads, and Roq_tail points to the next item down of rear of queue.It is precise abnormal that ROQ 105 can be used for guaranteeing instructing, when a micro-order among the ROQ 105 take place unusual after, ROQ 105 issues instruction fetching component 101 with abnormal information, decoding unit 102, emission element 103 and execution unit 104 etc.
Based on Fig. 1, Fig. 2 with Fig. 3 is described that the structured flowchart that unusual multilayer nest carries out treatment facility is taken place the pre-service micro-order, Fig. 4 shows the present invention the realization flow figure that unusual multilayer nest is handled overall technological scheme is taken place the pre-service micro-order, and this method may further comprise the steps:
Step 401: micro-order takes place unusually in the process of implementation, decoding unit buffer memory abnormal information, and the abnormal information of buffer memory deciphered the generation microinstruction address;
Step 402: decoding unit obtains unusual pre-service micro-order by the microinstruction address index microinstruction storage that produces, and the unusual pre-service micro-order that will obtain sends to back-end component (this back-end component comprises emission element, execution unit and ROQ), if it is unusual that back-end component takes place when the unusual pre-service micro-order that carry out to receive once more, then execution in step 403; If do not take place unusually, then execution in step 404;
Step 403: the ROQ in the back-end component brushes the instruction pipelining of empty computing machine, the abnormal information that the decoding unit buffer memory takes place once more, and the abnormal information that takes place once more deciphered the generation microinstruction address, then execution in step 402;
Step 404: ROQ redirect in the back-end component and execute exception handling procedure, by the time sequencing of unusual generation by the back to first one by one to repairing unusually.
Above-mentioned steps 402 comprises:
Step 4021: decoding unit obtains unusual pre-service micro-order by the microinstruction address index microinstruction storage that produces, and the unusual pre-service micro-order that will obtain sends to emission element;
In this step, to send to emission element be that sequence of addresses by micro-order sends to the unusual pre-service micro-order that will obtain of decoding unit;
Further, decoding unit leaves the unusual pre-service micro-order the obtained sequence of addresses by micro-order among the ROQ in when the unusual pre-service micro-order that will obtain sends to emission element.
Step 4022: emission element sends to execution unit with the unusual pre-service micro-order of DSR, and unusual pre-service micro-order needs to carry out 1 in execution unit claps or clap more, and execution unit will send to ROQ to the result that unusual pre-service micro-order is carried out.
Step 4023:ROQ claps the unusual pre-service micro-order of checking that Roq_head points to per 1, can check preceding 4,2 or 1 instruction, and unusual if the unusual pre-service micro-order that Roq_head points to takes place, then execution in step 403; If the unusual pre-service micro-order that Roq_head points to writes back, and do not take place unusually, then execution in step 404.
In the above-mentioned steps 403, the ROQ in the described back-end component brushes the instruction pipelining of empty computing machine, is that ROQ passes through to realize to instruction fetching component, decoding unit, emission element and execution unit output abnormality information;
The abnormal information that described decoding unit buffer memory takes place once more is that the abnormal information that will take place once more is buffered in the unusual buffer zone, if abnormal information has error code information, then decoding unit further also is cached to error code information in the unusual buffer zone.
Above-mentioned steps 404 comprises: the ROQ in the back-end component jumps to exception handler, after executing, the inferior exception handler of bottommost layer re-executes time profound exception handler, carry out the exception handler of top layer time at last, so just formed a depth-first traversal, behind unusual processed the finishing of bottommost layer, the sort processor structure can trigger the unusual of time profound level, and behind all unusually all processed finishing, complicated order just can obtain carrying out.
Based on Fig. 4 is described the realization flow figure that unusual multilayer nest is handled overall technological scheme is taken place the pre-service micro-order, Fig. 5 shows three layers of nested synoptic diagram of handling is taken place the pre-service micro-order.
As can be seen from Figure 5, processor jumps to exception handler for the first time to the 3rd layer handle unusually, this 3rd layer be to produce unusually by the unusual pre-service micro-order of the second layer.After the 3rd layer unusual reparation was finished, processor turned back to breakpoint and re-executes this instruction, and the result triggers unusually once more, and this moment is because the 3rd layer unusually be repaired, triggering be the unusual of the second layer.Processor jumps to exception handler for the second time to the handling unusually of the second layer, and after the unusual reparation of the second layer was finished, processor can turn back to breakpoint and carry out the unusual instruction of this generation once more, and the result causes triggering for the third time unusually.This moment is because all being repaired unusually of the 3rd layer and the second layer, so only can trigger the unusual of ground floor.Processor jumps to exception handler for the third time to the handling unusually of ground floor, and after the unusual reparation of ground floor was finished, processor can turn back to breakpoint and carry out the unusual instruction of this generation once more, and instruction just can be smoothly by having carried out.
For the register dependence that cancellation after exception-triggered has been set up, need specify the micro-order numbering for each register relies on.Fig. 6 shows in the rename module and sets up the synoptic diagram that relies on and cancel dependence for register.As shown in Figure 6, when running into micro-order 1, logic register 1 is mapped to physical register 3; When running into micro-order 6, logic register 2 is mapped to physical register 1; When running into micro-order 8, logic register 3 is mapped to physical register 5; Because micro-order 3,4,5 and 7 does not have corresponding destination register, so micro-order 3,4,5 and 7 is not set up corresponding relation with register, micro-order 3,4 is carried out and is not write back for 5 and 7; When running into micro-order 9, logic register 1 is mapped to physical register 7, and this moment, logic register 1 shone upon two physical registers 3 and 7, and their difference is that corresponding micro-order numbering is different, promptly is respectively 2 and 9.
In Fig. 6, if a micro-order has taken place unusually, then rename module is received this abnormal information, will compare according to the unusual micro-order of dependence of having set up and generation, and will be positioned at the dependence cancellation that the micro-order foundation afterwards of unusual micro-order takes place.For example, if micro-order 8 has taken place unusually, the dependence that micro-order 9 was set up after then rename module will be cancelled is promptly cancelled the dependence of logic register 1 to physical register 7, and other dependence keeps.
Provided by the invention the method that unusual multilayer nest is handled to be taken place in the pre-service micro-order in order more clearly illustrating, to be elaborated below in conjunction with specific embodiment.
In the present embodiment, be example with the processor of x86, a lot of complicated orders is arranged in the processor of x86 series, common as the instruction of string copy, soft interruptions int n instruction, indirect jump instruction etc., these instruct pairing micro-order to be stored in a rom.Decoding unit is obtained complicated order from storer after, can remove index rom, take out micro-order and send to rename logic and emission element respectively according to the operation code field of this instruction and other the domain of dependence.
The visible general-purpose register of X86 has 8, is respectively eax, ebx, ecx, edx, esp, ebp, esi and edi, corresponds to 8 common registers of micro-order.In addition, microinstruction set also has been assigned with 24 temporary registers, and these 24 temporary registers are used for cushioning the operation result of each execution unit, comprise adding unit, multiplying unit, division parts, memory access parts etc.Because it is relevant to produce data to these 32 registers when micro-order is carried out, this being correlated with carried out rename by the rename logic of rear end, thereby eliminated the false appearance pass.Micro-order after the rename is put in the resequencing buffer according to the order of sequence.Micro-order in the resequencing buffer has three state, dummy status, and mapping status writes back state.When a certain the state in the resequencing buffer be sky, represent that this can deposit a micro-order, just be not used at present.Mapping status represents that current list item deposited a micro-order, and this micro-order is to come from the rename components, which transmits, and this instruction just carries out or just medium to be launched in scoring plug at execution unit, does not also have operation result to produce.Write back the current instruction of state representation and be finished, and execution result write in the register file, just waited for that processor does last affirmation at execution unit.
Based on Fig. 4 is described the realization flow figure that unusual multilayer nest is handled overall technological scheme is taken place in the pre-service micro-order, Fig. 7 shows according in the embodiment of the invention method flow diagram that unusual multilayer nest is handled being taken place the pre-service micro-order, may further comprise the steps:
Step 701: resequencing buffer sends to the rename parts with the micro-order that has write back of queue heads in order, and the rename parts are revised the status information of respective objects register according to the micro-order that is received from resequencing buffer;
In this step, if the micro-order of queue heads has been attached abnormal information, then to send to the information of rename parts invalid for resequencing buffer, and resequencing buffer will send to decoding unit to the micro-order of having attached abnormal information once more.
Step 702: decoding unit from receive unusual obtain unusual vector, and the unusual vector coding that will obtain is a special instruction, the instruction address at the unusual place that record takes place.
Step 703: decoding unit obtains corresponding micro-order according to special instruction index from rom that coding produces, ROQ carries out the micro-order of obtaining and obtains the exception handler address, carry out pop down again, preserve pretreatment operation such as crucial scene, change formal exception handler over to according to the exception handler address that obtains then; If taken place again unusually unusual multilayer nest to take place promptly in pop down and the crucial on-the-spot process of preservation, then execution in step 705; If unusual multilayer nest does not take place, then execution in step 704.
Step 704: the ROQ execute exception handling procedure in the back-end component to repairing unusually of taking place, and re-executes this instruction, process ends after exception handler is complete.
Step 705: the new unusual vector that the decoding unit buffering obtains, with the new unusual vector coding that obtains is a special instruction, and according to the special instruction that comes by new unusual vector coding again from rom index obtain corresponding micro-order, the micro-order of obtaining by execution obtains the exception handler address for the second time;
In this step, in the time of decoding unit buffering obtains new unusual vector, Re-Order Buffer is cleared, and other various functional parts have also all been done removing work.
Step 706: decoding unit carries out pop down, preserves pretreatment operation such as crucial scene, if taken place again unusually unusual multilayer nest to take place promptly in pop down and the crucial on-the-spot process of preservation, then execution in step 708; If unusual multilayer nest does not take place, then execution in step 707.
Step 707: decoding unit changes formal exception handler over to according to the exception handler address that obtains for the second time, to repairing unusually of taking place, and re-executes this instruction, process ends after exception handler is complete.
Step 708: decoding unit continues execution in step 705 and 706, until unusual multilayer nest no longer takes place, changes formal exception handler over to, to repairing unusually of taking place, and re-executes this instruction after exception handler is complete.
In the present embodiment, processor is to handle with following order execute exception: can re-execute the exception handler of inferior profound level after the exception handler of bottommost layer time executes, carry out the exception handler of top layer time at last.
In illustrated embodiment step 701 of the present invention, the micro-order that resequencing buffer will attach abnormal information sends to decoding unit.In actual applications, the micro-order that to attach abnormal information at resequencing buffer sends to decoding unit simultaneously, can further the micro-order of having attached abnormal information be sent to the rename parts, the rename parts can be analyzed the abnormal information that receives, and then all dependences of once setting up of instruction back, cancellation abnormal information place.The technical scheme of being lifted in such technical scheme and the embodiment of the invention is consistent on thinking, should be included within protection scope of the present invention.
Above-described specific embodiment; purpose of the present invention, technical scheme and beneficial effect are further described; institute is understood that; the above only is specific embodiments of the invention; be not limited to the present invention; within the spirit and principles in the present invention all, any modification of being made, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.