Abstract:
The present invention relates in general to a data processing system (10), and more particularly to a method and apparatus for providing instruction pipe (106) status information, including fullness information, external to data processing system (10). In one embodiment, an IPIPE2 integrated circuit terminal (15) is used to serially provide a pipe depth value indicating the fullness of the instruction pipe (106). The serial protocol used with the IPIPE2 (15) terminal includes a start bit, a fetch pointer value, and a plurality of idle bits. In one embodiment, IPIPE0 (13) and IPIPE1 (14) integrated circuit terminals may indicate loading and unloading of instruction pipe (106) and may stop toggling when central processing unit (102) is in a loop mode.

Description:
REFERENCE TO RELATED APPLICATIONS 
     The present application is related to the following U.S. patent applications: 
     &#34;Method And Apparatus For Providing An External Indication Of Internal Cycles In A Data Processing System&#34;, invented by Jay Hartvigsen et al., Ser. No. 08/458,390, filed Jun. 2, 1995, and assigned to the assignee hereof now U.S. Pat. No. 5,826,058. 
    
    
     FIELD OF THE INVENTION 
     The present invention relates in general to a data processing system, and more particularly to a method and apparatus for providing pipe fullness information external to a data processing system. 
     BACKGROUND OF THE INVENTION 
     Data processing systems, such as microcontroller or microprocessor integrated circuits, may have an internal instruction pipe which is used to queue incoming instructions that are to be executed. In order to facilitate hardware testing and software program debugging, it is useful for the data processor to provide pipe status information to the data processor&#39;s external bus. In this manner, test and debug equipment external to the data processor, such as a development system, is able to monitor status information regarding the instruction pipe. 
     Prior art data processors have provided pipe status information which indicated whether or not the instruction pipe was empty. This is often sufficient pipe status information for data processors that have short instruction pipes, such as one or two stages. However, this is usually insufficient information for data processors that have a deeper instruction pipe. Some prior art data processors that have deeper instruction pipes have provided pipe status information which indicated when the data processor had a change of instruction flow, that is when the instruction pipe required flushing because a jump or a branch instruction required the old instructions in the instruction pipe to be removed without being executed. As an example, some members of the MC68HC16 and MC68300 families of microcontrollers, available from Motorola, Inc. of Austin, Tex., are able to provide this type of pipe status information on the external bus. 
     However, for data processors that have instruction pipes deeper than one or two stages, providing pipe status information indicating when the data processor had a change of instruction flow (i.e. indicating when the pipe must be flushed) may not be sufficient for the development system to quickly synchronize with the instruction execution within the data processor. For example, if the software code being executed by the data processor executes a significant amount of straight line code before a branch or jump is encountered, the development system may not be able to quickly synchronize with the data processor and may not be able to quickly determine which instruction the data processor is currently executing. 
     In some situations, a long delay in synchronizing the development system to the execution of instructions in the data processor may significantly hamper testing and debugging of the data processor. A solution was needed which would allow user visibility to pipe status information as real-time as possible, while allowing the development system to quickly synchronize with instruction execution in the data processor. Quick synchronization would allow the development system to determine which instruction is currently being executed so that instruction tracking may begin as soon as possible. Of course, it is important that the provision of pipe status information not significantly impact the internal operation and speed of the data processor. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 illustrates, in block diagram form, a data processing system 10 and external bus 12 in accordance with one embodiment of the present invention; 
     FIG. 2 illustrates, in block diagram form, a data processing system 10 of FIG. 1 in accordance with one embodiment of the present invention; 
     FIG. 3 illustrates, in timing diagram form, a portion of external bus signals 12 and the contents of fetch pointer 116 in accordance with one embodiment of the present invention; and 
     FIG. 4 illustrates, in tabular form, the relationship between the fetch pointer value 116 and the fullness of instruction pipe 106 at fetch #2 of FIG. 3 in accordance with one embodiment of the present invention. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENT 
     The term &#34;bus&#34; will be used to refer to a plurality of signals or conductors which may be used to transfer one or more various types of information, such as data, addresses, control, or status. The terms &#34;assert&#34; and &#34;negate&#34; will be used when referring to the rendering of a signal, status bit, or similar apparatus into its logically true or logically false state, respectively. If the logically true state is a logic level one, the logically false state will be a logic level zero. And if the logically true state is a logic level zero, the logically false state will be a logic level one. 
     FIG. 1 illustrates a data processing system 10 which is bi-directionally coupled to an external bus 12. In one embodiment of the present invention, external bus 12 includes the following signals: pipe tracking signals 11 which are transferred by way of conductors 13-15, address signals which are transferred by way of conductors 16, address/chip select signals which are transferred by way of conductors 17, data signals which are transferred by way of conductors 18, a read/write signal is transferred by way of conductor 19, a clock signal which can represent either an internal or external clock is transferred by conductor 21, and other control signals which are transferred by way of conductors 20. In one embodiment of the present invention, the address signals 16, the data signals 18, the read/write signal 19, and the other control signals 20 are bidirectional, while the remaining signals are provided by data processing system 10 to external bus 12. 
     Still referring to FIG. 1, in one embodiment of the present invention, pipe tracking signals 11 include the following signals: an IPIPE0 signal which is transferred external to data processing system 10 by way of conductor 13, an IPIPE1 signal which is transferred external to data processing system 10 by way of conductor 14, and an IPIPE2 signal which is transferred external to data processing system 10 by way of conductor 15. 
     FIG. 2 illustrates, in block diagram form, one embodiment of a data processing system 10. The data processing system 10 includes a central processing unit 102, an external bus interface 120, other modules 122 as needed, and an external bus 12. Central processing unit 102 generates pipe tracking signals 11, which includes IPIPE0 13, IPIPE1 14 and IPIPE2 15, in one embodiment of the present invention. Alternate embodiments of the present invention may use more or fewer pipe tracking signals 11. The pipe tracking signals 11 couple the central processing unit 102 to the external bus interface 120. In turn, the external bus interface 120 asserts signals representing IPIPE0, IPIPE1, and IPIPE2 as part of the external bus 12. External bus 12 also contains other control signals and data signals, and clock signal 21. The external bus interface 120 is coupled to the central processing unit 102 by bus 124. In addition, bus 124 couples the external bus interface 120 and the central processing unit 102 to any other modules 122 in the system. 
     The pipe tracking signals 11 from the central processing unit 102 are used to identify the status instructions within the central processing unit 102. This signal information is presented external to the chip on the external bus 12. 
     The central processing unit 102 contains a fetch pointer 116, a pipe tracking circuit 118, an instruction pipe 106, an instruction register 108, a microsequencer 110, an execution unit 112, and an internal bus interface 114. The pipe tracking circuit 118 is coupled to the fetch pointer 116 by data line 154, and block 104 by data line 142, which is the combination of the instruction pipe 106 and instruction register 108. In addition, pipe tracking circuitry 118 provides the pipe tracking signals 11 to the external bus interface 120. The instruction pipe 106 is coupled to the fetch pointer 116 by data line 144, the microsequencer 110 by data line 148, the instruction register 108 by data line 152, and the internal bus interface 114. The microsequencer is coupled to the block 104 containing the instruction pipe 106 and instruction register 108 by data line 148, the fetch pointer 116 by data line 146, and the execution unit 112 by data line 150. The execution unit 112 is coupled to the microsequencer 110 by data line 150, and the internal bus interface 114 by data line 160. The fetch pointer 116 is coupled to the microsequencer 110 by data line 146, the instruction pipe 106 by data line 144, and the pipe tracking circuitry 118 by data line 142. The internal bus interface 120 is coupled to the block 104, and the execution unit 112 by data line 160, and provides interfaces to the internal bus 124. 
     In operation, the external bus 12 provides instructions to the external bus interface unit 120. The external bus interface 120 interfaces with the internal bus interface 114 to provide instructions and control information allowing the instruction pipe 106 to be filled with the correct instructions. For example, if instruction pipe 106 were empty, the internal bus interface 114, operating in unison with the external bus 12, would receive a first instruction and load it into the instruction register labeled IR0. The next fetched instruction would be loaded into instruction register IR1, provided the instruction at IR0 had not been dispatched to the instruction register 108. This instruction loading process continues in a normal fashion until all instruction registers are full or no new instructions are available. As instructions are dispatched, or executed, they are loaded from IR0 into the instruction register 108. When this occurs, the data in each of the other instruction registers IR1 through IR7 are moved into the next adjacent instruction register; thereby moving closer to the instruction register 108. The fetch pointer 116 keeps track of the next available instruction register. The next available instruction register is the location where the next fetched instruction will be stored. Alternate embodiments of the present invention may use a fetch pointer 116 that stores a different value, such as the last instruction register containing a pending instruction. 
     The microsequencer 110 controls execution of the instruction in register IR 108. When the instruction in IR 108 is completed, the microsequencer 110 will retire that instruction, allowing the instruction in IR0 to be dispatched, and the remaining instructions registers IR1-IR7 to be advanced. These events are monitored by the fetch pointer 116 so that the next available location for an instruction in the instruction pipe 106 is identified. Also, the fetch pointer 116 monitors the receipt of instructions from internal bus interface 114 so that the next available instruction register is always pointed to by fetch pointer 116. The pipe tracking circuitry 118 monitors the fetch pointer value of fetch pointer 116. In accordance with the present invention, the pipe tracking circuitry 118 generates a serial output signal on pipe tracking signal IPIPE2 15. This signal communicates to external bus 12 which instruction register is the next available register. This information is synchronized to the clock 21 and provided to the external bus interface 120 which provides the information on external bus 12 at the integrated circuit terminal labeled IPIPE2. While the instruction pipe 106 status is transmitted serially in order to minimize the number of needed terminals, it is understood that alternate embodiments could use a plurality of pins to provide the information. 
     FIG. 3 illustrates in timing diagram form the operational relationship of the clock 21, IPIPE0-IPIPE2 11, data 18, which represents a portion of internal bus 124, and the fetch pointer value contained within fetch pointer 116. Clock 21 represents an external clock or an internal clock. The clock signal 21 serves to synchronize the operation of data processing system 10, including the pipe tracking signals 11, data 18, and fetch pointer 116. IPIPE0 13 serves to indicate when the instruction registers of the instruction pipe 106 are being retired. When IPIPE0 is low on either the rising edge or the falling edge of clock 21, it indicates the retirement of an instruction in the instruction pipe 106. This may also be thought of as indicating when the instruction registers IR0-IR7 are being advanced by one. Therefore, in FIG. 3, IPIPE0 13 during the falling edge of the second clock cycle of clock 21 is shown to be low. This indicates that an instruction register advance has occurred. During the rising edge of the next clock cycle, it is shown that IPIPE0 13 is active high. In this situation, no advancement of the pipe has occurred. Likewise, during the next falling clock 21 edge, IPIPE0 13 is high, indicating no advance of the pipe. However, at the next rising edge, the IPIPE0 13 value is in an active low state representing an advancement of instruction pipe 106. In this situation, the external emulator or debug circuitry (not shown), as discussed previously, could determine that an instruction register has been retired. The next falling edge of the clock signal 21 also indicates an advancing of the instruction registers since IPIPE0 13 is low. If the CPU 102 is executing in a loop mode, where a sequence of instructions that operate to form a loop are executed out of the instruction pipe 106 without being retired, then IPIPEO does not toggle, as the instruction pipe 106 registers IR0-IR7 are not being advanced. 
     The signal IPIPE1 14 is used to determine when a pipeline fetch or a pipeline flush occurs. During a falling edge of clock 21, IPIPE1 14 indicates a fetch by a low value. Likewise, if during a falling edge of clock 21 IPIPE1 14 is high, no fetch is occurring. In a similar manner, during the rising edge of clock 21 IPIPE1 14 will indicate a pipe flush by a low state, and conversely will indicate no flush has occurred if IPIPE1 14 is at a high state. Data 18 illustrates the progression of data across the internal data bus 124. The designations of data 1, data 2, and so on, reflects new instruction data on the data bus 18. The contents of fetch pointer 116 value indicates the current value contained within the fetch pointer circuitry 116, and will be referred to as fetch pointer 16. A fetch pointer 116 value of three indicates that register IR3 of instruction pipe 106 is the next instruction register location to receive data from the internal bus interface 114. Conversely, a fetch pointer 116 value of four would indicate that register IR4 will receive the next instruction from the internal bus interface 114. IPIPE2 15, as previously discussed, is used to identify which of the instruction register is available for the next incoming instruction data. 
     In one embodiment of the present invention, the IPIPE2 15 signal begins with a start bit. The start bit follows the first fetch after a valid idle state has occured, indicated by fetch #1 in FIG. 3. The idle state consists of signal IPIPE2 15 being high for a minimum four clock cycles of clock 21. Following an idle state, the start bit is identified by the IPIPE2 15 signal being low during a rising edge of clock 21. The value on IPIPE2 15 during the next three rising edges of clock 21 determines the fetch pointer value. As illustrated in FIG. 3, beginning at the second clock 21 rising edge after IPIPE2 15 goes low, it can be seen that IPIPE2 has the binary value 011. This indicates that instruction register IR3 is the next available instruction register in the instruction pipe 106. by receiving the fetch pointer from IPIPE2 15, an emulator(not shown) is able to determine that the incoming data 1 of data 18 will be stored into IR3. Note, that emulator software normally keeps track of the next instruction scheduled to be sent to the instruction pipeline 106. After sending the value of fetch pointer 116, the signal IPIPE2 15 begins the next idle state. Following a valid idle state on IPIPE2 15, another start bit will be asserted after the next valid fetch occurs. In FIG. 3, fetch #2 represents the next valid fetch. 
     FIG. 4 illustrates in tabular form the relationships between the contents of fetch pointer 116, the instruction registers IR0-IR7 in the instruction pipe 106, and the data contained in the instruction registers of the instruction pipe 106. The table represents the events that are occurring at a moment in time where fetch #2 (See FIG. 3) is occurring. At this point, the fetch pointer value received from the IPIPE2 15 signal indicates that the fetch pointer value is 4. Therefore, register IR4 in FIG. 4 is shown as receiving &#34;incoming data 5&#34;. At this point in time, register IRO contains data 1, instruction register 1 contains data 2, register IR2 contains data 3, register IR3 contains data 4. Since the instruction pointer value is 4, that indicates the next empty instruction register is IR4. Therefore, the emulator (not shown) is able to determine that IR4 will receive the incoming data 5, as is indicated in FIG. 4. This keeps the emulator or debugger synchronized with the instruction pipe 106. Note that instruction registers IR5-IR7 are empty and, if no instructions are retired, will contain data 6, data 7 and data 8. 
     By providing a mechanism whereby a single pin provides the current fill status of the instruction pipe 106, it is possible for emulators and debug software to synchronize with the CPU 102 at any point in the instruction sequence. Without having to wait for a change of instruction flow or a flush of the instruction pipe 106, a problem with the prior art is overcome. While the present invention has been illustrated and described with reference to specific embodiments, further modifications and improvements will occur to those skilled in the art. For example, IPIPE2 could provide other internal CPU status information (eg. loop mode, non-loop mode). It is to be understood, therefore, that this invention is not limited to the particular forms illustrated and that the appended claims cover all modifications that do not depart from the spirit and scope of this invention.