A virtual interface chip data analysis method and device based on state machine migration
By simplifying data transmission behavior into write and read operations and building a finite state machine, the confusion problem in interface chip data parsing is solved, and efficient and accurate real-time data parsing is achieved.
Patent Information
- Application Number
- CN202411666005.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2044-11-20
AI Technical Summary
Existing interface chip data analysis methods are prone to confusion during data operations, have low analysis efficiency and accuracy, and are difficult to meet real-time interpretation requirements.
The data transmission behavior is simplified into write and read operations, and a finite state machine is constructed. The conditions and actions of the state machine are used to parse the data in real time, including multiple states, conditions and actions. The data is parsed by determining the step to which it belongs through state transition.
It realizes real-time analysis of data, improves analysis efficiency and accuracy, avoids data confusion, and meets real-time interpretation needs.
Smart Images

Figure CN119597677B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of signal processing technology, and in particular to a virtual interface chip data parsing method and device based on state machine migration. Background Art
[0002] In the construction of some onboard control software test environments, the data paths that need to be completed are: (1) the processor sends data to the bus through the interface chip, which is a write operation; (2) the processor reads data on the bus through the interface chip, which is a read operation. All data transmission between the processor and the bus is completed through the interface chip, which is equivalent to the data transmission medium. Only by clarifying the specific ownership of each data in the interface chip can further data analysis be completed.
[0003] The existing interface chip data parsing method is mainly based on the feature word method, that is, first obtain all the data written to the interface chip data register, then find the feature word from the obtained data set, distinguish different operation types and data attribution based on the feature word, and then realize data parsing. However, this method has the following disadvantages: (1) When the specific data read and written are the same as the read and write feature words, confusion is easy to occur and further distinction is required, and the parsing efficiency and accuracy are low. (2) After the data operation is completed, this data parsing method classifies the acquired data set according to the feature word, and then confirms the specific meaning of the data under different types of operations. The real-time performance is poor, the parsing work lags, and it is difficult to meet the real-time interpretation requirements.
[0004] Therefore, there is an urgent need for a virtual interface chip data parsing method and device based on state machine migration. Summary of the Invention
[0005] The present invention provides a virtual interface chip data analysis method and device based on state machine migration, which can perform real-time data analysis with high analysis efficiency and accuracy. The technical solution is as follows:
[0006] On the one hand, a virtual interface chip data parsing method based on state machine migration is provided, the method comprising:
[0007] In response to data transmission between the processor and the bus based on the virtual interface chip, the data transmission behavior is simplified into a write operation and a read operation; the write operation and the read operation respectively include a plurality of steps performed in sequence, each of the steps being used to write data to a data register of the interface chip;
[0008] Based on the steps of the write operation and the read operation, a finite state machine is constructed; the finite state machine includes multiple states, multiple conditions, and multiple actions; each state corresponds to one of the steps, each condition is determined based on the category, atomicity, randomness, and timing of each step, each condition is used for transitions between corresponding states, and each action is used to change a corresponding condition;
[0009] For each data written into the data register, the step to which the data belongs is determined based on the data and the state of the finite state machine at a previous moment, so that the data is parsed based on the step to which it belongs.
[0010] On the other hand, a virtual interface chip data parsing device based on state machine migration is provided, the device comprising:
[0011] a simplification unit, configured to, in response to data transmission between the processor and the bus based on the virtual interface chip, simplify the data transmission behavior into a write operation and a read operation; the write operation and the read operation respectively include a plurality of steps executed in sequence, each of the steps being configured to write data to a data register of the interface chip;
[0012] a construction unit, configured to construct a finite state machine based on the steps of the write operation and the read operation; the finite state machine comprising a plurality of states, a plurality of conditions, and a plurality of actions; each state corresponding to a step, each condition being determined based on the category, atomicity, randomness, and timing of each step, each condition being used for transitioning between corresponding states, and each action being used for changing a corresponding condition;
[0013] The parsing unit is used to determine, for each data written into the data register, the step to which the data belongs based on the data and the state of the finite state machine at a previous moment, so as to parse the data based on the step to which the data belongs.
[0014] On the other hand, a computer device is provided, which includes a memory and a processor, wherein the memory is used to store computer programs, and the processor is used to execute the computer programs stored in the memory to implement the steps of the above-mentioned virtual interface chip data parsing method based on state machine migration.
[0015] On the other hand, a computer-readable storage medium is provided, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the virtual interface chip data parsing method based on state machine migration are implemented.
[0016] On the other hand, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the above-mentioned virtual interface chip data parsing method based on state machine migration are implemented.
[0017] The embodiment of the present invention provides a virtual interface chip data parsing method based on state machine migration, which simplifies the data transmission behavior into write operations and read operations, and equates each step to each state of a finite state machine, so that the data parsing process can be abstracted into a finite state machine, so as to utilize the transfer conditions between different states to parse the interface chip data. Since the transfer conditions include not only the categories of each step (such as feature words), but also the atomicity, randomness and timing of each step, the parsing errors caused by data confusion are avoided, and the parsing efficiency and accuracy are greatly improved. In addition, the method does not need to perform feature word recognition and data parsing after the data transmission is completed, which solves the problem of real-time parsing of interface chip data and meets the real-time interpretation requirements. It can be seen that the present application can perform real-time parsing of data with high parsing efficiency and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0019] Figure 1 This is a flow chart of a virtual interface chip data parsing method based on state machine migration provided by one embodiment of the present invention;
[0020] Figure 2 This is a structural diagram of a virtual interface chip data parsing device based on state machine migration provided by one embodiment of the present invention;
[0021] Figure 3 This is a hardware architecture diagram of a computer device provided by one embodiment of the present invention;
[0022] Figure 4 This is a state transition diagram provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0024] The specific implementation of the above concept is described below.
[0025] Please refer to Figure 1 , an embodiment of the present invention provides a virtual interface chip data parsing method based on state machine migration, the method comprising:
[0026] Step 100, in response to data transmission between the processor and the bus based on the virtual interface chip, simplifying the data transmission behavior into a write operation and a read operation; the write operation and the read operation each include a plurality of steps performed in sequence, each step being used to write data to a data register of the interface chip;
[0027] Step 102: Construct a finite state machine based on each step of the write operation and the read operation. The finite state machine includes multiple states, multiple conditions, and multiple actions. Each state corresponds to a step, and each condition is determined based on the category, atomicity, randomness, and timing of each step. Each condition is used to transition between corresponding states, and each action is used to change the corresponding condition.
[0028] Step 104 : For each data written into the data register, the step to which the data belongs is determined based on the data and the state of the finite state machine at the previous moment, so as to parse the data based on the step to which it belongs.
[0029] In an embodiment of the present invention, by simplifying the data transmission behavior into write operations and read operations, and equating each step to each state of a finite state machine, the data parsing process can be abstracted into a finite state machine, so that the interface chip data can be parsed using the transfer conditions between different states. Since the transfer conditions include not only the categories of each step (such as feature words), but also the atomicity, randomness and timing of each step, the parsing errors caused by data confusion are avoided, and the parsing efficiency and accuracy are greatly improved. In addition, the method does not need to perform feature word recognition and data parsing after the data transmission is completed, which solves the problem of real-time parsing of interface chip data and meets the real-time interpretation requirements. It can be seen that the present application can perform real-time parsing of data with high parsing efficiency and accuracy.
[0030] Described below Figure 1 How to perform the steps shown.
[0031] First, for step 100, in response to data transmission between the processor and the bus based on the virtual interface chip, the data transmission behavior is simplified into write operations and read operations; the write operation and the read operation respectively include multiple steps executed in sequence, and each step is used to write data to the data register of the interface chip.
[0032] In this step, the data transmission behavior between the processor and the bus is simplified and decomposed, and then refined after being classified into read and write. Among them, the write operation can be subdivided into 3 steps, and the read operation can be subdivided into 2 steps. The steps in the write operation and the read operation are executed in sequence.
[0033] In some embodiments, the write operation includes at least a first step, a second step, and a third step executed in sequence; the first step is to write a first feature word into the data register of the interface chip; the second step is to write the address of the data to be written into the data register of the interface chip; and the third step is to write the data to be written into the data register of the interface chip.
[0034] In some embodiments, the read operation includes at least a fourth step and a fifth step executed sequentially; the fourth step is writing the second signature word into the data register of the interface chip; the fifth step is writing the address of the data to be read into the data register of the interface chip.
[0035] It should be noted that the steps of the write operation and the read operation can be expanded as needed to include more or fewer steps, and this application does not make specific limitations. For example, the read operation can also include steps such as reading data from the interface chip data register.
[0036] Then, for step 102, a finite state machine is constructed based on the various steps of the write operation and the read operation, including:
[0037] A1, abstract each step of the write operation and the read operation into a state of a finite state machine;
[0038] A2, based on the category, atomicity, randomness, and timing characteristics of each step, determines multiple conditions that cause transitions between various states of the finite state machine. The categories include read operations and write operations. Atomicity means that no write operation or read operation can be interrupted before completion. Randomness means that after any write operation or read operation is completed, there is no restriction on the category of another new operation. The timing characteristic is that each step of the read operation and the write operation is executed in their respective order.
[0039] A3, based on the differences between the conditions, determine the actions that will change the conditions.
[0040] In step A1, one step corresponds to one state. When the write operation and the read operation include five steps, the finite state machine includes at least five states: the first state to the fifth state. The first state to the fifth state correspond to the first step to the fifth step, respectively, as shown in Table 1:
[0041] Table 1. Correspondence between each step and each state of the finite state machine
[0042]
[0043]
[0044] In some embodiments, step A2 comprises:
[0045] B1, abstracts the conditions for transitions between various states into the first, second, and third categories. The first category is the signature of read and write operations, the second category is the flag of the current operation, and the third category is the timing flag of read and write operations. The sub-conditions in each category are shown in Table 2:
[0046] Table 2 Three types of condition sets
[0047]
[0048] B2, select the corresponding sub-conditions from the three types of conditions and combine them to construct all the transition conditions between various states and delete redundant conditions to obtain the unique conditions that make the finite state machine transition between various states.
[0049] In step B1, the first category is used to distinguish between write and read operations; the second category is the flag to which the current operation belongs, that is, whether the current operation belongs to a read operation step or a write operation step. This flag is used to ensure the atomicity of the read or write operation and ensure that the read and write operations are not interrupted before completion. The third category is the timing flag for the read and write operations. That is, instead of using the specific data information in the operation steps, the timing is used to distinguish, avoiding data confusion and also facilitating the expansion of versatility. In actual applications, different bus operation protocols require their own signatures, and the specific steps of the read and write operations may vary. However, the present invention does not focus on the specific content of the read and write operation steps, but instead lists the timing flags of the various steps according to the timing relationship, and relies on the timing flags to obtain the step attribution. Therefore, when parsing chip interface data for different buses, it is only necessary to maintain the first and second categories for different virtual interface chip read and write specifications, and only expand the third category according to actual conditions.
[0050] In step B2, according to the condition classification in Table 2, the corresponding sub-conditions are selected in each category to construct all the migration conditions between the five states. After combining and removing the redundancy, the final transition condition is formed. Based on each condition, the current data state can be accurately obtained, and the state information is uniquely determined.
[0051] In some embodiments, the finite state machine includes at least first to fifth states, first to fifth conditions, and first to fifth actions;
[0052] The first to fifth states correspond to the first to fifth steps respectively;
[0053] The transition relationship between each state includes: based on the first condition, the state machine is transitioned from the initial state to the first state; based on the second condition, the state machine is transitioned from the first state to the second state; based on the third condition, the state machine is transitioned from the second state to the third state; based on the fifth condition, the state machine is transitioned from the fourth state to the fifth state; based on the first condition, the state machine is transitioned from the third state to the first state; based on the fourth condition, the state machine is transitioned from the third state to the fourth state; based on the first condition, the state machine is transitioned from the fifth state to the first state; based on the fourth condition, the state machine is transitioned from the fifth state to the fourth state;
[0054] The first action is used to convert the first condition into the second condition, the second action is used to convert the second condition into the third condition, the third action is used to convert the third condition into the first condition or the fourth condition, the fourth action is used to convert the fourth condition into the fifth condition, and the fifth action is used to convert the fifth condition into the fourth condition or the first condition.
[0055] like Figure 4 As shown in the figure, it is a schematic diagram of the transition between various states. From the figure, we can see the conditions required for the mutual transition between various states, the actions required for the transition between various conditions, and the corresponding relationship between various states and various steps.
[0056] In some embodiments, the first condition is: the data written to the data register is a first characteristic word, the write operation flag is false, the read operation flag is false, and the write operation timing flag is 1;
[0057] The second condition is: the write operation flag is true, the read operation flag is false, and the write operation timing flag is 2;
[0058] The third condition is: the write operation flag is true, the read operation flag is false, and the write operation timing flag is 3;
[0059] The fourth condition is: the data written to the data register is the second characteristic word, the write operation flag is false, the read operation flag is false, and the read operation timing flag is 1;
[0060] The fifth condition is: the write operation flag is false, the read operation flag is true, and the read operation timing flag is 2.
[0061] The relationship between each condition and the three major categories is shown in Table 3:
[0062] Table 3 Statistics of the first to fifth conditions
[0063] Category 1 Category II Category 3 first condition (1)a (2)b; (2)d (3)a Second condition (2)a; (2)d (3)b The third condition (2)a; (2)d (3)c Fourth condition (1)b (2)b; (2)d (3)d Fifth Condition (2)b; (2)c (3)e
[0064] After determining the current state of the finite state machine, some conditions need to be changed in order to transition to another state. In finite state machine theory, the act of changing conditions is called an "action." The corresponding actions for states 1 to 5 are defined as the first to fifth actions, respectively. The specific content of the first to fifth actions is determined by the differences between the conditions. Based on the differences between the different conditions in Table 3, the specific content of the actions in the five states can be summarized as follows:
[0065] The first action is: set the write operation flag to true and set the write operation timing flag to 2;
[0066] The second action is: set the write operation timing flag to 3;
[0067] The third action is: set the write operation flag to false and set the write operation timing flag to 1;
[0068] The fourth action is: set the read operation flag to true and set the read operation timing flag to 2;
[0069] The fifth action is: setting the read operation flag to false and setting the read operation timing flag to 1.
[0070] Through the above steps, all elements of the finite state machine can be constructed to form a complete finite state machine. All data written into the interface chip are screened through the first to fifth conditions to complete the current state determination. After the current state is determined, in order to continue to parse subsequent data, it is necessary to change the conditions and set the flag according to the current state, that is, set it according to the action corresponding to the current state, so as to meet the needs of subsequent data parsing.
[0071] In some embodiments, step 104 includes:
[0072] Set the initial conditions of the finite state machine; the initial conditions are: the write operation flag is false, the read operation flag is false, the write operation timing flag is 1, and the read operation timing flag is 1;
[0073] Traverse each data written into the data register, and execute the following for each data traversed:
[0074] S1, based on the data and the state of the finite state machine at the previous moment, determine the conditions satisfied by the data, and execute S2; for the first data, the state of the finite state machine at the previous moment is the initial condition;
[0075] S2, determine the current state of the finite state machine based on the conditions satisfied by the data, and execute S3;
[0076] S3, determining the step to which the data belongs based on the current state of the finite state machine, and executing S4;
[0077] S4, performing data parsing based on the step to which the data belongs, and determining whether the data is the last data, if so, ending the parsing process, if not, executing S5;
[0078] S5: Execute corresponding actions based on the current state of the finite state machine and the transition relationship between the states to update the state of the finite state machine, and return to execute S1.
[0079] In the above steps, if it is determined that the current data meets the first condition, the first action is executed, and the data is clearly identified as the data of the first step, and the data is parsed based on the first step.
[0080] If it is determined that the current data meets the second condition, the second action is executed, and the data is clearly identified as the data of the second step, and the data is parsed based on the second step.
[0081] If it is determined that the current data meets the third condition, the third action is executed, and the data is clearly identified as the data of the third step, and the data is parsed based on the third step.
[0082] If it is determined that the current data meets the fourth condition, the fourth action is executed, and the data is clearly identified as the data of the fourth step, and the data is parsed based on the fourth step.
[0083] If it is determined that the current data meets the fifth condition, the fifth action is executed, and the data is clearly identified as the data of the fifth step, and the data is parsed based on the fifth step.
[0084] It should be noted that when performing conditional judgment on each data, this application does not limit the judgment order, as long as the conditions satisfied by each data can be accurately determined.
[0085] In order to demonstrate the analytical effect of the present invention, the inventors conducted verification using the following data as an example:
[0086] When the data written into the data register of the interface chip is 0x02, 0x03, 0x02, 0x03, 0x02 in sequence, and the written address and data are the same as the signature word, there are several possibilities based on the existing data parsing method:
[0087] Possibility 1: Write operation 0x02, 0x03, 0x02. Read operation: 0x03, 0x02.
[0088] Possibility 2: Read operation: 0x03, 0x02. Read operation: 0x03, 0x02.
[0089] Possibility 3: Write operations 0x02, 0x03, 0x02.
[0090] The above is only the parsing process of 5 data. In the actual data interaction process, the data volume is large, the structure is complex, and there are many possible parsing results, which brings a huge workload and error potential to the parser.
[0091] The virtual interface chip data parsing method based on state machine migration proposed in the present invention no longer relies solely on feature words for parsing. Instead, an operation belonging flag and an operation timing flag are added to the judgment condition to uniquely determine the step to which the above data belongs. The above data is parsed using the method of the present application. The process is as follows:
[0092] The first data to arrive is 0x02. After judging that it meets the first condition, it is clear that the data is the data of the first step of the write operation, and it is a characteristic word, indicating that the current operation is a write operation. Then the data to arrive is 0x03. After judging that it meets the second condition, it is clear that the data is the data of the second step of the write operation, that is, data is to be written to the bus address 0x03. The next data to arrive is 0x02. After judging that it meets the third condition, it is clear that the data is the data of the third step of the write operation, that is, the specific data to be written to the bus is 0x02. The next data to arrive is 0x03. After judging that it meets the fourth condition, it is clear that the data is the data of the fourth step of the read operation, and it is a characteristic word, indicating that the current operation is a read operation. The last data to arrive is 0x02. After judging that it meets the fifth condition, it is clear that the data is the data of the fifth step of the read operation, that is, the bus data to be read is located at the bus address 0x02.
[0093] As can be seen, the method provided by the present invention uniquely determines the meaning of the above data: write operations: 0x02, 0x03, 0x02. Read operations: 0x03, 0x02. This avoids data confusion and eliminates the need for further analysis and confirmation among multiple possible solutions, significantly improving data analysis efficiency and reducing the possibility of incorrect analysis.
[0094] like Figure 2 、 Figure 3As shown, the embodiment of the present invention provides a virtual interface chip data parsing device based on state machine migration. The device embodiment can be implemented by software, hardware, or a combination of software and hardware. From the hardware level, as Figure 2 As shown in FIG. 1 , a hardware architecture diagram of a computing device where a virtual interface chip data parsing device based on state machine migration is provided in an embodiment of the present invention is located. Figure 2 In addition to the processor, memory, network interface, and non-volatile memory shown, the computing device in the embodiment may also include other hardware, such as a forwarding chip responsible for processing messages, etc. Taking software implementation as an example, Figure 3 As shown, as a device in a logical sense, it is formed by the CPU of the computing device in which it is located reading the corresponding computer program in the non-volatile memory into the internal memory and running it.
[0095] Please refer to Figure 3 The embodiment of the present invention provides a virtual interface chip data parsing device based on state machine migration, the device comprising:
[0096] The simplification unit 300 is configured to simplify the data transmission between the processor and the bus into a write operation and a read operation in response to the data transmission between the processor and the bus based on the virtual interface chip; the write operation and the read operation each include a plurality of steps executed in sequence, each step being used to write data to a data register of the interface chip;
[0097] A construction unit 302 is configured to construct a finite state machine based on the steps of the write operation and the read operation; the finite state machine includes multiple states, multiple conditions, and multiple actions; each state corresponds to a step, each condition is determined based on the type, atomicity, randomness, and timing of each step, each condition is used to transition between corresponding states, and each action is used to change the corresponding condition;
[0098] The parsing unit 304 is configured to determine, for each data written into the data register, the step to which the data belongs based on the data and the state of the finite state machine at a previous moment, so as to parse the data based on the step to which the data belongs.
[0099] In some embodiments, the construction unit 302 is configured to perform the following operations:
[0100] Abstract each step of the write operation and the read operation into a state of a finite state machine;
[0101] Based on the category, atomicity, randomness, and timing characteristics of each step, multiple conditions for transitioning between various states of the finite state machine are determined; the categories include read operations and write operations; atomicity means that no write operation or read operation can be interrupted before completion; randomness means that after any write operation or read operation is completed, there is no restriction on the category of another new operation; and the timing characteristic means that each step of the read operation and the write operation is executed in their respective order.
[0102] Based on the differences between the conditions, actions to change the conditions are determined.
[0103] In some embodiments, the write operation includes at least a first step, a second step, and a third step performed sequentially; wherein the first step is writing a first signature word into a data register of the interface chip; the second step is writing an address of data to be written into the data register of the interface chip; and the third step is writing the data to be written into the data register of the interface chip; and / or;
[0104] The read operation includes at least a fourth step and a fifth step executed in sequence; wherein the fourth step is to write the second signature word into the data register of the interface chip; and the fifth step is to write the address of the data to be read into the data register of the interface chip.
[0105] In some embodiments, multiple conditions for transitioning between various states of the finite state machine are determined based on the type, atomicity, randomness, and timing characteristics of each step, including:
[0106] The conditions for transitions between various states are abstracted into the first, second, and third categories, where: the first category is the characteristic words of read and write operations, and the sub-conditions in the first category are: the data written to the data register is the first characteristic word and the data written to the data register is the second characteristic word; the second category is the flag to which the current operation belongs, and the sub-conditions in the second category are: write operation is true, write operation is false, read operation is true, and read operation is false; the third category is the timing flags of read and write operations, and the sub-conditions in the third category are: write operation timing flag is 1, write operation timing flag is 2, write operation timing flag is 3, read operation timing flag is 1, and read operation timing flag is 2;
[0107] The corresponding sub-conditions are selected from the three types of conditions and combined to construct all the transition conditions between various states and delete the redundant conditions, so as to obtain the unique conditions that determine the transition between various states of the finite state machine.
[0108] In some embodiments, the finite state machine includes at least first to fifth states, first to fifth conditions, and first to fifth actions;
[0109] The first to fifth states correspond to the first to fifth steps respectively;
[0110] The transition relationship between each state includes: based on the first condition, the state machine is transitioned from the initial state to the first state; based on the second condition, the state machine is transitioned from the first state to the second state; based on the third condition, the state machine is transitioned from the second state to the third state; based on the fifth condition, the state machine is transitioned from the fourth state to the fifth state; based on the first condition, the state machine is transitioned from the third state to the first state; based on the fourth condition, the state machine is transitioned from the third state to the fourth state; based on the first condition, the state machine is transitioned from the fifth state to the first state; based on the fourth condition, the state machine is transitioned from the fifth state to the fourth state;
[0111] The first action is used to convert the first condition into the second condition, the second action is used to convert the second condition into the third condition, the third action is used to convert the third condition into the first condition or the fourth condition, the fourth action is used to convert the fourth condition into the fifth condition, and the fifth action is used to convert the fifth condition into the fourth condition or the first condition.
[0112] In some embodiments, the first condition is: the data written to the data register is a first characteristic word, the write operation flag is false, the read operation flag is false, and the write operation timing flag is 1;
[0113] The second condition is: the write operation flag is true, the read operation flag is false, and the write operation timing flag is 2;
[0114] The third condition is: the write operation flag is true, the read operation flag is false, and the write operation timing flag is 3;
[0115] The fourth condition is: the data written to the data register is the second characteristic word, the write operation flag is false, the read operation flag is false, and the read operation timing flag is 1;
[0116] The fifth condition is: the write operation flag is false, the read operation flag is true, and the read operation timing flag is 2;
[0117] The first action is: set the write operation flag to true and set the write operation timing flag to 2;
[0118] The second action is: set the write operation timing flag to 3;
[0119] The third action is: set the write operation flag to false and set the write operation timing flag to 1;
[0120] The fourth action is: set the read operation flag to true and set the read operation timing flag to 2;
[0121] The fifth action is: setting the read operation flag to false and setting the read operation timing flag to 1.
[0122] In some implementations, the parsing unit 304 is configured to perform the following operations:
[0123] Set the initial conditions of the finite state machine; the initial conditions are: the write operation flag is false, the read operation flag is false, the write operation timing flag is 1, and the read operation timing flag is 1;
[0124] Traverse each data written into the data register, and execute the following for each data traversed:
[0125] S1, based on the data and the state of the finite state machine at the previous moment, determine the conditions satisfied by the data, and execute S2; for the first data, the state of the finite state machine at the previous moment is the initial condition;
[0126] S2, determine the current state of the finite state machine based on the conditions satisfied by the data, and execute S3;
[0127] S3, determining the step to which the data belongs based on the current state of the finite state machine, and executing S4;
[0128] S4, performing data parsing based on the step to which the data belongs, and determining whether the data is the last data, if so, ending the parsing process, if not, executing S5;
[0129] S5: Execute corresponding actions based on the current state of the finite state machine and the transition relationship between the states to update the state of the finite state machine, and return to execute S1.
[0130] It should be noted that the aforementioned embodiment of the virtual interface chip data parsing device based on state machine migration is merely illustrative of the division of the aforementioned functional modules. In actual applications, the aforementioned functions can be assigned to different functional modules as needed, i.e., the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. Furthermore, the aforementioned embodiment of the virtual interface chip data parsing device based on state machine migration and the embodiment of the virtual interface chip data parsing method based on state machine migration are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0131] The embodiment of the present application also provides a computer device, please refer to Figure 3 The computer device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the virtual interface chip data parsing method based on state machine migration provided by the above-mentioned method embodiments.
[0132] An embodiment of the present application also provides a computer-readable storage medium, which stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the virtual interface chip data parsing method based on state machine migration provided by the above-mentioned method embodiments.
[0133] An embodiment of the present application also provides a computer program product, which includes a computer program. The processor of a computer device reads the computer program from a computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the virtual interface chip data parsing method based on state machine migration described in any of the above embodiments.
[0134] For the convenience of description, the above systems or devices are described as being divided into various modules or units according to their functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0135] Through the description of the above embodiments, it can be seen that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments of the present application or certain parts of the embodiments.
[0136] Finally, it should be noted that, in this document, relational terms such as first, second, third, and fourth are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus comprising the element.
[0137] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A virtual interface chip data parsing method based on state machine migration, characterized in that: The method comprises: In response to data transmission between the processor and the bus based on the virtual interface chip, the data transmission behavior is simplified into a write operation and a read operation; the write operation and the read operation respectively include a plurality of steps performed in sequence, each of the steps being used to write data to a data register of the interface chip; A finite state machine is constructed based on each step of the write operation and the read operation; the finite state machine includes multiple states, multiple conditions, and multiple actions; each state corresponds to one of the steps, each condition is determined based on the category, atomicity, randomness, and timing of each step, each condition is used to transition between corresponding states, and each action is used to change the corresponding condition; the randomness is that after any write operation or any read operation is completed, the category of another new operation is not restricted; For each data written into the data register, the step to which the data belongs is determined based on the data and the state of the finite state machine at a previous moment, so that the data is parsed based on the step to which it belongs.
2. The method according to claim 1, characterized in that The steps of constructing a finite state machine based on the write operation and the read operation include: Abstracting each step of the write operation and the read operation into a state of a finite state machine respectively; Determine multiple conditions for transitioning between various states of the finite state machine based on the category, atomicity, randomness, and timing characteristics of each step; the category includes read operations and write operations; the atomicity is that no write operation or read operation can be interrupted before completion; the timing characteristic is that each step of the read operation and the write operation are executed in sequence according to their respective orders; Based on the differences between the conditions, actions to change the conditions are determined.
3. The method according to claim 2, characterized in that The write operation comprises at least a first step, a second step, and a third step, which are performed in sequence; wherein the first step is to write a first signature word into the data register of the interface chip; the second step is to write the address of the data to be written into the data register of the interface chip; and the third step is to write the data to be written into the data register of the interface chip; and / or; The read operation includes at least a fourth step and a fifth step executed in sequence; wherein the fourth step is to write a second signature word into the data register of the interface chip; and the fifth step is to write the address of the data to be read into the data register of the interface chip.
4. The method according to claim 3, characterized in that The multiple conditions for transitioning between various states of the finite state machine are determined based on the category, atomicity, randomness, and timing characteristics of each step, including: The conditions for transitions between various states are abstracted into the first, second, and third categories, wherein: the first category is the characteristic words of read and write operations, and the sub-conditions in the first category are: the data written to the data register is the first characteristic word and the data written to the data register is the second characteristic word; the second category is the flag to which the current operation belongs, and the sub-conditions in the second category are: write operation is true, write operation is false, read operation is true, and read operation is false; the third category is the timing flags of read and write operations, and the sub-conditions in the third category are: write operation timing flag is 1, write operation timing flag is 2, write operation timing flag is 3, read operation timing flag is 1, and read operation timing flag is 2; Corresponding sub-conditions are selected from the three types of conditions and combined to construct all transition conditions between various states and delete redundant conditions, thereby obtaining unique conditions for transitioning between various states of the finite state machine.
5. The method according to claim 4, characterized in that The finite state machine at least includes a first state to a fifth state, a first condition to a fifth condition, and a first action to a fifth action; The first state to the fifth state correspond to the first step to the fifth step respectively; The transition relationship between each state includes: based on the first condition, the state machine is transitioned from the initial state to the first state; based on the second condition, the state machine is transitioned from the first state to the second state; based on the third condition, the state machine is transitioned from the second state to the third state; based on the fifth condition, the state machine is transitioned from the fourth state to the fifth state; based on the first condition, the state machine is transitioned from the third state to the first state; based on the fourth condition, the state machine is transitioned from the third state to the fourth state; based on the first condition, the state machine is transitioned from the fifth state to the first state; based on the fourth condition, the state machine is transitioned from the fifth state to the fourth state; The first action is used to convert the first condition into the second condition, the second action is used to convert the second condition into the third condition, the third action is used to convert the third condition into the first condition or the fourth condition, the fourth action is used to convert the fourth condition into the fifth condition, and the fifth action is used to convert the fifth condition into the fourth condition or the first condition.
6. The method according to claim 5, characterized in that The first condition is: the data written to the data register is a first characteristic word, the write operation flag is false, the read operation flag is false, and the write operation timing flag is 1; The second condition is: the write operation flag is true, the read operation flag is false, and the write operation timing flag is 2; The third condition is: the write operation flag is true, the read operation flag is false, and the write operation timing flag is 3; The fourth condition is: the data written to the data register is the second characteristic word, the write operation flag is false, the read operation flag is false, and the read operation timing flag is 1; The fifth condition is: the write operation flag is false, the read operation flag is true, and the read operation timing flag is 2; The first action is: setting the write operation flag to true and setting the write operation timing flag to 2; The second action is: setting the write operation timing flag to 3; The third action is: setting the write operation flag to false and setting the write operation timing flag to 1; The fourth action is: setting the read operation flag to true and setting the read operation timing flag to 2; The fifth action is: setting the read operation flag to false and setting the read operation timing flag to 1.
7. The method according to claim 1, characterized in that For each data written into the data register, the step to which the data belongs is determined based on the data and the state of the finite state machine at a previous moment, so as to parse the data based on the step to which it belongs, including: Set the initial conditions of the finite state machine; the initial conditions are: the write operation flag is false, the read operation flag is false, the write operation timing flag is 1, and the read operation timing flag is 1; Traverse each data written into the data register, and for the traversed data, execute: S1, determining the conditions satisfied by the data based on the data and the state of the finite state machine at the previous moment, and executing S2; for the first data, the state of the finite state machine at the previous moment is the initial condition; S2, determining the current state of the finite state machine based on the conditions satisfied by the data, and executing S3; S3, determining the step to which the data belongs based on the current state of the finite state machine, and executing S4; S4, performing data parsing based on the step to which the data belongs, and determining whether the data is the last data, if so, ending the parsing process, if not, executing S5; S5: Execute corresponding actions based on the current state of the finite state machine and the transition relationship between the states to update the state of the finite state machine, and return to execute S1.
8. A virtual interface chip data analysis device based on state machine migration, characterized in that: The device comprises: a simplification unit, configured to, in response to data transmission between the processor and the bus based on the virtual interface chip, simplify the data transmission behavior into a write operation and a read operation; the write operation and the read operation respectively include a plurality of steps executed in sequence, each of the steps being configured to write data to a data register of the interface chip; A construction unit is configured to construct a finite state machine based on the steps of the write operation and the read operation; the finite state machine includes multiple states, multiple conditions, and multiple actions; each state corresponds to one of the steps, each condition is determined based on the category, atomicity, randomness, and timing of each step, each condition is used to transition between corresponding states, and each action is used to change the corresponding condition; the randomness is that after any write operation or any read operation is completed, the category of another new operation is not restricted; The parsing unit is used to determine, for each data written into the data register, the step to which the data belongs based on the data and the state of the finite state machine at a previous moment, so as to parse the data based on the step to which the data belongs.
9. A computer device, characterized in that: The computer device includes a memory and a processor, the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory to implement the steps of any one of the methods described in claims 1-7.
10. A computer-readable storage medium, characterized in that The storage medium stores a computer program, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Universal nonvolatile memory control device for system on chip
CN102999453A
System for executing atomic operation, and atomic operation method and apparatus
WO2023093334A1