Data processor having a break function

Abstract: A circuit by which an SWI instruction held in a memory circuit is switchedly input in response to a signal supplied externally, is disposed, whereby the substitution of a program word can be realized using such an internal circuit, so that a high-­ speed and reliable break can be effected. Moreover, an interrupt function separate from normal interrupts is established by setting a specified operation mode, whereby when a data processor is used as an emulator, the break of a user program including the ordinary interrupt processes can be easily effected by utilizing the special interrupt function. Also, by additionally providing the function of delivering out a signal indicative of the break status, an external circuit can be simplified.

Description: BACKGROUND OF THE INVENTION In developing software for a microcomputer, various development aids are utilized. The document GB-A-1 192 372 discloses such an aid. As a typical example, an in-circuit emulator (ICE) is extensively employed. One of the functions of the ICE is the so-called "address break function" according to which, when the execution of the instructions of the software of a user has proceeded to a certain address, the process is tentatively suspended, and the status of the microcomputer at that time is displayed. In order to realize the break function, a non-maskable interrupt ( NMI ) being one of the interrupt functions of the microcomputer is employed. More specifically, when a user program has proceeded to an address to which a break is to be applied, this address is detected, and an NMI request is input to the microcomputer. Upon accepting the NMI request, the microcomputer suspends the user program tentatively and shifts its control to the ICE side. Thus, the microcomputer starts the run of an ICE program and performs the display of its internal status, etc. accordingly. Alternatively, when the address to which the break is to be applied is detected, an instruction on that occasion is altered to a software interrupt request instruction (SWI), which is executed, whereby the tentative suspension of the user program similar to the above is effected to shift the control to the ICE side. Such an in-circuit emulator is described in, for example, "HITACHI MICROCOMPUTER SYSTEM 6305UO/6305VO EMULATOR USERS MANUAL" issued by Hitachi, Ltd. in September 1985. SUMMARY OF THE INVENTION Meanwhile, a microcomputer having an instruction push-down fetch function has been developed for the purpose of raising an information processing speed. In this case, discrepancy arises between the fetch address of a program and the address of an instruction which is actually executed. Therefore, a break based on the NMI request as stated before incurs the problem that the break occurs immediately at the address of an instruction which is not executed. In such a case, there may be employed the technique as described above wherein, when the address at which the program is to be broken is detected, the instruction on that occasion is replaced with the SWI (software interrupt). For the replacement of the instruction, however, it is required that a bus to which the microcomputer and a memory device storing the program therein are coupled is switched so as to input the instruction word SWI. In this case, in the microcomputer whose speed is raised as stated above, the fetch of the instruction becomes fast, so that the switching of the bus is not in time, and the break as stated above fails to be realized. Moreover, when the NMI and SWI are employed for the break of the user program as described above, the user program becomes subject to the limitation that the interrupt processes such as NMI and SWI cannot be applied as they are. Besides, an external circuit needs to be disposed for detecting the fact that the data processing function of the microcomputer has shifted to the run of the program on the ICE side. For this reason, the number of components of the in-circuit emulator enlarges in correspondence with the external circuit. An object of this invention as defined in the appended claims is to provide a data processor having a high-speed and reliable break function, with a simple arrangement. Another object of this invention as defined in the appended claims is to provide a data processor which realizes a multiple function. The aforementioned and other objects and novel features of this invention will become apparent from the description of the specification and the accompanying drawings. Typical aspects of performance of this invention are briefly summarized as follows: A circuit is comprised by which instruction words or data items held in a memory circuit are switched and input in accordance with signals supplied from outside. In addition, an interrupt function separate from normal interrupts is established by setting a specified operation mode. According to the above expedient, fetched programs and the specified instructions or data items are substituted by means of the internal circuit, so that high-speed and reliable breaks can be realized. Besides, when the specified operation mode is set, a user program including ordinary interrupt processes can be easily broken with the special interrupt function. BRIEF DESCRIPTION OF THE DRAWINGS Fig. 1 is a block diagram showing an embodiment of a microprocessor to which this invention is applied; Fig. 2 is a schematic block diagram of an ICE system in which the microprocessor is employed; Fig. 3 is a timing chart for explaining an example of the break operation of the ICE system; Fig. 4 is a block diagram showing an embodiment of a one-chip microcomputer to which this invention is applied; Fig. 5 is a block diagram showing another embodiment of the microprocessor to which this invention is applied; and Fig. 6 is a block diagram showing another embodiment of the one-chip microcomputer to which this invention is applied. DESCRIPTION OF THE PREFERRED EMBODIMENTS [Embodiment 1] Shown in Fig. 1 is a block diagram of an embodiment of a microprocessor to which this invention is applied. Although not especially restricted, the microprocessor in the figure is formed on a single semiconductor substrate such as of single-crystal silicon by known techniques for manufacturing semiconductor integrated circuits. The microprocessor of this embodiment is constructed of an arithmetic-logic unit ALU, an instruction register ISTR, a microprogram ROM (hereinbelow, termed "mROM") which decodes instruction words stored in this register ISTR and forms various control signals required for executing them, a control circuit REG/ALUC which controls various registers REG to be stated below and the arithmetic-logic unit ALU, etc. By way of example, the registers which a programmer can utilize include the following: In a microprocessor composed of, for example, 8 bits, program counters PCL and PCH are 2-byte (16-bit) registers, and they function to indicate a current program address. Incrementers INL and INH perform the operations of incrementing (+1) the program counters PCL and PCH. A register TEP is a temporary register. Stack pointers SPL and SPH are 2-byte registers, and they function to indicate an address effective in a stack operation which is subsequently performed in an external push-down/pop-out stack area. A RAM (random access memory) is usually employed for the stack area, and it can be situated at any desired address. In case of a use in which information within a stack is to be conserved at the failure of power supply, the RAM employed for the stack area is furnished with a battery backup function. Index registers INXL and INXH are registers of 2 bytes, and they serve to store data or a 16-bit memory address for use in an index mode of memory addressing. Accumulators ACCA and ACCB function to temporarily hold an operand or an operated result from the arithmetic-logic unit ALU. A condition code register CC indicates the status of the operated result of the arithmetic-logic unit ALU. It has the flags of, for example, negative, zero, overflow, carry from bit 7, and half-carry from bit 3. In addition, it has an interrupt mask bit. If this mask bit is set, an interrupt from an IRQ (interrupt request) terminal is not accepted. When an interrupt signal from the IRQ terminal is supplied in the reset status of the mask bit, an interrupt sequence is started after the completion of an instruction cycle under execution. More specifically, the contents of the program counters PCL, PCH, index registers INXL, INXH, accumulators ACCA, ACCB, and condition code register CC are stored in the stack. Then, the mask bit is set so as not to accept any further interrupt ( IRQ ). An address stored in a specified memory address is stored in the program counter, and the control of the microprocessor is branched to the interrupt sequence indicated by this program counter. The control circuit REG/ALUC performs the selection of any of the various registers, as well as the operation control thereof, and the control of the arithmetic-logic unit ALU in accordance with an output from the mROM, the content of the condition code register CC, and the order of a control circuit BCC for a branch condition control. A timing generator circuit TG generates timing signals necessary for the operations of the control circuit REG/ALUC and the instruction register ISTR, in accordance with the output of the mROM and an output from an interrupt control circuit INTC to be described below. The interrupt control circuit INTC receives an NMI signal and the IRQ signal supplied externally, and forms control signals for an interrupt process. A halt control circuit HLTC receives a HALT signal supplied externally, and brings the operation of the microprocessor into a halt status. By way of example, when the signal HALT is at a high level, the microprocessor executes an instruction, and when it becomes a low level, the microprocessor falls into the halt status. The microprocessor is, in effect, separated from a system bus in this halt status. A reset control circuit RESC receives a signal RES supplied externally, and controls a reset operation. By way of example, this signal RES is used when the microprocessor is reset and started from the "off" condition of the power supply. It is also used in a case where the microprocessor is re-initialized at any desired point of time after having been started. Although not especially restricted, this embodiment is endowed with an instruction push-down fetch function for the purpose of high-speed data processing. To this end, an instruction word or data which is input from data bus terminals is transmitted to the instruction register ISTR through a FIFO (first-in first-out) which constructs an instruction holding circuit. In this embodiment, a multiplexer MPX is disposed at the input part of the FIFO in order to furnish the microprocessor with a function of realizing a break at any desired execution adddress fast and reliably. The inputs of this multiplexer MPX on one side are coupled to a data bus (DATA BUS). The inputs of the multiplexer MPX on the other side are supplied with the output signals of a pattern generator circuit PTG. This pattern generator circuit PTG is constructed of a memory circuit, in which the SWI instruction explained before is stored by way of example. The multiplexer MPX has its switching controlled by a trigger signal TRG which is externally supplied. When the SWI instruction is executed, a signal BACK indicating the acceptance of the interrupt is output from the control circuit REG/ALUC though no special restriction is meant. The data bus (DATA BUS) is coupled to an internal data bus through a three-status output circuit TSB. The microprocessor of this embodiment loads instructions from the data bus terminals and stores them in the FIFO in succession. In this case, the trigger signal TRG is set at a low level by way of example, and the multiplexer MPX is switched to the data bus side. Accordingly, programs fetched from an external memory device are input through the data bus terminals (DATA BUS), and the instructions loaded through the multiplexer MPX as well as the FIFO are successively decoded and executed. Data items formed in this data process are output from the data bus terminals through the three-status output circuit TSB. Address information items formed by the program counter are output from address bus terminals (ADD BUS) through a vector address generator circuit VAG as well as an address buffer ADB, whereby the addressing of a ROM (read only memory) or RAM in which the instruction words are stored and the addressing of a RAM or the like which indicates the transfer destinations of the data items to be output are carried out. By way of example, the vector address generator circuit VAG generates addresses $FFFC, FFFD for the interrupt NMI and $FFF8, FFF9 for the interrupt IRQ, whereupon the control shifts to interrupt service routines. Shown in Fig. 2 is a block diagram of an embodiment of an in-circuit emulator ICE in which the microprocessor of the above arrangement is employed as a target microprocessor TMPU. In this embodiment, the microprocessor TMPU takes charge of the controls of a user space UB and an ICE system space SB'. In the system space SB of the ICE, there are a main microprocessor MMPU; memory circuits RAM1 and ROM1 which are disposed in correspondence with the main microprocessor; an input/output interface circuit I/O to which a floppy memory circuit FDD, a console CRT, a printer PRT, etc. are connected; a trace circuit TRC; a break circuit BKC; and a memory circuit RAM2. The trace circuit TRC and the break circuit BKC are connected to the main microprocessor MMPU or the target microprocessor TMPU by a selector SEL2. In addition, the memory circuit RAM2 is selectively made accessible from the main microprocessor MMPU or the target microprocessor TMPU by a selector SEL1. The target microprocessor TMPU is connected to the system space SB through the selector SEL1 or SEL2 as mentioned above, and it operates under the control of the main microprocessor MMPU. By way of example, when a break command and a break address are applied as inputs from the console CRT, the main microprocessor MMPU writes the applied break command into the memory circuit RAM2 and writes the break address into a register within the break circuit BKC. The break circuit BKC has an address comparator circuit, which compares the break address stored in the register and an address signal delivered as an output from the target microprocessor TMPU (the address signal of the address bus of the user space UB). On this occasion, a selector SEL3 connects the microprocessor TMPU and the user space UB in accordance with the high level of the break acknowledge signal BACK which is output from the microprocessor TMPU. Thus, until a break is accepted, that is, during the period of time during which the break acknowledge signal BACK is at the high level as illustrated in a timing chart of Fig. 3, the target microprocessor TMPU is performing a data processing operation which conforms to a program to-be-developed stored in a ROM or the like, not shown, in the user space UB. When the break address and the execution address of the target microprocessor TMPU have coincided, the break circuit BKC changes a break signal BRK from a low level to a high level. Thus, the target microprocessor TMPU inserts an SWI instruction with the high level as the trigger signal TRG. Besides, when the break has been executed as described later, the signal BACK becomes active at its low level. In accordance with the low level of the signal BACK , the selector SEL3 disconnects the user space UB from the target microprocessor TMPU and connects memory circuits ROM3 and RAM3. The contents of the program counters PCL, PCH, condition code register CC, etc. of the target microprocessor TMPU at the time of the break are stacked in the memory circuit RAM3. Thereafter, according to a program in the memory circuit ROM3, the target microprocessor TMPU analyzes a command in the memory circuit RAM2, and it fetches the contents of the program counters PCL, PCH, condition code register CC, etc. written in the memory circuit RAM3 and writes them into the memory circuit RAM2. The information items written in the memory circuit RAM2 are fetched and are displayed through the input/output interface circuit I/O in such a way that the main microprocessor MMPU operates according to the program of the memory circuit ROM1. The signal BACK returns from the low level to the high level in such a way that the target microprocessor TMPU executes a return instruction written in the memory circuit ROM3. A mode setting circuit MDC generates the operation mode signals of the target microprocessor TMPU. When the trigger signal TRG (break signal BRK) is set at its high level, the target microprocessor TMPU switches the multiplexer MPX to the side of the pattern generator circuit PTG in Fig. 1. Thus, a program word stored at the above address is replaced with an SWI instruction stored in the pattern generator circuit PTG, and this instruction is input to the FIFO. When the SWI instruction is input to the instruction register ISTR through the FIFO, the execution thereof results in storing the contents of the program counters PCL, PCH, index registers INXL, INXH, accumulators ACCA, ACCB, and condition code register CC in a stack likewise to the interrupt process described before. Subsequently, the mask bit is set so as not to accept any further interrupt. Then, FFF8 and FFF9 are respectively set in the program counters PCL and PCH as in the foregoing interrupt by way of example, and the control is branched to an interrupt sequence stored at this address. In this way, the break is effected, whereupon the microprocessor shifts from the user program to the ICE system program stored in the memory circuit ROM3 in Fig. 2 and performs, for example, the data process for outputting the internal statuses of the microprocessor as described above. By the way, in a case where the microprocessor MPU has a built-in watchdog timer circuit, the timer operation thereof is invalidated in accordance with the break operation based on the SWI instruction. As a signal BACK for externally delivering the break status as an output, in order to distinguish this status from an interrupt based on an ordinary SWI instruction, a latch circuit for holding the fact that the trigger signal TRG has been input may be disposed so as to deliver the logical product between the output of this latch circuit and a signal formed by the execution of the SWI instruction. In a case where the insertion of the SWI instruction by the pattern generator circuit PTG is not desired to be opened to users, a mode setting terminal and a mode determining circuit as described below, for example, may be disposed, whereby the input of the trigger signal TRG is validated only when the ICE mode has been designated. More specifically, in case of employing the microprocessor of the foregoing arrangement for an in-circuit emulator, a signal indicative of this situation is supplied to the mode setting terminal. Upon decoding the signal level of the mode setting terminal, the mode determining circuit brings a mode signal to a high level (logic "1"). The trigger signal TRG is input through an AND gate circuit which is controlled by this mode signal. In a case where the break of the user program is to be effected at high reliability, a comparator circuit is provided. By way of example, when the microprocessor has decoded an SWI instruction, whether or not the ICE mode is designated is decided by the comparator circuit to be described later, and the instruction is executed only in the ICE mode. In this case, the AND gate circuit to which the trigger signal TRG is input may well be omitted. This arrangement permits SWI instructions to be used as they are in the user program. Accordingly, the addresses of interrupt service routines may be made different in the ICE mode and the user mode. In this embodiment, instruction words SWI held in a memory circuit are switched and are, in effect, input by signals supplied externally, so that high-speed and reliable breaks can be realized. Besides, even in a case where an instruction push-down fetch function is possessed as as in the embodiment, the instruction word is switched by detecting an address, and hence, the SWI instruction can be inserted into the desired address for the break. Further, since no interrupt terminal is used, interrupt signals NMI , IRQ etc. can be employed in a user program. If a mode determining circuit, etc. are disposed, it also becomes possible to insert the SWI instructions into the user program. By bestowing the function of supplying an external terminal with an output indicative of the proceeding of the break, it is dispensed with to additionally provide any special circuit outside, and the simplification of an emulator system can be attained. [Embodiment 2] Shown in Fig. 4 is a block diagram of an embodiment of a microcomputer of single chip to which this invention is applied. In the figure, a portion enclosed with a broken line is an integrated circuit LSI. Various circuit blocks formed here construct the single-chip microcomputer as a whole, and they are formed on a single semiconductor substrate such as of single-crystal silicon by known techniques for manufacturing semiconductor integrated circuits. Indicated by symbol CPU is a processor, the principal constituent blocks of which are typically exemplified. Symbol A denotes an accumulator, symbol X an index register, symbol CC a condition code register, symbol SP a stack pointer, symbols PCH and PCL program counters, symbol CPU-CONT a CPU controller, and symbol ALU an arithmetic-logic unit. The arrangement of such a processor CPU has been known from, for example, "FUNDAMENTALS OF MICROCOMPUTERS" by Kohji Yada, issued by Kabushiki-Kaisha Ohm-sha on April 10, 1978, and the outlines of the functions of the respective registers are similar to those explained before, so that the registers shall not be described in detail. Denoted by symbols PO1 thru PO4 are input/output ports, in which data transfer direction registers are respectively included. Each of the input/output ports PO3 and PO4 is used for inputting and outputting data of 8 bits, and it also has the function of delivering out address signals carried on a bus BUS to be stated below. By way of example, a multiplexer is disposed between the input/output port PO3 and the bus BUS and is switched so as to switch the data and the address. In addition, the input/output port PO4 operates as the data input/output port or the address output port in accordance with the setting of an operation mode. Although not especially restricted, the input/output port PO2 is composed of six terminals and has an input/output direction determined by the data direction register thereof. An output buffer of 6 bits is constructed as a three-status output buffer, and it becomes a high impedance status when the input/output port PO2 is operated in the input direction. Four of the terminals of the input/output port PO2 are used for mode programming during a reset period. The levels of the four terminals in a reset operation are held in the latch circuit of the input/output port PO2. The kinds of modes to be set with the four terminals are, for example, a single-chip mode, an expanded multiplex mode, an expanded non-multiplex mode, and the ICE mode as described before. Such modes are discriminated by a mode determination circuit MODE. The mode determination circuit MODE of this embodiment are shared with the other signal terminals as stated above, so that the mode setting signals supplied from the four terminals are validated when a system reset signal RES has been fed. That is, in setting the mode anew, it is a condition to reset the microprocessor. Symbol OSC indicates an oscillation circuit, which forms a reference frequency signal of high precision by utilizing an externally-mounted crystal oscillator Xtal though not especially restricted. Clock pulses required in the microprocessor CPU are formed on the basis of the reference frequency signal. Besides, the reference frequency signal is used as the reference time pulse of a timer. This timer is constructed of a counter COUT, a prescaler PR and a controller CONT. A watchdog timer circuit is also included in such a timer. Symbol RAM indicates a random access memory, which is used as a memory circuit for temporary data, a stack area or a general register by way of example. Symbol ROM indicates a read only memory, into which programs etc. for various information processes are principally written. This ROM is constructed of a mask type ROM, an EPROM (erasable & programmable read-only memory) rendered unerasable, or the like. The various circuit blocks mentioned above are interconnected around the microprocessor CPU by the bus BUS. This bus BUS includes a data bus and an address bus. An interrupt control circuit INTC performs interrupt control operations for interrupt signals NMI and IRQ as stated before. In the figure, an output signal BACK indicating a break status in the ICE mode is also depicted as being output through the interrupt control circuit INTC. The halt control circuit HLTC and reset control circuit RESC stated before may well be included in the interrupt control circuit INTC. In this case, corresponding input signals HALT and RES are supplied. As input terminals for such interrupts, any terminals in the input/output ports PO1 thru PO4 may well be shared. In this embodiment, the microprocessor CPU is provided with a multiplexer MPX and a pattern generator circuit PTG as in the foregoing. The multiplexer MPX has its switching controlled by a trigger signal TRG. In this embodiment, the input of the trigger signal TRG is validated only when the ICE mode has been designated by the mode determination circuit MODE. Although no special restriction is meant, the address signals are delivered out through any of the ports during the run of the program stored in the ROM. When a specified address has been detected by monitoring the address signals, the trigger signal TRG is input, whereby a break based on an SWI instruction as in the foregoing becomes possible. It is needless to say that, on this occasion, the ICE mode is instructed to the mode determination circuit MODE. In this embodiment, an interrupt based on the SWI instruction is validated only in the ICE mode as in the foregoing. Besides, the signal indicative of the proceeding of the break can be output from a terminal BACK. In addition, the input of the trigger signal TRG in an ordinary mode can be invalidated by designating an input to the mode determination circuit MODE. [Embodiment 3] Shown in Fig. 5 is a block diagram of another embodiment of the microprocessor to which this invention is applied. Although not especially restricted, the microprocessor in the figure is formed on a single semiconductor substrate such as of single-crystal silicon by known techniques for manufacturing semiconductor integrated circuits. Since the fundamental arrangement of the processor MPU is as understood from the description concerning Fig. 1 or has been extensively known from various literatures such as "HITACHI MICROCOMPUTER DATA BOOK" issuded by Hitachi, Ltd. in September 1985, the interior thereof shall not be illustrated. This processor is constructed of an arithmetic-logic unit, an instruction register, an instruction decoder which decodes an instruction word stored in the instruction register and generates various control signals and timing signals necessary for the execution thereof, various registers, a control circuit which controls the arithmetic-logic unit as well as the registers, etc. By way of example, the registers which a programmer can utilize include the following as in the foregoing: In the microprocessor composed of, for example, 8 bits, program counters are 2-byte (16-bit) registers, and they function to indicate a current program address. Stack pointers are 2-byte registers, and they function to indicate an address effective in a stack operation which is subsequently performed in an external push-down/pop-out stack area. A RAM is usually employed for the stack area, and it can be situated at any desired address. In case of a use in which information within a stack is to be conserved at the failure of power supply, the RAM employed for the stack area is furnished with a battery backup function. Index registers are registers of 2 bytes, and they serve to store data or a 16-bit memory address for use in an index mode of memory addressing. Accumulators function to temporarily hold an operand or an operated result from the arithmetic-logic unit. A condition code register indicates the status of the operated result of the arithmetic-logic unit. It has the flags of, for example, negative, zero, overflow, carry from bit 7, and half-carry from bit 3. In addition, it has an interrupt mask bit. If this mask bit is set, an interrupt from an IRQ (interrupt request) terminal is not accepted. When an interrupt signal is supplied from the IRQ terminal in the reset status of the mask bit, an interrupt sequence is started after the completion of an instruction cycle under execution. More specifically, the contents of the program counters, index registers, accumulators, and condition code register are stored in the stack. Then, the mask bit is set so as not to accept any further interrupt ( IRQ ). Thereafter, an address stored in a specified memory address is stored in the program counter, and the control of the microprocessor is branched to the interrupt sequence indicated by this program counter. Although not especially restricted, the condition code register is endowed with, besides the flags mentioned above, a flag which indicates an acknowledgement for a break request signal as described later. Although not especially restricted, a built-in input/output device IOC includes a RAM (random access memory), a timer circuit, a watchdog timer circuit for monitoring the internal operating status of the MPU, etc. The RAM can be employed as the stack area or a general register. The microprocessor MPU successively executes instructions loaded from data signal terminals, and delivers data formed by the execution, as outputs from the data signal terminals. An address formed by the program counter is output from address signal terminals, thereby to perform the addressing of a ROM (read only memory) or RAM in which the instruction word is stored and the addressing of a RAM or the like which indicates the transfer destination of the data to be output. The microprocessor MPU as stated above is additionally provided with the following circuits: A signal fed from at least one mode setting terminal MOD is supplied to a mode determination circuit MODE. This mode determination circuit MODE decodes a signal level or the combination of signal levels from the mode setting terminal(s) MOD, and generates an emulator mode signal ICE in the case of using the microprocessor as an ICE. The signal ICE is, on one hand, supplied to one input of an AND gate circuit G. The other input of the AND gate circuit G is supplied with a signal from a break terminal BRK. The output signal of the AND gate circuit G is supplied to an interrupt control circuit INTC. The interrupt control circuit INTC receives the output signal of the AND gate circuit G and also interrupt signals from normal interrupt terminals, such as NMI and IRQ , and it transmits them to the microprocessor MPU. Although not especially restricted, the signal ICE is supplied to a comparator DC. Upon receiving a check request signal CHK for the ICE mode from the microprocessor MPU, the comparator DC produces an output as to whether or not the ICE mode is proceeding. In other words, when the comparator DC is supplied with the request signal CHK, it transmits the acknowledgement signal OK thereof to the microprocessor MPU. Such a function can be realized by the microprogram ROM of the microprocessor MPU. Upon accepting the break request signal as stated below, the microprocessor MPU sets the corresponding flag of the condition code register. Thus, a control signal for invalidating the operation of the watchdog timer circuit of the input/output device IOC is applied, and a signal for indicating a break status is delivered from an external terminal BACK . In case of employing the microprocessor MPU of the above arrangement as the in-circuit emulator, the mode setting terminal MOD is supplied with a signal indicative of this situation. The mode determination circuit MODE decodes the signal level of the mode setting terminal MOD and brings the signal ICE to a high level (logic "1"). In response to this high-level signal, the AND gate circuit G has its gate opened, in other words, it is enabled to input the signal from the break terminal. In the development of the software of a microcomputer system employing the microprocessor MPU, when a user program has proceeded to an address desired for the break, the address is detected and the break terminal BRK is rendered a high level (active) as described with reference to Figs. 2 and 3. The break request signal from the break terminal BRK is transmitted to the interrupt control circuit INTC through the AND gate circuit G. The interrupt control circuit INTC transmits the interrupt signal to the microprocessor MPU. The microprocessor MPU suspends the user program and executes an interrupt sequence in accordance with a process similar to the foregoing. In this case, if necessary, the microprocessor MPU may well be endowed with the function of rejecting the acceptance of a further break request, likewise to the masking of the signal IRQ . When the interrupt based on the break request has been accepted, the user program is suspended, and hence, the watchdog timer of the input/output device IOC is stopped according to the flag. In addition, a signal indicative of the acceptance of the break request is output from the terminal BACK . In this embodiment, as thus far described, the interrupt for the analysis of the user program is possible with the signal different from the normal interrupt request signals, so that the normal interrupt signals NMI , IRQ etc. can be employed within the user program. Moreover, since the signal indicative of the proceeding of the break is output from the external terminal BACK , it is dispensed with to additionally provide any special circuit outside, and the simplification of an emulator system can be attained. In a case where the break of the user program is to be effected at high reliability, the comparator DC is utilized. More specifically, when the microprocessor MPU is supplied with the interrupt request based on the terminal BRK from the interrupt control circuit INTC, it delivers the check signal CHK to the comparator DC, and it performs the interrupt process upon receiving the signal OK for recognizing the ICE mode. As another breaking method, a break instruction (SWI or BRK) may be provided instead of the signal from the terminal BRK. More specifically, the break instruction (SWI or BRK) is inserted in a place desired to be suspended within the user program. By the run of the user program, the break instruction (SWI or BRK) is fetched from a program memory and is transmitted to the microprocessor MPU. Then, the microprocessor decodes the instruction, and it suspends the run of the user program as in the foregoing and shifts to the process of the ICE side likewise to the case of the interrupt. On this occasion, if the comparator DC is disposed, the microprocessor can execute the instruction (SWI or BRK) upon receiving the recognition signal OK for the ICE mode. It is also allowed to provide the two break functions based on the terminal BRK and the instruction (SWI or BRK). In this case, the breaks can be effected by the optimum method conforming to the user program. [Embodiment 4] Shown in Fig. 6 is a block diagram of another embodiment of the single-chip microcomputer to which this invention is applied. The single-chip microcomputer in the figure is basically similar to the microcomputer in Fig. 4. Therefore, the same constituent parts as in Fig. 4 shall be omitted from description. In this embodiment, an interrupt control circuit INTC' is disposed in order to afford the function of the normal interrupts open to users as stated before and the function of the interrupt (break) usable only in the ICE mode. This interrupt control circuit INTC' includes the AND gate circuit G in Fig. 5, besides the interrupt control circuit INTC shown in the figure. If necessary, the interrupt control circuit INTC' is also endowed with the function of the comparator circuit DC in Fig. 5. Therefore, a break signal is supplied from a terminal BRK through this interrupt control circuit INTC'. In Fig. 6, the signal of an output terminal BACK for outputting the break status is also depicted as being delivered through the interrupt control circuit INTC'. As a normal interrupt terminal, the terminal IRQ is typically exemplified, but it is to be understood that the terminals NMI etc. are also included. Such interrupt terminals may well be shared with any terminals among the input/output ports PO1 thru PO4. Also in this embodiment, the interrupt from the terminal BRK is validated only in the ICE mode as in the foregoing. In addition, this holds true of the case of providing the break instruction (SWI or BRK). Functional effects which are attained by the above embodiments are as follows: (1) A circuit by which an SWI instruction held in a memory circuit is switchedly input in response to a signal externally supplied, is disposed, whereby the substitution of a program word can be realized using such an internal circuit. This brings forth the effect that a high-speed and reliable break can be done. (2) Even in a microprocessor having an instruction push-down fetch function, it is only required that program addresses for fetching instructions from a memory device are monitored and that a trigger signal is input when an address desired for a break has been detected. This brings forth the effect that the break at the desired program address becomes possible. (3) By employing the break based on the SWI instruction, interrupts based on inputs from terminals can be assembled in a user program. Thus, in developing user software, the processing of interrupt functions based on the terminal inputs is not restricted. This brings forth the effect that the software development conforming to the actual software to be developed can be performed with ease. (4) By additionally providing the function of delivering out a signal which indicates the interrupt based on the SWI instruction, in other words, to the effect that the user program is under the break, an external circuit for recognizing the break status can be omitted. This brings forth the effect that a system for use as an in-circuit emulator can be simplified. (5) An interrupt function separate from normal interrupts is provided by setting a specified operation mode. This brings forth the effect that, when a data processor is used as the in-circuit emulator, the breaks of the user program including the ordinary interrupt processes can be easily done by employing the special interrupt function. (6) Owing to the above item (5), the interrupt function processes are not restricted in the development of the user software, and hence, there is attained the effect that the software development conforming to the actual software to be developed can be performed with ease. (7) In the interrupt process which is accepted only in the specified operation mode, the function of acknowledging the mode is provided, thereby to bring forth the effect that the interrupt process of high reliability becomes possible. (8) The function of delivering out to the effect that the interrupt process of the specified mode is proceeding, is additionally provided, whereby an external circuit for recognizing the interrupt process can be omitted. This brings forth the effect that a system for use as an in-circuit emulator can be simplified. Although, in the above, the invention made by the inventor has been concretely described in conjunction with embodiments, it is needless to say that this invention is not restricted to the foregoing embodiments, but that it can be variously altered within a scope not departing from the purport thereof. For example, in Fig. 1, the pattern generator circuit PTG may be made, not only of the mask ROM, but also of a register, an EPROM or the like so as to permit writing based on software. In this case, any desired instruction word or data is stored in addition to the SWI instruction as stated before, whereby the desired instruction word or data can be inserted in the user program. The data processor may well have no instruction push-down fetch function as in Fig. 4. To the contrary, the single-chip microcomputer in Fig. 4 may well be furnished with the instruction push-down fetch function. Besides, the vector addresses of the interrupt processes based on the terminals or instructions may be in agreement or disagreement. Further, if the vector addresses of the normal interrupts can be relocated, the vector addresses of the interrupts based on the instructions in the ICE mode may be relocated or fixed. In this manner, the interrupt processing system can adopt various apsects of performance. The break recognition signal BACK in the ICE mode is activated upon the acceptance of the interrupt based on the instruction SWI or the signal BRK. It can be inactivated by the execution of the corresponding instruction (for example, RTB instruction) for return from the break status. In the presence of the mode determination circuit, also this return instruction (RTB) may well be executed after checking the ICE mode. Further, a special break instruction may well be provided besides the SWI instruction and stored in the pattern generator circuit. In the above, the present invention has been mainly described as to applications to microprocessors or microcomputers forming the background thereof. However, this invention is not restricted to them, but it can be extensively utilized for various data processors which execute data processing in accordance with programs. Effects which are attained by typical aspects of performance of this invention will be briefly explained below: A circuit by which an SWI instruction held in a memory circuit is switchedly input in response to a signal supplied externally, is disposed, whereby the substitution of a program word can be realized using such an internal circuit, so that a high-speed and reliable break can be done. Moreover, an interrupt function separate from normal interrupts is established by setting a specified operation mode, whereby when a data processor is used as an emulator, the break of a user program including the ordinary interrupt processes can be easily done by utilizing the special interrupt function. Also, by additionally affording the function of delivering out a signal indicative of the break status, an external circuit can be simplified.

Claims: An integrated microprocessor comprising: a processor (CPU, MPU) for executing in a first operating mode a program to be developed and in a second operating mode an emulator program, a control signal input terminal (BRK, TRG) for receiving an external break signal which, when changing from a first state to a second state, switches the processor from said first to said second operating mode, and an output terminal (BACK) to which said processor supplies a break acknowledgement signal which has a first level when the processor is in the first operating mode and a second level when the processor is in the second operating mode. A microprocessor according to claim 1, wherein the break acknowledgement signal is changed from said second to said first level when the processor executes a return instruction from the emulator program. A microprocessor according to claim 1 or 2, further comprising: a mode signal input terminal (MOD) for receiving a mode control signal, mode identifying means (MODE) for providing an emulator mode signal (ICE) when the mode control signal (MOD) indicates that the integrated microprocessor is to be operated in an emulator mode in which said processor (CPU, MPU) executes said emulator program in its second operating mode, and a gate circuit (G) coupled to the control signal input terminal (BRK) and to the mode identifying means (MODE) for validating the break signal on the control signal input terminal only when the mode identifying means generates the emulator mode signal (ICE). A microprocessor according to claim 3, comprising: an interrupt request input terminal (NMI, IRQ) for receiving an interrupt request signal, and interrupt control means (INTC) coupled to the interrupt request input terminal and to the gate circuit (G) for delivering an interrupt control signal to said processor (CPU, MPU). A microprocessor according to claim 3 or 4, comprising: check means (DC) for supplying a signal which indicates whether the integrated microprocessor is in the emulator mode to said processor (CPU, MPU) when the check means receives a check request signal from the processor. A microprocessor according to claim 5, wherein the processor (CPU, MPU) is switched from the first operating mode to the second operating mode in response to a change of said break signal from the first to the second state, after having received from the check means (DC) the signal which indicates that the integrated microprocessor is in the emulator mode. A microprocessor according to claim 5, wherein the processor (CPU, MPU) is switched from the first operating mode to the second operating mode in response to a break instruction in the program to be developed, and wherein the processor executes the break instruction after having received from the check means (DC) the signal which indicates that the integrated microprocessor is in the emulator mode.

Inventors: AOTO YOSHIKAZU, BABA SHIRO, KAWASHIMA SHINJI, KIDA HIROYUKI, KURAKAZU KEIICHI, MASUDA SATOSHI, NARUSE YOSHIAKI, AOTO, YOSHIKAZU, BABA, SHIRO, KAWASHIMA, SHINJI, KIDA, HIROYUKI, MASUDA, SATOSHI, NARUSE, YOSHIAKI
Applicants: HITACHI LTD, HITACHI, LTD.
Application year: 1988
Main classification: G06F11
IPC codes: G06F11