System and method for detecting the execution of an instruction in a central processing unit

Abstract: A detecting system of an execution instruction for a central processing unit, which includes a signal generat­ ing circuit for generating a non-maskable interruption request signal through detection that the central processing unit (11) has fetched a specific instruction, a signal state memory circuit for memorizing whether or not the non-maskable interruption request signal was generated when the specific instruction was executed, and a nullifying circuit for nullifying the execution of the specific in­ struction. The detecting system is arranged to detect the state where the central processing unit (11) has executed the specific instruction, and also, to detect the instruc­ tion about to be executed by the central processing unit (11).

Description: The present invention generally relates to a detecting system of an execution instructicn for a central processing unit in a computer system, and more particularly, to a detecting system of a central processing unit execution instruction capable of realizing detection of a specific instruction even for a central processing unit fully adopting a pipelined construction. A data processing device for generating an interruption and arbitrary instruction is disclosed in Patent Abstracts of Japan, Vol. 7, No. 51 (P-179) /1196/, 26th February 1983; & JP-A-57 199 052. According to the known system, an address of the instruction executed next from the processor is outputted to a first bus and the content of the address of a main memory is outputted to a second data bus. The processor outputs an instruction fetch signal and reads the content of the data bus and the instruction is executed. The known system comprises an instruction register for storing the content of the bus in sychronizing with the instruction fetch signal. An instruction decode table decides whether an interruption is generated after the execution of the instruction or not. Computer systems are provided with hardware and software constructions inherent in respective models, and programs to be executed thereon are generally specific programs exclusive to the particular model, and can not be applied to other models for use. In the case where the application program exclusive to a certain specific system as stated above is to be used in a different system, if it is arranged to access the hardware structure only through means of the software referred to as "system call", it has been known that emulation is possible through detection of the system call, and such practice is also actually effected up to the present. However, in the case where the application program is adapted to directly access the hardware by input/output instruction, etc., it becomes necessary to detect the execution of the instruction. Referring to Fig. 4 showing a block diagram of a known hardware construction, the concept in a prior art system will be explained hereinbelow with reference to a representative 16 bit central processing unit i8086 (a model name used in trade and manufactured by Intel Co., Japan) as one example. In the arrangement of Fig. 4, a central processing unit 1, a read-only memory (ROM) 2, a random access memory (RAM) 3, an input/output port 4, and a detecting circuit 5 are connected to each other by a system bus ℓ1. The detection circuit 5 is provided to detect the execution instruction of the central processing unit 1, and includes an address decoder 6 therein. In the case where the central processing unit 1 is to access an outer or external device, whether the object to be dealt with is of a memory unit or input/output device (not shown) is fudged at the detection circuit 5 by an IO/M signal which is an identification signal outputted through a line ℓ2. In the case of memory access, the read only memory 2 or random access memory 3 is accessed through a line ℓ3, while, when the input/output device is to be accessed, the input/output port 4 is accessed through a line ℓ4. The address information necessary for the above access is applied to the address decoder 6 within the detection circuit 5 through the system bus ℓ1. The address decoder 6 generates an address latch enable signal (referred to as an ALE signal hereinafter), and decodes the content thereof as latched by the ALE signal, thereby to decode the address information corresponding to the object to be accessed by the central processing unit 1, and to access the specific external device. At this time, in the access of address space for the input/output port 4, if a ready signal (referred to as READY signal hereinafter) is returned through a passage line ℓ5 → detection circuit 5 → line ℓ6, to the central processing unit 1, without actually carrying out the access to the input/output device (not shown), the central processing unit 1 proceeds to the subsequent function based on a judgement that the above access to said input/output device has been effected. Such a processing step is referred to as an NMI processing step. In this case, at the starting of the input/output bus cycle, when the detection circuit 5 generates a non-maskable interrupt (referred to as NMI hereinafter) request signal, and applies the NMI signal to the central processing unit 1 through a line ℓ7, said central processing unit 1 transfers the control processing to the above NMI processing step before executing the subsequent instruction. Accordingly, in the NMI processing step, if the content of the instruction prior to the address at which the NMI signal is generated is checked, the kind of the instruction and the number of the address accessed can be found. The detecting system of the central processing unit execution instruction by outputting the NMI signal through bus cycle for interruption may be effective not only for the central processing unit model i8086 as described above, but also for other central processing units such as a typical 8 bit central processing unit model Z80 (a model name used in trade and manufactured by Zilog Inc., Japan) and the like. However, the conventional detecting system of the central processing unit execution instruction as described so far can not be applied to a central processing unit, e.g., Intel model i80286 (a model name used in trade and manufactured by Intel Co., Japan) in which processing blocks are largely formed into pipelines. Although the model i8086 referred to earlier is also formed into the pipelines in its interior, the degree of such pipeline formation is not so high as in the model i80286, and therefore, outputting of the NMI signal at the starting of the bus cycle may serve the purpose, if the instruction is limited only to the input/output instructions. However, in the central processing unit such as the model i80286 which is highly formed into pipelines, even when the interruption is applied by outputting the NMI signal through the bus cycle, processing at several steps forward has already been effected at the time point when the interruption was received, thus making it impossible to detect the instruction in object. In other words, there has been such a problem that the address having the input/output instructions can not be found in the NMI processing step. It is the object of the present invention to provide a detecting system of a central processing unit execution instruction, which is capable of detecting a specific instruction to be executed even in a highly pipelined central processing unit. The object is solved, according to the invention, with the features of claim 1. According to the present invention, there is provided a detecting system of an execution instruction for a central processing unit, which includes a signal generating circuit for generating a non-maskable interruption request signal by detecting that the central processing unit has fetched a specific instruction, a signal state memory circuit for memorizing whether or not said interruption request signal was generated when said specific instruction was executed, and a nullifying circuit for nullifying the execution of said specific instruction. The detecting system is arranged to detect the state where the central processing unit has executed the specific instruction, and also, to detect the instruction about to be executed by the central processing unit. By the arrangement according to the present invention as described above, the state where the central processing unit has executed the specific instruction, and also, the instruction about to be executed by the central processing unit may be detected, and the function following the content of the instruction is emulated. The detectingsystem is simple in construction and accurate in functioning, and can be readily manufactured at low cost. These and other objects and features of the present invention will become apparent from the following description taken in conjunction with the preferred embodiment thereof with reference to the accompanying drawings, in which: Fig. 1 is a block diagram showing a general construction of hardware according to one preferred embodiment of the present invention; Fig. 2 is a circuit diagram showing electrical construction of the hardware of Fig. 1; Fig. 3 is a flow-chart for explaining functions of the embodiment of Fig. 1; and Fig. 4 is a block diagram showing construction of conventional hardware (already referred to). Before the description of the present invention proceeds, it is to be noted that like parts are designated by like reference numerals throughout the accompanying drawings. Referring now to the drawings, there is shown in Fig. 1 a block diagram representing a hardware construction for realizing a detecting system of a central processing unit execution instruction according to one preferred embodiment of the present invention. The detecting system in Fig. 1 generally includes a central processing unit 11, a monitor circuit 17 for detecting that the central processing unit has taken in or fetched (referred to as "fetch" hereinafter) a specific instruction, a detection circuit 15 which is incorporated with a circuit for generating a NMI signal through detection of the above fetching, a circuit for memorizing whether or not said NMI signal was generated when said specific instruction is effected, and a nullifying circuit for nullifying the execution of said specific instruction, a read only memory 12, a random access memory 13, and an external device such as an input/output port 14 and the like. The detection circuit 15 includes an address decoder 16 incorporated therein, and all of the circuits as described so far are connected to each other by a system bus ℓ11 as shown. The embodiment of the present invention in Fig. 1 is characterized in that there is provided the monitor circuit 17 for detecting that the specific execution instruction of a highly pipelined central processing unit, for example, a processing unit of the model i80286 referred to earlier, has been fetched. Between the central processing unit 11 and the detection circuit 15, there are connected lines ℓ12, ℓ13 and ℓ14, besides the system bus ℓ11. The line ℓ12 is intended to transmit the NMI signal from the detection circuit 15 to the central processing unit 11, and the line ℓ13 is to transmit the status signal from the central processing unit 11 to the detection circuit 15, while the line ℓ14 is intended to transmit the ready signal from the detection circuit 15 to the central processing unit 11. The status signal contains therein various control information such as the IO/M signal, instruction fetch signal, memory read/write (read/write) signal, etc., and is decoded for its content by the detection circuit 15. The instruction fetch signal is applied to the monitor circuit 17 through the line ℓ15, while the IO/M signal is inputted to the IO port 14 through the line ℓ18. The output of the monitor circuit 17 is applied to the detection circuit 15 through a line ℓ16. Meanwhile, from the detection circuit 15, a memory select signal is applied to the read only memory 12 and random access memory 13 through a line ℓ17, and a device selection signal is applied to the input/output port 14 via the line ℓ18, and further, from the input/output port 14, an input/output READY signal is applied back to the detection circuit 15 through a line ℓ19. Reference is also made to Fig. 2 showing an electrical construction of one embodiment according to the present invention. In Fig. 2, the portions excluding the central processing unit 11, monitor circuit 17 and input/output port 14 constitute the detection circuit 15, and include the address decoder 16. In the arrangement of Fig. 2, it is assumed that the central processing unit 11 is, for example, of the model i80286 which is a highly pipelined central processing unit, and that the monitor circuit 17 is adapted to monitor the input/output instruction of the central processing unit 11. The codes for the input/output instruction of the central processing unit 11 to be applied to the monitor circuit 17 through the information bus ℓ11 are classified, for example, into eight kind as shown in Table 1 below, and are of 1 byte or 2 byte instruction. The status signal outputted from the central processing unit 11 through the line ℓ13 is decoded by a decoder 15a, and an instruction fetch signal derived from the line ℓ15 is applied to the monitor circuit 17. Moreover, there are individually derived a memory read signal (referred to as MRD signal hereinafter) through a line ℓ22, an outer read signal (referred to as IOR signal hereinafter) through a line ℓ23, and an outer write signal (referred to as IOW signal hereinafter) through a line ℓ24. The monitor circuit 17 decodes the kind of the bus cycle to be currently effected by the instruction fetch signal. The MRD signal is the signal to become active when the central processing unit 11 reads the memory, and is prepared in the decoder 15a based on the result of decoding of the status signal. When this memory access is effected, the output line ℓ12 of a first flip-flop circuit 15b to be described later is subjected to a level change from "L" to "H", and such level change is applied to the central processing unit 11 as the NMI signal. The IOR signal is the signal to become active when the central processing unit 11 reads the information related to an input/output device (not shown), while the IOW signal is the signal to be active when the above information is written in, both being prepared based on the result of reading of the above status signal in the decoder 15a. When the access of such input/output devices is effected, the output in a line ℓ30 of a second flip-flop circuit 15c is subjected to the level change from "L" to "H", and this level change is applied through the system bus ℓ11 to the central processing unit 11, which judges that the input/output access has been effected by reading this level change. Still referring to Figs. 1 and 2, functioning of the present embodiment described so far will be explained hereinbelow. Here, it is assumed that the first and second flip-flop circuits 15b and 15c are both cleared, and output levels derived into the line ℓ12 through which the NMI signal is transmitted, and the line ℓ30 for detecting whether or not the above input/output access is effected, are both "L", and that a third flip-flop circuit 15d which is to be set or reset by the access of the central processing unit 11 through the lines ℓ28 and ℓ29 is in the set state, with the level of its output line ℓ27 being "H". The decoder 15a reads the status signal derived onto the line ℓ13, and upon recognition of the fetch cycle, applies the instruction fetch signal to the monitor circuit 17 through the line ℓ15. The monitor circuit 17 recognizes the specific instruction code such as the input/output instruction by monitoring the information derived onto the information bus ℓ11. The monitor circuit 17 derives "H" level onto the line ℓ16 when the above two kinds of information are true, i.e., when the instruction fetch signal and the instruction code are inputted for application to an information input terminal of the first flip-flop circuit 15b through a CR gate 15f. On the other hand, at a timing when the MRD signal is changed from "L" to "H" level, i.e., at the time point when the central processing unit 11 has effected the memory reading, the above MRD signal is applied to the clock input terminal of the first flip-flop circuit 15b, whereby the output line ℓ12 of the first flip-flop circuit 15b is subjected to the level change from "L" to "H". This level change from "L" to "H" is applied to the central processing unit 11 as the NMI signal, at which time point, the specific instruction (e.g., the input/output instruction in the present embodiment) is to be fetched. It is to be noted here that the above NMI signal is retained until the first flip-flop circuit 15b is cleared. Furthermore, at this time, the state of the second flip-flop circuit 15c, i.e., the level of the line ℓ30 remains unchanged, staying at "L". Upon input of the above NMI signal, the central processing unit 11 transfers the control function to the interruption processing step after completion of the instruction being executed at that time, but normally, since unprocessed memory or access request of the input/output device remain in a bus interface unit (BIU) in the central processing unit, the actual transfer of the control function is effected after all of the above access request has been completed. At this time, when the input/output access is effected, a line ℓ25 is subjected to the level change from "L" to "H" through a NAND gate 15e by the IOR signal or IOW signal, and therefore, the second flip-flop circuit 15c is reset, with the output of "H" level being applied to the line ℓ30. If the input/output access is not produced, the second flip-flop circuit 15c reamins cleared and "L" level is maintained on the line ℓ30. By reading such "L" or "H" level of the line ℓ30 by the central processing unit 11 through the information bus ℓ11, it is judged whether or not the input/output access has been effected. The flip-flop circuits 15c and 15d are connected to the line ℓ14 through gates 15g and 15h via a line ℓ26, while the clear terminals CL of the flip-flop circuits 15b and 15c are coupled with the third flip-flop circuit 15d and the decoder 15a through a line ℓ21, a gate 15i and a line ℓ20 as shown. Reference is also made to a flow-chart of Fig. 3 for explaining the functions of the embodiment as described so far. At step n1. the level of the line ℓ30 is read by the central processing unit 11 for judgement of presence or absence of the input/output access. If the above level is of "L", the input/output access is not effected, and therefore, the procedure proceeds to step n2. Although the NMI signal is generated by the fetch of the input/output instruction as described earlier, it was also produced by the fetch of an operand in the actual case, and therefore, in order to study the content of the instruction at the interruption generating point, instruction at such interruption generating point is read at step n2, while at step n3, judgement is made at step n3, as to whether or not the instruction is of the input/output instruction. If it is of the input/output instruction, its executing function is emulated at step n4. At step n5, the return address after the emulation is altered to the next address of the input/output instruction, and the procedure proceeds to step n6 so as to clear the first and second flip-flop circuits 15b and 15c, and at step n7, the NMI processing control is completed, thereby to return to the state before the interruption. At step n3, if it is judged that the instruction is other than the input/output instruction, the procedure is transferred to step n10 to execute the instruction, and upon completion, the procedure proceeds to step n6 so as to clear the first and second flip-flop circuits 15b and 15c. At step n7, the NMI processing control is terminated so as to return to the state before the interruption. In the case where the level of the line ℓ30 is "H" at step n1, the procedure is transferred to step n8. Here, the fact that the level of the line ℓ30 is of "H" shows that the input and output access was effected in the period from the generation of the NMI signal to the transfer in the interruption processing step. In this case, since it is ensured that the instruction before the interruption generating point is of the input/output instruction of 1 to 2 bytes as shown in Table 1 referred to earlier, at step n8, the kind of the instruction before the interruption generating point by 1 byte or 2 bytes is checked, and at step n9, the function equivalent to the instruction is emulated. Thereafter, the procedure proceeds to step n6, where the first and second flip-flop circuits 15b and 15c are cleared. At step n7, the NMI processing control is completed so as to return to the state prior to the interruption. It is to be noted here that in the foregoing embodiment, although step n8 is provided so as to judge the signal fetch of the operand code contained in the status signal to be outputted from the central processing unit 11, the arrangement may be so modified as to separate the operand code from the state signal inputted to the detection circuit 15 for input only of the instruction code, whereby the generation of the NMI signal by the operand code is eliminated for a marked improvement of the processing speed. It is also to be noted that, in the foregoing embodiment, although the model i80286 is taken as an example for the central processing unit 11, the concept of the present invention is not limited in its application to this model alone, but may readily be applied to other central processing units as well, and that, although the input/output instruction is taken as an example for the instruction, the detecting function as described may be realized with respect to other instruction. As is clear from the foregoing description, the detecting system of execution instruction for a central processing unit of the present invention is arranged to detect the state where the central processing unit has executed the specific instruction, and also, to detect the instruction about to be executed by the central processing unit so as to emulate the function following the content of the instruction, whereby the execution instruction of a highly pipelined central processing unit may be detected, and particularly, by detecting the input/output instruction, it becomes possible to execute programs prepared for a system of a different hardware construction.

Claims: A system for detecting an execution instruction, comprising: central processing means (11) for developing a status signal indicative of when a specific execution instruction is fetched by said central processing means, said central processing means (11) being a highly pipelined unit, and detection means, operatively communicative with said central processing means, for detecting the specific execution instruction fetched by said central processing means, characterized in that said detection means comprises: signal generating means (15b,15f,17) operatively communicative with said central processing means, for developing a non-maskable interruption request signal NMI in response to the status signal indicating that said central processing means has fetched the specific execution instruction, signal state memory means (15c), operatively communicative with said signal generating means, for indicating whether or not said specific execution instruction has been effected before the start of the NMI routine, and nullifying means (15g,15i), operatively communicative with said signal generating means, for nullifying the specific execution instruction by returning a bus cycle termination signal to the central processing means without actually carrying out the specific execution instruction, wherein said detection means detects the address of the specific execution instruction based on the output of said signal state memory means so that the function following the content of the specific execution instruction can be emulated. A system as claimed in claim 1, wherein said signal generating means comprises monitor means (17) for detecting when said central processing means (11) has fetched the execution instruction. A system as claimed in claim 2, wherein said signal generating means further comprises an OR device (15f), and a flip-flop device (15b). A system as claimed in one of claims 1 to 3, wherein said signal generating means, said central processing means (11), and said signal state memory means operatively communicate by a system bus (111). A system as claimed in one of claims 1 to 4, wherein said central processing means comprises an Intel i80286 microprocessor chip. A system as claimed in one of claims 1 to 5, wherein said signal state memory means comprises a flip-flop device (15c). A system as claimed in one of claims 1 to 6, wherein said nullifying means comprises first and second AND devices (15g,15i). A system as claimed in one of claims 1 to 7, further comprising state retaining means for indicating that the execution instruction has been produced based on the supply of said non-maskable interruption request signal (NMI) outputted from said central processing means (11) by the execution instruction so that the content of said specific instruction is emulated according to the contents of the execution instruction. A method for detecting an execution instruction in a system by developing a status signal from central processing means (11) indicative of whether a specific execution instruction is fetched by said central processing means, characterized by the steps of: developing a non-maskable interruption request signal (NMI) in response to said status signal indicating that said central processing means has fetched the specific execution instruction, indicating whether or not said specific execution instruction has been effected before the start of the NMI routine, and nullifying the specific execution instruction responsive to the execution instruction being fetched by said central processing means by returning a bus cycle termination signal to the central processing means without actually carrying out the specific execution instruction, wherein the method detects the address of the specific execution instruction based on the output of said signal state memory means so that the function following the content of the specific execution instruction can be emulated. A method as claimed in claim 9, further comprising the step of indicating that the execution instruction has been produced based on the supply of said non-maskable interruption signal (NMI) outputted from said central processing means (11) by the execution instruction so that the content of said specific instruction is emulated according to the contents of the execution instruction.

Inventors: HASHIMOTO SADAKATSU, HASHIMOTO, SADAKATSU
Applicants: SHARP KK, SHARP KABUSHIKI KAISHA
Application year: 1988
Main classification: G06F9
IPC codes: G06F9, G06F11