The present invention relates to a computer device.
A conventional computer device and a control method thereof are described with reference to
Processing of an instruction performed inside the CPU 100 includes an instruction fetch cycle, an instruction decode cycle, and an execution cycle for performing execution of the instruction and the like. In the instruction fetch cycle, a program to be executed is acquired from the ROM 2. In the subsequent cycles including the instruction decode cycle, the acquired program is decoded and then subjected to actual processing such as memory access and data manipulation according to the decoded contents of the program.
The operation of the ROM 2 in the instruction fetch cycle will be described with reference to
Thereafter, on receipt of an instruction data determination signal (not shown), the read program is stored in an instruction register (not shown) of the CPU 100. Thus, the instruction fetch cycle is terminated.
In the conventional computer device described above, access to the ROM 2 is only once in the instruction fetch cycle. This arises the following problem. In general, each memory cell of the ROM 2 is essentially constructed of one capacitor and one transistor. With this configuration, if a bit line that is not connected to a turned-ON N-ch transistor 200 is grounded due to noise or the like while it holds the precharged potential and resultantly the H data is turned to L data, there is provided no means for correcting this error. As a result, a program may be read mistakenly from the CPU 100, and the mistakenly read program may be decoded and executed by the ROM 2.
An object of the present invention is providing a computer device capable of detecting an error when a program is mistakenly read from a ROM and reading the program again correctly to ensure safe operation.
To attain the above object, according to the present invention, a same program is read a plurality of times, and matching/non-matching of the read programs is detected. Only when matching is detected, the program is executed.
Specifically, the computer device of the present invention includes: a CPU for outputting an address signal and also outputting an access signal twice for the same address signal; a memory for storing a series of programs, the memory receiving the address signal and the access signal from the CPU and outputting a program located at an address corresponding to the address signal twice in response to the access signal; a latch circuit for latching the program output from the memory, according to the access signal; and a match detection circuit for comparing the two programs at the same address output from the memory, that is, a first-time program output from the latch circuit and a second-time program output from the memory, and detecting matching of the two programs, wherein the CPU receives a comparison result signal from the match detection circuit, and outputs the access signal for the same address again if the matching of the programs fails, so that the match detection circuit performs comparison of a third-time program output from the memory with the second-time program output from the latch circuit.
In the computer device described above, preferably, the first-time, second-time, and third-time programs are output from the memory in an instruction fetch cycle, and when the match detection circuit detects matching between the second-time program and the third-time program, the CPU proceeds to a decode cycle for the matching program.
Alternatively, the computer device of the present invention includes: a CPU for outputting an address signal and also outputting an access signal three times or more for the same address signal; a memory for storing a series of programs and outputting a program located at an address corresponding to the address signal sequentially in response to the access signal output three times or more; a plurality of latch circuits connected in series for latching the program output from the memory sequentially in response to the access signal output three times or more; and a match detection circuit for comparing the plurality of programs at the same address output from the memory, that is, a program output last from the memory and programs output from the respective latch circuits, and detecting matching of all the programs, wherein when the match detection circuit detects matching of all the programs, the CPU proceeds to a decode cycle for the matching program.
In the computer device described above, preferably, a majority circuit for determining a program based on majority rule among the plurality of programs at the same address output from the memory is provided in place of the plurality of latch circuits and the match detection circuit, and the CPU decodes the program determined as the majority by the majority circuit.
Alternatively, the computer device of the present invention includes: a memory for storing a series of programs; and a CPU for sequentially fetching programs from the memory in a pipeline, and decoding and executing the programs, wherein the CPU fetches a first program from the memory in a fetch cycle, in a decode cycle for the first program, the CPU fetches a second program succeeding to the first program, and also requests the memory to re-read the first program, compares the re-read first program with the first program fetched in the fetch cycle for the first program, and proceeds to execution of the first program if the two programs match with each other.
In the computer device described above, preferably, if the two programs fail to match with each other, the CPU requests the memory to second re-read the first program, compares the second re-read first program with the re-read first program, and proceeds to execution of the first program if the two programs match with each other.
In the computer device described above, preferably, the memory receives an address signal from the CPU, and outputs a program located at an address corresponding to the address signal and a program at an address immediately preceding the address corresponding to the address signal.
In the computer device described above, preferably, the memory stores a series of programs in rows and columns in the address order, and on receipt of the address signal from the CPU, the memory outputs two continuous row selection signals and two continuous column selection signals.
The computer device described above preferably further includes a latch circuit, wherein the latch circuit latches the first program output from the memory in the fetch cycle in synchronization with the access signal output from the CPU, and a match detection circuit is connected to the CPU for detecting matching between the first program latched by the latch circuit and the first program re-read in the decode cycle.
In the computer device described above, preferably, when the first program is re-read in the decode cycle, the latch circuit latches the re-read first program, and the match detection circuit detects matching between the secondly re-read first program read when the two first programs fail to match with each other and the re-read first program latched by the latch circuit.
Thus, according to the present invention, a program stored at a given address of the ROM is read a plurality of times, and the program is decoded and executed only when the match detection circuit detects matching of the read programs. This enables safe operation of the CPU as intended according to the correctly read program.
In particular, according to the present invention, when first-time and second-time programs read successively from the same address fail to match with each other, a third-time program is read from the same address. Only when the third-time program matches with the second-time program, the program is decoded and executed. Therefore, even when a program is mistakenly read once, a correctly read program can be executed only by reading the program at the same address three times in total.
According to the present invention, in the decode cycle, while a program fetched in the preceding instruction fetch cycle is being decoded, the program is re-fetched. Only when the re-fetched program matches with the program fetched in the preceding instruction fetch cycle, execution of the decoded program is allowed. Thus, since correct read of the program is confirmed simultaneously with decoding of the program, a high processing speed can be maintained.
Moreover, according to the present invention, a read program is latched by the latch circuit. The program latched by the latch circuit is always the latest-read program. Accordingly, even when the first read program is mistaken due to noise or the like, for example, a correctly read program can be latched by the latch circuit, and this enables confirmation of correct read of a program with high probability.
Hereinafter, preferred embodiments of the present invention will be described with reference to the accompanying drawings.
(First Embodiment)
The operation of the computer device of this embodiment will be described with reference to the signal waveform diagrams of
First, referring to
Next, referring to
As is understood from the above description, in the computer device of this embodiment, the access signal b is output a plurality of times for the same contents of the address signal a in the same instruction fetch cycle, so that the match detection circuit 4 detects matching between a program currently read from the ROM 2 every time the access signal b is output and a program read immediately before the currently read program. If the matching fails, the instruction fetch cycle is extended to read the program once more. And only after the matching of the programs read at the same address is confirmed, the process proceeds to the next decode cycle. This prevents the CPU 1 from executing a wrong program, and thus a safely operable computer device is provided.
Even when the program C is mistakenly read at the first read, the correct program B read at the second read is latched and output by the latch circuit 3 at the third read. Therefore, at the third read, the match detection circuit 4 compares the program B read at the second read with the program B read at the third read, to confirm the matching. Thus, even when the first read is wrong, the CPU 1 can proceed to the next decode cycle by a total of three read operations.
(First Modification)
In this modification, therefore, the reliability of the ROM data input into the CPU 1 is further improved.
(Second Modification)
Referring to
Specifically, referring to the signal waveform diagram of this modification shown in
(Second Embodiment)
A computer device of the second embodiment of the present invention will be described.
The ROM 2 has a configuration as shown in
Referring to
The operation of the computer device of this embodiment shown in of
First, referring to
Thereafter, the CPU 10 shifts the internal state to the instruction decode cycle, where the CPU 10 decodes the input new program A and prepares for processing corresponding to the program A. Simultaneously, the CPU 10 outputs the next address signal a (address data n+1) and the access signal b to the ROM 2. The ROM 2 outputs the preceding program A corresponding to the address N immediately preceding the current address of the address signal a. The latch circuit 3 outputs the latched program A. The match detection circuit 4 compares the two programs A and outputs the match signal e to the CPU 10. The second multiplexer 23 selects the preceding program A on receipt of the match signal e and outputs it to the CPU 10. The CPU 10, which has received the match signal e, stores the program A input from the second multiplexer 23 in an instruction register thereof as the correctly read ROM data. Thus, the instruction decode cycle is terminated.
Next, referring to
Thereafter, the CPU 10 shifts the internal state to the instruction decode cycle, where the CPU 10 decodes the input program C and prepares for processing corresponding to the program C. Simultaneously, however, the CPU 10 outputs the access signal b to the ROM 2, and in response, the ROM 2 outputs again the preceding program B onto the ROM data bus cB.
The match detection circuit 4 compares the re-read program B with the program C output from the latch circuit 3, and as a result, does not output the match signal e. The CPU 10, which receives no match signal e, halts the decoding performed for the program C. The first multiplexer 22 then selects the ROM data bus cB, and thus the latch circuit 3 latches the re-read program B present on the ROM data bus cB. The second multiplexer 23 also selects the re-read program B present on the ROM data bus cB, which is then input into the CPU 10.
Subsequently, the CPU 10, which has halted the decoding for the program C, outputs the access signal b again for re execution of the instruction decode cycle. In this second-time instruction decode cycle, the latch circuit 3 outputs the re-read program B, and the ROM 2 outputs the preceding program B a third time onto the ROM data bus cB. Since the two programs match with each other, the match detection circuit 4 outputs the match signal e to the CPU 10. The CPU 10, which has received the match signal e, stores the program B input from the second multiplexer 23 in the instruction register thereof as the correctly read ROM data. Thus, the instruction decode cycle is terminated, and the process proceeds to the instruction execution cycle for performing actual processing such as memory access and data manipulation.
As is understood from the above description, the computer device of this embodiment outputs the access signal b again in the instruction decode cycle after termination of the instruction fetch cycle. In the instruction decode cycle, the match detection circuit 4 determines whether or not the program under decoding is a correctly read program. If it is found that the program has been mistakenly read, the program at the same address is read again, and thereafter decoding is performed. This prevents a mistakenly read program from being executed.
In addition, in this embodiment, whether or not a program has been correctly read is determined in the instruction decode cycle. Therefore, the time period of one cycle can be shortened compared with the case in the first embodiment in which a program at the same address is read a plurality of times sequentially in the instruction fetch cycle. This makes it possible to provide a safely operable computer device with an increased processing speed.
When the program read from the ROM 2 is a branch instruction, the new program read from the ROM 2 in the instruction fetch cycle and the preceding program read for comparison in the next instruction decode cycle always fail to match with each other. In this case, therefore, read of the preceding program in the instruction decode cycle is forcefully halted.
While the present invention has been described in a preferred embodiment, it will be apparent to those skilled in the art that the disclosed invention may be modified in numerous ways and may assume many embodiments other than that specifically set out and described above. Accordingly, it is intended by the appended claims to cover all modifications of the invention which fall within the true spirit and scope of the invention.
Number | Date | Country | Kind |
---|---|---|---|
2000-375495 | Dec 2000 | JP | national |
Number | Name | Date | Kind |
---|---|---|---|
5157776 | Foster | Oct 1992 | A |
5404467 | Saba et al. | Apr 1995 | A |
5701506 | Hosotani | Dec 1997 | A |
Number | Date | Country |
---|---|---|
60-225254 | Apr 1984 | JP |
09-305422 | Nov 1997 | JP |
Number | Date | Country | |
---|---|---|---|
20020073286 A1 | Jun 2002 | US |