A kind of algorithm self-checking circuit and method
Technical field
The present invention relates to technical field of data processing, more particularly to a kind of algorithm self-checking circuit and method.
Background technology
Algorithm represents the policy mechanism for describing to solve the problems, such as with the method for system, is a series of clear fingers solved the problems, such as
Order, input that can be to certain specification obtains required output in finite time.With constantly carrying to performance requirement
Rise, the complexity of algorithm and diversification are also in rising situation.Therefore, need to carry out self-inspection to detect conditions present before algorithm adaptation
Correctness, integrality, security, matching of lower algorithm etc..
Due to various algorithm patterns it is different, it is necessary to parameter it is different, being transplanted to after new environment needs to redeploy, calculate
Method self-inspection may also need to redesign because of the change of condition.This adds resistance to the transplanting of algorithm, can reduce development efficiency,
It is also possible to algorithm is fallen flat.When polyalgorithm is both needed to carry out self-inspection, it need to respectively be identified and self-inspection, increase
System extra resource.
Based on above-mentioned situation, the present invention proposes a kind of algorithm self-checking circuit and method.
The content of the invention
There is provided a kind of simple efficient algorithm self-checking circuit and method for defect of the invention in order to make up prior art.
The present invention is achieved through the following technical solutions:
A kind of algorithm self-checking circuit, it is characterised in that:Including random parameter generation module, parameter memory module, self-inspection data is deposited
Module, self-inspection process control module and interface module are stored up, the interface module is connected with external microcontroller, the parameter storage
Module and self-inspection data memory module are all connected to interface module and algorithm unit;The random parameter generation module, parameter is deposited
Module is stored up, self-inspection data memory module and interface module are all connected to the self-inspection process control module, the random parameter life
Also it is connected into module with parameter memory module.
The random parameter generation module, for the random parameter needed for generating algorithm unit self-inspection, and by generation with
Machine parameter feeding parameter memory module is stored;
The parameter memory module, outside microcontroller is sent into for storing random parameter, and by random parameter by interface module
Device carries out random parameter verification;The preset parameter sent by external microcontroller is stored simultaneously, and calculation is sent into together with random parameter
Method unit;
The self-inspection data memory module, the self-detection result data after self-inspection is calculated and self-inspection are completed for storing through algorithm unit
Complement mark, and be read out by external microcontroller by interface unit;
The self-inspection process control module is used to realize algorithm self-inspection Row control;The algorithm self-inspection Row control includes random
The control of generation with the storage of parameter, notice external microcontroller carry out random parameter reading and start to receive the control of preset parameter
System, algorithm unit read random parameter and preset parameter, proceed by control, the arithmetic result returning to external micro-control of algorithm self-inspection
The control and the selection encoded control of multiple algorithm units for treating self-inspection of device processed.
The interface module is used to connect external microcontroller, realizes the selection decoding of polyalgorithm unit, and provides ginseng
Number memory module read write command and address information;
The external microcontroller is used to provide algorithm self-inspection initial signal, and random parameter is verified, and to algorithm self-inspection
Result data is judged;
The algorithm unit is some or certain the several algoritic modules for treating self-inspection.
The self checking method of the algorithm self-checking circuit, it is characterised in that comprise the following steps:
(1)Receive after external microcontroller initial signal, the random parameter needed for random parameter generation module generating algorithm is deposited
Enter parameter memory module;
(2)Random parameter reads in external microcontroller through interface module and carries out random parameter verification;
(3)External microcontroller sends preset parameter to parameter memory module;
(4)Each algorithm unit reads corresponding preset parameter and algorithm is configured, and calculating is obtained into algorithm self-detection result data
Self-inspection data memory module is stored in algorithm self-inspection complement mark;
(5)External microcontroller reads algorithm self-detection result data and carries out self-detection result judgement, completes algorithm process of self-test.
The beneficial effects of the invention are as follows:The algorithm self-checking circuit and method, can be to algorithm parameter and algorithm self-inspection data
Enter line access, facilitate external equipment to read self-detection result and verified, reduce the time in algorithm migration process and resource
Expense, improves development efficiency;, can be to polyalgorithm using selection decoding architecture by using interface module output result
Unit carries out self-inspection in order, with certain versatility.
Brief description of the drawings
Accompanying drawing 1 is inventive algorithm self-checking circuit structural representation.
Embodiment
In order that technical problems, technical solutions and advantages to be solved are more clearly understood, tie below
Drawings and examples are closed, the present invention will be described in detail.It should be noted that specific embodiment described herein is only used
To explain the present invention, it is not intended to limit the present invention.
The algorithm self-checking circuit, including random parameter generation module, parameter memory module, self-inspection data memory module, from
Examine process control module and interface module, the interface module is connected with external microcontroller, the parameter memory module and from
Inspection data memory module is all connected to interface module and algorithm unit;The random parameter generation module, parameter memory module, from
Inspection data memory module and interface module are all connected to the self-inspection process control module, the random parameter generation module also with
Parameter memory module is connected.
The random parameter generation module, for the random parameter needed for generating algorithm unit self-inspection, and by generation with
Machine parameter feeding parameter memory module is stored;
The parameter memory module, outside microcontroller is sent into for storing random parameter, and by random parameter by interface module
Device carries out random parameter verification;The preset parameter sent by external microcontroller is stored simultaneously, and calculation is sent into together with random parameter
Method unit;
The self-inspection data memory module, the self-detection result data after self-inspection is calculated and self-inspection are completed for storing through algorithm unit
Complement mark, and be read out by external microcontroller by interface unit;
The self-inspection process control module is used to realize algorithm self-inspection Row control;The algorithm self-inspection Row control includes random
The control of generation with the storage of parameter, notice external microcontroller carry out random parameter reading and start to receive the control of preset parameter
System, algorithm unit read random parameter and preset parameter, proceed by control, the arithmetic result returning to external micro-control of algorithm self-inspection
The control and the selection encoded control of multiple algorithm units for treating self-inspection of device processed.
The interface module is used to connect external microcontroller, realizes the selection decoding of polyalgorithm unit, and provides ginseng
Number memory module read write command and address information;
The external microcontroller is used to provide algorithm self-inspection initial signal, and random parameter is verified, and to algorithm self-inspection
Result data is judged;
The algorithm unit is some or certain the several algoritic modules for treating self-inspection.
The self checking method of the algorithm self-checking circuit, it is characterised in that comprise the following steps:
(1)Receive after external microcontroller initial signal, the random parameter needed for random parameter generation module generating algorithm is deposited
Enter parameter memory module;
(2)Random parameter reads in external microcontroller through interface module and carries out random parameter verification;
(3)External microcontroller sends preset parameter to parameter memory module;
(4)Each algorithm unit reads corresponding preset parameter and algorithm is configured, and calculating is obtained into algorithm self-detection result data
Self-inspection data memory module is stored in algorithm self-inspection complement mark;
(5)External microcontroller reads algorithm self-detection result data and carries out self-detection result judgement, completes algorithm process of self-test.