Summary of the invention
(1) technical matters that will solve
The invention provides a kind of online fault detection method and device of internal memory, to solve the technical matters that internal-memory detection method of the prior art is not suitable for the equipment of non-stop run in 7 × 24 hours.
(2) technical scheme
For solving the problems of the technologies described above, the invention provides a kind of online fault detection method of internal memory, comprising:
Data in CPU are write simultaneously working memory and reflection internal memory;
CPU is write described working memory and carry out real-time successive appraximation with the data in described reflection internal memory by comparing unit: when internal memory comparative result is consistent, judge that internal memory normally works; When internal memory comparative result is inconsistent, judges memory failure and process accordingly;
Utilize CPU to write different data in the Virtual Space beyond memory headroom and described reflection internal memory simultaneously, carry out real-time successive appraximation by comparing unit and realize comparing unit self-inspection: when self-inspection comparative result is consistent, judge comparing unit fault; When self-inspection comparative result is inconsistent, judge that comparing unit normally works.
Further, described method also comprises:
Between CPU and described reflection internal memory, access impact damper, when described reflection internal memory exports data, make described impact damper be in high-impedance state, the data that described reflection internal memory exports cannot arrive CPU.
Further,
The described data write by CPU in described working memory and described reflection internal memory are carried out real-time successive appraximation by comparing unit and are comprised: each data bit CPU being write the data in described working memory and described reflection internal memory is carried out real-time XOR and compared, and export internal memory comparative result;
Describedly carry out real-time successive appraximation by comparing unit and realize comparing unit self-inspection and comprise: by comparing unit, real-time XOR is carried out to each data bit and compare, export self-inspection comparative result.
Further, described judgement memory failure carry out corresponding process and comprise:
Export memory failure result;
And/or, carry out memory failure warning;
And/or, power down process is carried out to CPU.
Further, the described CPU of utilization writes different data and comprises in the Virtual Space beyond memory headroom and described reflection internal memory:
For each data bit, CPU is all utilized to only have with described reflection internal memory write the data that this data bit is different to Virtual Space.
On the other hand, the present invention also provides a kind of online failure detector of internal memory, comprising:
Writing unit, for writing working memory and reflection internal memory simultaneously by the data in CPU; Also for utilizing CPU by the Virtual Space beyond different data simultaneously write memory space and described reflection internal memory;
Comparing unit, carries out real-time successive appraximation for the data write by CPU in described working memory and described reflection internal memory, exports internal memory comparative result; Also carry out real-time successive appraximation for the data write by CPU in described Virtual Space and described reflection internal memory, export self-inspection comparative result;
Memory failure judging unit, for judging internal memory duty, when described internal memory comparative result is consistent, judges that internal memory normally works; When described internal memory comparative result is inconsistent, judges memory failure and process accordingly;
Self-test unit, for judging comparing unit duty, when described self-inspection comparative result is consistent, judges comparing unit fault; When described self-inspection comparative result is inconsistent, judge that comparing unit normally works.
Further, described device also comprises:
Impact damper, is connected between CPU and described reflection internal memory, and for preventing the data of described reflection internal memory from arriving CPU, when described reflection internal memory exports data, described impact damper is in high-impedance state, and the data that described reflection internal memory exports cannot arrive CPU.
Further, described comparing unit comprises:
Internal memory compares subelement, and each data bit for CPU being write the data in described working memory and described reflection internal memory is carried out real-time XOR and compared, and exports internal memory comparative result;
Subelement is compared in self-inspection, and each data bit for CPU being write the data in described Virtual Space and described reflection internal memory is carried out real-time XOR and compared, and exports self-inspection comparative result.
Further, described memory failure judging unit comprises:
Fault exports subelement, for exporting memory failure result;
And/or alarm part-unit, for carrying out memory failure warning;
And/or power-off subelement, for carrying out power down process to CPU.
Further, said write unit comprises:
Self-inspection write subelement, for for each data bit, all utilizes CPU to only have with described reflection internal memory write the data that this data bit is different to Virtual Space.
(3) beneficial effect
Visible, in the online fault detection method and device of internal memory provided by the invention, the data using two internal memory real-time storage identical compare, the fault occurred for internal memory can in delicate level identification out, improve the promptness that memory failure detects, reduce the possibility that memory failure works the mischief.Method of the present invention is simple, and do not affect the execution time of program, and do not have specific demand to software, development difficulty reduces greatly.
Embodiment
For making the object of the embodiment of the present invention, technical scheme and advantage clearly, below in conjunction with the accompanying drawing in the embodiment of the present invention, technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
First the embodiment of the present invention provides a kind of online fault detection method of internal memory, see Fig. 1, comprising:
Step 101: the data in CPU are write simultaneously working memory and reflection internal memory.
Step 102: CPU is write described working memory and carry out real-time successive appraximation with the data in described reflection internal memory by comparing unit: when internal memory comparative result is consistent, judge that internal memory normally works; When internal memory comparative result is inconsistent, judges memory failure and process accordingly.
Step 103: utilize CPU simultaneously to write different data in the Virtual Space beyond memory headroom and described reflection internal memory, carry out real-time successive appraximation by comparing unit and realize comparing unit self-inspection: when self-inspection comparative result is consistent, judge comparing unit fault; When self-inspection comparative result is inconsistent, judge that comparing unit normally works.
Visible, in the online fault detection method of the internal memory provided in the embodiment of the present invention, the data using two internal memory real-time storage identical compare, the fault occurred for internal memory can in delicate level identification out, improve the promptness that memory failure detects, reduce the possibility that memory failure works the mischief.The method of the embodiment of the present invention is simple, and do not affect the execution time of program, and do not have specific demand to software, development difficulty reduces greatly.
In order to ensure normal reading and writing data between CPU and working memory, do not affect the normal work of working memory, in one embodiment of the invention, preferably, impact damper Buffer can be accessed between CPU and reflection internal memory, when described reflection internal memory exports data, make impact damper be in high-impedance state, the data that described reflection internal memory exports cannot arrive CPU.
In another embodiment of the present invention, preferably, the data write by CPU in working memory and reflection internal memory are carried out real-time successive appraximation by comparing unit and can be comprised: each data bit D0, the D1 that CPU are write the data in described working memory and described reflection internal memory ... Dn carries out real-time XOR and compares, the comparative result of all figure places to be connected to or on door, as long as have an output inconsistent, or door will export inconsistent internal memory comparative result.
In like manner, preferably, carry out real-time successive appraximation by comparing unit and realize comparing unit self-inspection and also can comprise: by comparing unit, real-time XOR is carried out to each data bit and compare, export self-inspection comparative result.
In one embodiment of the invention, preferably, judge memory failure and carry out processing accordingly and can comprising: exporting memory failure result; And/or, carry out memory failure warning; And/or, power down process is carried out to CPU.
In order to can both process of self-test be performed to each data bit of comparing unit, in another embodiment of the present invention, preferably, utilize CPU to write different data in the Virtual Space beyond memory headroom and reflection internal memory can comprise: for each data bit, all utilize CPU to only have with described reflection internal memory write the data that this data bit is different to Virtual Space.Utilize the comparison of this loop-around data position mode and self-detection result to export, the fault of each data bit can be identified.
Below to carry out the online fault detect of internal memory to the system of 32 bit data bus, describe the specific implementation process of the embodiment of the present invention in detail, see Fig. 2.
Step 201: the data in CPU are write simultaneously working memory and reflection internal memory.
Fig. 3 is the internal memory testing circuit schematic diagram of the embodiment of the present invention, according to the typical circuit of CPU, the chip selection signal CS of CPU, read-write W/R, address bus A [0..n], data bus D [0..n] are directly connected on working memory, while ensureing that CPU can normally work, then CS, W/R, A [0..n], D [0..n] signal are connected on reflection internal memory by buffer zone Buffer.When CPU writes data to working memory and reflection internal memory simultaneously, by W/R, CS signal control Buffer conducting, data D [0..n] can write in working memory, reflection internal memory simultaneously.When CPU reads data, CS, W/R, A [0..n] signal can normally access reflection internal memory, high-impedance state is in again by W/R, CS signal control Buffer, the data of reflection internal memory can normally export, but because Buffer is in high-impedance state, the data of reflection internal memory can't arrive CPU, do not affect the normal work of working memory.
Step 202: the data in working memory described in CPU and reflection internal memory are carried out real-time successive appraximation by comparing unit.
In this step, by working memory, reflection Memory linkage on comparing unit, comparing unit carries out successive appraximation, see the comparing unit schematic diagram of Fig. 4 to the data bus of working memory, reflection internal memory under the control of CS signal.To each data bit D0, the D1 of two internal storage data buses ... D32 carries out XOR and compares, and identical words export 0, and not identical output 1, the result that all figure places compare is connected to or on door, as long as there is an output inconsistent, or door will export 1 signal.Result relatively, eventually through CS signal latch, according to the sequential of different CPU, can select rising edge or negative edge to latch.Comparing unit is realized by logical device, certainly, also can utilize the realizations such as FPGA.
Step 203: export internal memory comparative result.
In this step, memory failure can be judged by the internal memory comparative result exported and processes accordingly.When internal memory comparative result is consistent, judge that internal memory normally works; When internal memory comparative result is inconsistent, process accordingly, in the embodiment of the present invention, internal memory comparative result will be exported and to CPU power-off.
Step 204: compare unit self-inspection.
When comparing unit fault export always comparative result correct time, can cause can't detect during the real fault of internal memory, therefore need to check comparing unit in good time.In the embodiment of the present invention, by the situation that process simulation data are more inconsistent, judge whether comparing unit can export more inconsistent signal: utilize CPU by high address to the Virtual Space write data beyond memory headroom, this high address line traffic control Buffer is utilized to be in high-impedance state, simultaneously by the data bus pull-up after Buffer, under high-impedance state, show as high level.
Make CPU write the form of data to high address for export 0 successively from D0 ~ D32, other positions export 1, and all export 1 to all data bit of reflection internal memory, also namely from D0=0, Dn=1(n ≠ 0), D1=0, Dn=1(n ≠ 1), arrive D32=0 successively, Dn=1(n ≠ 32).Such comparing unit just can identify fault corresponding to each data bit.Comparing unit process of self-test only needs execution 32 times for 32 bit data bus, does not substantially account for the application program execution time.
So far, then the online fault detection method overall process of embodiment of the present invention internal memory is completed.
The embodiment of the present invention additionally provides a kind of online failure detector of internal memory, see Fig. 5, comprising:
Writing unit 501, for writing working memory and reflection internal memory simultaneously by the data in CPU; Also for utilizing CPU by the Virtual Space beyond different data simultaneously write memory space and described reflection internal memory;
Comparing unit 502, carries out real-time successive appraximation for the data write by CPU in described working memory and described reflection internal memory, exports internal memory comparative result; Also carry out real-time successive appraximation for the data write by CPU in described Virtual Space and described reflection internal memory, export self-inspection comparative result;
Memory failure judging unit 503, for judging internal memory duty, when described internal memory comparative result is consistent, judges that internal memory normally works; When described internal memory comparative result is inconsistent, judges memory failure and process accordingly;
Self-test unit 504, for judging comparing unit duty, when described self-inspection comparative result is consistent, judges comparing unit fault; When described self-inspection comparative result is inconsistent, judge that comparing unit normally works.
In one embodiment of the invention, preferably, pick-up unit can also comprise: impact damper, be connected between CPU and described reflection internal memory, CPU is arrived for preventing the data of reflection internal memory, when internal memory of videoing exports data, impact damper is in high-impedance state, and the data that reflection internal memory exports cannot arrive CPU.
In another embodiment of the present invention, preferably, comparing unit 502 can comprise:
Internal memory compares subelement, and each data bit for CPU being write the data in described working memory and described reflection internal memory is carried out real-time XOR and compared, and exports internal memory comparative result;
Subelement is compared in self-inspection, and each data bit for CPU being write the data in described Virtual Space and described reflection internal memory is carried out real-time XOR and compared, and exports self-inspection comparative result.
In one embodiment of the invention, preferably, memory failure judging unit 503 can comprise:
Fault exports subelement, for exporting memory failure result;
And/or alarm part-unit, for carrying out memory failure warning;
And/or power-off subelement, for carrying out power down process to CPU.
In another embodiment of the present invention, preferably, writing unit 501 can comprise:
Self-inspection write subelement, for for each data bit, all utilizes CPU to only have with described reflection internal memory write the data that this data bit is different to Virtual Space.
Visible, the embodiment of the present invention has following beneficial effect:
In the online fault detection method of the internal memory provided in the embodiment of the present invention and device, the data using two internal memory real-time storage identical compare, the fault occurred for internal memory can in delicate level identification out, improve the promptness that memory failure detects, reduce the possibility that memory failure works the mischief.The method of the embodiment of the present invention is simple, and do not affect the execution time of program, and do not have specific demand to software, development difficulty reduces greatly.
Last it is noted that above embodiment is only in order to illustrate technical scheme of the present invention, be not intended to limit; Although with reference to previous embodiment to invention has been detailed description, those of ordinary skill in the art is to be understood that: it still can be modified to the technical scheme described in foregoing embodiments, or carries out equivalent replacement to wherein portion of techniques feature; And these amendments or replacement, do not make the essence of appropriate technical solution depart from the spirit and scope of various embodiments of the present invention technical scheme.