State recovery circuit and method and device thereof, electronic equipment and storage medium
By introducing control modules and lookup table modules into the state recovery circuit, the status information of the fault-free runtime is directly obtained from the lookup table module and transmitted to the state machine, solving the problem of low state recovery efficiency of the state machine and achieving efficient state recovery.
Patent Information
- Application Number
- CN202510190712.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-20
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2045-02-20
AI Technical Summary
In the prior art, the state recovery efficiency of the state machine is low, and the state machine needs to be initialized, resulting in low recovery efficiency.
A state recovery circuit is designed, including a control module and a lookup table module. The control module is used to determine whether the state machine has a fault, and to obtain the state information of the fault-free runtime from the lookup table module and transmit it to the state machine to realize state recovery.
By directly restoring to the current state without initialization, the state recovery efficiency of the state machine is significantly improved.
Smart Images

Figure CN119675652A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of circuit technology, and in particular to a state recovery circuit and a method, device, electronic device and storage medium thereof. Background Art
[0002] A state machine is a sequential logic circuit. A state machine has multiple states. Different functions are achieved by switching the state machine between different states. When a state machine fails, the state of the state machine needs to be restored.
[0003] In the state recovery related technology, the state machine is usually initialized and the state machine is run again in the initial state to the state before the failure occurs, resulting in low state recovery efficiency of the state machine. Summary of the invention
[0004] The present application provides a state recovery circuit and a method, device, electronic device and storage medium thereof, so as to at least solve the problem of low state recovery efficiency of a state machine in the related art.
[0005] The present application provides a state recovery circuit, comprising: a control module, a lookup table module; The control module and the lookup table module are connected to the state machine, and the control module is connected to the lookup table module; The lookup table module is used to store state information of at least one state when the state machine is in fault-free operation; The control module is used to determine whether a fault occurs when the state machine is in the current state. If it is determined that a fault occurs when the state machine is in the current state, the control module transmits first state information to the state machine so that the state machine performs state recovery based on the first state information. The first state information is state information obtained from the lookup table module and generated by fault-free operation of the state machine in the current state.
[0006] The present application also provides a state recovery method, including: Using the control module to determine whether a fault occurs when the state machine is in the current state; When it is determined that a fault occurs when the state machine is in the current state, the control module is used to transmit first state information generated by the state machine running without fault when in the current state obtained from the lookup table module to the state machine, so that the state machine performs state recovery based on the first state information; the lookup table module contains state information of at least one state when the state machine is running without fault.
[0007] The present application also provides a state recovery device, comprising: a determination unit, used to determine, using the control module, whether a fault occurs when the state machine is in a current state; A transmission unit is used to transmit, by means of a control module, first state information generated by the state machine running without fault in the current state obtained from the lookup table module to the state machine when a fault occurs when the state machine is in the current state, so that the state machine performs state recovery based on the first state information; the lookup table module contains state information of at least one state when the state machine is running without fault.
[0008] The present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any of the above-mentioned state recovery methods when executing the computer program.
[0009] The present application also provides a computer-readable storage medium, in which a computer program is stored, wherein when the computer program is executed by a processor, the steps of any of the above-mentioned state recovery methods are implemented.
[0010] The present application also provides a computer program product, including a computer program, which implements the steps of any of the above-mentioned state recovery methods when executed by a processor.
[0011] Through the present application, since the control module in the state recovery circuit is connected to the state machine, the control module can determine whether a fault occurs when the state machine is in the current state. When it is determined that a fault occurs when the state machine is in the current state, the control module obtains the first state information generated by the trouble-free operation of the state machine in the current state from the lookup table module, and the control module transmits the first state information to the state machine. Since the first state information is the state information generated by the trouble-free operation of the state machine in the current state, when a fault occurs when the state machine is in the current state, resulting in the loss of state information, the state machine can be directly restored to the current state using the first state information without initializing the state machine. Therefore, the technical problem of low state recovery efficiency of the state machine can be solved, and the technical effect of improving the state recovery efficiency of the state machine can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0013] Figure 1 A schematic diagram of the structure of a state recovery circuit provided in an embodiment of the present application; Figure 2 A schematic diagram of the structure of another state recovery circuit provided in an embodiment of the present application; Figure 3A schematic diagram of the structure of another state recovery circuit provided in an embodiment of the present application; Figure 4 A comparison diagram of a power supply method provided in an embodiment of the present application; Figure 5 A flowchart of a state recovery method provided in an embodiment of the present application; Figure 6 An internal structure diagram of a control module provided in an embodiment of the present application; Figure 7 An internal structure diagram of a power monitoring module provided in an embodiment of the present application; Figure 8 An internal structure diagram of a status display module provided in an embodiment of the present application; Fig. 9 A schematic diagram of the structure of a state recovery device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0014] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0015] It should be noted that, in the description of this application, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in this application are used to distinguish similar objects, and are not used to describe a specific order or sequence.
[0016] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0017] The embodiment of the present application provides a state recovery circuit, and describes the method in detail in conjunction with the execution flow of the state recovery circuit.
[0018] Figure 1 A schematic diagram of a state recovery circuit provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the state recovery circuit includes: a control module 10 and a lookup table module 20.
[0019] The control module 10 and the lookup table module 20 are connected to the state machine 30 , and the control module 10 is connected to the lookup table module 20 .
[0020] In the embodiments of the present application, the state machine is a circuit design that follows sequential logic and has multiple different states. Its operating principle is to switch between different states to achieve specific functions. For example, in a vending machine, the state machine can switch to different states such as waiting, coin insertion, product selection, and shipment according to the user's operation (such as inserting coins, selecting goods), so as to realize processes such as product delivery.
[0021] In order to better understand the state transfer of the state machine, an example is provided. Assume that the state machine consists of N states, such as state 1, state 2, ..., state n, and there are N trigger conditions 1~n; when the state machine is reset (that is, the reset signal is valid), the state machine enters state 1; when the reset process is completed (the reset signal is invalid), and trigger condition 1 occurs, it enters state 2; after that, each time a trigger condition is generated, the state machine enters the next state until it returns to state 1 and then cycles through state transfers. However, it should be clear that this statement is not intended to limit state transfers to only between adjacent states, but also between non-adjacent states.
[0022] In order to better understand the transition between non-adjacent states, Figure 2 As shown, Figure 2 This is a structural diagram of another state recovery circuit provided in an embodiment of the present application. Each state has a corresponding logic module, and the logic module controls the opening and closing of the corresponding state. The transfer between non-adjacent states can be achieved through the logic module.
[0023] The control module is the core control unit in the state recovery circuit, responsible for monitoring and managing the state of the state machine. The lookup table module is a storage unit used to store the state information of at least one state of the state machine when it is running without fault. The lookup table module can be a non-volatile storage unit, for example, a read-only memory (ROM), and the data stored in the ROM will not be lost after the ROM loses power. The lookup table module is used to store the state information of n states when the state machine is running normally. The state information includes but is not limited to the input, output and data generated in each state. Specifically: for a certain state n (n=1,2,…,N), its input is trigger condition n-1, the output is trigger condition n, and the generated data is data n, wherein trigger condition n-1 is the start condition of state n, and trigger condition n is the transfer condition of state n, that is, the start condition of the next state of state n. However, it should be clear that this statement is not intended to limit the lookup table module to only a non-volatile storage unit, but can also be other storage units.
[0024] Through the direct connection, the control module can quickly obtain the state information of the fault-free operation from the lookup table module and transmit the state information to the state machine, thereby achieving fast state recovery.
[0025] The lookup table module 20 is used to store state information of at least one state when the state machine 30 is in fault-free operation.
[0026] In addition to the input and output of each state and the data generated in the state, the state information may also include state code, internal variables, timestamp or duration, fault detection flag, and transition conditions. The state code is a unique code or identifier of the state, which is used to distinguish different states. The internal variables are variables or counter values stored inside the state machine. The internal variables change during the state transition process. The duration or timestamp is the length of time the state machine is in the current state or the time point when it enters the current state. The fault detection flag is a flag that indicates whether the current state is normal, which is used for fault detection and recovery. The transition condition is the condition or event that causes the state machine to transition from the current state to the next state. In addition to the trigger conditions, the input and output may also include input signals, which are the input signal values received by the state machine in the current state. The input signal comes from the external environment or other circuit modules. The output may also include output signals, which are the output signal values generated by the state machine in the current state. The output signal is used to drive other circuits or perform specific operations.
[0027] The lookup table module is connected to the state machine. When the state machine does not fail in a state transfer cycle, the lookup table module will store all state information in the state transfer cycle. All state information generated by the state machine running without failure can also be stored in the lookup table module in the form of external input. The fault-free state information (first state information) stored in the lookup table module provides an accurate reference benchmark for the control module to determine whether the current state of the state machine is normal.
[0028] The control module 10 is used to determine whether a fault occurs when the state machine 30 is in the current state. When it is determined that a fault occurs when the state machine 30 is in the current state, the control module 10 transmits first state information to the state machine 30 so that the state machine 30 performs state recovery based on the first state information. The first state information is state information obtained from the lookup table module 20 and generated by fault-free operation of the state machine 30 when it is in the current state.
[0029] The control module collects the second state information generated by the state machine in the current state, and extracts the first state information corresponding to this state when the state machine is running without fault from the lookup table module. The control module compares the first state information and the second state information for consistency. If the two are inconsistent, it is determined that the current state is faulty. For example, in a state machine of a vending machine, the inventory quantity of goods should be reduced accordingly during normal shipment (first state information). If the inventory quantity does not change under the current actual state (second state information), it means that there may be a fault in the shipment state. However, it should be clear that this statement is not intended to limit the determination of the state and whether a fault occurs in the current state to only be achieved through the above method, and it can also be determined by other methods.
[0030] After receiving the first state information, the state machine restores its own state to the corresponding state during trouble-free operation according to the first state information. Specific operations include but are not limited to resetting the internal register of the state machine, adjusting the output signal, and reconfiguring the internal logic according to the first state information.
[0031] The fault-free status information stored in the lookup table module is accurate data that has been verified and confirmed in advance. The control module uses this as a benchmark for comparative judgment, which can effectively avoid misjudgment and missed judgment and improve the accuracy of fault detection.
[0032] Through the present application, since the control module in the state recovery circuit is connected to the state machine, the control module can determine whether a fault occurs when the state machine is in the current state. When it is determined that a fault occurs when the state machine is in the current state, the control module obtains the first state information generated by the trouble-free operation of the state machine in the current state from the lookup table module, and the control module transmits the first state information to the state machine. Since the first state information is the state information generated by the trouble-free operation of the state machine in the current state, when a fault occurs when the state machine is in the current state, resulting in the loss of state information, the state machine can be directly restored to the current state using the first state information without initializing the state machine. Therefore, the technical problem of low state recovery efficiency of the state machine can be solved, and the technical effect of improving the state recovery efficiency of the state machine can be achieved.
[0033] In some embodiments, please refer to Figure 1 The control module 10 includes: a status register 101 , a status monitor 102 and a status transmitter 103 .
[0034] The state register 101 is connected to the state machine 30 and the state monitor 102 respectively; The state monitor 102 is connected to the lookup table module 20 and the state transmitter 103 respectively; The state transmitter 103 is connected to the state machine 30; The state register 101 is used to obtain the second state information of the state machine 30 and transmit the second state information to the state monitor 102; the second state information is the state information obtained from the state machine 30 and generated when the state machine 30 is in the current state; The state monitor 102 is used to receive the second state information. The state monitor 102 is used to obtain the first state information from the lookup table module 20, and determine whether a fault occurs when the state machine 30 is in the current state according to the first state information and the second state information; The state monitor 102 is used to transmit the first state information to the state transmitter 103 when it is determined that a fault occurs when the state machine 30 is in the current state; The state transmitter 103 is used for receiving the first state information and transmitting the first state information to the state machine 30 .
[0035] A state register is a circuit or storage unit used to store the current state information of a state machine. A state monitor is a circuit or logic unit used to monitor and analyze the state of a state machine. A state transmitter is a circuit or interface unit used to transmit state information in a circuit.
[0036] Among them, the state register can also temporarily store the state code value of the current state of the state machine, that is, the state code value is used to distinguish different states. For example, if the binary coding method is adopted, the state code value of state 2 is '2', and the state code value of state 3 is '3'... The state monitor can also monitor the input / output trigger conditions of the current state, and compare them with the correct input / output information of the corresponding state stored in the lookup table module. When the comparison is consistent, it means that the current state is normal; when the comparison is inconsistent, it means that the current state is abnormal, and a fault signal is generated to the state machine. In addition, a preset time threshold is set in the state monitor to monitor whether the value of the state register changes within the preset time threshold. If the value of the state register changes within the preset time threshold, it means that the state has been transferred; when the value of the state register does not change after exceeding the preset time threshold, it means that the state machine is abnormal and stays in the current state, and a fault signal is also generated at this time. In addition, the preset time threshold can be manually set and changed according to the actual operation of the system. The state transmitter is a data buffer. The state transmitter can be a volatile storage unit, such as a random access memory (RAM). When an abnormal state occurs, the control module transmits the corresponding state information in the lookup table module to the state transmitter. However, it should be clear that this statement is not intended to limit the state transmitter to only a volatile storage unit, but can also be other storage units.
[0037] The entire fault detection and status recovery process is automatically completed by the status register, status monitor and status transmitter without manual intervention, which improves the automation level of the system. This automation capability enables the system to respond to various fault conditions more intelligently, improving the system's operating efficiency and management level.
[0038] In some embodiments, please refer to Figure 1 The state register 101 is also used to obtain the duration of the state machine 30 being in the current state, and transmit the duration to the state monitor 102, so that the state monitor 102 determines whether a fault occurs when the state machine 30 is in the current state according to the duration.
[0039] Duration refers to the length of time the state machine stays in the current state. By comparing the duration with the preset time threshold, it is possible to determine whether the current state has failed. Some faults may not immediately cause a change in state information, but will manifest as an abnormal state duration. This design enables the state recovery circuit to adapt to a wider range of fault scenarios.
[0040] In some embodiments, please refer to Figure 1 The state monitor 102 is also used to receive a duration; compare the duration with a preset time threshold; if the duration is greater than the preset time threshold, determine that a fault occurs when the state machine 30 is in the current state.
[0041] An example is provided for ease of understanding. Assuming that the duration is 10 seconds and the preset time threshold is 8 seconds, since 10 seconds is greater than 8 seconds, it is determined that a fault occurs in the current state.
[0042] By combining the consistency comparison of state information and the judgment of state duration, faults can be detected from multiple dimensions. When the first state information is consistent with the second state information, but the state duration is too long, it can also be determined that the state machine may have a fault, thereby improving the accuracy of fault detection and reducing misjudgments and missed judgments.
[0043] In some embodiments, please refer to Figure 1 The state monitor 102 is used to determine whether a fault occurs when the state machine 30 is in the current state according to the first state information and the second state information, including: Comparing the first state information with the second state information for consistency; If the first state information is inconsistent with the second state information, it is determined that a failure occurs when the state machine 30 is in the current state.
[0044] When the state machine has an abnormality that the first state information is inconsistent with the second state information or the duration exceeds the preset time threshold, the state machine is stuck in a certain state, the first state information is read from the lookup table module, and then transmitted to the state transmitter, and a fault signal is generated; after the state machine obtains the fault signal, it reads the correct first state information in the state transmitter, thereby recovering to the current state and continuing to run from the current state. Therefore, there is no need to manually reset the system, and the data of the state machine will not be lost.
[0045] Furthermore, in a possible implementation of this embodiment, as Figure 3 As shown, the state recovery circuit further includes: a power monitoring module 40; The power supply monitoring module 40 is connected to the mains 50 , and the power supply monitoring module 40 is connected to the control module 10 ; The power monitoring module 40 transmits the mains power 50 to the control module so that the control module 10 operates based on the mains power 50; The power monitoring module 40 is used to monitor whether the mains 50 is powered off when the state machine 30 is in the current state, so that the control module 10 determines whether a fault occurs when the state machine 30 is in the current state based on the monitoring result of whether the mains 50 is powered off.
[0046] The power monitoring module is an electronic circuit or device used to monitor the power status. The main function of the power monitoring module is to monitor the status of the mains in real time, including whether it is powered on and whether the voltage is stable. The power monitoring module transmits the monitored mains status information to the control module so that the control module can make corresponding judgments and operations based on this information. In the event of a mains power outage, the power monitoring module will send a signal to notify the control module that the mains power is off. Mains power refers to the alternating current provided by the city power grid, usually the 220V or 380V AC power used in daily life.
[0047] The monitoring results include, but are not limited to, whether the mains power is on, voltage level, voltage stability, fault type, and fault duration.
[0048] The external 220V mains electricity is converted into 3.3V and 1.2V DC voltages after alternating current (AC) / direct current (DC), which are used as the input / output (IO) voltage and core voltage of the state recovery circuit respectively; the IO voltage is used by the input / output (IO) module of the state machine, and the core voltage is used by the control module. In addition to judging faults by comparing the consistency of state information and monitoring the duration, the addition of the power monitoring module enables fault detection to be monitored from the perspective of power supply. As an important energy source for system operation, whether the mains electricity is cut off is directly related to the normal operation of the system. By monitoring the mains power status, faults caused by power problems can be discovered in time, thereby enhancing the comprehensiveness of fault detection.
[0049] Furthermore, in a possible implementation of this embodiment, as Figure 3 As shown, the state recovery circuit also includes: a power supply 60; The power supply 60 is connected to the control module 10; The power supply 60 is used to provide an uninterruptible power supply to the control module 10 .
[0050] The power supply is a backup power supply device. When the mains power fails in the current state of the state machine, it can provide power support for the control module to ensure that the control module can continue to work, thereby completing important operations such as monitoring state machine faults, obtaining information, and state recovery. The power supply includes but is not limited to button batteries and farad capacitors. In order to better understand the power supply method of the state recovery circuit, such as Figure 4 As shown, Figure 4 A comparison diagram of a power supply method provided in an embodiment of the present application, Figure 4 (a) is a power supply method of the related technology, which is powered only by the mains. Once the mains is cut off, the state recovery circuit will fail. Figure 4 (b) is the power supply method of this application. Even in the case of a power outage, the power supply can still provide uninterrupted power to the control module. By providing uninterrupted power support, the power supply enhances the reliability of the state recovery circuit, thereby improving the reliability of the entire system. When facing external interference such as power outages, the system can operate more stably, reduce the probability and scope of failure, and provide a strong guarantee for the long-term stable operation of the system.
[0051] Furthermore, in a possible implementation of this embodiment, as Figure 3 As shown, the state recovery circuit further includes: a state display module 70; The status display module 70 is connected to the control module 10; The state display module 70 is used to obtain the second state information from the control module 10 and visually display the second state information.
[0052] The status display module is a functional module that can receive specific information and present it in a visual form. Visual display can be to display text, numbers, graphics and other information on a display screen, or to display status information through devices such as indicator lights and buzzers. For example, different colors of indicator lights can be used to represent different states, or the current state of the state machine, fault information, etc. can be displayed on the display screen. Visual display of the second state information can remind administrators to discover state machine faults in a timely manner.
[0053] According to the embodiment of the present application, the present application also proposes a state recovery method, such as Figure 5 As shown, Figure 5 A flow chart of a state recovery method provided in an embodiment of the present application is provided. The method is applied to a state recovery circuit. The method comprises the following steps: Step 801, using a control module to determine whether a fault occurs when the state machine is in a current state.
[0054] Step 802, when it is determined that a fault occurs when the state machine is in the current state, the control module transmits the first state information generated by the state machine running without fault in the current state obtained from the lookup table module to the state machine, so that the state machine performs state recovery based on the first state information; the lookup table module contains state information of at least one state when the state machine is running without fault.
[0055] Since the embodiments of the state recovery method part and the embodiments of the state recovery circuit part correspond to each other, the embodiments of the state recovery method part refer to the description of the embodiments of the state recovery circuit part, and are not described here. And it has the same beneficial effects as the above-mentioned state recovery circuit.
[0056] Through the present application, since the control module in the state recovery circuit is connected to the state machine, the control module can determine whether a fault occurs when the state machine is in the current state. When it is determined that a fault occurs when the state machine is in the current state, the control module obtains the first state information generated by the trouble-free operation of the state machine when it is in the current state from the lookup table module, and the control module transmits the first state information to the state machine. Since the first state information is the state information generated by the trouble-free operation of the state machine when it is in the current state, when a fault occurs when the state machine is in the current state, resulting in the loss of state information, the state machine can be directly restored to the current state using the first state information without initializing the state machine. Therefore, the technical problem of low state recovery efficiency of the state machine can be solved, and the technical effect of improving the state recovery efficiency of the state machine can be achieved.
[0057] As a refinement of step 801, when using the control module to determine whether a fault occurs when the state machine is in the current state, it can be implemented in but not limited to the following ways, including: using the state register in the control module to obtain the second state information generated when the state machine is in the current state, and using the state register to transmit the second state information to the state monitor in the control module; the control module includes a state register and a state monitor; using the state monitor to receive the second state information, and using the state monitor to obtain the first state information from the lookup table module; using the state monitor to determine whether a fault occurs in the current state based on the first state information and the second state information.
[0058] For more specific working processes of the above embodiments, please refer to the corresponding contents disclosed in the above embodiments, which will not be repeated here.
[0059] As a refinement of step 801, when executing the control module to determine whether a fault occurs when the state machine is in the current state, it can also be implemented by but not limited to the following methods, including: using a status register to obtain the duration when the state machine is in the current state, and transmitting the duration to a status monitor; using the status monitor to determine whether a fault occurs when the state machine is in the current state based on the duration.
[0060] For more specific working processes of the above embodiments, please refer to the corresponding contents disclosed in the above embodiments, which will not be repeated here.
[0061] As a refinement of step 802, when executing the process of transmitting the first state information generated by the state machine obtained from the lookup table module when it is in the current state and running without fault to the state machine using the control module, it can be implemented in but not limited to the following ways, including: when it is determined that a fault occurs when the state machine is in the current state, transmitting the first state information to the state transmitter in the control module using the state monitor; the control module includes a state register, a state monitor and a state transmitter; and transmitting the first state information to the state machine using the state transmitter.
[0062] For more specific working processes of the above embodiments, please refer to the corresponding contents disclosed in the above embodiments, which will not be repeated here.
[0063] In one possible implementation of the embodiment of the present application, in order to facilitate a better understanding of the internal structure of the control module, as shown in FIG. Figure 6 As shown, Figure 6An internal structure diagram of a control module provided in an embodiment of the present application includes a timer (Count, CNT), a comparator (Compare, CMP)_1, a comparator (Compare, CMP)_2, a trigger D_FF_1 with an enable terminal (Enable, E) and a clear terminal (Remove, R), an input AND gate AND_1, an input AND gate AND_2, an input OR gate OR, an XOR gate XOR, and NOT gates NOT_1~NOT_5.
[0064] Among them, the functions of CMP_1 and CMP_2 are to compare input terminals 1 and 2. When input terminal 1 ≤ the value of input terminal 2, the comparator outputs a high level; when input terminal 1 > the value of input terminal 2, the comparator outputs a low level; the function of XOR is to perform an XOR operation on input terminals 1 and 2. When the values of input terminal 1 and input terminal 2 are the same, a low level is output; when the values of input terminal 1 and input terminal 2 are different, a high level is output; the function of CNT is to time according to the clock cycle (Clock, CLK) signal and output the timing time T_out. reg is the value of the register, that is, the state encoding value. During the operation of the state machine, the state encoding value of the current operating state will be written into the controller. The function of CNT is to time the duration of the current state and compare it with the preset time threshold Threshold. The value of Threshold can be manually set and adjusted by developers, administrators, etc.; when the state changes, the value of reg changes, and the timing time is cleared through the R (clear terminal) of CNT so that the state machine can be re-timed after switching to the next state.
[0065] When the state machine is reset (reset signal RSTn='0'), RSTn becomes high level after passing through NOT_5, making the clear terminal R='1' of D_FF_1 valid, and the output terminal (Q) is low level, connected to the input terminal of the OR gate OR; when the state machine is running normally (RSTn='1'), the clear terminal R='0' of D_FF_1 is invalid. At this time, the output value of D_FF_1 is determined by the enable terminal (E) and the data input terminal (D); in a certain state of the state machine operation process, the controller obtains the trigger signal Tri_sig of the current state, and reads the corresponding reference trigger signal Tri_base in the lookup table 2, and compares it through XOR. When Tri_sig≠Tri_base, XOR outputs a high level, which becomes a low level after passing through NOT_1, and becomes a high level after passing through AND_2 and NOT_3 and is input to the enable terminal (E) of D_FF_1; at the same time, the low level output by NOT_1 becomes a high level after passing through AND_1 and NOT_2 and is input to the data input terminal (D) of D_FF_1, because at this time the enable terminal (E) of D_FF_1 is valid (high level), and the output of D_FF_1 depends on the input terminal (D), so the output terminal (Q) is high level, and then after OR, the fault signal error='1' is output; in addition, when Tri_sig=Tri_base, it means that the trigger signal is normal, and the output of D_FF_1 depends on other circuit components. The timing time T_out of the current state is compared with the time threshold Threshold through CMP_1 and CMP_2. When T_out>Threshold, CMP_2 outputs a high level, which becomes a low level after passing through NOT_4, and then becomes a high level after passing through AND_2 and NOT_3 and is input to the enable end (E) of D_FF_1; at this time, CMP_1 outputs a low level, which becomes a high level after passing through AND_1 and NOT_2 and is input to the data input end (D) of D_FF_1. Since the (E) end is valid (high level) at this time, D_FF_1 outputs a high level, and then outputs a fault signal error='1' after passing through OR; in addition, when T_out≤Threshold, it means that the duration of the state has not timed out and is a normal state. At this time, the output of D_FF_1 depends on other circuit components. The power-off signal vol_off is also connected to the input end of the OR gate OR. When vol_off='1', the fault signal error='1' is output.
[0066] In one possible implementation of the embodiment of the present application, in order to facilitate a better understanding of the internal structure of the power monitoring module, as shown in FIG. Figure 7 As shown, Figure 7The internal structure diagram of a power monitoring module provided by the embodiment of the present application includes a trigger (D_FF_2) with a clear terminal (R), NOT gates NOT_6 and NOT_7. The clock signal CLK is connected to the clock port of D_FF_2; vol_in is the IO voltage 3.3V output of the state machine, which is connected to D_FF_2 as the data input port after passing through NOT_6; the reset signal RSTn is connected to the clear port R of D_FF_2 after passing through NOT_7; the data output of D_FF_2 is the vol_off signal.
[0067] When the state machine is reset (RSTn='0'), RSTn becomes a high level after passing through NOT_7, making the clear terminal R='1' of D_FF_2 valid and the output vol_off='0'; when the state machine is operating normally (RSTn='1'), the clear terminal R='0' of D_FF_2 is invalid. At this time, the output value of D_FF_2 is determined by the input terminal D: when vol_in is a high level of 3.3V, it becomes a low level after passing through NOT_6 and is input to D_FF_2, and the output of D_FF_2 is also a low level; when the external 220V power of the state machine is cut off, vol_in becomes zero accordingly, becomes a high level after passing through NOT_6 and is input to D_FF_2, and vol_off='1' output by D_FF_2.
[0068] In one possible implementation of the embodiment of the present application, in order to facilitate a better understanding of the internal structure of the status display module, as shown in FIG. Figure 8 As shown, Figure 8 This is an internal structure diagram of a status display module provided in an embodiment of the present application. Figure 8 The function of (a) is to display the current state code value according to the value of the control module, and it is composed of a decoder and a digital tube. Among them, the input terminals S1~S3 of the decoder are respectively connected to the reg(0)~reg(2) bits of the register, wherein reg(0) is the lowest bit of the register, reg(1) is the middle bit of the register, and reg(2) is the highest bit of the register; the enable terminal ENB of the decoder is connected to a high level (5V) to make the decoder effective; the output terminals D1~D8 of the decoder are connected to 8-segment digital tubes. The decoder can make the digital tube display 8 different states 0~7 of the state machine according to the value 0~7 of the register input. This embodiment shows the case where the control module is 3 bits. If the state of the state machine is greater than 8, the number of bits of the control module needs to be increased, and the number of decoders and digital tubes also needs to be increased accordingly to display the state value when the number of states is greater than 8. This embodiment does not specifically limit the number of states.
[0069] Figure 8The function of (b) is to light up the alarm light and sound the alarm when the state machine is powered off, which serves as a reminder so that the administrator can promptly discover the fault of the state machine power failure and take measures to re-power it on. The circuit specifically includes resistor R1, light emitting diode (LED), and buzzer (BUZ); the LED serves as the alarm light, and the BUZ sounds as the alarm. Figure 8 The vol_off in the circuit is the input signal: When the state machine is powered normally, vol_off is at a low level, the positive pole of the LED and the input end of the BUZ are both at a low level, and the LED will not turn on and emit light, and the BUZ will not sound; When the state machine is powered off, vol_off becomes high level, the positive pole of LED and the input end of BUZ are both high level, then LED turns on and lights up, BUZ sounds; R1 is a pull-up resistor with a typical value of 10KΩ. Since vol_off is driven by the core voltage of the state machine, the voltage value is relatively weak (about 1.2V). Through R1 and the external 5V voltage, the voltage signal strength of vof_off can be increased to ensure that the vol_off signal can drive the LED and BUZ normally.
[0070] in addition, Figure 8 The 5V voltage is also provided by an independent power supply module to ensure that the circuit can work normally when the 220V power of the state machine is cut off.
[0071] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method.
[0072] The embodiment of the present application also provides a state recovery device, Fig. 9 A schematic diagram of the structure of a state recovery device provided in an embodiment of the present application is shown in FIG. Fig. 9 As shown, including: A determination unit 91, configured to use a control module to determine whether a fault occurs when the state machine is in a current state; The transmission unit 92 is used to transmit the first state information generated by the state machine running without fault in the current state obtained from the lookup table module to the state machine by the control module when it is determined that a fault occurs when the state machine is in the current state, so that the state machine performs state recovery based on the first state information; the lookup table module contains state information of at least one state when the state machine is in fault-free operation.
[0073] Through the present application, since the control module in the state recovery circuit is connected to the state machine, the control module can determine whether a fault occurs when the state machine is in the current state. When it is determined that a fault occurs when the state machine is in the current state, the control module obtains the first state information generated by the trouble-free operation of the state machine in the current state from the lookup table module, and the control module transmits the first state information to the state machine. Since the first state information is the state information generated by the trouble-free operation of the state machine in the current state, when a fault occurs when the state machine is in the current state, resulting in the loss of state information, the state machine can be directly restored to the current state using the first state information without initializing the state machine. Therefore, the technical problem of low state recovery efficiency of the state machine can be solved, and the technical effect of improving the state recovery efficiency of the state machine can be achieved.
[0074] Furthermore, in a possible implementation of this embodiment, the determining unit 91 is further configured to: Using a state register in the control module to obtain second state information generated when the state machine is in the current state, and using the state register to transmit the second state information to a state monitor in the control module; the control module includes a state register and a state monitor; Receiving the second state information using the state monitor, and acquiring the first state information from the lookup table module using the state monitor; The state monitor is used to determine whether a fault occurs in the current state according to the first state information and the second state information.
[0075] Furthermore, in a possible implementation of this embodiment, the determining unit 91 is further configured to: Using the state register to obtain the duration of the state machine being in the current state, and transmitting the duration to the state monitor; The state monitor is used to determine whether a fault occurs when the state machine is in the current state based on the duration.
[0076] Furthermore, in a possible implementation of this embodiment, the transmission unit 92 is further configured to: In the case of determining that a fault occurs when the state machine is in the current state, the state monitor is used to transmit the first state information to the state transmitter in the control module; the control module includes a state register, a state monitor and a state transmitter; The state transmitter is used to transmit the first state information to the state machine.
[0077] The description of the features in the embodiment corresponding to the state recovery device can refer to the relevant description of the embodiment corresponding to the state recovery method, which will not be repeated here.
[0078] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any of the above-mentioned state recovery method embodiments.
[0079] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above-mentioned state recovery method embodiments when running.
[0080] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0081] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any of the above-mentioned state recovery method embodiments are implemented.
[0082] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above-mentioned state recovery method embodiments are implemented.
[0083] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0084] The above is a detailed introduction to a state recovery circuit and its method, device, electronic device and storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
Claims
1. A state recovery circuit, characterized in that: include: Control module, lookup table module; The control module and the lookup table module are connected to the state machine, and the control module is connected to the lookup table module; The lookup table module is used to store state information of at least one state when the state machine is in fault-free operation; The control module is used to determine whether a fault occurs when the state machine is in a current state. If it is determined that a fault occurs when the state machine is in the current state, first state information is transmitted to the state machine so that the state machine performs state recovery based on the first state information. The first state information is state information obtained from the lookup table module and generated when the state machine is in the current state and operates without fault.
2. The state recovery circuit according to claim 1, characterized in that: The control module includes: a status register, a status monitor and a status transmitter; The state register is connected to the state machine and the state monitor respectively; The state monitor is connected to the lookup table module and the state transmitter respectively; The state transmitter is connected to the state machine; The state register is used to obtain second state information and transmit the second state information to the state monitor; the second state information is state information obtained from the state machine and generated when the state machine is in the current state; The state monitor is used to receive the second state information, the state monitor is used to obtain the first state information from the lookup table module, and determine whether a fault occurs when the state machine is in the current state according to the first state information and the second state information; The state monitor is used to transmit the first state information to the state transmitter when determining that the state machine fails when in the current state; The state transmitter is used for receiving the first state information and transmitting the first state information to the state machine.
3. The state recovery circuit according to claim 2, characterized in that: The state monitor is used to determine whether a fault occurs when the state machine is in the current state according to the first state information and the second state information, including: Comparing the first state information with the second state information for consistency; If the first state information is inconsistent with the second state information, it is determined that a failure occurs when the state machine is in the current state.
4. The state recovery circuit according to claim 2, characterized in that: The state register is further used to obtain a duration when the state machine is in the current state, and transmit the duration to the state monitor, so that the state monitor determines whether a fault occurs when the state machine is in the current state according to the duration.
5. The state recovery circuit according to claim 4, characterized in that: The state monitor is also used to: receiving the duration; comparing the duration to a preset time threshold; If the duration is greater than the preset time threshold, it is determined that a fault occurs when the state machine is in the current state.
6. The state recovery circuit according to claim 1, characterized in that: The state recovery circuit also includes: a power supply monitoring module; The power supply monitoring module is connected to the mains, and the power supply monitoring module is connected to the control module; The power supply monitoring module transmits the mains power to the control module so that the control module operates based on the mains power; The power supply monitoring module is used to monitor whether the mains power is cut off when the state machine is in the current state, so that the control module determines whether a fault occurs when the state machine is in the current state based on the monitoring result of whether the mains power is cut off.
7. The state recovery circuit according to claim 6, characterized in that: The state recovery circuit also includes: a power supply; The power supply is connected to the control module; The power supply is used to provide uninterruptible power supply to the control module.
8. A state recovery method, characterized in that: include: Using the control module to determine whether a fault occurs when the state machine is in the current state; When it is determined that a fault occurs when the state machine is in the current state, the control module is used to transmit first state information generated by the state machine running without fault when in the current state obtained from the lookup table module to the state machine, so that the state machine performs state recovery based on the first state information; the lookup table module contains state information of at least one state when the state machine is running without fault.
9. The state recovery method according to claim 8, characterized in that: Determining whether a fault occurs when the state machine is in the current state by using the control module includes: Using the state register in the control module to obtain the second state information generated when the state machine is in the current state, and using the state register to transmit the second state information to the state monitor in the control module; the control module includes the state register and the state monitor; receiving the second state information by using the state monitor, and acquiring the first state information from the lookup table module by using the state monitor; The state monitor is used to determine whether a fault occurs in the current state according to the first state information and the second state information.
10. The state recovery method according to claim 9, characterized in that: The method of using the control module to determine whether a fault occurs when the state machine is in the current state further includes: Using the state register to obtain a duration when the state machine is in the current state, and transmitting the duration to the state monitor; The state monitor is used to determine whether a fault occurs when the state machine is in the current state according to the duration.
11. The state recovery method according to claim 9, characterized in that: The method of transmitting the first state information obtained from the lookup table module when the state machine is in the current state and operating without failure to the state machine by the control module includes: In the case where it is determined that a fault occurs when the state machine is in the current state, the state monitor is used to transmit the first state information to a state transmitter in the control module; the control module includes the state register, the state monitor and the state transmitter; The first state information is transmitted to the state machine by using the state transmitter.
12. A state recovery device, characterized in that: include: a determination unit, used to determine, using the control module, whether a fault occurs when the state machine is in a current state; A transmission unit is used to transmit, by means of the control module, first state information generated by the state machine running without fault when in the current state and obtained from the lookup table module to the state machine when it is determined that a fault occurs when the state machine is in the current state, so that the state machine performs state recovery based on the first state information; the lookup table module contains state information of at least one state when the state machine is running without fault.
13. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the state recovery method as claimed in any one of claims 8 to 11 when executing the computer program.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the state recovery method according to any one of claims 8 to 11.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the state recovery method according to any one of claims 8 to 11 are implemented.
Citation Information
Patent Citations
Fire early warning device for aircraft engine
CN104700547A
Fault management and recovery controller for FPGA triple-modular redundancy framework and control method thereof
CN104731668A
Data recovery method, a data backup method, a related device and a system
CN109522154A
Server startup fault monitoring method and system, and related components
CN110515802A
Fault recovery method and device, electronic equipment, storage medium and vehicle
CN117148824A