Summary of the invention
In view of this, the present invention proposes a kind of method of state machine equivalence transformation, with to the various state machine design equivalence transformation rule meeting equivalence transformation rule, improves state machine splicing scope and correctness.
To achieve these goals, as one aspect of the present invention, the present invention proposes a kind of method of state machine equivalence transformation, comprise the following steps:
Step 1, is initialized to tree-like two-dimensional structure by the status block of state machine;
Step 2, reads the state extracting mode of a state machine and state machine, selects output or reverse according to state extracting mode to state machine; Extract if extracting mode is forward, then input state machine is put into the input of step 3, jump to step 3; If extracting mode is reverse extraction, then status block is put into the input of step 2.1, invocation step 2.1, status block step 2.1 returned replaces the previous status block in state machine, and new state machine is put into the input of step 3, jumps to step 3;
Step 2.1, is denoted as head region by the territory, tail region of input state machine, is territory, tail region by acron domain identifier simultaneously;
Wherein, if current main areas is nested loop blocks, then by the status block in nested loop blocks, inverted sequence, and to each status block invocation step 2.1, replace the previous status block in nested loop blocks with the status block returned; If current main areas is not nested loop blocks, then by state transposes all in status block in main areas;
Status block after adjustment is exported, turns back to that call ought in the previous step of up till now step;
Step 3, reads the first status block of an input state machine, judges the type of this status block, and jumps in the step of corresponding state bulk state extraction; Wherein
If current state block is order block, then jump to step 4;
If current state block is loop blocks, then jump to step 5;
If current state block is nested loop blocks, then jump to step 6;
Step 4, receives an order status block and length to be extracted as input, extracts a specified quantity state and be placed in head region, and revise length to be extracted from input sequence build portion; State machine after extracting is exported, jumps to step 8;
Step 5, receives a loop blocks and length to be extracted as input, judges length to be extracted and loop blocks internal state quantity and territory, tail region number of states, extracts the state of specified quantity;
Sub-step 5.0, the length in territory, computation cycles block tail region, and judge current the need of extraction loop blocks;
Sub-step 5.1, forms a new order block in order, this order block is put into the head in territory, tail region, the cycle index of loop blocks is added 1, jumps to sub-step 5.2 by inner for loop body all states;
Sub-step 5.2, if length to be extracted is more than or equal to loop blocks internal state quantity, is then put into the afterbody extracting region, and quantity to be extracted is deducted loop blocks internal state quantity, jump to step 8 by order block first in territory, tail region; If length to be extracted is less than loop blocks internal state quantity, then the order block in territory, tail region is merged in order an order block, then from the order block merged, extract a length to be extracted state of head, form a new order block and put into the afterbody extracting region, empty territory, tail region, if status number is not 0 in the order block after extracting, then the order block after extraction is put into territory, tail region.Jump to sub-step 5.3;
Sub-step 5.3, takes out the afterbody of the state in loop blocks that is put into, forms a circulating rolling, and length to be extracted is set to 0, jump to sub-step 8 by length to be extracted for head in a loop blocks state;
Step 6, receives nested loop blocks and length to be extracted as input, extracts a specified quantity state, export the combination that can be used for the status block that state machine splices from the nested loop blocks head of input;
Sub-step 6.0, if territory, tail region is empty, then skips to sub-step 6.1; If territory, tail region non-NULL, then skip to sub-step 6.2;
Sub-step 6.1, extracts all status blocks in nested loop blocks, is placed in territory, tail region in order, the cycle index of nested loop blocks is added 1, jumps to sub-step 6.2;
Sub-step 6.2, the territory, tail region of nested loop blocks is taken out, form a new state machine, using length to be extracted and new state machine as input, recursive call this method, all status blocks in the head region of the first status block of the state machine returned are taken out, puts into the afterbody extracting region, jump to sub-step 6.3;
Sub-step 6.3, status blocks all in nested loop blocks are taken out, the state machine that composition one is new in order, length to be extracted and new state machine are as input, recursive call this method, takes out status blocks all in the head region of the first status block of the state machine returned after last status block being put into the state machine returned, and replaces all status blocks in nested loop blocks with the status block in this state machine, and length to be extracted is set to 0, jump to step 8;
Step 8, if current length to be extracted is not 0, then using current state machine and length to be extracted as the input of step 3, jump to step 3, otherwise jump to step 9;
Step 9, will extract region, be placed into the afterbody of first status block head region; If former extracting mode is reverse extraction, first status block is put into the input of step 2.1, invocation step 2.1, status block step 2.1 returned replaces the previous status block in state machine, and the method terminates; Otherwise the method terminates.
Wherein, described step 1 comprises:
For each status block of input state machine, judge whether it has been two-dimensional structure, is namely made up of head region, main areas and territory, tail region, and if so, then this state machine is the state machine having participated in equivalence transformation, jumps to step 2; If not, then for status block builds the two-dimensional structure in a head region, main areas and territory, tail region, previous status block is put into main part, and sky is put in head region and territory, tail region, if status block is nested loop blocks, builds two-dimensional structure to each status block in status block;
Jump to step 2.
Wherein, described in step 4, a reception order status block and length to be extracted are as input, extract a specified quantity state and be placed in head region, and the feature revising the step of length to be extracted is from input sequence build portion:
If length to be extracted is less than or equal to the status number in order block, extract from status block beginning, from current state block first state, extract a specified quantity state in order, be a new order status block these status mergings, this status block is placed in and extracts region afterbody; Extract remaining part as new order status block, replace previous status block.Length to be extracted is set to zero.
If length to be extracted is more than or equal to the status number in order block, whole order block is placed in and extracts region afterbody, delete this status block in state machine, and length to be extracted is deducted the status number in order block.
As another aspect of the present invention, the invention allows for a kind of equivalence transformation device of state machine, comprising:
First and second state machine registers 1,9, for receiving and the head region in memory mapping process, main areas and territory, tail region;
Status block type judging module 3, achieves the alternative types determining step in state machine equivalence transformation method; This module reads the status block to be transformed that the first state machine reverse module 2 exports, and according to execution result, status block is exported to order block extraction module 6, one of loop blocks extraction module 7 or nested loop blocks extraction module 8;
The reverse module 2,10 of first and second state machines, achieve state machine reverse step, the reverse module of wherein said first state machine 2 reads initial input state machine and length to be extracted, for the treatment of first time state machine backward conversion when oppositely extracting; The reverse module of described second state machine 10 is connected with described second state machine registers 9 and status block storehouse 4, the state machine backward conversion that the state machine for realizing oppositely extracting when exporting carries out, and after step is finished, export sliceable state machine;
Status block storehouse 4, with the reverse module of described first and second state machine 2,10, extraction module 5 is connected, and for main state machine equivalence transformation step provides the storehouse memory function of status block, assisted the shift step performed in these modules;
Extraction module 5, contains order block extraction module 6, loop blocks extraction module 7, nested loop blocks extraction module 8; Wherein said order block extraction module 6 achieves order bulk state extraction step, and described loop blocks extraction module 7 achieves loop blocks extraction step, and described nested loop blocks extraction module 8 achieves nested loop blocks extraction step; Described extraction module 5 by as a whole to connect described status block storehouse 4 for three dissimilar status block extraction module set, and carried out the storage of status block by described status block storehouse 4 and is called; The Output rusults of described extraction module 5 is stored in described second state machine registers 9.
Wherein, described first and second state machine registers 1,9 are designed to the memory module of tree-like two-dimensional structure.
Wherein, described status block storehouse 4 is the stack register of storage status block, and inner is basic unit of storage with status block, achieves the storage organization such as storehouse, queue that status block stores.
Wherein, described equivalence transformation device is realized by C++ programming language, is applicable to x86 or MIPS processor system.
Wherein, described equivalence transformation device carries out hardware implementing by verilog, as independently transplantable pipeline configuration module.
Known based on technique scheme, method of the present invention, as the important submethod in state machine joining method, greatly can improve scope and the correctness of state machine splicing.Meanwhile, formal argument and the analysis of other similar program segments and code segment can also be applied to.
Embodiment
For making the object, technical solutions and advantages of the present invention clearly understand, below in conjunction with specific embodiment, and with reference to accompanying drawing, the present invention is described in further detail.
The invention discloses a kind of method and apparatus of state machine equivalence transformation.The basic mode of state machine equivalence transformation of the present invention is before a status block (forward extraction) or (oppositely extract) combination of extracting a length to be extracted state and forming new status block and being extracted status block below.When the method forward extracts, still consistent with virgin state block after the head of the status block be extracted from the stateful connection extracted above; When oppositely extracting, the stateful connection extracted from behind is still consistent with virgin state block after the afterbody of the status block be extracted.
State machine equivalence transformation method of the present invention comprises the following steps: state machine pre-treatment step, status block reverse step, alternative types determining step, order bulk state extraction step, loop blocks state extraction step, nested loop blocks state extraction step, iteration determining step and output step.Respectively it is described in detail below in conjunction with accompanying drawing 18.
Step 1, state machine pre-treatment step
The status block of state machine is initialized to tree-like two-dimensional structure by this step mule.The feature of this step is each status block for input state machine, judge whether it has been two-dimensional structure, is namely made up of head region, main areas and territory, tail region, if, then this state machine is the state machine having participated in this method equivalence transformation, jumps to step 2; If not, then for status block builds the two-dimensional structure in a head region, main areas and territory, tail region, previous status block is put into main part, and sky is put in head region and territory, tail region, if status block is nested loop blocks, builds two-dimensional structure to each status block in status block.
After pre-service completes, jump to step 2.
Step 2, status block reverse step
The effect of this step is reversed by the first status block of state machine, and the mode that the status block of output can extract according to forward carries out equivalence transformation, then reverses, and reaches the object oppositely extracted.This step reads the state extracting mode (forward extracts or oppositely extracts) of a state machine and state machine, selects output or reverse according to state extracting mode to state machine.
Extract if extracting mode is forward, then input state machine is put into the input of step 3, jump to step 3.
If extracting mode is reverse extraction, then status block is put into the input of step 2.1, invocation step 2.1, status block step 2.1 returned replaces the previous status block in state machine, and new state machine is put into the input of step 3, jumps to step 3.
Step 2.1, state machine backward step
The territory, tail region of input state machine is denoted as head region, is territory, tail region by acron domain identifier simultaneously.
By the status block in current head region, inverted sequence, and to each status block invocation step 2.1, with the previous status block in the status block replacement head region returned.
If current main areas is nested loop blocks, then by the status block in nested loop blocks, inverted sequence, and to each status block invocation step 2.1, replace the previous status block in nested loop blocks with the status block returned; If current main areas is not nested loop blocks, then by state transposes all in status block in main areas.
By the status block in territory, current tail region, inverted sequence, and to each status block invocation step 2.1, replace the previous status block in territory, tail region with the status block returned.
Status block after adjustment is exported, turns back to that call ought in the previous step of up till now step.
Step 3, alternative types determining step
This step reads the first status block of an input state machine, judges the type of this status block, and jumps in the step of corresponding state bulk state extraction.
If current state block is order block, then jump to step 4.
If current state block is loop blocks, then jump to step 5.
If current state block is nested loop blocks, then jump to step 6.
Step 4, order bulk state extraction step
This step receives an order status block and length to be extracted as input, extracts a specified quantity state and is placed in head region, and revise length to be extracted from input sequence build portion.The feature of this step is:
If length to be extracted is less than or equal to the status number in order block, extract from status block beginning, from current state block first state, extract a specified quantity state in order, be a new order status block these status mergings, this status block is placed in and extracts region afterbody; Extract remaining part as new order status block, replace previous status block.Length to be extracted is set to zero.
If length to be extracted is more than or equal to the status number in order block, whole order block is placed in and extracts region afterbody, delete this status block in state machine, and length to be extracted is deducted the status number in order block.
State machine after extracting is exported, jumps to step 8.
Step 5, loop blocks state extraction step
This step receives a loop blocks and length to be extracted as input, judges length to be extracted and loop blocks internal state quantity and territory, tail region number of states, extracts the state of specified quantity.
Sub-step 5.0, tail region length of field judge sub-step
The length in this territory, sub-step computation cycles block tail region, (in the territory, tail region of loop blocks, only should comprise order block), and judge current the need of extraction loop blocks.It is characterized by: the status number in order blocks all in territory, tail region is added up as the length in territory, tail region, if tail region length of field is more than or equal to length to be extracted, then jumps to sub-step 5.2, otherwise jump to sub-step 5.1
Sub-step 5.1, single-wheel circulation extract sub-step
Inner for loop body all states are formed in order a new order block, this order block is put into the head in territory, tail region, the cycle index of loop blocks is added 1, jumps to sub-step 5.2.
Sub-step 5.2, tail extracted region sub-step
If length to be extracted is more than or equal to loop blocks internal state quantity, then order block (length is loop blocks internal state quantity necessarily) first in territory, tail region is put into the afterbody extracting region, and quantity to be extracted is deducted loop blocks internal state quantity, jump to step 8.
If length to be extracted is less than loop blocks internal state quantity, then the order block in territory, tail region is merged in order an order block, then from the order block merged, extract a length to be extracted state of head, form a new order block and put into the afterbody extracting region, empty territory, tail region, if status number is not 0 in the order block after extracting, then the order block after extraction is put into territory, tail region.Jump to sub-step 5.3.
Sub-step 5.3, loop blocks rolling sub-step
Length to be extracted for head in a loop blocks state is taken out the afterbody of the state in loop blocks that is put into, form a circulating rolling, and length to be extracted is set to 0.Jump to sub-step 8.
Step 6, nested loop blocks state extraction step
This step receives nested loop blocks and length to be extracted as input, extracts a specified quantity state, export the combination that can be used for the status block that state machine splices from the nested loop blocks head of input.
Sub-step 6.0, tail region decision sub-step
If territory, tail region is empty, then skip to sub-step 6.1;
If territory, tail region non-NULL, then skip to sub-step 6.2.
Sub-step 6.1, the nested loop blocks of single-wheel extract sub-step
Extract all status blocks in nested loop blocks, be placed in territory, tail region in order, the cycle index of nested loop blocks is added 1, jumps to sub-step 6.2.
Sub-step 6.2, nested extraction sub-step
The territory, tail region of nested loop blocks is taken out, form a new state machine, using length to be extracted and new state machine as input, recursive call this method, all status blocks in the head region of the first status block of the state machine returned are taken out, puts into the afterbody extracting region.Jump to sub-step 6.3.
Sub-step 6.3, nested rolling sub-step
Status blocks all in nested loop blocks are taken out, the state machine that composition one is new in order, length to be extracted and new state machine are as input, recursive call this method, status blocks all in the head region of the first status block of the state machine returned are taken out after last status block being put into the state machine returned, and all status blocks replaced with the status block in this state machine in nested loop blocks, and length to be extracted is set to 0.Jump to step 8.
Step 8, iteration determining step
If current length to be extracted is not 0, then using current state machine and length to be extracted as the input of step 3, jump to step 3, otherwise jump to step 9.
Step 9, output step
To region be extracted, be placed into the afterbody of first status block head region.
If former extracting mode is reverse extraction, first status block is put into the input of step 2.1, invocation step 2.1, status block step 2.1 returned replaces the previous status block in state machine, and the method terminates; Otherwise the method terminates.
State machine equivalence transformation device
State machine equivalence transformation device of the present invention as shown in Figure 1.Comprise the first and second state machine registers 1 and 9, the reverse module of status block type judging module 3, first and second state machine 2 and 10, status block storehouse 4, extraction module 5, order block extraction module 6, loop blocks extraction module 7, nested loop blocks extraction module 8.
This device inputs state machine to be transformed and extracts length, performs whole state machine equivalence transformation methods, and exports sliceable state machine.
First and second state machine registers 1 and 9 are for receiving and memory state machine.These registers are designed to the memory module of tree-like two-dimensional structure, for the head region in memory state machine conversion process, main areas and territory, tail region.Each region can both store one or more complete status block respectively.First and second state machine registers 1 are connected with the reverse module of the first and second state machines 2 and 10, order block extraction module 6, loop blocks extraction module 7, nested loop blocks extraction module 8 with 9, perform the storage of regional state machine in step and call for these modules.
Status block storehouse 4 is the stack register of storage status block, and inner is basic unit of storage with status block, achieves the storage organization such as storehouse, queue that status block stores.Status block storehouse 4 is connected with the reverse module 2 and 10 of the first and second state machines, extraction module 5, for main state machine equivalence transformation step provides the storehouse memory function of status block, has assisted the shift step performed in these modules.
The reverse module 2 and 10 of first and second state machines achieves the state machine reverse step in the method, and wherein the reverse module of the first state machine 2 reads initial input state machine and length to be extracted, for the treatment of first time state machine backward conversion when oppositely extracting.The reverse module 10 of second state machine is connected with the second state machine registers 9 and status block storehouse 4, the state machine backward conversion that the state machine for realizing oppositely extracting when exporting carries out, and exports sliceable state machine after step mule is finished.
Status block type judging module 3 achieves the alternative types determining step in state machine equivalence transformation method.This module reads the status block to be transformed that the first state machine reverse module 2 exports, and according to execution result, status block is exported to order block extraction module 6, one of loop blocks extraction module 7 or nested loop blocks extraction module 8.
Extraction module 5 contains order block extraction module 6, loop blocks extraction module 7, nested loop blocks extraction module 8.Wherein order block extraction module 6 achieves the order bulk state extraction step in state machine equivalence transformation method of the present invention, loop blocks extraction module 7 achieves the loop blocks extraction step in the method, and nested loop blocks extraction module 8 achieves the nested loop blocks extraction step in the method.Extraction module 5 by as a whole with connection status block storehouse 4 for three dissimilar status block extraction module set, and carried out the storage of status block by status block storehouse 4 and is called.The Output rusults of extraction module 5 is stored in the second state machine registers 9.
The sliceable state machine that this device exports generally comprises three status blocks, and these status blocks meet sliceable rule, can be used for follow-up state machine joining method or re-start state machine equivalence determination methods.
Said apparatus is realized by C++ programming language, goes for the processor systems such as x86, MIPS, for realize dynamically can the configuration of reprovision streamline and download work.This device also can carry out hardware implementing by verilog, as independently transplantable pipeline configuration module.
Below in conjunction with specific embodiment, the invention will be further elaborated.
Embodiment 1:
Recurrent state block as shown in Figure 2, once complete circulation comprises 3 states, and cycle index is N, and it is the status block of 2 that forward extracts length.
The first step: step 1, state machine pre-treatment step
Being input as 1 recurrent state block, is not two-dimensional structure.For status block builds a head region, a main areas, territory, a tail region, former recurrent state block is put into main areas, and sky is put in head region and territory, tail region, as shown in Figure 3.
Second step: step 2, status block reverse step
Extracting mode is that forward extracts, and input state machine is put into the input of step 3, jumps to step 3.
3rd step: step 3, alternative types determining step
Read the first status block of input state machine, current state block is loop blocks, jumps to step 5.
4th step: step 5, loop blocks state extraction step
This step receives the loop blocks of input, and length to be extracted is 2.
Sub-step 5.0 tail region length of field judges sub-step
Territory, current tail region is empty, and length is 0, is less than length to be extracted, skips to sub-step 5.1.
Sub-step is extracted in sub-step 5.1 single-wheel circulation
Inner for loop body all states are formed in order a new order block, this order block is put into the head in territory, tail region, the cycle index of loop blocks adds 1 (loop body global cycle number of times subtracts 1), as shown in Figure 4.Jump to sub-step 5.2.
Sub-step 5.2, tail extracted region sub-step
Length to be extracted is 2, and loop blocks internal state quantity is 3, and length to be extracted is less than loop blocks internal state quantity.2 states of head are extracted from the order block in territory, tail region, form a new order block and put into the afterbody extracting region, empty territory, tail region, in the order block after extraction, status number is 1, order block (only having a state A3) after extracting is put into territory, tail region, as shown in Figure 5.Jump to sub-step 5.3.
Sub-step 5.3 loop blocks rolling sub-step
2 states of head in loop blocks are taken out the afterbody of the state in loop blocks that is put into, form a circulating rolling, and length to be extracted is set to 0, as shown in Figure 6.Jump to sub-step 8.
5th step: step 8, iteration determining step
Current length to be extracted is 0, jumps to step 9.
6th step: step 9, output step
Now extract region and comprise an order status block, it has 2 state A1 and A2.Extraction zone state block is placed into the afterbody of first status block head region; Second status block is a recurrent state block, and internal state is followed successively by A3, A1, A2, and cycle index is 9; 3rd status block is territory, tail region status block, comprises a state A3.Export this 3 status blocks, as shown in Figure 7.The method terminates.
Embodiment 2:
Nested recurrent state block as shown in Figure 8, once complete circulation comprises 1 order status block and a recurrent state block, and this recurrent state block cycle index is M, and nested loop blocks cycle index is N, and it is the status block of 2 that forward extracts length.
The first step: step 1, state machine pre-treatment step
Being input as 1 nested recurrent state block, is not two-dimensional structure.For status block builds a head region, a main areas, territory, a tail region, former nested recurrent state block is put into main areas, and sky is put in head region and territory, tail region.
Because this status block is nested loop blocks, two-dimensional structure is built to each status block in status block.First two-dimensional structure is built to internal sequence block A1: for order block builds a head region, a main areas, territory, a tail region, order block is put into main areas, and sky is put in its head region and territory, tail region.Again two-dimensional structure is built to the recurrent state block of inside: for loop blocks builds a head region, a main areas, territory, a tail region, this loop blocks is put into main areas, and sky is put in its head region and territory, tail region.
Pre-service completes, as shown in Figure 9.Jump to step 2.
Second step: step 2, status block reverse step
Extracting mode is that forward extracts, and input state machine is put into the input of step 3, jumps to step 3.
3rd step: step 3, alternative types determining step
Read the first status block of input state machine, current state block is nested loop blocks, jumps to step 6.
4th step: step 6, nested loop blocks state extraction step
This step receives the input of nested loop blocks, and length to be extracted is 2.
Sub-step 6.0, tail region decision sub-step
The territory, tail region of current nested loop blocks is empty, skips to sub-step 6.1;
Sub-step 6.1, the nested loop blocks of single-wheel extract sub-step
Extract all status blocks in nested loop blocks, be placed in territory, tail region in order, the cycle index of nested loop blocks is added 1, as shown in Figure 10.Jump to sub-step 6.2.
Sub-step 6.2, nested extraction sub-step
Taken out in the territory, tail region of nested loop blocks, form a new state machine, this state machine is guaranteed replacement an order block A1 and loop blocks A2A3.Using length 2 to be extracted and new state machine as input, recursive call this method.
The recurrence first step: step 1, state machine pre-treatment step
Be input as 1 order status block and a recurrent state block, these two status blocks are all two-dimensional structures.Jump to step 2.
Recurrence second step: step 2, status block reverse step
Extracting mode is that forward extracts, and input state machine is put into the input of step 3, jumps to step 3.
Recurrence the 3rd step: step 3, alternative types determining step
The first status block reading input state machine is order block, jumps to step 4.
Recurrence the 4th step: step 4, order bulk state extraction step
This step receives order status block A1, and its length is 1, and length to be extracted is 2.Length to be extracted is more than or equal to the status number in order block, and all order block A1 is placed in and extracts region afterbody, deletes this status block in state machine, and length to be extracted is deducted the status number 1 in order block, and current length to be extracted is 1.State machine after extracting is exported, as shown in figure 11.Jump to step 8.
Recurrence the 5th step: step 8, iteration determining step
Current length to be extracted is not 0, using current state machine and length to be extracted 1 as the input of step 3, jumps to step 3.
Recurrence the 6th step: step 3, alternative types determining step
The first status block reading input state machine is loop blocks, jumps to step 5.
Recurrence the 7th step: step 5, loop blocks state extraction step
The loop blocks that this step receives is A2A3, and cycle index is 5, and length to be extracted is 1.
Sub-step 5.0, tail region length of field judge sub-step
Territory, current tail region is empty, and length is 0, is less than length 1 to be extracted, jumps to sub-step 5.1.
Sub-step 5.1, single-wheel circulation extract sub-step
Inner for loop body all states are formed in order a new order block, this order block is put into the head in territory, tail region, the cycle index of loop blocks is added 1, as shown in figure 12.Jump to sub-step 5.2.
Sub-step 5.2, tail extracted region sub-step
Length to be extracted is 1, be less than loop blocks internal state quantity 2,1 state of head will be extracted in order block in territory, tail region, put into the afterbody extracting region, empty territory, tail region, in order block after extraction, status number is not 0, then the order block A3 after extraction is put into territory, tail region, as shown in figure 13.Jump to sub-step 5.3.
Sub-step 5.3, loop blocks rolling sub-step
1 state of head in loop blocks is taken out the afterbody of the state in loop blocks that is put into, form a circulating rolling, and length to be extracted is set to 0.Previous cycle block is A3A2, and cycle index is M-1, as shown in figure 14.Jump to sub-step 8.
Recurrence the 8th step: step 8, iteration determining step
Current length to be extracted is not 0, jumps to step 9.
Recurrence the 9th step: step 9, output step
Extraction zone state block A1A2 is placed into the afterbody of first status block head region.Former extracting mode is that forward extracts, and recursion method terminates.Exporting first status block is order block A1A2, and second status block is loop blocks A3A2, and cycle index is M-1, and the 3rd status block is A3, as shown in figure 15.Return to recursive call position.
4th step: step 6, nested loop blocks state extraction step
The nested extraction sub-step of sub-step 6.2
Recursive call returns, and the first status block returned is order block A1A2, and it is taken out the afterbody put into and extract region.Jump to sub-step 6.3.
The nested rolling sub-step of sub-step 6.3
Taken out by status blocks all in nested loop blocks, the state machine that composition one is new in order, it comprises a block A1 and loop blocks A2A3 in proper order, and cycle index is 5.Recursive call this method, is input as this state machine, and length to be extracted is 2.This recursive call process is with once identical before.The first status block of the state machine returned is order block A1A2, it is taken out after last status block being placed on return state machine, and replaces all status blocks in nested loop blocks with the status block in this state machine.All status blocks in current nested loop blocks are successively: loop blocks A3A2, and cycle index is 4; Order block A3; Order block A1A2.Length to be extracted is set to 0, as shown in figure 16.Jump to step 8.
5th step: step 8, iteration determining step
Current length to be extracted is 0, jumps to step 9.
6th step: step 9, output step
Zone state block A1A2 will be extracted, be placed into the afterbody of first status block head region.Extracting mode is that forward extracts, and the method terminates.The state machine of final output as shown in figure 17.
Above-described specific embodiment; object of the present invention, technical scheme and beneficial effect are further described; be understood that; the foregoing is only specific embodiments of the invention; be not limited to the present invention; within the spirit and principles in the present invention all, any amendment made, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.