Instruction altering system
BACKGROUND OF THE INVENTION 
     This invention relates in general to an information processing system, and more particularly, to a circuit for altering operation codes of a macroinstruction or an instruction. 
     A microprogram control system is a control system for information processing systems of the type proposed by M. V. Wilkes et al in an article entitled &#34;Microprogramming and the Design of Control Circuits in an Electrical Digital Computer&#34; found in the proceedings of the Cambridge Philosphical Society, Volume 49, pages 230-238 and by Yaohan Chu as an article entitled &#34;Digital Computer Design Fundamentals&#34; on pages 246-247, FIG. 12.30. According to such a control system, an operation corresponding to a macroinstruction is decomposed into several basic operations, and the basic operations are respectivey defined as a microinstruction. In executing the macroinstruction, a macroinstruction signal is decoded by an address decoder, and the first address of a microprogram routine which consists of a plurality of microinstructions or microoders corresponding to the macroinstruction is accessed. Thereafter, the microprogram routine instructions of the routine are sequentially accessed and executed. When it is detected that the miroprogram routine corresonding to the macroinstruction has been fully completed, the execution of the macroinstruction is terminated. 
     As a memory for storing the microprogram routines, a ROM (read only memory) is usually employed In this case, the operation code of an identical macroinstruction alwys designates a predetermined microprogram routine corresponding to the macroinstruction and performs a fixed microprogram routine. By way of example, consider a case where the microprogram routine in the ROM is designed so as to execute the operation of addition (ADD) when the operation code of a macroinstruction word is `0001.` Then, whenever the operation code is `0001,` the ADD function is performed. Since it is usually impossible to rewrite the microprogram routine stored in the ROM during the program execution, another microprogram cannot be addressed using the same macroinstruction. 
     Where it is necessary to enable many kinds of instructions to be executed, the number of bits of the operation code of an instruction word must be made large. This naturally leads to an increase in the instruction word length which may not be desirable or possible depending upon the system. For example, when four digits or bits have been assigned for the instruction word length, then 2 4  or 16 different instructions may be addressed. When access to more than 16 instructions is required, prior art systems would be required to add one or more extra digits or bits to the original four digit instruction word. 
     SUMMARY OF THE INVENTION 
     Accordingly, it is an object of this invention to provide a novel instruction amending system for an information processing system which can address more instructions than the the number of digits or bits in the operation code would normally allow. 
     Another object of this invention is to provide a novel instruction altering system for an information processing system which can alter a specific operation corresponding to an instruction code of a predetermined instruction word in the course of the execution of a program. 
     Yet another object of this invention is to provide a novel instruction altering system for an information processing system which can alter the operation corresponding to a macroinstruction in the course of the information processing operation without rewriting the contents of the memory for storing microprograms. 
     The present invention accomplishes the above-stated objects by providing a first logic circuit to hold an address or operation code for an instruction to be altered and to compare that held address or operation code with the address or operation code of an instruction to be executed, and a second logic circuit controlled by an output from the first logic circuit for delivering either address or operation code of the instruction to be executed or the address or operation code for a second instruction as an output, the address or operation code for the second instruction being delivered as the output from the second logic circuit when the first logic circuit provides a coincidence signal to the second logic circuit indicating that the held address or operation code is identical to the address or operation code of the instruction to be executed. 
    
    
     BRIEF DESCRIPTION OF THE DRAWING 
     FIG. 1 is a block diagram showing the fundamental construction of this invention; 
     FIG. 2 is a circuit diagram showing an embodiment of this invention; and 
     FIG. 3 and FIG. 4 are circuit diagrams each showing another embodiment of this invention. 
    
    
     PREFERRED EMBODIMENTS OF THE INVENTION 
     Hereunder, this invention will be described in connection with various exemplary embodiments. 
     FIG. 1 shows an embodiment of this invention, in which numeral 1 denotes a register for storing therein the operation code of one macroinstruction (macroinstruction operation code to be altered) which is the object of alteration. Numeral 2 denotes a register for storing therein the operation code of a new macroinstruction (altered macroinstruction operation code) which is to be transmitted to an address register instead of the macroinstruction operation code to be altered which is stored in the register 1. A judging circuit 3 compares the operation code of a macroinstruction which is about to be executed as applied to an address input terminal IN and the content of the register 1 which stores therein the macroinstruction operation code to be altered, and it judges whether they coincide or not. Numeral 4 indicates a multiplexor which is controlled by the output of the judging circuit 3. Numeral 5 represents an address register, and numeral 6 a ROM for storing microprograms therein. 
     By way of example, consider a case where, when the operation code of a macroinstruction work is `0001,` the first address of a microprogram routine which executes an addition (ADD) stored in the ROM 6 is accessed without any alteration, and where, in the course of the execution of a series of information processings, there occurs the necessity for executing an instruction other than ADD, for example, a subtraction (SUB) operation in the place of the operation code `0001.` In such case, the macroinstruction operation code to be altered `0001` is stored in the register 1, while a signal (altered macroinstruction operation code) for designating the first address of a microprogram routine which realizes the macroinstruction SUB, for example `1111,` is stored in the register 2. 
     When the operation code of the macroinstruction presently about to be executed is applied to the address input terminal IN is `0001,` it coincides with the content `0001` of the register 1, and a control signal (coincidence signal) is transmitted from the judging circuit 3 to the multiplexor 4. Thus, switching is effected in the multiplexor 4, and the content `1111` of the altered macroinstruction code stored in the register 2 is transmitted from the multiplexor 4 to the address decoder in place of the operation code of the macroinsruction presently about to be executed, which is inputted to the terminal IN. The first address of the microprogram routine which realizes SUB and which is accumulated within the ROM 6 is accessed, and a series of microinstructions are executed in a predetermined sequence. 
     When it is unnecessary to alter the actual operation corresponding to the macroinstruction, the content of the register 2 is made to be identical to that of the register 1, or alternatively, the output of the judging circuit 3 is inhibited. Then, the operation code of the macroinstruction presently about to be executed, as received at the address input terminal IN, is fed through the multiplexor 4 to the address register 5 without any change. 
     FIG. 2 shows an embodiment of this invention in the case where the macroinstruction operation code to be altered is fixed to a specific code `0001` by the wired logic of gate 31. It specifies the macroinstruction to be altered by connecting inverters to specific terminals on the input side of a logic product gate 31. 
     In the embodiment shown in FIG. 2, when the operation code `0001` of a macroinstruction is applied to an address input terminal IN, an operation code `1111` stored in a register 2 is transmitted to an address register 5 in lieu of the operation code `0001` due to the inhibiting of gates 401, 403, 405, and 407 and the enabling of gates 402, 404, 406, and 408 from the output of gate 31. The contents of the register 2 are thus transferred through gates 402, 404, 406, and 408, as well as gates 409 - 412 to the register 5. As a result, the information processing system performs an operation which corresponds to the operation code `1111,` not to the code `0001.` It is understood that the circular symbol connected at the sides of certain of the gates in FIG. 2 and subsequent Figures is the standard symbol for an inverter. 
     FIG. 3 shows another embodiment of this invention which is similar to the embodiment of FIG. 2, and wherein the macroinstruction operation code to be altered is similarly fixed by the wired logic. In the present embodiment, however, when an operation code `0001` of 4 bits is applied to an address input terminal IN, an operation code `11111` of 5 bits is transmitted to an address register 5 in place thereof. 
     FIG. 4 is a circuit diagram of still another embodiment of this invention which can perform two sorts of alterations for the content of a code corresponding to a macroinstruction. 
     Thus, by way of example, this circuit permits both the operation code of an instruction word designating ADD to be altered to SUB and that when the operation code designating AND it can be altered to NOP (no operation). 
     Numeral 11 denotes a register for storing therein one macroinstruction code to be altered, numeral 21 a register for storing therein an altered macroinstruction operation code which is executed instead of the instruction stored in the register 11. Numeral 12 denotes a register for storing therein another macroinstruction code to be altered macroinstruction operation code which is executed instead of the instruction stored in the register 12. 
     For example, where the operation code of the macroinstruction which is presently about to be executed is applied to an address input terminal IN and coincides with the macroinstruction operation code to be altered stored in the register 11, an output of level &#34;1&#34; is applied to one input terminal of an AND circuit 428 by the output of a coincident logic circuit 33. As a result, the altered macroinstruction operation code stored in the register 21 is transmitted through the AND circuit 428 and an OR circuit 431 to an address register 5. Likewise, when the operation code of the macroinstruction which is presently about to be executed is applied to the address input terminal IN and is identical to the macroinstruction operation code to be altered stored in the register 12, an output of level &#34;1&#34; is applied to one input terminal of an AND circuit 429 from the output of a coincident logic circuit 34. As a result, the altered macroinstruction operation code stored in the register 22 is transmitted through the AND circuit 429 and the OR circuit 431 to the address register 5. 
     When the address input coincides neither with the stored content of the register 11 nor with that of the register 12, one input terminal of an AND circuit 430 is made &#34;1&#34; by the output of a NOR circuit 427. Therefore, the operation code of the macroinstruction which is applied to the address input terminal IN is transmitted through the AND circuit 430 as well as the OR circuit 431 to the address register 5 without any change. 
     In this invention, as explained above, the numbers of digits of the registers and the multiplexer may be the numbers of digits which need be altered, and bits which do not concern the alteration of the operation code are directly coupled with an effective address register. However, the comparison between the signal applied to the address, i.e., operation code, input terminal IN and the macroinstruction operation code to be altered must be made over all the digits. 
     In this manner, according to the present invention, when the operation code of the macroinstruction which is presently about to be executed and is applied to the address input terminal IN coincides with the address, i.e. operation code, to be altered (the operation code of the macroinstruction to be altered), the multiplexor is switched by the output of the judging circuit, the operation code of the altered macroinstruction stored in the register 2 is outputted to the address register of the ROM for storing microprograms as the address of the ROM in place of the operation code of the macroinstruction which is about to be executed. Therefore, the first address of the microprogram routine corresponding to the altered macroinstruction operation code is selected. As a result, it becomes possible to alter the actual operation of the macroinstruction. 
     Thus, the actual operation corresponding to the macroinstruction can be altered without rewriting of data in the ROM for storing microprograms. The timing of such alteration is the point when various addresses, e.g., addresses designated by a so-called operand of an instruction, have been altered and determined in the course of the execution of information processing. Therefore, the kind of macroinstruction is surely the same at a certain point of time. As viewed from the aspect of the whole job, however, the kind of macroinstruction increases. Consequently, whereas usually only 2 5  kinds of macroinstructions can be executed when only 5 bits are allotted to the operation code of an instruction word, over 2 5  kinds of macroinstructions can be executed according to this invention. 
     This invention is applicable to computers, especially microprogram-controlled computers, and other control circuits.