Abstract:
A status register apparatus includes a control information register for holding one item of control information. An ON decoder is connected to receive a control word composed of a plurality of bits and for generating a set signal to the control information register when the ON decoder detects a first bit pattern for setting the control information register into an on condition. An OFF decoder is connected to receive the control word and for generating a clear signal to the control information register when the OFF decoder detects a second bit pattern for setting the control information register into an off condition. When the first bit pattern is detected by the ON decoder, the control information register is set to the on condition in response to the set signal. When the second bit pattern is detected by the OFF decoder, the control information register is set to the off condition in response to the clear signal. When neither the first bit pattern nor the second bit pattern is detected, the control information register maintains its preceding condition.

Description:
This application is a continuation of application Ser. No. 07/514,141, filed Apr. 25, 1990, now abandoned. 
    
    
     BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to a data processor, and more specifically to a status register apparatus for use in a microprocessor. 
     2. Description of Related Art 
     In general, a status register apparatus provided in a microprocessor includes a plurality of control information registers, each being adapted to hold one item of control information inherent to the control information register. 
     Conventionally, a control word of a microprocessor which is inherent data for setting the status registers is constituted in such a manner that each bit of the control word is assigned to one corresponding control information register. Therefore, it is possible to simultaneously set a plurality of items of control information by means of the control word. 
     Referring to FIG. 1, there is shown a typical relation between a conventional control word and a virtual mode flag and a cache enable flag, these flags being typical control information registers in the status register apparatus of the microprocessor. The virtual mode flag is for switching between a real address mode of the microprocessor and a virtual address mode for a virtual memory function. This virtual mode flag is assigned to a &#34;No.3&#34; bit of the control word. The cache enable flag is for controlling whether or not an internal cache memory of the microprocessor is used. This cache enable flag is assigned to a &#34;No.2&#34; bit of the control word. In the example shown, since the control word is composed of 8 bits, the control word can be allocated to eight control information registers at maximum. When an operator of the microprocessor rewrites the cache enable flag, the control word is read out from the status register apparatus, and the &#34;No. 2&#34; bit of the read-out control word is modified by means of, for example, an logical product operation, and thereafter, the modified control word is rewritten into the status register apparatus by activating a write signal for the status register apparatus. As a result, the cache enable flag is rewritten. 
     Thus, the control information register for the cache enable flag can be written by setting a desired value to a corresponding &#34;No.2&#34; bit of the control word, and by writing the corresponding &#34;No.2&#34; bit of the control word having the desired value into the control information register when the write signal is active. Similarly, the control information register for the virtual mode flag can be written by setting a desired value to a corresponding &#34;No.3&#34; bit of the control word, and by writing the corresponding &#34;No.3&#34; bit of the control word having the desired value into the control information register when the write signal is active. In other words, when the write signal is active, all bits or allocated bits of the control words are written into corresponding control information registers. On the other hand, contents of the respective control information registers are maintained by maintaining the write signal in an inaction condition. 
     On the other hand, the status register apparatus of the conventional microprocessor has been mainly such that the respective control information registers hold control information of the system itself or are allocated to flags indicative of an operation condition of the microprocessor. Therefore, if the status register apparatus is erroneously set, there is a danger that it might cause the system to malfunction, or might damage the system. In the conventional status register apparatus there is a possibility that the status register apparatus might be erroneously set. For example, although only the cache enable flag should be rewritten, if not only the &#34;No.2&#34; bit of the control word corresponding to the cache enable flag but also the &#34;No.3&#34; bit of the control word corresponding to the virtual mode flag were modified, when the write signal becomes active and the cache enable flag is properly rewritten the virtual mode flag might be erroneously rewritten, with the result that the system would cause a &#34;program run away&#34;. 
     SUMMARY OF THE INVENTION 
     Accordingly, it is an object of the present invention to provide a status register apparatus which has overcome the above mentioned defect of the conventional one. 
     Another object of the present invention is to provide a status register apparatus which can prevent a control information register from being erroneously rewritten in place of another control information register. 
     The above and other objects of the present invention are achieved in accordance with the present invention by a status register apparatus including a control information register for holding one item of control information, a first decoder connected for receive register control data composed of a plurality of bits and for generating a first signal to the control information register when the first decoder detects a first bit pattern for setting the control information register into an on condition, and a second decoder connected to receive the register control data and for generating a second signal for the control information register when the second decoder detects a second bit pattern for setting the control information register into an off condition, so that when the first bit pattern is detected by the first decoder, the control information register is set to the on condition in response to the first signal, and when the second bit pattern is detected by the second decoder, the control information register is set to the off condition in response to the second signal, and when neither the first bit pattern nor the second bit pattern is detected, the control information register maintains its preceding condition. 
     According to another aspect of the present invention, there is provided a status register apparatus including a plurality of control information registers each for holding one item of control information, a plurality of ON decoders each provided for a corresponding one of the control information registers and to receive register control data composed of a plurality of bits for generating a set signal for the corresponding control information register when the ON decoder detects a bit pattern for setting the corresponding control information register into an on condition, and a plurality of OFF decoders each provided for a corresponding one of the control information registers and to receive the same data as the register control data supplied to the ON decoder corresponding to the corresponding control information register, so as to generate a clear signal for the corresponding control information register when the OFF decoder detects another bit pattern for setting the corresponding control information register into an off condition, so that each of the control information registers is brought into the on condition when the corresponding ON decoder generates the set signal as the result of detection of the bit pattern for setting the control information register into the on condition, and into the off condition when the corresponding OFF decoder generates the clear signal as the result of detection of the bit pattern for setting the control information register into the off condition. 
     With the above mentioned arrangement, a bit pattern composed of a plurality of bits is assigned for one control information register, and is given in the form of register control data composed of a plurality of bits, which can be a control word, so that only one control information register is set to the on condition or the off condition at a time. This is completely different from the conventional status register apparatus of the microprocessor in which each bit of a control word is allocated to one corresponding item of control information, so that a plurality of items of control information can be simultaneously set. 
     The above and other objects, features and advantages of the present invention will be apparent from the following description of preferred embodiments of the invention with reference to the accompanying drawings. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 illustrates items of control information allocated to a control word in the conventional system; 
     FIG. 2 is a block diagram of an embodiment of a status register apparatus in accordance with the present invention for a microcomputer; 
     FIG. 3 illustrates items of control information allocated to a control word in the embodiment shown in FIG. 2; 
     FIG. 4 is a block diagram of another embodiment of a status register apparatus in accordance with the present invention for a microcomputer: and 
     FIG. 5 illustrates items of control information allocated to a control word in the embodiment shown in FIG. 4. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     Referring to FIG. 2, there is shown a block diagram of an embodiment of a status register apparatus in accordance with the present invention for a microcomputer. This embodiment of the status register apparatus includes one control information register, one ON decoder, one OFF decoder, one initializing circuit and one reading circuit, for each control information flag. A control information register for a cache enable flag is composed of a R-S flipflop 101, and a control information register for a virtual mode flag is composed of a R-S flipflop 111. 
     First, the cache enable flag will be explained. A Q output of the R-S flipflop 101 constitutes a cache enable signal 100. A set input S of the R-S flipflop 101 is connected to an output of an ON decoder 102, which receives, in parallel, a write signal REGWR 104 and all bits of a 8-bit control word through terminals 109 labeled with DATA(7) to DATA(0), respectively. This ON decoder is constructed to decode a bit pattern of &#34;01100101&#34; when the write signal REGWR is active. Therefore, the ON decoder 102 can be formed of one 9-input AND gate and four inverters connected as shown in FIG. 2. A reset input R of the R-S flipflop 101 is connected to receive an output of an OFF decoder 103, which receives, in parallel, the write signal REGWR 104 and all the bits of the 8-bit control word 109, similarly to the ON decoder 102. This OFF decoder is constructed to decode a bit pattern of &#34;10010000&#34; when the write signal REGWR is active. Therefore, the OFF decoder 103 can be formed of one 9-input AND gate and six inverters connected as shown in FIG. 2. 
     The initializing circuit for the cache enable flag is formed of an OR gate 106 having an output connected to the reset input R of the R-S flipflop 101 and a first input connected to an output of the OFF decoder 103 and a second input connected to receive a reset signal IRESET 107, so that an initial value of the R-S flipflop (control information register) 101 is brought to an OFF condition in response to the reset signal IRESET 107. The read circuit is composed of a tristate buffer 108 controlled by a read signal REGRD 105 and having an input connected to the Q output of the R-S flipflop 101 and an output connected to the &#34;No. 2&#34; bit terminal DATA(2) of the control word 109, so that the control information held in the control information register (R-S flipflop 101) is output or set through the tristate buffer 108 to the &#34;No. 2&#34; bit terminal DATA(2) of the control word 109 when the tristate butter 108 is activated by the read signal REGRD 105. 
     Now, the virtual mode flag will be explained. A Q output of the R-S flipflop 111 constitutes a virtual mode signal 110. A set input S of the R-S flipflop 111 is connected to an output of an ON decoder 112, which receives, in parallel, the write signal REGWR 104 and all the bits of the 8-bit control word 109, similarly to the ON decoder 101 for the cache enable flag. This ON decoder is constructed to decode a bit pattern of &#34;11101011&#34; when the write signal REGWR is active. Therefore, the ON decoder 112 can be formed of one 9-input AND gate and two inverters connected as shown in FIG. 2. A reset input R of the R-S flipflop 111 is connected to receive an output of an OFF decoder 113, which receives, in parallel, the write signal REGWR 104 and all the bits of the 8-bit control word 109, similarly to the ON decoder 112. This OFF decoder is constructed to decode a bit pattern of &#34;01010000&#34; when the write signal REGWR is active. Therefore, the OFF decoder 113 can be formed of one 9-input AND gate and six inverters connected as shown in FIG. 2. 
     The initializing circuit for the virtual mode flag is formed of an OR gate 116 having an output connected to the reset input R of the R-S flipflop 111 and a first input connected to an output of the OFF decoder 113 and a second input connected to receive the reset signal IRESET 107, so that an initial value of the R-S flipflop (control information register) 111 is brought to an OFF condition in response to the reset signal IRESET 107. The read circuit is composed of a tristate buffer 118 controlled by the read signal REGRD 105 and having an input connected to the Q output of the R-S flipflop 111 and an output connected to the &#34;No. 3&#34; bit terminal DATA(3) of the control word 109, so that the control information held in the control information register (R-S flipflop 111) is outputted through the tristate butter 118 to the &#34;No. 3&#34; bit terminal DATA(3) of the control word 109 when the tristate butter 118 is activated by the read signal REGRD 105. 
     Turning to FIG. 3, there is illustrated an allocation between items of control information and the control word in the embodiment of the status register apparatus shown in FIG. 2 for the microprocessor. 
     As seen from FIG. 3, the bit pattern for setting the control information register corresponding to the cache enable flag is such that when &#34;01100101&#34; is set to the control word, the control information register is set to the ON condition, and when &#34;1001000&#34; is set to the control word, the control information register is set to the OFF condition. The bit pattern for setting the control information register corresponding to the virtual mode flag is such that when &#34;11101011&#34; is set to the control word, the control information register is set to the ON condition, and when &#34;01010000&#34; is set to the control word, the control information register is set to the OFF condition. When the other bits patterns are set to the control word, the two control information registers are not changed so that their preceding conditions are maintained. 
     Now, a write operation for the control information register will be explained. The bit patterns of the control words are supplied through the terminals 109 DATA(7-0) to the ON decoder 102 and the OFF decoder 103 for the cache enable flag and to the ON decoder 112 and the OFF decoder 113 for the virtual mode flag. When the supplied bit pattern is &#34;01100101&#34;, it is decoded by the ON decoder 102 for the cache enable flag, so that the R-S flipflop 101 (the control information register) is set in synchronism with the write signal REGWR 104. With this, the cache enable signal 101 is set to the ON condition. If the bit pattern is &#34;00100101&#34;, it is decoded by none of the four decoders 102, 103, 112 and 113, and therefore, the conditions of the two control information registers are not changed, so that the cache enable flag and the virtual mode flag maintain their preceding condition. 
     Referring to FIG. 4, there is shown a block diagram of another embodiment of a status register apparatus in accordance with the present invention for a microcomputer. This second embodiment includes one control information register, one ON decoder, one OFF decoder, one initializing circuit and one reading circuit, for each control information flag. The first embodiment is such that all the four decoders receive the same bit pattern of 8 bits, but the second embodiment is such that for each control information flag, a bit pattern composed of two bits, which are selected from the control word, but which are different from those selected for other control information flags, is decoded. A control information register for a cache enable flag is composed of a R-S flipflop 201, and a control information register for a virtual mode flag is composed of a R-S flipflop 211. 
     First, the cache enable flag will be explained. A Q output of the R-S flipflop 201 constitutes a cache enable signal 200. A set input S of the R-S flipflop 201 is connected to an output of an ON decoder 202, which receives, in parallel, a write signal REGWR 204 and &#34;No.1&#34; and &#34;No.0&#34; bits of a 8-bit control word through terminals 209 labeled with DATA(1) and DATA(0), respectively. This ON decoder is constructed to decode a bit pattern of &#34;01&#34; on the terminals DATA(1) and DATA(0) when the write signal REGWR is active. A reset input R of the R-S flipflop 201 is connected to receive an output of an OFF decoder 203, which receives, in parallel, the write signal REGWR 204 and the same &#34;No.1&#34; and &#34;No.0&#34; bits of the 8-bit control word 209, similarly to the ON decoder 202. This OFF decoder is constructed to decode a bit pattern of &#34;10&#34; on the terminals DATA(1) and DATA(0) when the write signal REGWR is active. The initializing circuit for the cache enable flag is formed of an OR gate 206 having an output connected to the reset input R of the R-S flipflop 201 and a first input connected to an output of the OFF decoder 203 and a second input connected to receive a reset signal IRESET 207, so that an initial value of the R-S flipflop (control information register) 201 is brought to an OFF condition in response to the reset signal IRESET 207. The read circuit is composed of a tristate buffer 208 controlled by a read signal REGRD 205 and having an input connected to the Q output of the R-S flipflop 201 and an output connected to the &#34;No. 0&#34; bit terminal DATA(0) of the control word 209, so that the control information held in the control information register (R-S flipflop 201) is output or set through the tristate buffer to the the &#34;No. 0&#34; bit terminal DATA(0) of the control word 209. 
     Now, the virtual mode flag will be explained. A Q output of the R-S flipflop 211 constitutes a virtual mode signal 210. A set input S of the R-S flipflop 211 is connected to an output of an ON decoder 212, which receives, in parallel, the write signal REGWR 204 and &#34;No.3&#34; and &#34;No.2&#34; bits of the 8-bit control word through terminals 209 labeled with DATA(3) and DATA(2), respectively, which are different from the two bits inputted to the ON decoder 201 for the cache enable flag. This ON decoder is constructed to decode a bit pattern of &#34;01&#34; when the write signal REGWR is active. A reset input R of the R-S flipflop 211 is connected to receive an output of an OFF decoder 213, which receives, in parallel, the write signal REGWR 204 and the two bits DATA(3) and DATA(2) of the control word 209, similarly to the ON decoder 212. This OFF decoder is constructed to decode a bit pattern of &#34;10&#34; when the write signal REGWR is active. The initializing circuit for the virtual mode flag is formed of an OR gate 216 and the read circuit is composed of a tristate buffer 218, similarly to those for the cache enable flag. But, the tristate buffer 218 has an output connected to the &#34;No. 2&#34; bit terminal DATA(2) of the control word 209, so that the control information held in the R-S flipflop 211 is output through the tristate buffer to the &#34;No. 2&#34; bit terminal DATA(2) of the control word 209. Each of the decoders 202, 203, 212 having 213 can be composed of one 3-input AND gate and one inverter connected as shown in FIG. 4. 
     Turning to FIG. 5, there is illustrated an allocation between items of control information and the control word in the embodiment of the status register apparatus shown in FIG. 4 for the microprocessor. 
     As seen from FIG. 5, the bit pattern for setting the control information register corresponding to the cache enable flag is such that when &#34;XXXXXX01&#34; is set to the control word, the control information register is set to the ON condition, and when &#34;XXXXXX10&#34; is set to the control word, the control information register is set to the OFF condition. The bit pattern for setting the control information register corresponding to the virtual mode flag is such that when &#34;XXXX01XX&#34; is set to the control word, the control information register is set to the ON condition, and when &#34;XXXX10XX&#34; is set to the control word, the control information register is set to the OFF condition. In addition, the bit pattern for writing both of the control information register of the cache enable flag and the control information register of the virtual mode flag is as follows: When &#34;XXXX0101&#34; is set to the control word, both of the control information registers are set to the ON condition, and when &#34;XXXX1010&#34; is set to the control word, both of the control information registers are set to the OFF condition. When &#34;XXXX0110&#34; is set to the control word, the control information register of the cache enable flag is set to the OFF condition, and the control information register of the virtual mode flag is set to the ON condition. If &#34;XXXX1001&#34; is set to the control word, the control information register of the cache enable flag is set to the ON condition, and the control information register of the virtual mode flag is set to the OFF condition. When the other bits patterns are set to the control word, the two control information registers are not changed so that the preceding conditions are maintained. 
     In the first embodiment shown in FIG. 2, all bits of the control word is utilized in order for one control information register to be set to the ON or OFF condition on the basis of the bit pattern given to the control word. Therefore, the setting of the control word at one time can rewrite only one control information register. In the second embodiment, on the other hand, the control word is divided into a plurality of units each composed of two bits, so that a plurality of control information registers can be simultaneously set to the ON or OFF condition. 
     Now, a write operation for the control information register in the second embodiment shown in FIG. 4 will be explained. The bit pattern of the control words are supplied through the terminals 209 DATA(7-0) as they are, and the bits DATA(1-0) are input to the ON decoder 202 and the OFF decoder 203 for the cache enable flag, and the bits DATA(3-2) are input to the ON decoder 212 and the OFF decoder 213 for the virtual mode flag. When the supplied bit pattern is &#34;XXXX0101&#34;, it is decoded by the ON decoder 202 for the cache enable flag and the ON decoder 212 for the virtual mode flag, so that the two R-S flipflops 201 and 211 (the control information registers) are set in synchronism with the write signal REGWR 204. With this, the cache enable signal 200 and the virtual mode signal 210 are set to the ON condition. If the bit pattern is &#34;XXXX0000&#34;, it is decoded by none of the four decoders 202, 203, 212 and 213, and therefore, the conditions of the two control information registers are not changed, so that the cache enable flag and the virtual mode flag maintain their preceding condition. 
     As seen from the above description of the embodiments, the status register apparatus in accordance with the present invention is such that when one control information register is rewritten, the rewriting will not influence the other control information registers. Therefore, it is not necessary to read out the control word, to modify a bit of the control word corresponding to a control information register to be rewritten, and to return the control word having the modified bit. In other words, the present invention is advantageous in that a control information register to be rewritten can be easily set to the ON or OFF condition by giving a predetermined bit pattern composed of a plurality of bits to the control word. In some cases, however, the number of the control information registers allowed to be allocated to the control word would become smaller than that of the conventional apparatus. This is not a problem. In this connection, it should be noted that it is the conventional practice that all the bits of the control word are not allocated to various control information registers. Items of control information having a particularly significant meaning are a limited number, and, some systems have a plurality of different control words in accordance with the degree of significance in control information and the function of the control information. 
     In addition, if inherent patterns are given to a bit pattern for the control word, it is possible to make control information not open to users. 
     The invention has thus been shown and described with reference to the specific embodiments. However, it should be noted that the present invention is in no way limited to the details of the illustrated structures but changes and modifications may be made within the scope of the appended claims.