Status register for microprocessor

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: Background of the Invention 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. 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 an 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 Figure 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 to switch 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 "No.3" bit of the control word. The cache enable flag is to control whether or not an internal cache memory of the microprocessor is used. This cache enable flag is assigned to a "No.2" bit of the control word. In the shown example, 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 "No. 2" 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 to the status register apparatus by activating a write signal to 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 "No.2" bit of the control word, and by writing the corresponding "No.2" bit of the control word having the desired value to 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 "No.3" bit of the control word, and by writing the corresponding "No.3" bit of the control word having the desired value to 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 to 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 holds 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 fear that it causes the system to malfunction, or breaks the system. However, the conventional status register apparatus has possibility that the status register apparatus is erroneously set. For example, although only the cache enable flag should be written, if not only the "No.2" bit of the control word corresponding to the cache enable flag but also the "No.3" bit of the control word corresponding to the virtual mode flag were modified, when the write signal becomes active, the cache flag is properly rewritten but the virtual mode flag is erroneously rewritten, with the result that the system would cause a "program run away". US-A-4788655 discloses a condition code producing system comprising decoders for setting or resetting the bits of the condition code register. JP-A-55033242 discloses a communications controller, wherein individual flip-flops are set or reset by virtue of bit patterns appearing in the address bus, and detected by a decoder. Accordingly, it is an aim of at least the preferred embodiments of the present invention to provide a status register apparatus which has overcome the above mentioned defect of the conventional one. Another such aim 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. In a first aspect, the present invention provides a microprocessor status register apparatus as set out in Claim 1. In a second aspect, the present invention provides a microprocessor status register apparatus as set out in Claim 2. 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 the 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 Figure 1 illustrates items of control information allocated to a control word in the conventional system; Figure 2 is a block diagram of an embodiment of a status register apparatus in accordance with the present invention for a microcomputer; Figure 3 illustrates items of control information allocated to a control word in the embodiment shown in Figure 2; Figure 4 is a block diagram of another embodiment of a status register apparatus in accordance with the present invention for a microcomputer; and Figure 5 illustrates items of control information allocated to a control word in the embodiment shown in Figure 4. Description of the Preferred embodiments Referring to Figure 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 "01100101" 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 Figure 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 "10010000" 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 Figure 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 "No. 2" 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 outputted or set through the tristate buffer 108 to the "No. 2" 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 "11101011" 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 Figure 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 "01010000" 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 Figure 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 "No. 3" 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 "No. 3" bit terminal DATA(3) of the control word 109 when the tristate butter 118 is activated by the read signal REGRD 105. Turning to Figure 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 Figure 2 for the microprocessor. As seen from Figure 3, the bit pattern for setting the control information register corresponding to the cache enable flag is such that when "01100101" is set to the control word, the control information register is set to the ON condition, and when "1001000" 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 "11101011" is set to the control word, the control information register is set to the ON condition, and when "01010000" 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 pattern 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 "01100101", 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 "00100101", 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 maintains their preceding condition. Referring to Figure 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 receives 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 "No.1" and "No.0" 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 "01" 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 "No.1" and "No.0" 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 "10" 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 "No. 0" 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 outputted or set through the tristate to the the "No. 0" 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 "No.3" and "No.2" 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 "01" 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 "10" 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 "No. 2" bit terminal DATA(2) of the control word 209, so that the control information held in the R-S flipflop 211 is outputted through the tristate to the "No. 2" bit terminal DATA(2) of the control word 209. The decoders 202, 203, 212 and 213 can be composed of one 3-input AND gate and one inverter connected as shown in Figure 4. Turning to Figure 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 Figure 4 for the microprocessor. As seen from Figure 5, the bit pattern for setting the control information register corresponding to the cache enable flag is such that when "XXXXXX01" is set to the control word, the control information register is set to the ON condition, and when "XXXXXX10" 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 "XXXX01XX" is set to the control word, the control information register is set to the ON condition, and when "XXXX10XX" 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 "XXXX0101" is set to the control word, both of the control information registers are set to the ON condition, and when "XXXX1010" is set to the control word, both of the control information registers are set to the OFF condition. When "XXXX0110" 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 "XXXX1001" 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 Figure 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 Figure 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 inputted to the ON decoder 202 and the OFF decoder 203 for the cache enable flag, and the bits DATA(3-2) are inputted to the ON decoder 212 and the OFF decoder 213 for the virtual mode flag. When the supplied bit pattern is "XXXX0101", 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 "XXXX0000", 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 maintains 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 give any influence to 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 case, 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.

Claims: A microprocessor status register apparatus in which a control word is composed of a plurality of bits, the microprocessor status register apparatus comprising: a control information register (101, 111; 201, 211) constituted of a plurality of bits for holding a plurality of bits of control information; a plurality of bit terminals (109; 209) connected to receive said control word composed of a plurality of bits for setting the control information register (101, 111; 201, 211); a plurality of ON decoders (102,111;202,212), each ON decoder (102, 112; 202, 212) being connected to said plurality of bit terminals (109; 209) to receive a plurality of bits of said control word and also connected to receive a write signal (104; 204), for generating a set signal to set a predetermined one bit of said plurality of bits of said control information register (101, 111; 201, 211) into an ON condition when a first bit pattern of said plurality of bits of said control word is written to the status register apparatus; a plurality of OFF decoders (103,113;203,213), each OFF decoder (103, 113; 203, 213) connected to said plurality of bit terminals (109; 209) to receive a plurality of bits of said control word and also connected to receive said write signal (104; 204) for generating a reset signal to reset a predetermined one bit of said plurality of bits of said control information register (101; 111) when a second bit pattern of said plurality of bits of said control word is written to the status register apparatus, said first bit pattern being different from said second bit pattern; wherein all of said ON decoders (102, 112) and said OFF decoders (103, 113) are connected to receive all the bits of said control word, each of said ON decoders (102, 112) decoding a predetermined bit pattern which is composed of all the bits of said control word and which is arranged to indicate a setting of only the corresponding bit of the control information register into the on condition, and each of said OFF decoders (103, 113) decoding another predetermined bit pattern which is composed of all the bits of said control word and which is arranged to indicate a setting of only the corresponding bit of the control information register (101, 111) into the off condition, so that when bit patterns of said plurality of bits other than said first and second bit patterns are written to the status register apparatus, said predetermined one bit of said plurality of bits of said control information register (101, 111; 201, 211) is not changed. A microprocessor status register apparatus in which a control word is composed of a plurality of bits, the microprocessor status register apparatus comprising: a plurality of control information registers (101,111;201,211), each for holding one bit of control information; a plurality of bit terminals (109;209) connected to receive said control word composed of a plurality of bits for setting a control information register (101,111;201,211); a plurality of ON decoders, each ON decoder corresponding to a said control information register (201,211) and connected to said plurality of bit terminals (109;209) to receive at least two bits selected from all the bits of said control word, different from bits selected for the other control information registers, and also connected to receive a write signal (104;204), for generating a set signal to set said corresponding control information register (101,111;201,211) into an ON condition, whereby said ON decoder (202,212) decodes a predetermined bit pattern which is composed of said at least two selected bits and which is arranged to indicate a setting of only the corresponding control information register (201;211) into the on condition; a plurality of OFF decoders, each OFF decoder (103,113;203,213) corresponding to a said control information register (201,211) and connected to said plurality of bits terminals (109;209) to receive at least two bits selected from all the bits of said control word, different from bits selected for the other control information registers, and also connected to receive said write signal (104;204) for generating a reset signal to reset said corresponding control information register (101;111), whereby said OFF decoder (203,213) decodes another predetermined bit pattern which is composed of said at least two selected bits and which is arranged to indicate a setting of only the corresponding control information register into the off condition, and whereby said first bit pattern is different from said second bit pattern; so that when bit patterns of said plurality of bits other than said first and second bit patterns are written to the status register apparatus, said control information register (101,111;201,211) is not changed. A microprocessor status register apparatus according to any preceding claim wherein the or each control information registers comprises an R-S flipflop having a set input coupled to the corresponding ON decoder and a reset input coupled to the corresponding OFF decoder, a Q output of the R-S flipflop giving control information. A microprocessor status register apparatus as claimed in Claim 3 wherein the reset input of the or each R-S flipflop is connected to an output of an OR gate having a first input connected to the output of the corresponding OFF decoder and a second input connected to receive a reset signal.

Inventors: TSUBOTA MASASHI, TSUBOTA, MASASHI
Applicants: NIPPON ELECTRIC CO, NEC CORPORATION
Application year: 1990
Main classification: G06F9
IPC codes: G06F12, G06F9