Data retention circuit

Abstract: A data retention circuit which can securely prevent erroneous data from being written into a backup RAM, even when a software upset occurs, for secure data retention in the backup RAM and a game machine provided with the data retention circuit. A backup chip select signal (21f) output from an address decoder (21) is supplied through an AND gate (30) to the backup RAM (20), and outputs of an enable circuit (31) and a software upset detection circuit (41) are used to enable the AND gate (30). The enable circuit (31) outputs an enable signal (31a) only when a predetermined ID code signal is supplied from a CPU (22). When inconsistency between an access pattern and read/write signal occurs, the software upset detection circuit (41) outputs a software upset detection signal (41a). The AND gate (30) blocks a supply of a backup chip select signal (21f) to the backup RAM (20) according to a combination of the software upset detection signal (41a) and the enable signal (31a).

Description: BACKGROUND OF THE INVENTION 1. Field of the Invention This invention relates to a data retention circuit and more particularly to a data retention circuit which can securely prevent an erroneous write from destructing data stored in a backup random access memory (RAM) for secure data retention and a game machine provided with the data retention circuit. 2. Description of the Related Art A conventional video game machine selects a program read from a plurality of program read-only memories (ROMs) or a cassette containing game programs by a chip select signal of an address decoder for desired processing. The address decoder selects one of the program ROMs containing predetermined programs by a chip select signal. To save data such as the current execution state or the game result intact at any period, the address decoder can select a backup RAM and when a save signal is input, output a backup chip select signal for saving the data at the point in time. Therefore, in the video game machine, the intermediate state or the result (score) of a gate such as a roll playing game can be stored securely. Figure 4 shows a schematic circuit configuration of a conventional video game machine. In Figure 4, the video game machine is provided with a work RAM 19 and four program ROMs 11 to 14 installed in a cassette attached to a cassette cartridge or the video game machine main unit. Besides the program ROMs 11-14 and work RAM 19, a backup RAM 20 is located. An address decoder 21 is provided to select one of the four program ROMs 11-14, work RAM 19, and backup RAM 20; it selects one of the program ROMs 11-14 and work RAM 19 by chip select signals 21a, 21b, 21c, 21d, and 21e respectively. When a predetermined save signal is input, the address decoder 21 outputs a backup chip select signal 21f to enable the backup RAM 20. A CPU 22 is provided to supply a desired address signal to the address decoder 21 and predetermined address signals to the ROMs 11-14, work RAM 19, and backup RAM 20. According to a conventional embodiment, a 4-bit address signal is supplied to the address decoder 21 and 8-bit address signals are supplied to the ROMs 11-14, work RAM 19, and backup RAM 20. As is generally known, a data storage RAM 23 is connected to the CPU 22 and an input signal through a joy stick 25 is supplied via an I/O controller to the CPU 22 and further the operation result is displayed on a CRT 27 through a video controller 26. Therefore, formerly, in response to a signal entered by the user through the joy stick 25 or a save signal output independently by the CPU 22, the video game machine 10 can select the backup RAM 20 by the backup chip select signal 21f from the address decoder 21 to save each time the processing contents made so far. A software upset or runaway may occur during system execution by the CPU for a reason such as a bug latent in the game programs stored in the program ROMs 11-14 or a shock given to the video game machine 10. Formerly, a watchdog timer is provided to take a predetermined action or reset the system when such a software upset occurs. If a reset signal is not sent to the watchdog timer every a predetermined period, a software upset is judged to occur and predetermined reset processing is performed. However, when a save signal is input, unconditionally the conventional video game machine 10 selects the backup RAM 20 and saves the state or result at the time, thus when a software upset occurs in the system of the video game machine 10, it may cause the backup chip select signal 21f to be output by accident from the address decoder 21, in which case erroneous data is stored in the backup RAM 20. Thus, data such as the intermediate state of the game stored is destroyed and reliability of the game machine or the programs used with the game machine degrades. Particularly, the data which needs to be stored or retained is not much frequently written, and if the data is easily lost when the software upset or the like occurs, a fatal loss will be incurred. Prevention of an erroneous write at the software upset is a great problem to be solved. From EP-A2-O 431 723 is known a TV game machine with a memory cassette having at least non-volatile memories containing a game program and further processing data for the components of the game machine. A work RAM temporarily memorizes the progress of the game and an IC cart including a RAM, on which the progress of the game can be stored. However, there is no solution provided for the problem of erroneously storing data during a program upset. SUMMARY OF THE INVENTION Accordingly, it is an object of the invention to provide a data retention circuit which can securely prevent erroneous data from being written into a backup RAM, even when a software upset occurs, for secure data retention in the backup RAM and a game machine provided with the data retention circuit. To the end, according to one embodiment of the invention, there is provided a data retention circuit comprising an address decoder which selects one of a plurality of program ROMs and a backup RAM in response to an address signal supplied from a CPU and an enable circuit which enables a backup chip select signal to be supplied to the backup RAM from said address decoder only when a predetermined address signal indicating absence of a software upset is input. According to another embodiment of the invention, there is provided a data retention circuit comprising an address decoder which selects one of a plurality of program ROMs and a backup RAM in response to an address signal supplied from a CPU and a CPU software upset detection circuit which contains a logical operation circuit which performs an operation on a chip select signal from the address decoder and a read/write signal of one of the program ROMs, wherein the software upset detection circuit outputs a software upset detection signal when a memory access pattern to the program ROM is inconsistent with the read/write signal on which data are prevented from being written to the backup RAM. According to a further embodiment of the invention, there is provided a data retention circuit comprising an address decoder which selects one of a plurality of program ROMs and a backup RAM in response to an address signal supplied from a CPU, an enable circuit which enables a backup chip select signal to be supplied to the backup RAM from said address decoder only when a predetermined address signal indicating absence of a software upset is input, and a CPU software upset detection circuit which contains a logical operation circuit which performs an operation on a chip select signal from the address decoder and a read/write signal of one of the program ROMs, wherein the software upset detection circuit outputs a software upset detection signal when a memory access pattern to the program ROM is inconsistent with the read/write signal on which data are prevented from being written to the backup RAM. According to the invention, there is provided a game machine comprising the data retention circuit. Therefore, according to the invention, even if a software upset occurs, the CPU software upset detection circuit can compare a disordered chip select signal peculiar to the address decoder upset time with the read/write signal state, and use inconsistency occurring between the chip select signal and read/write signal for secure software upset detection, thereby securely preventing erroneous writing into the backup RAM when the software upset occurs. In any source other than the software upset, since the enable circuit enables backup operation only when a specific address signal is applied, erroneous writing into the backup RAM can be prevented securely and data can be saved in the backup RAM only when backup operation is enabled. BRIEF DESCRIPTION OF THE DRAWINGS In the accompanying drawings: Figure 1 is a block circuit diagram showing a data retention circuit according to a preferred embodiment of the invention; Figure 2 is a block circuit diagram showing the main part of the data retention circuit which incorporates a software upset detection circuit according to the invention; Figure 3 is a circuit diagram showing one preferred embodiment of an enable circuit according to the invention; and Figure 4 is a block circuit diagram showing an example of a conventional game machine. DESCRIPTION OF THE PREFERRED EMBODIMENTS Referring now to the accompanying drawings, there is shown a preferred embodiment of the invention. Figure 1 shows a data retention circuit in a game machine according to the invention. Circuit parts identical with or similar to those previously described with reference to Figure 4 are denoted by the same reference numerals in Figure 1, and will not be discussed again. The invention is characterized by a backup chip select signal 21f of an address decoder 21 which is supplied via an AND gate 30 to a backup RAM 20 and the AND gate 30 which is enabled after a check is made to ensure that no software upset occurs according to a combination of presence and absence of signal outputs from an enable circuit 31 and a software upset detection circuit 41 making up the data retention circuit. Erroneous data can securely be prevented from being written into the backup RAM 20 for data retention by using the enable circuit 31 and the software upset detection circuit 41 to enable the AND gate 30. The operation of the data retention circuit according to the embodiment is described. The software upset detection circuit 41, one component of the data retention circuit, calculates the correlation between the chip select signals 21a-21d and a read signal 41b and a write signal 41c, and when inconsistency between the memory access pattern and read/write signal occurs, detects a software upset. Figure 2 extracts a part of Figure 1 to show details of the configuration of the software upset detection circuit 41. The operation of the software upset detection circuit 41 is described in conjunction with Figures 1 and 2. In Figure 2, two types of comparison between the access pattern and read/write signal are made. The first comparison is enabled by a NOR gate 42 to which all of the chip select signals 21a-21d are input, an OR gate 43 which detects either a read signal RD or a write signal WR, and an AND gate 44 which ANDs the signals output from the NOR gate 42 and OR gate 43. Therefore, according to the first software upset detection, when the read or write signal is output, at least the address decoder 21 should select one of the external memories and one of the chip select signals 21a-21d should be selected. Therefore, when either the read signal RD or the write signal WR is output, if none of the chip select signals 21a-21d are output, it can be determined that a software upset occurs. This is because such a state means an access to an area whose address is not decoded and the access pattern is inconsistent with the read or write signal output. When such inconsistency occurs, it may be determined that a software upset occurs. In the second software upset detection in the embodiment, when the program ROM 11 is selected by the chip select signal 21a, the chip select signal 21a and the write signal WR are ANDed by an AND gate 45. When the signal 21a for selecting the program ROM 11 is output, it is proper that the read signal RD should be output, but it is not proper that the write signal WR should be output; when both the signals RD and WR are output, inconsistency between the access pattern and the write signal WR is judged to occur. It is caused by a software upset in almost all cases. Therefore, the output of the AND gate can be used as a software upset detection signal 41a. Thus, the software upset detection circuit 41 in the embodiment executes two types of software upset detection. Outputs of both the AND gates 44 and 45 are input to an OR gate 46 and the ORing result is input to a flip-flop 47. When either of the software upsets is detected as described above, the software upset signal 41a can be output from a Q terminal of the flip-flop 47. When an area whose address is not decoded is accessed or when a write signal 41c into the program ROM 11 is output, it is determined that a software upset occurs, and a software upset detection signal 41a is output from the logical operation circuit. Although the second software upset detection in the embodiment uses the chip select signal 21a for the logical operation with the write signal WR, the signal is not limited to the chip select signal 21a. An address signal of any number of bits, such as high-order two bits, selected out of an address signal of high-order four bits input to the address decoder 21 is supplied from the CPU 22 to the enable circuit 31, one component of the data retention circuit. Only when the high-order address signals are supplied in a specific combination, an enable signal 31a can be sent to the AND gate 30. The specific address signal set thus determined is supplied from the CPU 22 as an ID code signal for saving. When outputting a save signal to save the processing contents during execution of the current program, the CPU 22 supplies the predetermined ID code signal to the enable circuit 31. For example, the ID code can be made up of a combination of four 2-bit signals of "11, 10, 01, 00" The enable circuit 31 does not output an enable signal 31a to the AND gate 30 until the high-order two bits of address signals are supplied in the sequence. Therefore, when a software upset occurs, such a specific ID code signal is not provided. Even if the backup chip select signal 21f is output from the address decoder 21, a write operation into the backup RAM 20 can be prevented. The operation of the enable circuit 31 is described in conjunction with Figures 1 and 3. Figure 3 shows a preferred embodiment of the enable circuit 31, wherein four D-type flip-flops 33 to 36 are cascaded and high-order two bits of each signal supplied from the CPU 22, A15 and A14, are fed through logical circuits into D input of each of the flip-flops 33-36. One of the chip select signals output from the address decoders 21, such as 21a, is supplied to a reset input of each of the flip-flops 33-36 and a read clock signal RDCLK is supplied to each clock input. Therefore, according to the embodiment shown in Figure 3, an enable signal 31a is not output from a Q output of the flip-flop 36 at the last stage until the above-mentioned ID code signal, "11, 10, 01, 00" is supplied. Therefore, even when a system upset occurs on the program ROMs 11-14, erroneous data is not written into the backup RAM 20 because a predetermined ID code signal is not input to the enable circuit 31 from the CPU 22. In the embodiment in Figure 1, the enable circuit 31 as well as the software upset detection circuit 41 is provided to prevent an erroneous write, and when an enable signal 31a is not output even if a software upset detection signal 41a is not output, or when a software upset detection signal 41a is also output although an enable signal 31a is output, the AND gate 30 blocks a supply of a backup chip select signal 21f from the address decoder 21 to the backup RAM 20. Therefore, when a software upset occurs, writing into the backup RAM 20 can be prevented securely, and only when no system upset occurs and writing into the backup RAM 20 is enabled, data can be saved. In the embodiment, the chip select signals of the address decoder are used to detect inconsistency between a given access pattern and read/write signal, as described above. However, the inconsistency detection contents are not limited to an access to an area whose address is not decoded or a write instruction into program ROM, and a software upset can be detected with any similar pattern. The data retention circuit according to the embodiment can also be applied to a game machine used by changing a cassette containing a game; it can be incorporated in the game machine main unit or the cassette. According to the invention, software upset detection formerly made by a watchdog timer is executed by using the chip select signals of the address decoder, thus a software upset containing a periodical reset that cannot be detected by the watchdog timer can also be detected securely and when a system upset occurs, erroneous writing into the backup RAM can be prevented securely and destruction of data written in the backup RAM can be prevented securely. On chip select control of program ROMs and backup RAM, the enable circuit can securely prevent erroneous writing into the backup RAM when a system upset occurs, and enables data to be securely saved only when no system upset occurs and writing into the backup RAM is enabled, thereby improving reliability of the game machine installing the data retention circuit.

Claims: A data retention circuit characterized by an address decoder (21) which selects one of a plurality of program ROMs (11, 12, 13, 14) and a backup RAM (20) in response to an address signal supplied from a CPU (22) and an enable circuit (31) which enables a backup chip select signal (21f) to be supplied to said backup RAM (20) only when a predetermined address signal is input indicating absence of a software upset. A data retention circuit characterized by an address decoder (21) which selects one of a plurality of program ROMs (11, 12, 13, 14) and a backup RAM (20) in response to an address signal supplied from a CPU (22) and a CPU software upset detection circuit (41) which contains a logical operation circuit which performs an operation on a chip select signal from said address decoder (21) and a read/write signal (41b, 41c) of said backup RAM (20), wherein said software upset detection circuit (41) outputs a software upset detection signal (41a) when a memory access pattern to said program ROM (11, 12, 13, 14) is inconsistent with the read/write signal (41b, 41c) on which data are prevented from being written to the backup RAM (20). A data retention circuit as claimed in claim 2, further characterized by an enable circuit (31) which enables a backup chip select signal (21f) to be supplied to said backup RAM (20) only when a predetermined address signal is input indicating absence of a software upset. A game machine (10) characterized by comprising the data retention circuit as claimed in anyone of the claims 1 to 3.

Inventors: ONISHI SHUJI, ONISHI, SHUJI
Applicants: ROHM CO LTD, ROHM CO., LTD.
Application year: 1993
Main classification: G11C14
IPC codes: G06F11, G06F21, G06F12, G11C7