CN119675652A - State recovery circuit and method, device, electronic device and storage medium - Google Patents
State recovery circuit and method, device, electronic device and storage medium Download PDFInfo
- Publication number
- CN119675652A CN119675652A CN202510190712.2A CN202510190712A CN119675652A CN 119675652 A CN119675652 A CN 119675652A CN 202510190712 A CN202510190712 A CN 202510190712A CN 119675652 A CN119675652 A CN 119675652A
- Authority
- CN
- China
- Prior art keywords
- state
- state machine
- machine
- control module
- information
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The application discloses a state recovery circuit, a method, a device, an electronic device and a storage medium thereof, which relate to the technical field of circuits. Under the condition that the state machine is determined to be in the current state and has faults, the control module obtains first state information generated by fault-free operation when the state machine is in the current state from the lookup table module, the control module transmits the first state information to the state machine, and the state machine can be directly restored to the current state by utilizing the first state information under the condition that the state information is lost due to the failure of the state machine when the state machine is in the current state because the first state information is the state information generated by the failure-free operation of the state machine when the state machine is in the current state, and the state machine is not required to be initialized. Therefore, the technical problem of lower state recovery efficiency of the state machine can be solved, and the technical effect of improving the state recovery efficiency of the state machine is achieved.
Description
Technical Field
The present application relates to the field of circuit technologies, and in particular, to a state recovery circuit, a method and apparatus thereof, an electronic device, and a storage medium.
Background
The state machine is a time sequence logic circuit, the state machine has multiple states, different functions are realized by switching the state machine between different states, and when the state machine fails, the state of the state machine needs to be recovered.
In the related art of state recovery, a state machine is usually initialized, and the state machine is restarted to be operated in an initial state to a state before a fault occurs, so that the state recovery efficiency of the state machine is low.
Disclosure of Invention
The application provides a state recovery circuit, a method, a device, electronic equipment and a storage medium thereof, which at least solve the problem of low state recovery efficiency of a state machine in the related art.
The application provides a state recovery circuit, which comprises a control module and a lookup table module;
the control module and the lookup table module are connected with the state machine, and the control module is connected with the lookup table module;
the lookup table module is used for storing state information of at least one state of the state machine in fault-free operation;
The control module is used for determining whether the state machine is in a current state or not, and transmitting first state information to the state machine under the condition that the state machine is determined to be in the current state, so that the state machine can recover the state based on the first state information, wherein the first state information is the state information which is generated by fault-free operation when the state machine is in the current state and is acquired from the lookup table module.
The application also provides a state recovery method, which comprises the following steps:
Determining whether a fault occurs when the state machine is in a current state by using a control module;
And under the condition that the state machine is determined to be in the current state and has a fault, transmitting first state information generated by fault-free operation of the state machine in the current state, which is acquired from the lookup table module, to the state machine by using the control module so as to enable the state machine to recover the state based on the first state information, wherein the lookup table module comprises the state information of at least one state of the state machine in the fault-free operation.
The application also provides a state recovery device, which comprises:
The determining unit is used for determining whether a fault occurs when the state machine is in the current state by using the control module;
The system comprises a control module, a state machine recovery unit and a state machine management unit, wherein the control module is used for transmitting first state information which is obtained from the lookup table module and is generated by fault-free operation when the state machine is in a current state to the state machine under the condition that the state machine is determined to be in the current state and is in faults, so that the state machine can recover the state based on the first state information, and the lookup table module comprises the state information of at least one state when the state machine is in the fault-free operation.
The application also provides an electronic device comprising a memory for storing a computer program and a processor for implementing any one of the above state recovery methods when executing the computer program.
The present application also provides a computer readable storage medium having a computer program stored therein, wherein the computer program when executed by a processor implements the steps of any of the above state recovery methods.
The application also provides a computer program product comprising a computer program which when executed by a processor implements the steps of any of the above state recovery methods.
According to the application, the control module in the state recovery circuit is connected with the state machine, so that the control module can determine whether the state machine is in the current state or not, under the condition that the state machine is in the current state and is in fault, the control module acquires first state information generated by fault-free operation when the state machine is in the current state from the lookup table module, and the control module transmits the first state information to the state machine. Therefore, the technical problem of lower state recovery efficiency of the state machine can be solved, and the technical effect of improving the state recovery efficiency of the state machine is achieved.
Drawings
For a clearer description of embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described, it being apparent that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to the drawings without inventive effort for those skilled in the art.
Fig. 1 is a schematic diagram of a state recovery circuit according to an embodiment of the present application;
FIG. 2 is a schematic diagram of another state recovery circuit according to an embodiment of the present application;
FIG. 3 is a schematic diagram of another state recovery circuit according to an embodiment of the present application;
FIG. 4 is a diagram illustrating a power supply mode according to an embodiment of the present application;
FIG. 5 is a flowchart of a state recovery method according to an embodiment of the present application;
FIG. 6 is a schematic diagram illustrating an internal configuration of a control module according to an embodiment of the present application;
FIG. 7 is a schematic diagram illustrating an internal configuration of a power monitoring module according to an embodiment of the present application;
FIG. 8 is a schematic diagram illustrating an internal structure of a status display module according to an embodiment of the present application;
Fig. 9 is a schematic structural diagram of a state recovery device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. Based on the embodiments of the present application, all other embodiments obtained by a person of ordinary skill in the art without making any inventive effort are within the scope of the present application.
It should be noted that in the description of the present application, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. The terms "first," "second," and the like in this specification are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order.
The present application will be further described in detail below with reference to the drawings and detailed description for the purpose of enabling those skilled in the art to better understand the aspects of the present application.
The embodiment of the application provides a state recovery circuit, and a method is described in detail by combining an execution flow of the state recovery circuit.
Fig. 1 is a schematic structural diagram of a state recovery circuit according to an embodiment of the present application, as shown in fig. 1, the state recovery circuit includes a control module 10 and a lookup table module 20.
The control module 10 and the lookup table module 20 are connected with the state machine 30, and the control module 10 is connected with the lookup table module 20.
In an embodiment of the present application, a state machine is a circuit design that follows sequential logic, with a plurality of different states. The principle of operation is that specific functions are achieved by switching between different states. For example, in vending machines, the state machine can switch to different states, such as waiting, coin-in, selecting, delivering, etc., according to operations (such as coin-in, selecting, etc.) of a user, so as to implement a flow of commodity delivery, etc.
In order to facilitate better understanding of state transitions of a state machine, an example is provided, assuming that the state machine consists of N states, state 1, state 2,..and state N, with N trigger conditions 1-N in addition, the state machine enters state 1 when the state machine is reset (i.e. the reset signal is active), enters state 2 when the reset process is finished (the reset signal is inactive) and trigger condition 1 occurs, and then enters the next state each time a trigger condition is generated until the state machine returns to state 1 and then the state transitions are recycled. It should be understood that this phrase is not intended to limit the transition of states to only between adjacent states, but also between non-adjacent states.
In order to facilitate better understanding of the transition between non-adjacent states, as shown in fig. 2, fig. 2 is a schematic structural diagram of another state recovery circuit provided in an embodiment of the present application, where each state has a corresponding logic module, and the logic module controls opening and closing of the corresponding state, so that the transition between non-adjacent states can be implemented through the logic module.
The control module is a core control unit in the state recovery circuit and is responsible for monitoring and managing the state of the state machine. The lookup table module is a storage unit for storing state information of at least one state of the state machine when the state machine operates without faults, and may be a nonvolatile storage unit, for example, a Read-Only Memory (ROM), so that data stored in the ROM is not lost after the ROM is powered down. The lookup table module is used for storing state information of n states when the state machine normally operates, wherein the state information comprises, but is not limited to, input and output of each state and data generated in the state. Specifically, for a certain state N (n=1, 2,.. N), the input is a trigger condition N-1, the output is a trigger condition N, and the generated data is data N, wherein the trigger condition N-1 is an on condition of the state N, and the trigger condition N is a transition condition of the state N, that is, an on condition of a next state of the state N. It should be understood that this term is not intended to limit the look-up table module to only nonvolatile memory cells, but may be other memory cells as well.
Through direct connection, the control module can rapidly acquire state information in fault-free operation from the lookup table module and transmit the state information to the state machine, so that rapid state recovery is realized.
The look-up table module 20 is used to store state information for at least one state of the state machine 30 when operating without a fault.
The state information may include, in addition to the input and output of each state and the data generated in the state, a state code, an internal variable, a time stamp or duration, a fault detection flag, and a transition condition, where the state code is a unique code or identifier of the state, used to distinguish different states, the internal variable is a variable or a counter value stored in the state machine, the internal variable changes during state transition, the duration or the time stamp is a time length of the state machine in the current state or a time point of entering the current state, the fault detection flag is a flag for detecting and recovering a fault, the transition condition is a condition or an event that causes the state machine to transition from the current state to the next state, the input and output may include, in addition to a trigger condition, an input signal, the input signal value received by the state machine in the current state, the input signal may be from an external environment or other circuit module, the output signal may also include an output signal, the output signal is an output signal value generated by the state machine in the current state, and the output signal is used to drive other circuits or perform a specific operation.
The lookup table module is connected with the state machine, and when the state machine does not have a fault in one state transition cycle, the lookup table module stores all state information in the state transition cycle, and also can store all state information generated by the fault-free operation of the state machine in the lookup table module in an external input mode. The fault-free state information (first state information) stored in the lookup table module provides an accurate reference basis for the control module to determine whether the current state of the state machine is normal.
The control module 10 is configured to determine whether a fault occurs when the state machine 30 is in a current state, and in case that the fault occurs when the state machine 30 is in the current state, transmit first state information to the state machine 30, so that the state machine 30 performs state recovery based on the first state information, where the first state information is obtained from the lookup table module 20 and is generated by a fault-free operation when the state machine 30 is in the current state.
The control module collects second state information generated by the state machine in the current state, and extracts first state information corresponding to the state of the state machine in fault-free operation from the lookup table module. The control module compares the first state information with the second state information in consistency. If the two are inconsistent, the current state is judged to have faults. For example, in a vending machine state machine, the inventory quantity of goods should be correspondingly reduced (first state information) in normal shipment, and if the inventory quantity is unchanged (second state information) in the current actual state, the shipment state may be faulty. It should be understood that this description is not intended to limit the determination of the state and whether a fault has occurred in the current state to be achieved by the methods described above, but may be determined by other methods.
After receiving the first state information, the state machine restores the state of the state machine to the corresponding state in fault-free operation according to the first state information. Specific operations include, but are not limited to, resetting internal registers of the state machine, adjusting output signals, reconfiguring internal logic according to the first state information.
The fault-free state information stored in the lookup table module is accurate data which is verified and confirmed in advance, and the control module is used for comparing and judging by taking the fault-free state information as a reference, so that misjudgment and missed judgment can be effectively avoided, and the accuracy of fault detection is improved.
According to the application, the control module in the state recovery circuit is connected with the state machine, so that the control module can determine whether the state machine is in the current state or not, under the condition that the state machine is in the current state and is in fault, the control module acquires first state information generated by fault-free operation when the state machine is in the current state from the lookup table module, and the control module transmits the first state information to the state machine. Therefore, the technical problem of lower state recovery efficiency of the state machine can be solved, and the technical effect of improving the state recovery efficiency of the state machine is achieved.
In some embodiments, with continued reference to FIG. 1, the control module 10 includes a status register 101, a status monitor 102, and a status transmitter 103.
The state register 101 is respectively connected with the state machine 30 and the state monitor 102;
the state monitor 102 is respectively connected with the lookup table module 20 and the state transmitter 103;
The state transmitter 103 is connected with the state machine 30;
The state register 101 is configured to obtain second state information of the state machine 30, and transmit the second state information to the state monitor 102, where the second state information is state information generated by operation of the state machine 30 when the state machine 30 is in a current state;
the state monitor 102 is configured to receive the second state information, and the state monitor 102 is configured to obtain the first state information from the lookup table module 20, and determine, according to the first state information and the second state information, whether a fault occurs when the state machine 30 is in a current state;
The state monitor 102 is configured to transmit the first state information to the state transmitter 103 in case of a failure when it is determined that the state machine 30 is in the current state;
The state transmitter 103 is configured to receive the first state information and transmit the first state information to the state machine 30.
A state register is a circuit or memory element used to store the current state information of a state machine. A state monitor is a circuit or logic unit for monitoring and analyzing the state of a state machine. A state transmitter is a circuit or interface unit for transmitting state information in a circuit.
The state register may also temporarily store a state code value of a current state of the state machine, that is, distinguish different states by the state code value, for example, if a binary coding mode is adopted, the state code value of the state 2 is '2', the state code value of the state 3 is '3', the state monitor may also monitor an input/output trigger condition of the current state, compare the input/output trigger condition with correct input/output information of a corresponding state stored in the lookup table module, indicate that the current state is normal when the comparison is consistent, indicate that the current state is abnormal when the comparison is inconsistent, and generate a fault signal to the state machine. In addition, a preset time threshold is set in the state monitor, and whether the value of the state register is changed or not is monitored within the preset time threshold. If the value of the state register is changed within the preset time threshold, the state is transferred, and when the value of the state register is not changed after the preset time threshold is exceeded, the state machine is abnormal, the state machine stays in the current state, and a fault signal is generated at the moment. In addition, the preset time threshold can be set and changed manually according to the actual running condition of the system. The state transmitter is a data buffer, and the state transmitter may be a volatile memory unit, such as a random access memory (Random Access Memory, RAM), and is used for transmitting corresponding state information in the lookup table module to the state transmitter when a state abnormality occurs. It should be understood that this description is not intended to limit the state transmitter to volatile memory cells, but to other memory cells.
The whole fault detection and state recovery process is automatically completed by the state register, the state monitor and the state transmitter, manual intervention is not needed, and the degree of automation of the system is improved. The automatic capability enables the system to more intelligently cope with various fault conditions, and improves the operation efficiency and management level of the system.
In some embodiments, referring still to fig. 1, the status register 101 is further configured to obtain a duration of time when the state machine 30 is in the current state, and transmit the duration of time 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 of time.
Duration refers to the length of time that the state machine remains in the current state. By comparing the duration with a preset time threshold, it can be determined whether the current state is malfunctioning. Some faults may not immediately result in a change in state information, but may appear as an anomaly in state duration. This design enables the state recovery circuit to accommodate a wider variety of fault scenarios.
In some embodiments, referring still to FIG. 1, the state monitor 102 is further configured to receive the duration, compare the duration to a predetermined time threshold, and determine that the state machine 30 is in the current state if the duration is greater than the predetermined time threshold.
For ease of understanding, an example is provided in which the preset time threshold is 8 seconds assuming a duration of 10 seconds, and since 10 seconds is greater than 8 seconds, it is determined that the current state is malfunctioning.
In combination with a consistency comparison of state information and a 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, the state machine can be judged to possibly fail, so that the accuracy of fault detection is improved, and the situations of misjudgment and missed judgment are reduced.
In some embodiments, referring to fig. 1, the state monitor 102 is configured to determine whether the state machine 30 is in the current state according to the first state information and the second state information, including:
Consistency comparison is carried out on the first state information and the second state information;
if the first state information is inconsistent with the second state information, then it is determined that the state machine 30 is in the current state and a fault occurs.
When the state machine is inconsistent with the first state information or the duration exceeds a preset time threshold value, the state machine is stopped in a certain state, the first state information is read from the lookup table module and then transmitted to the state transmitter, a fault signal is generated, and the state machine acquires the fault signal and then reads the correct first state information in the state transmitter, so that the state machine is restored to the current state, and the operation is continued from the current state. Thus, the system does not need to be reset manually, and the data of the state machine is not lost.
Further, in one possible implementation of the present embodiment, as shown in fig. 3, the state recovery circuit further includes a power supply monitoring module 40;
The power supply monitoring module 40 is connected with the mains supply 50, and the power supply monitoring module 40 is connected with the control module 10;
The power monitoring module 40 transmits the mains 50 to the control module so that the control module 10 operates based on the mains 50;
the power monitoring module 40 is configured to monitor whether the utility power 50 is powered off when the state machine 30 is in the current state, so that the control module 10 determines whether the state machine 30 is in the current state and fails based on the monitoring result of whether the utility power 50 is powered off.
A power monitoring module is an electronic circuit or device for monitoring the status of a power source. The main functions of the power supply monitoring module are to monitor the state of the commercial power in real time, including whether the power is on, whether the voltage is stable or not, and the like. The power supply monitoring module transmits the monitored state information of the mains supply to the control module so that the control module can make corresponding judgment and operation according to the information. Under the condition of commercial power outage, the power supply monitoring module can send out a signal to inform the control module of the commercial power outage. The utility power refers to alternating current supplied by an urban power grid, and generally refers to 220V or 380V alternating current power supply used in daily life.
Monitoring results include, but are not limited to, whether the mains is powered on, voltage level, voltage stability, fault type, fault duration.
The external 220V mains supply is converted into 3.3V and 1.2V Direct Current voltages through alternating Current (ALTERNATING CURRENT, AC)/Direct Current (DC), and the Direct Current voltages are respectively used as Input/Output (IO) voltage and kernel voltage of a state recovery circuit, wherein the IO voltage is used by an Input/Output (IO) module of a state machine, and the kernel voltage is used by a control module. In addition to determining faults through consistency comparisons of status information and monitoring of duration, the addition of the power monitoring module allows fault detection to be monitored from the perspective of the power supply. The utility power is used as an important energy source for system operation, whether power failure is directly related to the normal operation of the system or not, and faults caused by power supply problems can be timely found by monitoring the state of the utility power, so that the comprehensiveness of fault detection is enhanced.
Further, in one possible implementation of the present embodiment, as shown in fig. 3, the state recovery circuit further includes a power supply 60;
the power supply 60 is connected with the control module 10;
The power supply 60 is used to provide uninterruptible power to the control module 10.
The power supply is a standby power supply device, and can provide power support for the control module when the commercial power is powered off in the current state of the state machine so as to ensure that the control module can continuously work and further complete important operations such as monitoring faults of the state machine, information acquisition, state recovery and the like. The power supply includes but is not limited to button cell and Faraday capacitor. In order to better understand the power supply mode of the state recovery circuit, as shown in fig. 4, fig. 4 is a comparison diagram of the power supply mode provided by the embodiment of the present application, where (a) in fig. 4 is a related art power supply mode, power is supplied only by the mains supply, once the mains supply is powered off, the state recovery circuit will fail, and (b) in fig. 4 is the power supply mode of the present application, and even if the mains supply is powered off, the power supply can still provide the uninterrupted power supply for 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 overall system. When the system is in face of external interference such as mains supply outage, the system can operate more stably, probability and influence range of faults are reduced, and powerful guarantee is provided for long-term stable operation of the system.
Further, in one possible implementation of the present embodiment, as shown in fig. 3, the state recovery circuit further includes a state display module 70;
The status display module 70 is connected with the control module 10;
The status display module 70 is configured to obtain the second status information from the control module 10, and visually display the second status information.
The status display module is a functional module capable of receiving specific information and presenting it in a visual form. The visual display can be to display information such as characters, numbers, figures and the like through a display screen, or to display state information through equipment such as an indicator lamp, a buzzer and the like. For example, different states may be indicated by different colored indicator lights, or the current state of the state machine, fault information, etc. may be displayed on a display screen. And the second state information is visually displayed, so that an administrator can be reminded of timely finding out the faults of the state machine.
According to an embodiment of the present application, as shown in fig. 5, fig. 5 is a schematic flow chart of a state recovery method provided by the embodiment of the present application, where the method is applied to a state recovery circuit, and the method includes the following steps:
Step 801, a control module is used to determine if a fault has occurred while the state machine is in a current state.
Step 802, under the condition that the state machine is determined to be in a current state and has a fault, transmitting first state information generated by fault-free operation of the state machine in the current state, which is obtained from a lookup table module, to the state machine by using a control module so that the state machine can perform state recovery based on the first state information, wherein the lookup table module comprises state information of at least one state of the state machine in the fault-free operation.
Since the embodiments of the state recovery method portion and the embodiments of the state recovery circuit portion correspond to each other, the embodiments of the state recovery method portion are referred to the description of the embodiments of the state recovery circuit portion, and are not repeated herein. And has the same advantageous effects as the state restoration circuit mentioned above.
According to the application, the control module in the state recovery circuit is connected with the state machine, so that the control module can determine whether the state machine is in the current state or not, and under the condition that the state machine is in the current state, the control module acquires the first state information generated by the fault-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.
As a refinement of step 801, when executing the determination of whether the state machine is in the current state by the control module, the method may be implemented, but is not limited to, by acquiring second state information generated when the state machine is in the current state by a state register in the control module and transmitting the second state information to a state monitor in the control module by the state register, where the control module includes the state register and the state monitor, receiving the second state information by the state monitor and acquiring the first state information from the lookup table module by the state monitor, and determining whether the current state is faulty by the state monitor according to the first state information and the second state information.
For more specific working procedures of the above embodiments, reference may be made to the corresponding disclosure of the foregoing embodiments, and details are not repeated here.
As a refinement to step 801, when executing the determination by the control module of whether the state machine is in the current state is faulty, it may also be implemented, but is not limited to, by using a state register to obtain the duration of the state machine in the current state and transmitting the duration to a state monitor, and using the state monitor to determine whether the state machine is faulty when in the current state according to the duration.
For more specific working procedures of the above embodiments, reference may be made to the corresponding disclosure of the foregoing embodiments, and details are not repeated here.
As a refinement to step 802, when executing the transmission of the first state information generated by the fault-free operation of the state machine in the current state, which is obtained from the lookup table module, to the state machine by the control module, the method may be implemented by, but is not limited to, transmitting the first state information to a state transmitter in the control module by the state monitor in the case that the state machine is determined to be in the current state, wherein the control module comprises a state register, the state monitor and the state transmitter, and transmitting the first state information to the state machine by the state transmitter.
For more specific working procedures of the above embodiments, reference may be made to the corresponding disclosure of the foregoing embodiments, and details are not repeated here.
In one implementation manner of the embodiment of the present application, in order to better understand the internal structure of the control module, as shown in fig. 6, fig. 6 is an internal structure diagram of the control module provided by the embodiment of the present application, including a timer (Count, CNT), a Comparator (CMP) _1, a Comparator (CMP) _2, a trigger d_ff_1 of a band Enable (E) AND a clear (Remove, R), an input AND gate and_1, an input AND gate and_2, an input OR gate OR, an exclusive OR gate XOR, AND a NOT gate not_1 to not_5.
Wherein, the functions of the CMP_1 and the CMP_2 are to compare the input ends 1 and 2, when the input end 1 is less than or equal to the value of the input end 2, the comparator outputs a high level, when the input end 1 is greater than the value of the input end 2, the comparator outputs a low level, the XOR functions to exclusive-OR the input ends 1 and 2, when the input end 1 is the same as the value of the input end 2, the low level is output, when the input end 1 is different from the value of the input end 2, the high level is output, the CNT functions to count time according to a Clock Cycle (CLK) signal, and the count time T_out is output. reg is the value of a register, i.e. a state code value, which is written into the controller during operation of the state machine. The function of CNT is to time the duration of the current state and compare it with the Threshold, the value of Threshold can be set and adjusted by the developer, manager, etc. when the state changes, reg value changes, the R (clearing end) of CNT clears the timing time, so that the state machine switches to the next state and then counts again.
When the state machine is reset (reset signal RSTn= '0'), RSTn goes through NOT_5 AND becomes high level, so that the clearing end R= '1' of D_FF_1 is enabled, the output end (Q) is low level AND connected to the input end of OR gate OR, when the state machine is in normal operation (RSTn= '1'), the clearing end R= '0' of D_FF_1 is disabled, at the same time, the output value of D_FF_1 is determined by the enabling end (E) AND the data input end (D), at a certain state in the running process of the state machine, the controller acquires the trigger signal Tri_sig of the current state, reads the corresponding reference trigger signal Tri_base in the lookup table 2, compares by XOR, when Tri_sig is NOT equal to Tri_base, the XOR outputs high level, becomes low level after passing through NOT_1, AND NOT_1 becomes high level, AND when NOT_1 passes through NOT_2 AND NOT_3 AND becomes high level to the enabling end (E) of D_FF_1, AND when NOT_1 is higher than D_1 AND the corresponding to the corresponding reference trigger signal Tri_1 in the lookup table 2 is output, AND when Tri_1 is higher than the corresponding to the corresponding reference trigger signal Tri_base in the lookup table 2, AND the corresponding to the corresponding reference trigger signal Tri_1 is output to the input to Tri_base. The timing time T_out of the current state is compared with the time Threshold value Threshold through CMP_1 AND CMP_2, when T_out > Threshold, CMP_2 outputs a high level, becomes a low level after NOT_4, becomes a high level after passing through AND_2 AND NOT_3, AND is input to an enabling terminal (E) of D_FF_1, at the moment, CMP_1 outputs a low level, becomes a high level after passing through AND_1 AND NOT_2, is input to a data input terminal (D) of D_FF_1, AND because the terminal (E) is effective (high level), D_FF_1 outputs a high level, AND then outputs a fault signal error= '1' after passing through OR, AND in addition, when T_out is less than OR equal to Threshold, the time-out is NOT generated, the state is a normal state, AND the output of D_FF_1 depends on other circuit components. The power-down signal vol_off is also connected to the input terminal of the OR gate OR, and when vol_off= '1', a fault signal error= '1' is output.
In one implementation manner of the embodiment of the present application, in order to facilitate better understanding of the internal structure of the power supply monitoring module, as shown in fig. 7, fig. 7 is an internal structure diagram of the power supply monitoring module provided by the embodiment of the present application, including a trigger (d_ff_2) with a clearing end (R), and NOT gates not_6 and not_7. The clock signal CLK is connected to the clock port of D_FF_2, the output of the IO voltage 3.3V of the state machine is vol_in, the output of the data input port is connected to D_FF_2 after NOT_6, the reset signal RSTn is connected to the clearing port R of D_FF_2 after NOT_7, and the output of the data of D_FF_2 is the vol_off signal.
When the state machine is reset (RSTn= '0'), RSTn becomes high level after passing through NOT_7, so that the clearing end R= '1' of D_FF_2 is enabled, and the output vol_off= '0', when the state machine is normally operated (RSTn= '1'), the clearing end R= '0' of D_FF_2 is disabled, at this time, the output value of D_FF_2 is determined by the input end D, when the vol_in is 3.3V high level, the output which is input to D_FF_2 through NOT_6 to be low level is also low level, when the external 220V of the state machine is powered off, the corresponding vol_in becomes zero, and the output of D_FF_2 through NOT_6 to be high level is input to D_FF_2, and the corresponding vol_off= '1'.
In one implementation manner of the embodiment of the present application, in order to facilitate better understanding of the internal structure of the status display module, as shown in fig. 8, fig. 8 is an internal structure diagram of the status display module provided by the embodiment of the present application, where the function of (a) in fig. 8 is to display the current status encoding value according to the value of the control module, and the status encoding value is composed of a decoder and a digital pipe. The input ends S1-S3 of the decoder are respectively connected to 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, reg (2) is the highest bit of the register, the enable end ENB of the decoder is connected to a high level (5V) to enable the decoder to be effective, and the output ends D1-D8 of the decoder are connected to an 8-section nixie tube. The decoder can enable the nixie tube to display 8 different states 0-7 of the state machine according to the values 0-7 input by the register. In this embodiment, the control module is given as 3 bits, if the number of states of the state machine is greater than 8, the number of bits of the control module needs to be increased, and correspondingly, the number of decoders and the number of digital tubes needs to be increased, so as to display the state value when the number of states is greater than 8, and the number of states is not specifically limited in this embodiment.
The function of (b) in fig. 8 is to turn on the alarm lamp and give out an alarm sound when the state machine is powered off, so as to play a role of prompting, so that an administrator can find out the failure of the power-off state machine in time to take a measure of re-powering on. The circuit specifically comprises a resistor R1, a light emitting Diode (LIGHT EMITTING Diode, LED) and a buzzer (Buzzer, BUZ), wherein the LED is used as an alarm lamp, and the BUZ is used as an alarm sound when sounding. Vol_off in fig. 8 is the input signal to the circuit:
When the power supply of the state machine is normal and the voltage is low, the anode of the LED and the input end of the BUZ are both low, at the moment, the LED cannot be conducted to emit light, and the BUZ cannot sound;
when the state machine is powered off, and the voltage of the LED is higher than the voltage of the BUZ, and the LED is turned on to emit light and the BUZ sounds;
R1 is a pull-up resistor, and is typically 10KΩ, and has the effect that the voltage value is weaker (about 1.2V) because the vol_off is driven by the core voltage of the state machine, and the voltage signal strength of the vof _off can be improved through the R1 and the externally connected 5V voltage, so that the vol_off signal can be ensured to normally drive the LEDs and the BUZ.
In addition, the 5V voltage in FIG. 8 is also provided by an independent power supply module, so that the circuit can work normally when the 220V power of the state machine is cut off.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment.
The embodiment of the application also provides a state recovery device, and fig. 9 is a schematic structural diagram of the state recovery device provided by the embodiment of the application, as shown in fig. 9, including:
A determining unit 91, configured to determine, by using a control module, whether a fault occurs when the state machine is in a current state;
And the transmission unit 92 is configured to, when it is determined that the state machine is in the current state and is in a failure state, transmit, by using the control module, first state information generated by the state machine in the current state and having no failure operation, to the state machine, so that the state machine performs state recovery based on the first state information, where the state information of at least one state of the state machine in the no failure operation is included in the lookup table module.
According to the application, the control module in the state recovery circuit is connected with the state machine, so that the control module can determine whether the state machine is in the current state or not, under the condition that the state machine is in the current state and is in fault, the control module acquires first state information generated by fault-free operation when the state machine is in the current state from the lookup table module, and the control module transmits the first state information to the state machine. Therefore, the technical problem of lower state recovery efficiency of the state machine can be solved, and the technical effect of improving the state recovery efficiency of the state machine is achieved.
Further, in a possible implementation of the present embodiment, the determining unit 91 is further configured to,
Acquiring second state information generated when the state machine is in a current state by using a state register in the control module, and transmitting the second state information to a state monitor in the control module by using the state register;
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;
And determining whether the current state fails or not by using the state monitor according to the first state information and the second state information.
Further, in a possible implementation of the present embodiment, the determining unit 91 is further configured to,
Acquiring the duration time when the state machine is in the current state by using a state register, and transmitting the duration time to a state monitor;
And determining whether the state machine is in the current state or not by using a state monitor according to the duration.
Further, in one possible implementation of the present embodiment, the transmission unit 92 is further configured to,
Under the condition that the state machine is determined to be in a current state and has faults, the first state information is transmitted to a state transmitter in a control module by using a state monitor, wherein the control module comprises a state register, the state monitor and the state transmitter;
The first state information is transmitted to the state machine using the state transmitter.
The description of the features in the embodiment corresponding to the state restoration device may refer to the related description of the embodiment corresponding to the state restoration method, which is not described in detail herein.
An embodiment of the application also provides an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the state recovery method embodiments described above.
Embodiments of the present application also provide a computer readable storage medium having a computer program stored therein, wherein the computer program is configured to perform the steps of any of the state recovery method embodiments described above when run.
In an exemplary embodiment, the computer readable storage medium may include, but is not limited to, a U disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, etc. various media in which a computer program may be stored.
Embodiments of the present application also provide a computer program product comprising a computer program which, when executed by a processor, implements the steps of any of the state recovery method embodiments described above.
Embodiments of the present application also provide another computer program product comprising a non-volatile computer readable storage medium storing a computer program which when executed by a processor implements the steps of any of the state restoration method embodiments described above.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The state recovery circuit, the method, the device, the electronic equipment and the storage medium provided by the application are described in detail. The principles and embodiments of the present application have been described herein with reference to specific examples, the description of which is intended only to facilitate an understanding of the method of the present application and its core ideas. It should be noted that it will be apparent to those skilled in the art that various modifications and adaptations of the application can be made without departing from the principles of the application and these modifications and adaptations are intended to be within the scope of the application as defined in the following claims.
Claims (15)
1. The state recovery circuit is characterized by comprising a control module and a lookup table module;
The control module and the lookup table module are connected with a state machine, and the control module is connected with the lookup table module;
The lookup table module is used for storing state information of at least one state of the state machine in fault-free operation;
The control module is used for determining whether the state machine is in a current state or not, and transmitting first state information to the state machine under the condition that the state machine is determined to be in the current state and is in failure, so that the state machine can recover the state based on the first state information, wherein the first state information is the state information which is obtained from the lookup table module and is generated by failure-free operation of the state machine in the current state.
2. The state restoration circuit according to claim 1, wherein the control module comprises a state register, a state monitor and a state transmitter;
The state register is respectively connected with the state machine and the state monitor;
The state monitor is respectively connected with the lookup table module and the state transmitter;
the state transmitter is connected with the state machine;
The state register is used for acquiring second state information and transmitting the second state information to the state monitor, wherein the second state information is the state information generated by running when the state machine acquired from the state machine is in the current state;
the state monitor is used for receiving the second state information, acquiring the first state information from the lookup table module, and determining whether the state machine has a fault in the current state according to the first state information and the second state information;
The state monitor is used for transmitting the first state information to the state transmitter under the condition that the state machine is determined to be in the current state and has faults;
The state transmitter is configured to receive the first state information and transmit the first state information to the state machine.
3. The state restoration circuit of claim 2, wherein the state monitor for determining whether a fault occurred while the state machine was in the current state based on the first state information and the second state information comprises:
consistency comparison is carried out on the first state information and the second state information;
If the first state information is inconsistent with the second state information, determining that the state machine fails when in the current state.
4. The state restoration circuit according to claim 2, wherein the state register is further configured to obtain a duration of time when the state machine is in the current state, and transmit the duration of time 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 of time.
5. The state restoration circuit according to claim 4, wherein the state monitor is further configured to,
Receiving the duration;
comparing the duration with a preset time threshold;
And if the duration is greater than the preset time threshold, determining that the state machine fails when in the current state.
6. The state restoration circuit according to claim 1, further comprising a power supply monitoring module;
The power supply monitoring module is connected with the mains supply, and the power supply monitoring module is connected with the control module;
the power supply monitoring module transmits the commercial power to the control module so that the control module runs based on the commercial power;
The power supply monitoring module is used for monitoring whether the commercial power is powered off when the state machine is in the current state, so that the control module determines whether the state machine is in the current state and fails or not based on the monitoring result of whether the commercial power is powered off.
7. The state restoration circuit according to claim 6, wherein the state restoration circuit further comprises a power supply;
the power supply is connected with the control module;
the power supply is used for providing uninterrupted power supply for the control module.
8. A method for state recovery, comprising:
Determining whether a fault occurs when the state machine is in a current state by using a control module;
And under the condition that the state machine is determined to be in the current state and has a fault, transmitting first state information which is acquired from a lookup table module and is generated by fault-free operation when the state machine is in the current state to the state machine by using the control module so that the state machine can recover the state based on the first state information, wherein the lookup table module comprises the state information of at least one state when the state machine is in the fault-free operation.
9. The state restoration method according to claim 8, wherein determining, with the control module, whether a failure has occurred while the state machine is in the current state comprises:
acquiring second state information generated when the state machine is in the current state by using a state register in the control module, and transmitting the second state information to a state monitor in the control module by using the state register;
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;
and determining whether the current state fails or not according to the first state information and the second state information by using the state monitor.
10. The state restoration method according to claim 9, wherein determining, with the control module, whether the state machine is in a current state and fails further comprises:
acquiring the duration time when the state machine is in the current state by using the state register, and transmitting the duration time to the state monitor;
And determining whether a fault occurs when the state machine is in the current state according to the duration time by using the state monitor.
11. The state restoration method according to claim 9, wherein the transmitting, by the control module, first state information generated by the state machine having no malfunction when the state machine is in the current state, which is obtained from a lookup table module, to the state machine includes:
transmitting the first state information to a state transmitter in the control module by using the state monitor under the condition that the state machine is determined to be in the current state and fails;
And transmitting the first state information to the state machine by using the state transmitter.
12. A state restoration device, comprising:
The determining unit is used for determining whether a fault occurs when the state machine is in the current state by using the control module;
And the transmission unit is used for transmitting first state information which is acquired from the lookup table module and generated by the state machine in the current state and is generated by fault-free operation to the state machine under the condition that the state machine is determined to be in the current state and faults, so that the state machine can recover the state based on the first state information, and the lookup table module comprises the state information of at least one state of the state machine in the fault-free operation.
13. An electronic device, comprising:
a memory for storing a computer program;
Processor for implementing the steps of the state restoration method according to any of the claims 8 to 11 when executing said computer program.
14. A computer readable storage medium, characterized in that a computer program is stored in the computer readable storage medium, wherein the computer program, when being executed by a processor, implements the steps of the state restoration method according to any of claims 8 to 11.
15. A computer program product comprising a computer program which, when executed by a processor, implements the steps of the state restoration method according to any one of claims 8 to 11.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202510190712.2A CN119675652A (en) | 2025-02-20 | 2025-02-20 | State recovery circuit and method, device, electronic device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202510190712.2A CN119675652A (en) | 2025-02-20 | 2025-02-20 | State recovery circuit and method, device, electronic device and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN119675652A true CN119675652A (en) | 2025-03-21 |
Family
ID=94996845
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202510190712.2A Pending CN119675652A (en) | 2025-02-20 | 2025-02-20 | State recovery circuit and method, device, electronic device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN119675652A (en) |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1434603A (en) * | 2002-01-23 | 2003-08-06 | 华为技术有限公司 | Method for realizing LUT circuit and LUT circuit thereof |
CN104700547A (en) * | 2014-07-11 | 2015-06-10 | 成都飞亚航空设备应用研究所有限公司 | Fire early warning device for aircraft engine |
CN104731668A (en) * | 2014-12-05 | 2015-06-24 | 中国航空工业集团公司第六三一研究所 | Fault management and recovery controller for FPGA triple-modular redundancy framework and control method thereof |
US20180113775A1 (en) * | 2016-10-21 | 2018-04-26 | Microsoft Technology Licensing, Llc | Systematic testing of failover and recovery for distributed system components |
CN109522154A (en) * | 2015-09-10 | 2019-03-26 | 华为技术有限公司 | Data reconstruction method and relevant device and system |
CN110515802A (en) * | 2019-08-23 | 2019-11-29 | 苏州浪潮智能科技有限公司 | A monitoring method, system and related components for server startup failure |
US20210124655A1 (en) * | 2019-10-28 | 2021-04-29 | Nxp Usa, Inc. | Dynamic Configurable Microcontroller Recovery |
CN119448353A (en) * | 2024-11-14 | 2025-02-14 | 江苏果下科技有限公司 | A method for controlling an energy storage converter |
-
2025
- 2025-02-20 CN CN202510190712.2A patent/CN119675652A/en active Pending
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1434603A (en) * | 2002-01-23 | 2003-08-06 | 华为技术有限公司 | Method for realizing LUT circuit and LUT circuit thereof |
CN104700547A (en) * | 2014-07-11 | 2015-06-10 | 成都飞亚航空设备应用研究所有限公司 | Fire early warning device for aircraft engine |
CN104731668A (en) * | 2014-12-05 | 2015-06-24 | 中国航空工业集团公司第六三一研究所 | Fault management and recovery controller for FPGA triple-modular redundancy framework and control method thereof |
CN109522154A (en) * | 2015-09-10 | 2019-03-26 | 华为技术有限公司 | Data reconstruction method and relevant device and system |
US20180113775A1 (en) * | 2016-10-21 | 2018-04-26 | Microsoft Technology Licensing, Llc | Systematic testing of failover and recovery for distributed system components |
CN110515802A (en) * | 2019-08-23 | 2019-11-29 | 苏州浪潮智能科技有限公司 | A monitoring method, system and related components for server startup failure |
US20210124655A1 (en) * | 2019-10-28 | 2021-04-29 | Nxp Usa, Inc. | Dynamic Configurable Microcontroller Recovery |
CN119448353A (en) * | 2024-11-14 | 2025-02-14 | 江苏果下科技有限公司 | A method for controlling an energy storage converter |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US5283905A (en) | Power supply for computer system manager | |
CN112763960B (en) | Self-operation and maintenance method of on-site module | |
US12222787B2 (en) | Server firmware self-recovery system and server | |
CN110212645B (en) | A method and device for reporting a power outage event in a power consumption information collection terminal | |
CN106877442B (en) | Battery management method | |
CN211208607U (en) | Monitoring device and battery management system for battery management system | |
CN113806132B (en) | Processing method and device for abnormal reset | |
US7818597B2 (en) | Computer system fault detection | |
CN105372584A (en) | Microswitch testing method, device and system | |
CN104360918A (en) | Self-diagnosis and self-recovery method of intelligent transformer substation system | |
CN113917385A (en) | A self-checking method and system for electric energy meter | |
CN114327968A (en) | Method and device for realizing telephone warning of server hardware failure with universal interface | |
CN101124549B (en) | Equipment and method for displaying computer status | |
CN201319650Y (en) | Fault detection circuit and electronic equipment | |
CN109032318A (en) | A kind of power monitoring system and storage server system | |
CN119675652A (en) | State recovery circuit and method, device, electronic device and storage medium | |
KR20140146341A (en) | Watt-hour meter and operating method thereof | |
CN109582498A (en) | Data protection circuit and guard method when a kind of CPLD powered-off fault | |
CN112114901A (en) | Standby control circuit, method, device and storage medium | |
CN112463479A (en) | Automatic testing method and system for VR abnormal power failure detection positioning function | |
CN114884021B (en) | Power supply control method of power supply circuit and related components | |
CN216014202U (en) | Power supply and power-on reset circuit of RF transmitting chip | |
CN112217273B (en) | Monitoring method and monitoring device for battery management system | |
CN115202983A (en) | Distributed cluster disk fault location method, system, device and storage medium | |
CN115658373A (en) | Server-based memory processing method and device, processor and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |