CN104572028A - Equivalent transformation method and device of finite state machine - Google Patents

Equivalent transformation method and device of finite state machine Download PDF

Info

Publication number
CN104572028A
CN104572028A CN201410836231.6A CN201410836231A CN104572028A CN 104572028 A CN104572028 A CN 104572028A CN 201410836231 A CN201410836231 A CN 201410836231A CN 104572028 A CN104572028 A CN 104572028A
Authority
CN
China
Prior art keywords
state machine
block
status
state
status block
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201410836231.6A
Other languages
Chinese (zh)
Other versions
CN104572028B (en
Inventor
王磊
杨磊
谢少林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Silang Technology Co ltd
Original Assignee
Institute of Automation of Chinese Academy of Science
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Institute of Automation of Chinese Academy of Science filed Critical Institute of Automation of Chinese Academy of Science
Priority to CN201410836231.6A priority Critical patent/CN104572028B/en
Publication of CN104572028A publication Critical patent/CN104572028A/en
Priority to PCT/CN2015/094489 priority patent/WO2016101726A1/en
Application granted granted Critical
Publication of CN104572028B publication Critical patent/CN104572028B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline, look ahead

Abstract

The invention discloses an equivalent transformation method and device of a finite state machine. The equivalent transformation method includes a transformation type judgment step, a sequence block state extraction step, a circulating block state extraction step and a nested loop block state extraction step. The equivalent transformation device of the state machine is capable of receiving one or more state block inputs conforming to the equivalent transformation rules, executing all steps of the equivalent transformation method and outputting state blocks conforming to combinable rules. The equivalent transformation method is an important sub-method in the state machining splicing method, and splicing range and accuracy of the state machine can be greatly improved. Meanwhile, the equivalent transformation method and device can also be applied to transformation and analysis of other similar program sections and code sections.

Description

A kind of method and apparatus of state machine equivalence transformation
Technical field
The present invention relates to digital integrated circuit field, relate more specifically to a kind of method and apparatus of state machine equivalence transformation, with the development difficulty of the circuit complexity and configurator that reduce dynamic and configurable streamline.
Background technology
Streamline and be a kind of digital integrated circuit form generally applied by the annexation between each pipelining-stage and pipelining-stage on state machine control flow check waterline.Such as, in the streamline of instruction, the network processing unit streamline of handle packet, the streamline of base band signal process etc.Instruction flow line line technology refers to a kind for the treatment of technology that many effects of overlappings carry out operating when program performs, and Command Resolution is become the different stages by it, allows circuit can utilize hardware resource more fully according to the operation of specifying.
Dynamically can reprovision pipelining make hardware circuit controlled more flexibly, its essence be the behavior with each state machine on program description streamline.State machine corresponds to each functional unit in circuit, can manipulate hardware resource easily by Programming and configuration state machine.Then, when circuit is comparatively complicated, the design of state machine and configuration just become extremely complicated.
The form of, state machine comparatively complicated when the function that state machine realizes and type more time, can run in state machine splicing that a lot of complicated situation causes cannot direct splicing.The splicing situation of such as recurrent state block and order status block, and the splicing situation etc. of recurrent state block and nested recurrent state block.At this moment need specifically to fix a price conversion to state machine, the state machine after converting can be spliced, and the function that state machine realizes is constant.
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.
Accompanying drawing explanation
Fig. 1 is the structural representation of state machine equivalence transformation device of the present invention;
Fig. 2 is the schematic diagram of the embodiment of the present invention 1 input state block;
Fig. 3 is the schematic diagram of the embodiment of the present invention 1 step 1 status block;
Fig. 4 is the schematic diagram of the embodiment of the present invention 1 step 5.1 status block;
Fig. 5 is the schematic diagram of the embodiment of the present invention 1 step 5.2 status block;
Fig. 6 is the schematic diagram of the embodiment of the present invention 1 step 5.3 status block;
Fig. 7 is the schematic diagram of the embodiment of the present invention 1 step 9 output state machine;
Fig. 8 is the schematic diagram of the embodiment of the present invention 2 input state block;
Fig. 9 is the schematic diagram of the embodiment of the present invention 2 first step status block;
Figure 10 is the schematic diagram of the embodiment of the present invention 2 sub-step 6.1 status block;
Figure 11 is the schematic diagram of the embodiment of the present invention 2 recurrence the 4th step status block;
Figure 12 is the schematic diagram of the embodiment of the present invention 2 sub-step 5.1 status block;
Figure 13 is the schematic diagram of the embodiment of the present invention 2 sub-step 5.2 status block;
Figure 14 is the schematic diagram of the embodiment of the present invention 2 sub-step 5.3 status block;
Figure 15 is the schematic diagram of the embodiment of the present invention 2 recurrence the 9th step status block;
Figure 16 is the schematic diagram of the embodiment of the present invention 2 sub-step 6.3 status block;
Figure 17 is the schematic diagram of the embodiment of the present invention 2 step 9 output state machine;
Figure 18 is the process flow diagram of state machine equivalence transformation method of the present invention.
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.

Claims (8)

1. a method for state machine equivalence transformation, comprises 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.
2. the method for state machine equivalence transformation according to claim 1, wherein said 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.
3. the method for state machine equivalence transformation according to claim 1, wherein a reception order status block and length to be extracted described in step 4 are as input, extracts a specified quantity state from input sequence build portion and be placed in head region, and the feature revising the step of length to be extracted 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.
4. an equivalence transformation device for 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 reverse module of the first state machine (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 of first and second state machines (2,10), 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), for the state machine backward conversion that the state machine realizing oppositely extracting when exporting carries out, and after step is finished, export sliceable state machine;
Status block storehouse (4), be connected with the reverse module of described first and second state machine (2,10), extraction module (5), for main state machine equivalence transformation step provides the storehouse memory function of status block, assist 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, 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).
5. the equivalence transformation device of state machine according to claim 4, wherein said first and second state machine registers (1,9) are designed to the memory module of tree-like two-dimensional structure.
6. the equivalence transformation device of state machine according to claim 4, the stack register that wherein said status block storehouse (4) is storage status block, inner is basic unit of storage with status block, achieves the storage organization such as storehouse, queue that status block stores.
7. the equivalence transformation device of state machine according to claim 4, wherein said equivalence transformation device is realized by C++ programming language, is applicable to x86 or MIPS processor system.
8. the equivalence transformation device of state machine according to claim 4, wherein said equivalence transformation device carries out hardware implementing by verilog, as independently transplantable pipeline configuration module.
CN201410836231.6A 2014-12-26 2014-12-26 A kind of method and apparatus of state machine equivalence transformation Active CN104572028B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201410836231.6A CN104572028B (en) 2014-12-26 2014-12-26 A kind of method and apparatus of state machine equivalence transformation
PCT/CN2015/094489 WO2016101726A1 (en) 2014-12-26 2015-11-12 Equivalent transformation method and device for state machine

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410836231.6A CN104572028B (en) 2014-12-26 2014-12-26 A kind of method and apparatus of state machine equivalence transformation

Publications (2)

Publication Number Publication Date
CN104572028A true CN104572028A (en) 2015-04-29
CN104572028B CN104572028B (en) 2017-06-20

Family

ID=53088205

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410836231.6A Active CN104572028B (en) 2014-12-26 2014-12-26 A kind of method and apparatus of state machine equivalence transformation

Country Status (2)

Country Link
CN (1) CN104572028B (en)
WO (1) WO2016101726A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016101726A1 (en) * 2014-12-26 2016-06-30 中国科学院自动化研究所 Equivalent transformation method and device for state machine

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6233544B1 (en) * 1996-06-14 2001-05-15 At&T Corp Method and apparatus for language translation
CN101196810A (en) * 2006-12-08 2008-06-11 中颖电子(上海)有限公司 Built-in equipment operation method
CN102110437A (en) * 2009-12-14 2011-06-29 英特尔公司 Methods and systems to traverse graph-based networks
US20110276934A1 (en) * 2010-05-06 2011-11-10 Synopsys, Inc. Formal equivalence checking between two models of a circuit design using checkpoints

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4528728B2 (en) * 2006-01-31 2010-08-18 株式会社東芝 Digital circuit automatic design apparatus, automatic design method, and automatic design program
US7624075B2 (en) * 2006-09-15 2009-11-24 Microsoft Corporation Transformation of modular finite state transducers
US7627541B2 (en) * 2006-09-15 2009-12-01 Microsoft Corporation Transformation of modular finite state transducers
CN104572028B (en) * 2014-12-26 2017-06-20 中国科学院自动化研究所 A kind of method and apparatus of state machine equivalence transformation

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6233544B1 (en) * 1996-06-14 2001-05-15 At&T Corp Method and apparatus for language translation
CN101196810A (en) * 2006-12-08 2008-06-11 中颖电子(上海)有限公司 Built-in equipment operation method
CN102110437A (en) * 2009-12-14 2011-06-29 英特尔公司 Methods and systems to traverse graph-based networks
US20110276934A1 (en) * 2010-05-06 2011-11-10 Synopsys, Inc. Formal equivalence checking between two models of a circuit design using checkpoints

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016101726A1 (en) * 2014-12-26 2016-06-30 中国科学院自动化研究所 Equivalent transformation method and device for state machine

Also Published As

Publication number Publication date
CN104572028B (en) 2017-06-20
WO2016101726A1 (en) 2016-06-30

Similar Documents

Publication Publication Date Title
CN101661384B (en) Microprocessor and microprocessor method
CN102508635A (en) Processor device and loop processing method thereof
CN103942083B (en) A kind of compiling implementation method towards variable ginseng function
CN103942081A (en) Method for generating IL instruction lists of PLC ladder diagrams
CN107515739B (en) Method and device for improving code execution performance
CN115098412A (en) Peripheral access controller, data access device and corresponding method, medium and chip
CN104503733A (en) Merging method and device for state machine
CN104346132A (en) Control device applied to running of intelligent card virtual machine and intelligent card virtual machine
CN103793208B (en) The data handling system of vector dsp processor and coprocessor Collaboration
CN104572028A (en) Equivalent transformation method and device of finite state machine
CN103941627B (en) Conversion methods of the SFC to ladder diagram in a kind of programming based on PLC
CN101295239A (en) Instruction execution method of Java card virtual machine
CN109656641A (en) A kind of operating system and method for multilayer circulation program
CN114579141A (en) Method and device for converting require frame into VUE frame
CN104615443B (en) MCU Instruction extended method and system
CN111401020A (en) Interface loading method and system and computing equipment
CN106325973B (en) The interpret-execution method and device of virtual machine instructions
CN110427210A (en) A kind of fast construction method and device of storm topology task
CN113469327B (en) Integrated circuit device for performing rotation number advance
JP3495230B2 (en) Emulation processing method
CN113469328B (en) Device, board, method and readable storage medium for executing revolution passing
CN117271424B (en) Processing device and processing method based on multimode fusion computing framework
CN102930322A (en) Smart card and method for processing instructions
CN113590194B (en) Method for transplanting and cutting execution components crossing instruction sets
CN115250251B (en) Transmission path planning method and device in network-on-chip simulation, electronic equipment and computer readable storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20171204

Address after: 102412 Beijing City, Fangshan District Yan Village Yan Fu Road No. 1 No. 11 building 4 layer 402

Patentee after: Beijing Si Lang science and Technology Co.,Ltd.

Address before: 100190 Zhongguancun East Road, Beijing, No. 95, No.

Patentee before: Institute of Automation, Chinese Academy of Sciences

CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: 201306 building C, No. 888, Huanhu West 2nd Road, Lingang New District, China (Shanghai) pilot Free Trade Zone, Pudong New Area, Shanghai

Patentee after: Shanghai Silang Technology Co.,Ltd.

Address before: 102412 room 402, 4th floor, building 11, No. 1, Yanfu Road, Yancun Town, Fangshan District, Beijing

Patentee before: Beijing Si Lang science and Technology Co.,Ltd.