Data processing system with internal instruction cache

Abstract: A processing system is configured for providing an external in circuit emulator with an internal execution state insulting from the execution by a first processor of an internal instruction stored in an internal instruction cache. The processing system includes a second processor which includes an internal instruction cache for also storing the internal instructions. The second processor is coupled to the first processor in a master/slave configuration to enable the second processor to duplicate the instruction executions of the first processor. The second processor includes an output for providing the internal execution state which is coupled to the in circuit emulator by an external address bus for providing the internal execution parameter to the in circuit emulator.

Description: The present invention is generally directed to a processing system such as an arrangement for verifying, with an in circuit emulator, the instructions to be executed by a processor of a processing system. The present invention is more particularly directed to such an arrangement wherein the processor includes an internal instruction cache for storing internal instructions and wherein internal execution parameters, resulting from the execution of internal instructions by the processor, are made available to the in circuit emulator. Processing systems are well known in the art. Such systems generally include a processor and an external memory. A program counter of the processor provides a series of memory addresses which are used by the processor for fetching instructions stored in the external memory to obtain the instructions. For each memory address, the processor conveys the memory address to the external memory over an external address bus and the external memory responds by conveying to the processor over an external instruction/data bus the instruction stored in the corresponding addressed memory location. One well known form of processor is known in the art as a reduced instruction set computer (RISC) processor. Generally, this type of processor performs four operations in sequence for each instruction. The first operation is a fetch operation to obtain the instruction from the external memory. The second operation is a decode operation wherein the processor decodes the instruction. The third operation is an execute operation wherein the processor executes the instruction and the fourth operation is a write-back operation where the processor writes a resultant from the execution back to the external memory. Such a processor also generally employs a pipelined architecture to permit parallel processing. Such processing permits the processor to operate on more than one instruction at a time. For example, while the processor is fetching an instruction, it may also decode a previously fetched instruction, execute a still previously fetched instruction, and write-back a resultant from executing a still further previously fetched instruction. The processor generally operates off of a clock and performs each operation during a single clock cycle unless the pipeline is held by, for example, a trap or an exception condition. Hence, for each instruction, the processor executes four operations; fetch, decode, execute, and write-back. As can also be appreciated, the instructions stored in the external memory constitute the program for the processor. During program development, it is advantageous to verify the correctness of the program instructions stored in the external memory to be executed by the processor. Such program verification, referred to as debugging, can employ an in circuit emulator. In circuit emulators are well known in the art and are used to track the execution of a processor. To do so, the in circuit emulator includes a duplicate of the program instructions in its own memory and receives from the processor, the external memory fetch addresses, the obtained instructions and data, and execution status signals. Hence, the in circuit emulators receive the external activity or state of the processor. The foregoing debugging operation works well except for executions of the processor which result from instructions obtained by the processor from an internal instruction cache. The use of such internal caches is increasing because a fetch to an internal cache by a processor takes less time than a fetch to external memory. Unfortunately, when a fetch to an internal cache takes place, there is no external activity for the in circuit emulator to monitor except possibly for a status signal from the processor indicating a non-sequential fetch to the internal cache. In the prior art, in order to track all of the state of the processor, the instructions stored in the internal cache had to be duplicated in the circuit emulator. This required additional debugging time, effort, and resources and such disadvantages are only worsened with internal caches of increased size. GB-A-2 200 482 discloses a microprocessor featuring an on-chip instruction cache and providing an additional interface signal ISF whenever a taken branch or jump is executed, allowing to monitor control flow. Additional information is also provided on the interface signals used for memory references: exception code and service address in case of an exception, virtual address of the jump in case of a taken jump. In US-A-4 670 838, a single chip microprocessor is operable in a debug mode wherein it carries out external instructions in either of a master and a slave mode. In the debug mode, the address signals produced by the internal program counter are sent to an external program memory during a first operation cycle; during other cycles, the corresponding port groups can be used for another object: and address latch may also be provided on the external bus. We will describe an arrangement whereby all states of a processor can be provided to an in circuit emulator without duplicating the internally stored processor instructions in the in circuit emulator. In addition, in a preferred arrangement, precise processor state and execution status can be provided to an in circuit emulator even when the processor is operating at a rate which is a multiple of the external memory operating rate. According to a first aspect, the invention provides a system for providing, externally to a first processor, an internal execution parameter resulting from the execution by the first processor of internal instructions stored in an internal instruction cache of the first processor. The system includes a second processor including an internal instruction cache for also storing the internal instructions. The second processor is coupled to the first processor in a master/slave configuration to enable the second processor to duplicate the instruction executions of the first processor and includes an output for providing the internal execution parameter resulting from said duplicate executions. The system further includes external bus means coupled to the second processor output and being external to the first and second processors for making available the execution parameter externally to the first and second processors. The second processor may also include a second status output coupled to the in circuit emulator for providing the in circuit emulator with status signals indicative of the execution status of the instruction executions of the processors. The first and second processors may be configurable for executing instructions at an operating rate which is multiple of the operating rate of the external memory and the second processor is configurable for providing, at the second status output, the status signals indicative of the execution status of the processors for each operating cycle of the processors. BRIEF DESCRIPTION OF THE DRAWINGS The features of the present invention which are believed to be novel are set forth with particularity in the appended claims. The invention, together with advantages thereof, may best be understood by making reference to the following description taken in conjunction with the accompany drawing, in the several figures of which like reference characters identify identical elements, and wherein: Figure 1 is a block diagram of a system embodying the present invention including first and second processors coupled together in a master/ slave configuration; Figure 2 is a block diagram of a portion of the slave microprocessor illustrating the manner in which the internal execution parameter is provided by the slave processor externally to the master and slave processors; and Figure 3 is a series of wave forms illustrating the operation of the system of Figure 1 over several clock cycles of operation of the master and slave processors. DESCRIPTION OF THE PREFERRED EMBODIMENT Referring now to Figure 1, it illustrates a system 10 embodying the present invention. The system 10 generally includes a first processor 12, a second processor 14, an external instruction/data memory 16, and an in circuit emulator 18. As will be seen hereinafter, the system 10 is configured to permit the in circuit emulator 18 to verify the execution by the processors 12 and 14 of the execution instructions to be executed by the processors. To that end, and as will be more fully described hereinafter, the first processor 12 and second processor 14 are coupled together in a master/slave configuration to permit the second processor 14, which is the slave processor, to duplicate the instructions performed by the first processor 12, which is the master processor. The external memory 16 is of the type which stores instructions to be executed by the processors, data required by the processors in their executions, and resultants which are written back to the external memory 16. The instructions, data, and resultants are stored in addressable storage locations of the external memory 16 and are addressable by the first processor 12 to permit processor 12 to fetch the instructions and data and to store resultants. To that end, the external memory 16 includes a multiple-bit REQUESTS input 17 which is coupled to a multiple-bit REQUESTS output 20 of the first processor 12 by an external control bus 22. The requests generated by the first processor 12 indicate to the external memory 16 whether an access to the external memory is a load access for fetching instruction or data or a store access for storing a resultant. The external memory 16 further includes a 32-bit address input 24 which is coupled to a 32-bit address output 26 of the first processor 12 by an external address bus 28. For each access to the external memory 16 the first processor 12 generates an address at the address output 26 which is conveyed to the external memory by the external address bus 28 for fetching the instructions or data stored in the external memory 16 at the corresponding address or for storing a resultant at the corresponding memory address of the external memory 16. For receiving an instruction or data from the external memory 16 or for providing a resultant to the external memory 16, the first processor 12 includes a multiple-bit instruction/data port 30 which is coupled to a multiple-bit external memory instruction/data port 32 of the memory 16 by an external instruction/data bus 34. To enable the second processor 14 to duplicate the executions of the first processor 12, the second processor 14 includes a multiple-bit instruction/data input 36 which is coupled to the external instruction/data bus 34. The input 36 is an input only and the system 10 is configured so that only the first processor 12 addresses the external memory 16 for fetching instructions and data for both processors. To control system timing, the first processor 12 includes a clock input 40 and the second processor 14 includes a clock input 42. The clock inputs 40 and 42 are coupled together by an INCLOCK line 44 which is adapted to be coupled to an external clock source (not shown). To further control system timing, the first processor 12 is preferably arranged to derive from the clock pulses received at input 40 a memory clock which is provided at an output 46. Preferably, processor 12 is of the type which is arranged for generating memory clock pulses at a rate which is equal to the processing rate of the processors 12 and 14 corresponding to a 1X mode of operation or at a rate which is one half the processing rate of the processors 12 and 14 corresponding to a .5X mode of operation. Such a processor is fully disclosed in US-A-5 291 070 filed January 28, 1991 for Microprocessor Synchronous Timing System, which application is assigned to the assignee of the present invention. The memory clock pulses provided by the first processor 12 are conveyed from output 46 to a memory clock input 48 of the second processor 14 and to a memory clock input 50 of the external memory 16. The first processor 12 and second processor 14 further include a 5-bit JTAG (Joint Test Action Group) input 54 and 56 respectively which, as well known in the art, may be utilized for setting the first and second processors 12 and 14 respectively into the master/slave configuration as contemplated by the present invention. JTAG inputs, as well known, are becoming standard in logic devices and microprocessors to allow an asynchronous boundary scan chain to connect all the inputs and outputs of such devices together and make them addressable. It also allows special test instructions or modes to be defined and implemented while using the standard protocol to enable them. Hence, it is a convenient way to change the mode of a processor, as for example, to move the processor to the slave tracking state without requiring special external logic or pins. Hence, as will be appreciated by those skilled in the art, the JTAG inputs 54 and 56 may also be utilized for placing the microprocessors 12 and 14 into other modes of operation as well. As thus far described, the microprocessors 12 and 14 are configured for executing instructions stored externally in the external memory 16. To permit the in circuit emulator 18 to track the execution of such external instructions, the in circuit emulator 18 includes a multiple-bit address input 60 which is coupled to the external address bus 28 and an instruction/data input 62 which is coupled to the external instruction/data bus 34. To further permit the in circuit emulator to track the executions of the first processor 12, the first processor 12 includes a 3-bit status output 52 which is coupled to a first 3-bit status input 64 of the in circuit emulator 18. The 3-bit status signals provided at the status output 52 as well known in the art can provide a great degree of information as to the state of execution of the processor 12. The three status bits may provide, for example, information as to the state of execution as indicated in the table below. STAT CYCLE 000 Halt or Step 001 Pipeline Hold 010 Load Test Instruction 011 Wait Mode 100 Interrupt Return 101 Taking Interrupt or Trap 110 Non-sequential Fetch 111 Executing Mode As thus far described, the system 10 is capable of providing the in circuit emulator 18 with sufficient information to track the executions of the processors 12 and 14 of external instructions stored in the external memory 16. However, as will be noted in Figure 1, each of the processors 12 and 14 includes an internal instruction cache 13 and 15 respectively. Such internal instruction caches are provided within processors because an access to an internal cache generally requires less time than accesses to external memory. Unfortunately, when a processor accesses an internal cache, there is no detectable external activity generated by a processor. Prior to the present invention, the only way that an in circuit emulator could track internal executions of internally stored instructions, was to totally duplicate the internal instructions stored within an internal cache within the in circuit emulator. However, and as will be seen hereinafter, since the processors 12 and 14 are coupled together in a master/slave configuration, the second processor 14 is able to provide the in circuit emulator 18 with internal execution parameters resulting from the processors executing internal instructions stored within the internal instruction caches 13 and 15. For decode, such an internal execution parameter may be program counter value, absolute register file number on a read or a virtual address of a load/store. In write-back, such an execution parameter could be a data element driven into the register file on a write, or an absolute register file number on a write. In accordance with the preferred embodiment, the internal execution parameter to be provided by the processor 14 is the address of the internal caches 13 and 15 for a non-sequential fetch to the internal caches. This, when combined with the information of when the pipeline is advanced, stalled, branching, or taking a trap, can give the in circuit emulator the instruction trace information it needs. The second or slave processor 14 provides the non-sequential fetch address at its multiple-bit address output 70. The address output 70 is coupled to a second address input 72 of the in circuit emulator by another external address bus 71. As will be seen with respect to Figure 2, each time the processors 12 and 14 first access their internal caches 13 and 15 respectively, the second processor 14 will provide at its output 70 the exact address of the internal cache storage location being addressed. Such non-sequential addresses are known in the art as jump addresses. Also, as will be seen with respect to Figure 2, the second processor 14 will continue to provide the current non-sequential fetch address until the next non-sequential fetch occurs. In the master/slave configuration, both processors 12 and 14 execute the program from external memory 16 at the same time, but only the master processor 12 is allowed to drive the external bus. This is accomplished by tieing all the inputs and outputs of the two processors together and by setting processor 14 into the slave mode through the JTAG input 56 to prevent it from ever driving an output value. As a result, both processors run the same program, but only processor 12 drives the value for stores to the external memory 16. Because of this relationship, the address bus 71 of the slave processor 14 is not needed for instruction fetches, loads, and stores, since the master processor 12 drives the value. In addition to the foregoing, the second processor 14 also includes a 3-bit status output 74 which is coupled to a second status input 76 of the in circuit emulator. When the processors 12 and 14 are operating in the 1X mode (when the processor operating rate is equal to the external memory operating rate) the status signals provided at the status output 74 will be identical to the status signals provided at the status output 52 of the first processor 12. However, when the processors 12 and 14 are operating in the .5X mode (when the processor operating rate is twice the operating rate of the external memory) the status signals provided at output 74 can be modified by encoding in a manner as will be appreciated by those skilled in the art to provide, for example, the information illustrated in the table below. STAT Cycle i Cycle i + 1 000 pipehold pipehold 001 pipehold executing 010 executing pipehold 011 executing executing 100 pipehold branch 101 branch pipehold 110 executing branch 111 branch executing In the .5X mode, the first processor 12 will continue to provide at its status output 52 the execution status for each operating cycle of the external memory 16. However, the second processor 14 will provide at its status output 74 status signals indicative of the execution status of the processor for each operating cycle of the processors. As can be seen from the table above, in the .5X mode, the processors will execute two operating cycles for each operating cycle of the external memory. As a result, the status output 74 of the second processor 14, when the processors are operating in the .5X mode, will reflect the exact execution status of the processors 12 and 14. By virtue of these status signals at output 74 and the corresponding jump or non-sequential fetch addresses provided at output 70, the in circuit emulator 18 is provided with an exact cycle by cycle breakdown of the instruction stream of the processors 12 and 14 without physically duplicating the entire instruction caches externally. This therefore provides a high degree of accuracy and visibility of the microprocessor executions for verifying the instructions to be executed by the processors. Referring now to Figure 2, it illustrates in greater detail the manner in which the second processor 14 provides the non-sequential jump addresses to its external address bus 71 when the processors 12 and 14 issue a non-sequential address for accessing the internal caches 13 and 15. The internal cache of the second processor 14 is referenced in Figure 2 by the reference character 15. Common to both processors are a program counter 80, an address unit 82, a next block adder 84, a fetch-ahead adder 86, a latch 88, a multiplexer 90, an internal instruction bus 92 and a second internal address bus 94. The program counter 80 generates an initial address which is utilized by the next-block adder 84 and the fetch-ahead adder 86 to generate sequential addresses within address blocks of the external memory 16. When an instruction is received on the external instruction/data bus 34 which requires a non-sequential fetch, the address unit 82 sets the program counter 80 to the non-sequential fetch address which is conveyed to the instruction cache 15 over the second internal address bus 94. To control the provision of the non-sequential jump address by the second processor 14, the second processor 14 includes a control means 96. The program counter 80 is coupled to the control means 96 and the latch 88 by a first internal address bus 98. The control means 96 includes a control input 100 which is set when the JTAG input 56 is set to condition the second processor 14 for master/slave operation. When a non-sequential fetch address is provided by the program counter 80, the non-sequential address is conveyed to the latch 88 and the control means 96 by the first internal address bus 98. Responsive to receiving the non-sequential fetch address, the control means 96 causes the non sequential address to be latched in the latch 88. The control means 96 also is coupled to the multiplexer 90 and causes the multiplexer to select input 102 for conveying the non-sequential address from the latch 88 through the multiplexer 90 and onto the external address bus 71 couple to the second processor 14. The non-sequential address is held on the bus 71 until the next non-sequential address is provided by the program counter 80 and detected by the control means 96. As a result, even though an internal instruction is fetched by the processors from the internal instruction caches resulting in internal execution of the instruction and no external activity by the first processor 12, the second processor 14 is arranged to provide the internal jump address to the in circuit emulator 18 over the external address bus 71. As will be appreciated by those skilled in the art, additional slave processors may be added to the system 10 of Figure 1 for providing other internal execution parameters with only slight modification to the existing hardware. Referring now to Figure 3, it illustrates a series of wave forms which may be referenced to lend further understanding of the present invention. Figure 3 illustrates four memory clock operating cycles including a first cycle from T0 to T1, a second cycle from T1 to T2, a third cycle from T2 to T3, and fourth cycle from T3 to T4. During the first cycle, the first processor 12 provides at its status output 52 an indication that it is currently executing on an instruction. At the beginning at the second cycle at T1, the first processor 12 provides a load request from its request output 20 and a load address at its address output 26. This is an external access to the external memory 16. Also during the second cycle, the first processor 12 indicates at its status output 52, that it is currently executing. For purposes of illustration, at the beginning of the third cycle at T2, the program counters of the processors 12 and 14 issue a non-sequential fetch address to the internal caches 13 and 15. However, such an internal access is not evident by the external activity of the first processor 12. However, as will be noted in the figure, at time T2 the second or slave processor 14 issues at its address output 70 the non-sequential fetch address to the internal caches which is the exact address of the caches being accessed. As a result, the in circuit emulator 18 is provided with the non-sequential fetch address and is able to track the internal executions of the processors 12 and 14. It will be further noted in Figure 3 that during the second half of the third cycle the external memory 16 provides the requested data responsive to the access initiated by the first processor 12 at time T1. The data appears on the external instruction/data bus 34 and is received by both the first processor 12 and the second processor 14. Also during the third cycle, the processor 12 indicates at its status output 52 that it has provided a non-sequential fetch address which, as previously mentioned, is provided by the second processor 14 at its address output 70. During the fourth cycle, the first processor indicates at its status output 52 that it is currently executing. Also during the fourth cycle, it will be noted that the second or slave processor 14 continues to hold the non-sequential fetch address at its address output 70. The wave forms referred to above relate to the operation of the processors 12 and 14 when in the 1X mode. The status output of the second processor from its status output 74 is not shown in Figure 3 for this mode of operation since it would indicate the same execution status as that provided by the first processor 12. However, the bottom wave form illustrates the status indications which may be provided by the second or slave processor 14 when the processors 12 and 14 are operating in the .5X mode. As will be noted, during each memory clock cycle, the second processor 14 indicates the execution status of both processors for each operating cycle of the processors. Since the processors when operating in the .5X mode are operating at a rate which is twice the operating rate of the external memory, the second processor 14 during each memory clock cycle will indicate the execution status of the processors for two processor operating cycles. For example, during the third cycle, the second processor 14 indicates that the processors were in a branch state during the first microprocessor cycle and then in an execution state during the second microprocessor cycle of the third memory clock cycle between times T2 and T3. As a result, the second or slave processor 14 is not only able to provide an internal execution parameter externally to the processors 12 and 14, it additionally is enabled to provide an exact indication of the execution status of the processors for each operating cycle while the first processor 12 provides a status indication of the execution of the processors for each memory clock cycle. In accordance with this preferred embodiment, each of the processors 12 and 14 is preferably an Am29030/35 microprocessor manufactured by Advanced Micro Devices. However, as will be appreciated by those skilled in the art, the present invention may be employed to advantage in association with virtually any like plurality of microprocessors. From the foregoing, it can be seen that the present embodiment overcomes the difficulty in providing an in circuit emulator with all instructions that are internally being executed by a processor. In addition, all such instructions are provided to the in circuit emulator on a real time basis for duplicating the actual timing of the processor. In addition, additional slave processors may be added with each separately configured to provide a different key internal state to an external in circuit emulator for break-pointing purposes. This is made possible since the external address bus of a slave processor is always idle. As a result, the present embodiment is capable of providing an external in circuit emulator with many different internal execution parameters with the addition of a separate slave processor for each such internal execution parameter to be provided. The foregoing represents a powerful tool in verifying instructions to be executed by a processor since large on-chip caches are becoming increasingly popular for use in microprocessors. In accordance with the preferred embodiment, the slave processor 14 watches and duplicates the request and instructions obtained by the master processor 12 and thus duplicates the executions of the master. At every non-sequential fetch internally on the slave processor 14, the external address bus 71 will latch the address value of the jump and drive it externally on the next memory clock cycle rising edge. As a result, the slave processor 14 will provide the external in circuit emulator with the exact address of every jump and not the pre-fetch address. It will continue to drive this value until the next non-sequential fetch is performed by the processors. While a particular embodiment of the present invention has been shown and described, modificacions may be made.

Claims: A system for providing, externally to a first processor (12), an internal execution parameter resulting from the execution by said first processor of internal instructions stored in an internal instruction cache (13) of said first processor, being characterised by said system further comprising: a second processor (14) including an internal instruction cache (15) for also storing said internal instructions, said second processor being coupled to said first processor in a master/slave configuration to enable said second processor to duplicate the instruction executions of said first processor, said second processor including an output (70) for providing the internal execution parameter resulting from said duplicate executions; and bus means (71) coupled to said second processor output and being external to said first and second processors for making available said internal execution parameter externally to said first and second processors. A system as claimed in claim 1 wherein said second processor includes latch means (88) for latching said internal execution parameter at said output. A system as claimed in claim 2 wherein said second processor further includes control means (96) for detecting the occurrence of said internal execution parameter, said control means being coupled to said latch means for causing said latch means to latch said internal execution parameter. A system as claimed in claim 3 wherein said second processor includes an internal bus means (98) for carrying said internal execution parameter and wherein said latch means and said control means are coupled to said internal bus means. A system as claimed in claim 4 wherein said internal execution parameter is a non-sequential fetch address to said first and second processor internal instruction caches. A system as claimed in claim 5 wherein said second processor further includes a program counter (80) for providing said non-sequential fetch address and wherein said program counter is coupled to said second processor internal instruction cache by said internal bus means. A system as claimed in claim 6 wherein said internal bus means comprises a first internal address bus (98) for coupling said program counter to said latch means and said control means and a second internal address bus (94) for coupling said program counter to said second processor internal instruction cache. A system as claimed in claim 4 wherein said second processor further includes a multiplexer (90) for coupling said latch means to said output and wherein said multiplexer is responsive to said control means for providing said internal execution parameter to said output. A system as claimed in claim 1 wherein said second processor includes a status output for providing status signals indicative of the execution status of said instruction executions of said processors. A system as claimed in claim 9 further including an external memory (16) for storing external instructions, wherein said first and second processors are coupled to said external memory for receiving said external instructions, and wherein said first processor is configured to fetch said external instructions from said external memory for said first and second processors. A system as claimed in claim 10 wherein said first and second processors are configurable for executing instructions at an operating rate which is a multiple of the operating rate of said external memory and wherein said second processor is configurable for providing, at said status output, said status signals indicative of the execution status of said processors for each operating cycle of said processors. A system as claimed in claim 11 wherein said first processor includes a status output (52) for providing status signals indicative of the execution status of said instruction executions of said first processor for each operating cycle of said external memory. A system as claimed in claim 12 further including an in circuit emulator (18) coupled to said external memory, to said second processor for receiving said internal execution parameter, and to said first and second processor status outputs for receiving said status signals.

Inventors: JOHNSON WILLIAM M, WITT DAVID B, JOHNSON, WILLIAM M., WITT, DAVID B.
Applicants: ADVANCED MICRO DEVICES INC, ADVANCED MICRO DEVICES, INC.
Application year: 1992
Main classification: G06F9
IPC codes: G06F9, G06F11, G06F12