Trace device preventing loss of trace information which will be important in debugging
Claim Score by NHIP
Abstract
A comparator generates an event A when a value of a PC of a CPU matches a target address set in a target address register. If a trace is performed in a real-time trace mode in the initial state, an RS-FF is set by the generation of the event A and the trace will be performed in a full trace mode. Therefore, by setting a starting address of a subroutine for debugging in the target address register, the trace mode will be changed to the full trace mode when the CPU executes the subroutine, and thereby loss of trace information which will be important in debugging software can be prevented.

Term
Term ended
Projected expiry passed 4 December 2022, 3.8 years ago.
- Priority
- Filed
- Published
- Projected expiry
- Today
17 claims: 3 independent, 14 dependent
- 1A trace device to generate trace information by switching between a full trace mode to generate trace information while stalling a processor, and a real-time trace mode to generate trace information while not stalling said processor, comprising:an event unit generating an event when a predetermined condition is met;and a trace unit detecting generation of said event and generating trace information by switching between said full trace mode and said real-time trace mode.
- 12A trace device to generate trace information of a processor by switching a trace mode to one of a branch trace mode, a data trace mode and a mixed trace mode, comprising:an event unit generating an event when a predetermined condition is met;and a trace unit detecting a generation of said event and generating trace information by switching to one of said branch trace mode, said data trace mode and said mixed trace mode.
- 14Broadest claimClaim Score 81, broad(NHIP)A trace device to generate and output trace information of a processor, comprising:an event unit generating an event when a predetermined condition is met;and a trace unit detecting a generation of said event and generating trace information after determining whether to generate the trace information in an absolute address or in a relative address.
Independent claims3
136 paragraphs in 4 sections, as filed
BACKGROUND OF THE INVENTION
[0001] 1. Field of the Invention
[0002] The present invention relates to a technique of generating trace information of a CPU (Central Processing Unit) used for debugging hardware having the CPU and for debugging software and, more specifically, to a trace device preventing loss of trace information which will be important in debugging.
[0003] 2. Description of the Background Art
[0004] In recent years, CPUs are widely used in information equipment such as personal computer, home appliances and the like. It is important to analyze flow of a program executed by a CPU in development of the CPU itself, as well as in development of information equipment, home appliances or the like which is provided with such CPU. One of the methods enabling such analysis is to provide a trace function inside a semiconductor chip to transmit operations of the CPU to the outside of the semiconductor chip having the CPU.
[0005] On the other hand, there is also a need to enhance the processing speed of a CPU, and an operation frequency of a CPU is correspondingly becoming higher, so that the frequency is becoming much higher than that of the circuits outside the CPU. As a result, the operation of the outside circuit cannot follow the speed of the trace output, and various contrivances have been made to the trace function.
[0006] One of conventional trace devices has a break pointer for beginning the trace and a break pointer for ending the trace, and the trace is started when a value of a program counter of a CPU (hereinafter referred to as a PC value) matches a value of the break pointer for beginning the trace, and the trace is ended when the PC value of the CPU matches a value of the break pointer for ending the trace.
[0007] In addition, a conventional trace device performs a full trace or a real-time trace. The full trace is to output all of the trace information of the CPU, and therefore the trace output is performed while stalling the CPU. On the other hand, the real-time trace permits loss of a part of the trace information of the CPU, and therefore the trace output is performed while not stalling the CPU.
[0008] In the above-mentioned conventional trace device, as the trace is started when the PC value of the CPU matches the value of the break pointer for beginning the trace and is ended when the PC value of the CPU matches the value of the break pointer for ending the trace, the trace information between the time when the CPU started the execution of the program and the time when the PC value of the CPU matches the value of the break pointer for beginning the trace, and the trace information after the PC value of the CPU matches the value of the break pointer for ending the trace would not be output. As a result, if the CPU operates in an unexpected manner due to a bug of software when the trace is not output, this operation will not be found early so that the debugging of the software will be difficult.
[0009] In addition, as the full trace operates the CPU while stalling the same, a bug may not be reproduced because the operation of the CPU is different from a normal operation, and therefore the debugging will be unsuccessful. Furthermore, though the real-time trace operates the CPU in a normal manner, as most of the trace information is lost due to an overflow of a trace buffer, the analysis of the bug of the software will be difficult.
[0010] The traces include a branch trace which outputs a branch destination address every time the CPU executes a branch instruction, a data trace which outputs data accessed by the CPU, and a mixed trace which outputs both the branch destination address and the data. As the mixed trace has large trace information, the operation speed of the CPU will further be decreased when the full trace is selected, and further trace information will be lost when the real-time trace is selected.
SUMMARY OF THE INVENTION
[0011] An object of the present invention is to provide a trace device preventing loss of trace information which will be important in debugging software.
[0012] Another object of the present invention is to provide a trace device which enables debugging of software with minimal loss of trace information.
[0013] A further object of the present invention is to provide a trace device which allows a CPU to execute a program in a condition similar to that of the normal operation of the CPU even when the trace is performed in a full trace mode.
[0014] According to one aspect of the present invention, a trace device generates trace information by switching between a full trace mode to generate trace information while stalling a processor, and a real-time trace mode to generate trace information while not stalling the processor. The trace device includes an event unit generating an event when a predetermined condition is met, and a trace unit detecting the generation of the event and generating the trace information by switching between the full trace mode and the real-time trace mode.
[0015] As the trace unit detects the generation of the event and generates the trace information by switching between the full trace mode and the real-time trace mode, the trace device can operate in the full trace mode when an operation of a processor is to be analyzed in detail, and can operate in the real-time trace mode when the detailed analysis is unnecessary. Therefore, loss of the trace information which will be important in debugging software can be prevented. In addition, as the trace is performed in the real-time trace mode when the detailed analysis of the operation of the processor is unnecessary, the CPU can operate in a condition similar to that of the normal operation of the CPU.
[0016] According to another aspect of the present invention, a trace device generates trace information of a processor by switching a trace mode to one of a branch trace mode, a data trace mode, and a mixed trace mode. The trace device includes an event unit generating an event when a predetermined condition is met, and a trace unit detecting the generation of the event and generating the trace information by switching of the branch trace mode, data trace mode and mixed trace mode.
[0017] As the trace unit detects the generation of the event and generates the trace information by switching of the branch trace mode, data trace mode and mixed trace mode, the type of the trace information can be changed when an operation of a processor is to be analyzed in detail, and when the detailed analysis is unnecessary. Therefore, as an amount of the trace information can be reduced in the branch trace mode or the data trace mode, time for stalling the processor can be minimized and the debugging of the software can be performed in a condition similar to that of the normal operation of the processor.
[0018] According to further aspect of the present invention, a trace device to generate and output trace information of a processor includes an event unit generating an event when a predetermined condition is met, and a trace unit detecting the generation of the event and generating the trace information after determining whether to generate the trace information in an absolute address or in a relative address.
[0019] As the trace unit detects the generation of the event and generates the trace information after determining whether to generate the trace information in the absolute address or in the relative address, an amount of the trace information can be reduced when the trace information is generated in the relative address. Therefore, a time for stalling the processor can be minimized when the trace is performed in the full trace mode, and the debugging of the software can be performed in a condition similar to that of the normal operation of the processor. In addition, loss of the trace information can be minimized when the trace is performed in the real-time trace mode.
[0020] The foregoing and other objects, features, aspects and advantages of the present invention will become more apparent from the following detailed description of the present invention when taken in conjunction with the accompanying drawings.
BRIEF DESCRIPTION OF THE DRAWINGS
[0021] FIGS. <b>1</b>-<b>10</b> are block diagrams showing schematic structures of semiconductor devices respectively having trace devices in first to tenth embodiments of the present invention.
DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0022] (First Embodiment)
[0023]FIG. 1 is a block diagram showing a schematic structure of a semiconductor device having a trace device in a first embodiment of the present invention. The semiconductor device includes a CPU <b>1</b>, an event unit <b>2</b><i>a</i>, and a trace unit <b>3</b><i>a</i>. Hereinafter, event unit <b>2</b><i>a </i>and trace unit <b>3</b><i>a </i>are referred to as a trace device as a whole.
[0024] Event unit <b>2</b><i>a </i>includes target address registers <b>21</b><i>a </i>and <b>21</b><i>b </i>wherein target addresses are set, a comparator <b>22</b><i>a </i>to compare a value of a PC <b>11</b> of CPU <b>1</b> with the target address held in target address register <b>21</b><i>a</i>, and a comparator <b>22</b><i>b </i>to compare the value of PC <b>11</b> of CPU <b>1</b> with the target address held in target address register <b>21</b><i>b</i>. Target address registers <b>21</b><i>a </i>and <b>21</b><i>b </i>are accessible by CPU <b>1</b>.
[0025] Comparator <b>22</b><i>a </i>compares the PC value of CPU <b>1</b> with the target address set in target address register <b>21</b><i>a</i>, and outputs the low level (referred to as the “L level” hereinafter) when they mismatch, and outputs the high level (referred to as the “H level” hereinafter) when they match to notify trace unit <b>3</b><i>a </i>of a generation of an event A. Similarly, comparator <b>22</b><i>b </i>compares the PC value of CPU <b>1</b> with the target address set in target address register <b>21</b><i>b</i>, and outputs the L level when they mismatch, and outputs the H level when they match to notify trace unit <b>3</b><i>a </i>of a generation of an event B.
[0026] Trace unit <b>3</b><i>a </i>includes switches <b>31</b><i>a </i>and <b>31</b><i>b</i>, a register <b>32</b><i>a </i>wherein a value for switching switch <b>31</b><i>a </i>is set, a register <b>32</b><i>b </i>wherein a value for switching switch <b>31</b><i>b </i>is set, OR gates <b>35</b><i>a </i>and <b>35</b><i>b</i>, an AND gate <b>36</b>, an RS-flip-flop (referred to as an RS-FF hereinafter) <b>37</b>, and a trace buffer <b>39</b>. Herein, registers <b>32</b><i>a </i>and <b>32</b><i>b </i>are accessible by CPU <b>1</b>.
[0027] In a branch trace mode, trace buffer <b>39</b> successively receives a branch address output to an address bus <b>41</b>, generates a packet including the branch address, and outputs the same from a trace output terminal. In a data trace mode, trace buffer <b>39</b> successively receives an operand access data output to a data bus <b>42</b>, generates a packet including the operand access data, and outputs the same from the trace output terminal. In a mixed trace mode, trace buffer <b>39</b> successively receives the branch address output to address bus <b>41</b> and the operand access data output to data bus <b>42</b>, generates a packet including the branch address or the operand access data, and outputs the same from the trace output terminal.
[0028] Trace buffer <b>39</b> outputs the trace information to the outside by outputting a packet of 8 bits several times from the trace output terminal. In the branch trace mode, trace buffer <b>39</b> outputs from the trace output terminal the branch trace information of 6 bytes (6 packets) in total, that is, identification information (4 bits), the branch address (4 bytes), and the number of instructions executed between the last branch instruction and the present branch instruction (12 bits).
[0029] In the data trace mode, trace buffer <b>39</b> outputs from the trace output terminal the data trace information of 9 bytes (9 packets) in total, that is, the identification information (1 byte), the operand access data (4 bytes), and the address (4 bytes).
[0030] In the mixed trace mode, trace buffer <b>39</b> selectively outputs the above-mentioned branch trace information of 6 bytes and data trace information of 9 bytes from the trace output terminal. It is to be noted that, since the instruction executing speed of CPU <b>1</b> is much higher than the output speed of trace buffer <b>39</b> generating the trace information and outputting the same from the trace output terminal by 8 bits, trace buffer <b>39</b> will enter a buffer-full state. In such a condition, trace buffer <b>39</b> outputs a buffer-full signal of the H level.
[0031] In register <b>32</b><i>a</i>, a value is set indicating whether the trace device will operate in the full trace mode or in the real-time trace mode when the event A is generated. Similarly, in register <b>32</b><i>b</i>, a value is set indicating whether the trace device will operate in the full trace mode or in the real-time trace mode when the event B is generated.
[0032] When switches <b>31</b><i>a </i>and <b>31</b><i>b </i>are connected as shown in FIG. 1 with the values set in registers <b>32</b><i>a </i>and <b>32</b><i>b</i>, for example, if the event A is generated, OR gate <b>35</b><i>b </i>outputs the H level and RS-FF <b>37</b> is set to output a full trace mode signal of the H level. As a result, when trace buffer <b>39</b> enters the buffer-full state (the buffer-full signal is at the H level), AND gate <b>36</b> outputs a CPU stall signal of the H level and stalls CPU <b>1</b>. That is, the trace is performed in the full trace mode. The buffer-full signal is set to the L level when there is any available space in trace buffer <b>39</b>, and then the execution of instructions by CPU <b>1</b> is resumed.
[0033] When the event B is generated, OR gate <b>35</b><i>a </i>outputs the H level, and RS-FF <b>37</b> is reset to output the full trace mode signal of the L level. As a result, AND gate <b>36</b> outputs the CPU stall signal of the L level and does not stall CPU <b>1</b>. That is, the trace is performed in the real-time trace mode. In this condition, as the output signal of AND gate <b>36</b> remains at the L level and CPU <b>1</b> is not stalled even when trace buffer <b>39</b> enters the buffer-full state and the buffer-full signal is set to the H level, the trace information is overwritten and the old trace information is lost.
[0034] When switches <b>31</b><i>a </i>and <b>31</b><i>b </i>are connected to the respective opposite terminals with the values set in registers <b>32</b><i>a </i>and <b>32</b><i>b</i>, the trace is performed in the real-time trace mode by the generation of the event A, and in the full trace mode by the generation of the event B.
[0035] When a subroutine on software probably having a bug can be predicted, the starting address of the subroutine is set in target address register <b>21</b><i>a</i>, and the last address of the subroutine is set in target address register <b>21</b><i>b</i>. Then, by setting switches <b>31</b><i>a </i>and <b>31</b><i>b </i>as shown in FIG. 1 with the values in registers <b>32</b><i>a </i>and <b>32</b><i>b</i>, the trace is performed in the full trace mode while CPU <b>1</b> is executing the subroutine to prevent loss of the trace information. The trace can be performed in the real-time trace mode in the other periods to allow loss of the trace information.
[0036] As described above, according to the trace device in the first embodiment of the present invention, the trace mode is switched when the PC value of CPU <b>1</b> matches the target addresses set in target address registers <b>21</b><i>a </i>and <b>21</b><i>b</i>. As a result, the trace is performed in different trace modes at a portion where the trace information must be analyzed in detail and at the other portions, and therefore the debugging of a subroutine or the like can easily be performed.
[0037] (Second embodiment)
[0038]FIG. 2 is a block diagram showing a schematic structure of a semiconductor device having a trace device in a second embodiment of the present invention. The semiconductor device includes CPU <b>1</b>, an event unit <b>2</b><i>b</i>, and a trace unit <b>3</b><i>b</i>. Herein, the same reference characters indicate portions having the same structure and function as the semiconductor device in the first embodiment shown in FIG. 1.
[0039] Event unit <b>2</b><i>b </i>includes a target address register <b>23</b> wherein a target address is set, a target data register <b>24</b> wherein target data are set, comparator <b>22</b><i>a </i>to compare the address value output to address bus <b>41</b> with the target address held in target address register <b>23</b>, comparator <b>22</b><i>b </i>to compare the data output to data bus <b>42</b> with the target data held in target data register <b>24</b>, and an AND gate <b>25</b>. Herein, target address register <b>23</b> and target data register <b>24</b> are accessible by CPU <b>1</b>.
[0040] Comparator <b>22</b><i>a </i>compares the address value output to address bus <b>41</b> with the target address set in target address register <b>23</b>, and outputs the L level when they mismatch, and outputs the H level when they match. Comparator <b>22</b><i>b </i>compares the data output to data bus <b>42</b> with the target data set in target data register <b>24</b>, and outputs the L level when they mismatch, and outputs the H level when they match.
[0041] When the output signals of both comparators <b>22</b><i>a </i>and <b>22</b><i>b </i>are at the H level, AND gate <b>25</b> outputs the H level to notify trace unit <b>3</b><i>b </i>of the generation of the event.
[0042] Trace unit <b>3</b><i>b </i>includes switch <b>31</b>, register <b>32</b> wherein a value for switching switch <b>31</b> is set, AND gate <b>36</b>, RS-FF <b>37</b>, and trace buffer <b>39</b>. Herein, register <b>32</b> is accessible by CPU <b>1</b>.
[0043] In register <b>32</b>, a value is set indicating whether the trace device operates in the full trace mode or in the real-time trace mode when the event is generated. When switch <b>31</b> is connected as shown in FIG. 2 with the value set in register <b>32</b>, if the event is generated, RS-FF <b>37</b> is set and the full trace mode signal of the H level is output. As a result, when trace buffer <b>39</b> enters the buffer-full state (the buffer-full signal is set to the H level), AND gate <b>36</b> outputs the CPU stall signal of the H level and stalls CPU <b>1</b>. That is, the trace is performed in the full trace mode. It is assumed that RS-FF <b>37</b> outputs the L level and CPU <b>1</b> operates in the real-time trace mode in the initial state.
[0044] When switch <b>31</b> is connected to the opposite terminal with the value set in register <b>32</b>, the full trace mode will be switched to the real-time trace mode by the generation of the event.
[0045] If there is a bug in an operation to transfer data of a DMAC (Direct Memory Access Controller), for example, prescribed data of a prescribed address generated in the data transfer of the DMAC is set in target address register <b>23</b> and target data register <b>24</b>. Then, by setting switch <b>31</b> as shown in FIG. 2 with the value of register <b>32</b>, the trace can be performed in the full trace mode when the prescribed data of the prescribed address is accessed by the DMAC to prevent loss of the trace information. The trace is performed in the real-time trace mode in other periods, and loss of the trace information is allowed.
[0046] As described above, according to the trace device in the second embodiment of the present invention, the trace mode is switched when the address value output to address bus <b>41</b> matches the target address set in target address register <b>23</b> and the data output to data bus <b>42</b> matches the data set in target data register <b>24</b>. As a result, the trace is performed in different modes at a portion where the trace information must be analyzed in detail and at the other portions, and the debugging of a portion such as a certain portion where the DMA transfer occurs can easily be performed.
[0047] (Third embodiment)
[0048]FIG. 3 is a block diagram showing a schematic structure of a semiconductor device having a trace device in a third embodiment of the present invention. The semiconductor device includes CPU <b>1</b>, a trace unit <b>3</b><i>c</i>, and an interrupt control unit (referred to as an ICU hereinafter) <b>5</b>. Herein, portions having the same structure and function as the semiconductor devices in the first and second embodiments shown in FIGS. 1 and 2 are indicated by the same reference characters.
[0049] When the prescribed cause of interrupt is generated, ICU <b>5</b> outputs an interrupt request to CPU <b>1</b>, and also outputs an event A output signal of the H level to notify trace unit <b>3</b><i>c </i>of the generation of the event A. In addition, to return from the interrupt routine corresponding to the event A to the state before receiving the interrupt, CPU <b>1</b> outputs a return-from-interrupt signal of the H level, and notifies trace unit <b>3</b><i>c </i>of the end of interrupt routine (the event B).
[0050] Trace unit <b>3</b><i>c </i>includes a counter <b>33</b>, AND gate <b>36</b>, RS-FF <b>37</b>, and trace buffer <b>39</b>. Herein, the count value of counter <b>33</b> is changed by CPU <b>1</b>.
[0051] Counter <b>33</b> counts the number of the event A output from ICU <b>5</b>, and outputs the H level when the overflow occurs. At this time, RS-FF <b>37</b> is set to output the full trace mode signal of the H level. As a result, when trace buffer <b>39</b> enters the buffer-full state (the buffer-full signal is set to the H level), AND gate <b>36</b> outputs a CPU stall signal of the H level and stalls CPU <b>1</b>. That is, the trace is performed in the full trace mode.
[0052] When the processing of the interrupt routine corresponding to the event A is to be ended, CPU <b>1</b> outputs the return-from-interrupt signal of the H level and resets RS-FF <b>37</b>. As a result, RS-FF <b>37</b> outputs the L level, and CPU <b>1</b> operates in the real-time trace mode.
[0053] Assume that a bug is found in the second interrupt processing, for example. As the trace information of the normal processing other than the interrupt processing as well as that of the first interrupt processing may be lost, the trace can be operated while not stalling CPU <b>1</b> for such processing. By changing the trace mode to the full trace mode for the second interrupt processing, loss of the trace information thereof can be prevented. In addition, as the operation of CPU <b>1</b> just before the generation of the second interrupt processing can be analyzed to a certain degree, a bug of the software before and after the interrupt processing can be found.
[0054] As described above, according to the trace device in the third embodiment of the present invention, the trace mode is changed to the full trace mode by counting the number of the event corresponding to the prescribed cause of interrupt output from ICU <b>5</b>. As a result, the bug of the software in the interrupt processing can be found when the interrupt corresponding to the event is generated for a prescribed number of times.
[0055] (Fourth embodiment)
[0056]FIG. 4 is a block diagram showing a schematic structure of a semiconductor device having a trace device in a fourth embodiment of the present invention. The semiconductor device includes CPU <b>1</b>, an event unit <b>2</b><i>d </i>and a trace unit <b>3</b><i>d</i>. Herein, portions having the same structure and function as the semiconductor devices in the first to third embodiments shown in FIGS. <b>1</b>-<b>3</b> are indicated by the same reference characters.
[0057] Event unit <b>2</b><i>d </i>includes a timer <b>26</b>. The count number of timer <b>26</b> is set by CPU <b>1</b>. When the set value is attained, timer <b>26</b> outputs an event output signal of the H level, and clears the count value of timer <b>26</b> itself.
[0058] Trace unit <b>3</b><i>d </i>includes a register <b>34</b>, AND gates <b>36</b><i>a</i>-<b>36</b><i>c</i>, RS-FF <b>37</b>, and trace buffer <b>39</b>. Herein, the output signal of register <b>34</b> is output to the outside of the chip via a PAD <b>45</b>.
[0059] Register <b>34</b> holds a value of the output signal of RS-FF <b>37</b>, that is, a value indicating whether the trace device is operating in the full trace mode or the real-time trace mode at present. When timer <b>26</b> attains the set value and the event is generated while register <b>34</b> is holding the L level (the real-time trace mode), for example, the output signal of AND gate <b>36</b><i>b </i>is set to the H level and RS-FF <b>37</b> is set to output the full trace mode signal of the H level. As a result, the trace mode is changed to the full trace mode, and the output signal of register <b>34</b> is set to the H level to notify the outside of the trace device operating in the full trace mode via PAD <b>45</b>.
[0060] Thereafter, when timer <b>26</b> again attains the set value and outputs the event output signal of the H level, the output signal of AND gate <b>36</b><i>a </i>is set to the H level, and RS-FF <b>37</b> is reset to output the full trace mode signal of the L level. As a result, the trace mode is changed to the real-time trace mode, and the output signal of register <b>34</b> is set to the L level to notify the outside of the trace device operating in the real-time trace mode via PAD <b>45</b>.
[0061] If there is such a bug that causes CPU <b>1</b> to hang up when a program is operated longer than a certain time period, by setting that time period to timer <b>26</b>, the trace can be performed in the real-time trace mode till the certain time period has passed, and then in the full trace mode after the certain time period has passed to prevent loss of the trace information. Therefore, the operation of CPU <b>1</b> can be analyzed in detail from just before the hang-up of CPU <b>1</b>.
[0062] As described above, according to the trace device in the fourth embodiment of the present invention, the trace mode is changed when a certain time period set in timer <b>26</b> has passed. As a result, when CPU <b>1</b> operates incorrectly after operating a program for longer than a certain time period, for example, the operation of CPU <b>1</b> can be analyzed in detail from just before the operation error occurs, so that the debugging can easily be performed.
[0063] (Fifth embodiment)
[0064]FIG. 5 is a block diagram showing a schematic structure of a semiconductor device having a trace device in a fifth embodiment of the present invention. The semiconductor device includes CPU <b>1</b>, an event unit <b>2</b><i>e </i>and a trace unit <b>3</b><i>e</i>. Herein, portions having the same structure and function as the semiconductor devices in the first to fourth embodiments shown in FIGS. <b>1</b>-<b>4</b> are indicated by the same reference characters.
[0065] Event unit <b>2</b><i>e </i>includes target address registers <b>21</b><i>a </i>and <b>21</b><i>b </i>wherein target addresses are set, a comparator <b>22</b><i>a </i>to compare a value of PC <b>11</b> of CPU <b>1</b> with the target address held in target address register <b>21</b><i>a</i>, and a comparator <b>22</b><i>b </i>to compare the value of PC <b>11</b> of CPU <b>1</b> with the target address held in target address register <b>21</b><i>b</i>. Target address registers <b>21</b><i>a </i>and <b>21</b><i>b </i>are accessible by CPU <b>1</b>.
[0066] Comparator <b>22</b><i>a </i>compares the PC value of CPU <b>1</b> with the target address set in target address register <b>21</b><i>a</i>, and outputs the L level when they mismatch, and outputs the H level when they match to notify trace unit <b>3</b><i>e </i>of a generation of the event A. Similarly, comparator <b>22</b><i>b </i>compares the PC value of CPU <b>1</b> with the target address set in target address register <b>21</b><i>b</i>, and outputs the L level when they mismatch, and outputs the H level when they match to notify trace unit <b>3</b><i>e </i>of a generation of the event B.
[0067] Trace unit <b>3</b><i>e </i>includes AND gates <b>36</b><i>a </i>and <b>36</b><i>b</i>, RS-FFs <b>37</b> and <b>38</b>, and trace buffer <b>39</b>. In the initial state, it is assumed that each of RS-FFs <b>37</b> and <b>38</b> outputs the output signal of the L level, and the trace device is operating in the real time trace mode.
[0068] When the event A is generated, RS-FF <b>38</b> is set to output the output signal of the H level. Thereafter, when the event B is generated, AND gate <b>36</b><i>a </i>outputs the output signal of the H level, and RS-FF <b>37</b> is set to output the full trace mode signal of the H level while RS-FF <b>38</b> is reset. As a result, when trace buffer <b>39</b> enters the buffer-full state (the buffer-full signal is set to the H level), AND gate <b>36</b><i>b </i>outputs the CPU stall signal of the H level and stalls CPU <b>1</b>. That is, the trace is performed in the full trace mode. The buffer-full signal is set to the L level when there is any available space in trace buffer <b>39</b>, and then the execution of instructions by CPU <b>1</b> is resumed.
[0069] Assume that CPU <b>1</b> operates incorrectly only when the subroutine B is executed after the subroutine A, and that the operation error does not occur when the subroutine B is executed before the subroutine A, for example. In such a case, with setting the starting address of the subroutine A in target address register <b>21</b><i>a </i>and the starting address of the subroutine B in target address register <b>21</b><i>b</i>, normal operation of CPU <b>1</b> is allowed as long as possible before the occurrence of the operation error of CPU <b>1</b>, and by changing the trace mode to the full trace mode at the probable portion for a bug of the software, the operation of CPU <b>1</b> before and after the occurrence of the operation error can be analyzed in detail.
[0070] As described above, according to the trace device in the fifth embodiment of the present invention, the trace mode is switched only when the PC value of CPU <b>1</b> matches the target address set in target address register <b>21</b><i>b </i>after the PC value of CPU <b>1</b> matches the target address set in target address register <b>21</b><i>a</i>. As a result, software such as the one with which CPU <b>1</b> operates incorrectly only when two subroutines are processed in a certain order, can easily be debugged.
[0071] (Sixth embodiment)
[0072]FIG. 6 is a block diagram showing a schematic structure of a semiconductor device having a trace device in a sixth embodiment of the present invention. The semiconductor device includes CPU <b>1</b>, an event unit <b>2</b><i>f </i>and a trace unit <b>3</b><i>f</i>. Herein, portions having the same structure and function as the semiconductor devices in the first to fifth embodiments shown in FIGS. <b>1</b>-<b>5</b> are indicated by the same reference characters.
[0073] When an operand access instruction is executed (on an instruction execution stage in a pipeline processing), CPU <b>1</b> outputs an OAEND signal of the H level. In addition, when the branch instruction is executed (on an instruction execution stage in a pipeline processing), CPU <b>1</b> outputs a JMP signal of the H level.
[0074] Event unit <b>2</b><i>f </i>includes target address registers <b>21</b><i>a</i>-<b>21</b><i>c </i>wherein target addresses are set, comparator <b>22</b><i>a </i>to compare a value of PC <b>11</b> of CPU <b>1</b> with the target address held in target address register <b>21</b><i>a</i>, comparator <b>22</b><i>b </i>to compare the value of PC <b>11</b> of CPU <b>1</b> with the target address held in target address register <b>21</b><i>b</i>, and a comparator <b>22</b><i>c </i>to compare the value of PC <b>11</b> of CPU <b>1</b> with the target address held in target address register <b>21</b><i>c</i>. Target address registers <b>21</b><i>a</i>-<b>21</b><i>c </i>are accessible by CPU <b>1</b>.
[0075] Comparator <b>22</b><i>a </i>compares the PC value of CPU <b>1</b> with the target address set in target address register <b>21</b><i>a</i>, and outputs the L level when they mismatch, and outputs the H level when they match to notify trace unit <b>3</b><i>f </i>of a generation of the event A. Similarly, comparator <b>22</b><i>b </i>compares the PC value of CPU <b>1</b> with the target address set in target address register <b>21</b><i>b</i>, and outputs the L level when they mismatch, and outputs the H level when they match to notify trace unit <b>3</b><i>f </i>of a generation of the event B. Similarly, comparator <b>22</b><i>c </i>compares the PC value of CPU <b>1</b> with the target address set in target address register <b>21</b><i>c</i>, and outputs the L level when they mismatch, and outputs the H level when they match to notify trace unit <b>3</b><i>f </i>of a generation of an event C.
[0076] Trace unit <b>3</b><i>f </i>includes OR gates <b>35</b><i>a</i>-<b>35</b><i>c</i>, AND gates <b>36</b><i>a</i>-<b>36</b><i>d</i>, RS-FFs <b>37</b><i>a</i>, <b>37</b><i>b </i>and <b>38</b>, and a trace buffer <b>39</b>′. It is assumed that, in the initial state, RS-FF <b>37</b><i>a </i>outputs the output signal of the H level while RS-FFs <b>37</b><i>b </i>and <b>38</b> output the output signals of the L level, and a branch trace enable signal is set to the H level (enabled) while a data trace enable signal is set to the L level (disabled).
[0077] When AND gate <b>36</b><i>d </i>outputs a branch trace start signal of the H level, trace buffer <b>39</b>′ receives the branch address output to address bus <b>41</b>, generates a packet including the branch address and outputs the same from the trace output terminal. In addition, when AND gate <b>36</b><i>c </i>outputs a data trace start signal of the H level, trace buffer <b>39</b>′ receives the operand access data output to data bus <b>42</b>, generates a packet including the operand access data and outputs the same from the trace output terminal.
[0078] In the initial state, as RS-FF <b>37</b><i>a </i>outputs the output signal of the H level, a packet including the branch trace information is output from trace buffer <b>39</b>′ whenever CPU <b>1</b> executes the branch instruction and the JMP signal of the H level is output. On the other hand, as RS-FF <b>37</b><i>b </i>outputs the output signal of the L level in the initial state, the packet including the data trace information is not generated by trace buffer <b>39</b>′ even when CPU <b>1</b> executes the operand access instruction and the OAEND signal of the H level is output.
[0079] As the output signal of RS-FF <b>38</b> is at the L level even if the event B or event C is generated in such condition, the output signals of AND gates <b>36</b><i>a </i>and <b>36</b><i>b </i>remain at the L level, and the output signals of RS-FFs <b>37</b><i>a </i>and <b>37</b><i>b </i>are unchanged.
[0080] When the PC value of CPU <b>1</b> matches the target address held in target address register <b>21</b><i>a </i>and the event A is generated, RS-FF <b>38</b> is set and the output signal of the H level is output. At the same time, since the output signals of OR gates <b>35</b><i>b </i>and <b>35</b><i>c </i>are set to the H level, the output signals of RS-FFs <b>37</b><i>a </i>and <b>37</b><i>b </i>are set to the H level. As a result, both of the branch trace enable signal and the data trace enable signal are set to the H level, and the packet including the branch trace information or the data trace information is output from trace buffer <b>39</b>′ whenever CPU <b>1</b> executes the branch instruction or the operand access instruction. That is, the trace mode is changed to the mixed trace mode.
[0081] Thereafter, when the PC value of CPU <b>1</b> matches the target address held in target address register <b>21</b><i>c </i>and the event C is generated, the output signal of RS-FF <b>37</b><i>b </i>remains at the H level, while RS-FF <b>37</b><i>a </i>is reset and the output signal thereof is reset to the L level. As a result, the data trace enable signal is set to the H level, and the packet including the data trace information is output from trace buffer <b>39</b>′ whenever CPU <b>1</b> executes the operand access instruction and the OAEND signal of the H level is output. On the other hand, as the branch trace enable signal is reset to the L level, the packet including the branch trace information is not generated by trace buffer <b>39</b>′ even when CPU <b>1</b> executes the branch instruction and the JMP signal of the H level is output. That is, the trace mode is changed to the data trace mode.
[0082] As described above, according to the trace device in the sixth embodiment of the present invention, the trace mode is changed to one of the branch trace mode, data trace mode and mixed trace mode when the PC value of CPU <b>1</b> matches one of the target addresses set in target address registers <b>21</b><i>a</i>-<b>21</b><i>c</i>. As a result, the kind of trace information necessary for debugging the program can be changed for every subroutine, and the time for stalling CPU <b>1</b> can be minimized, therefore the debugging can be performed in a condition similar to that of the normal operation of CPU <b>1</b>.
[0083] (Seventh embodiment)
[0084]FIG. 7 is a block diagram showing a schematic structure of a semiconductor device having a trace device in a seventh embodiment of the present invention. The semiconductor device includes CPU <b>1</b>, an event unit <b>2</b><i>g </i>and a trace unit <b>3</b><i>g</i>. Herein, portions having the same structure and function as the semiconductor devices in the first to sixth embodiments shown in FIGS. <b>1</b>-<b>6</b> are indicated by the same reference characters.
[0085] Event unit <b>2</b><i>g </i>includes target address register <b>23</b> wherein a target address is set, and target data register <b>24</b> wherein target data are set, comparator <b>22</b><i>a </i>to compare the address value output to address bus <b>41</b> with the target address held in target address register <b>23</b>, comparator <b>22</b><i>b </i>to compare the data output to data bus <b>42</b> with the target data held in target data register <b>24</b>, and AND gate <b>25</b>. Herein, target address register <b>23</b> and target data register <b>24</b> are accessible by CPU <b>1</b>.
[0086] Comparator <b>22</b><i>a </i>compares the address value output to address bus <b>41</b> with the target address set in target address register <b>23</b>, and outputs the L level when they mismatch, and outputs the H level when they match. Comparator <b>22</b><i>b </i>compares the data output to data bus <b>42</b> with the target data set in target data register <b>24</b>, and outputs the L level when they mismatch, and outputs the H level when they match.
[0087] When the output signals of both comparators <b>22</b><i>a </i>and <b>22</b><i>b </i>are at the H level, AND gate <b>25</b> outputs the H level to notify trace unit <b>3</b><i>g </i>of the generation of the event.
[0088] Trace unit <b>3</b><i>g </i>includes switch <b>31</b>, register <b>32</b> wherein a value for switching switch <b>31</b> is set, OR gates <b>35</b><i>a </i>and <b>35</b><i>b</i>, AND gates <b>36</b><i>a </i>and <b>36</b><i>b</i>, RS-FFs <b>37</b><i>a </i>and <b>37</b><i>b</i>, and trace buffer <b>39</b>′. Herein, register <b>32</b> is accessible by CPU <b>1</b>.
[0089] A value of 2 bits is set in register <b>32</b>, indicating if the trace device will operate in the branch trace mode, data trace mode or mixed trace mode when the event is generated. If the event is generated when switch <b>31</b> is connected as shown in FIG. 7 with the value set in register <b>32</b>, for example, RS-FF <b>37</b><i>a </i>is set and RS-FF <b>37</b><i>b </i>is reset, and the branch trace enable signal of the H level is output, while the data trace enable signal of the L level is output.
[0090] As a result, the packet including the branch trace information is output from trace buffer <b>39</b>′ whenever CPU <b>1</b> executes the branch instruction and the JMP signal of the H level is output. In addition, the packet including the data trace information is not generated by trace buffer <b>39</b>′ even if CPU <b>1</b> executes the operand access instruction and the OAEND signal of the H level is output, because the output signal of AND gate <b>36</b><i>a </i>remains at the L level. That is, the trace device operates in the branch trace mode.
[0091] When switch <b>31</b> is connected to the left terminal with the value set in register <b>32</b>, the trace mode is changed to the data trace mode by the generation of the event. When switch <b>31</b> is connected to the right terminal with the value set in register <b>32</b>, the trace mode is changed to the mixed trace mode by the generation of the event.
[0092] Assume that CPU <b>1</b> is known to hang up after writing a certain data into a certain address, for example. In such a case, with setting the certain address and data in target address register <b>23</b> and target data register <b>24</b>, it is possible to analyze, for example, the address to which CPU <b>1</b> was branching, or the operand which is accessed by CPU <b>1</b> just before the hang-up, whereby the debugging of the software can easily be performed.
[0093] It is to be noted that, the output signal of AND gate <b>36</b><i>a </i>may be used as the event output signal, and the branch trace enable signal or the data trace enable signal may be switched if the event B is generated after the event A, as the trace device in the fifth embodiment shown in FIG. 5.
[0094] As described above, according to the trace device in the seventh embodiment of the present invention, the trace mode is switched when the address value output to address bus <b>41</b> matches the target address set in target address register <b>23</b> and the data output to data bus <b>42</b> matches the data set in target data register <b>24</b>. As a result, the kind of trace information output from trace buffer <b>39</b>′ can be changed corresponding to the condition of the bug, and the debugging of the software can easily be performed.
[0095] (Eighth embodiment)
[0096]FIG. 8 is a block diagram showing a schematic structure of a semiconductor device having a trace device in an eighth embodiment of the present invention. The semiconductor device includes CPU <b>1</b>, a trace unit <b>3</b><i>h </i>and ICU <b>5</b>. Herein, portions having the same structure and function as the semiconductor devices in the first to seventh embodiments shown in FIGS. <b>1</b>-<b>7</b> are indicated by the same reference characters.
[0097] Trace unit <b>3</b><i>h </i>includes AND gate <b>36</b>, RS-FF <b>37</b> and trace buffer <b>39</b>′. It is assumed that the output signal of RS-FF <b>37</b> of the H level is output in the initial state.
[0098] In the initial state, if CPU <b>1</b> executes the branch instruction and outputs the JMP signal of the H level, AND gate <b>36</b> outputs the branch trace start signal of the H level, because the branch trace enable signal of the H level is output. As a result, the packet including the branch trace information is output from trace buffer <b>39</b>′. In addition, when CPU <b>1</b> executes the operand access instruction and the OAEND signal is set to the H level, the packet including the data trace information is output from trace buffer <b>39</b>′ regardless of the output signal of RS-FF <b>37</b>. That is, the trace device operates in the mixed trace mode.
[0099] In addition, when ICU <b>5</b> outputs the event A output signal of the H level, the output signal of RS-FF<b>3</b> of the L level is output. As a result, the packet including the branch trace information is not generated by trace buffer <b>39</b>′, because the branch trace start signal remains at the L level even when CPU <b>1</b> executes the branch instruction and the JMP signal of the H level is output. That is, the trace device is operated in the data trace mode.
[0100] Furthermore, when the processing of the interrupt routine corresponding to the event A is ended, CPU <b>1</b> outputs the return-from-interrupt signal (an event B output signal) of the H level and sets RS-FF <b>37</b>. As a result, RS-FF <b>37</b> outputs the H level, and CPU <b>1</b> operates in the mixed trace mode.
[0101] Though the branch trace information is needed in the normal processing other than the interrupt processing because the flow of the processing of the program must be analyzed, as most of the operations in the interrupt processing routine are relatively simple, sometimes only the access state of the memory is to be analyzed. In such a situation, only the needed data trace information can be obtained with minimized stall of CPU <b>1</b>.
[0102] It is to be noted that, the output signal of counter <b>33</b> may be used as the event A output signal, and the branch trace enable signal may be switched if the interrupt request from ICU <b>5</b> is made for a prescribed number of times, as the trace device in the third embodiment shown in FIG. 3.
[0103] As described above, according to the trace device in the eighth embodiment of the present invention, the mixed trace mode is changed to the data trace mode when the event corresponding to the prescribed cause of interrupt is generated. As a result, the operand access in the interrupt processing can be analyzed in detail, and the bug of the software can easily be found.
[0104] (Ninth embodiment)
[0105]FIG. 9 is a block diagram showing a schematic structure of a semiconductor device having a trace device in a ninth embodiment of the present invention. The semiconductor device includes CPU <b>1</b>, an event unit <b>2</b><i>i </i>and a trace unit <b>3</b><i>i</i>. Herein, portions having the same structure and function as the semiconductor devices in the first to eighth embodiments shown in FIGS. <b>1</b>-<b>8</b> are indicated by the same reference characters.
[0106] Event unit <b>2</b><i>i </i>includes target address registers <b>21</b><i>a</i>-<b>21</b><i>c </i>wherein target addresses are set, comparator <b>22</b><i>a </i>to compare a value of PC <b>11</b> of CPU <b>1</b> with the target address held in target address register <b>21</b><i>a</i>, comparator <b>22</b><i>b </i>to compare the value of PC <b>11</b> of CPU <b>1</b> with the target address held in target address register <b>21</b><i>b</i>, and comparator <b>22</b><i>c </i>to compare the value of PC <b>11</b> of CPU <b>1</b> with the target address held in target address register <b>21</b><i>c</i>. Target address registers <b>21</b><i>a</i>-<b>21</b><i>c </i>are accessible by CPU <b>1</b>.
[0107] Comparator <b>22</b><i>a </i>compares the PC value of CPU <b>1</b> with the target address set in target address register <b>21</b><i>a</i>, and outputs the L level when they mismatch, and outputs the H level when they match to notify trace unit <b>3</b><i>i </i>of the generation of the event A. Similarly, comparator <b>22</b><i>b </i>compares the PC value of CPU <b>1</b> with the target address set in target address register <b>21</b><i>b</i>, and outputs the L level when they mismatch, and outputs the H level when they match to notify trace unit <b>3</b><i>i </i>of the generation of the event B. Similarly, comparator <b>22</b><i>c </i>compares the PC value of CPU <b>1</b> with the target address set in target address register <b>21</b><i>c</i>, and outputs the L level when they mismatch, and outputs the H level when they match to notify trace unit <b>3</b><i>i </i>of the generation of the event C.
[0108] Trace unit <b>3</b><i>i </i>includes AND gate <b>36</b>, RS-FFs <b>37</b> and <b>38</b>, trace buffer <b>39</b>, address buffers <b>301</b> and <b>302</b> to hold addresses of 32 bits, a selector <b>303</b>, a subtracter <b>304</b>, a buffer <b>305</b> to convert an address having width of 32 bits to an address having width of 8 bits, and a trace output controller <b>306</b>. It is assumed that, in the initial state, RS-FF <b>37</b> outputs the output signal of the H level, RS-FF <b>38</b> outputs the output signal of the L level, and an address information output signal is set to the H level.
[0109] Address buffer <b>301</b> holds the address of 32 bits that is being output to address bus <b>41</b> at present. Address buffer <b>302</b> holds the address of 32 bits that is being output to the address bus last time. Subtracter <b>304</b> subtracts the last address held in address buffer <b>302</b> from the present address held in address buffer <b>301</b>, and outputs the result as a difference address of 8 bits to selector <b>303</b>.
[0110] Buffer <b>305</b> for converting the bus width converts the present address of <b>32</b> bits held in address buffer <b>301</b> to four addresses of <b>8</b> bits, and successively outputs the result to selector <b>303</b>.
[0111] If the address information output signal output from RS-FF <b>37</b> is at the H level, selector <b>303</b> selects and outputs the output signal of buffer <b>305</b>. In addition, if the address information output signal output from RS-FF <b>37</b> is at the L level, selector <b>303</b> selects and outputs the output signal of subtracter <b>304</b>.
[0112] Trace output controller <b>306</b> refers to the address information output signal output from RS-FF <b>37</b>, decides whether the address output from selector <b>303</b> is the address with converted bus width or the subtracted address, and controls the packet output from trace buffer <b>39</b>. If the address information output signal is at the H level, trace output controller <b>306</b> controls trace buffer <b>39</b> so as to generate the packet including four addresses of 8 bits. In such a situation, the trace information of <b>6</b> packets is generated and output, as described above.
[0113] If the address information output signal is at the L level, trace output controller <b>306</b> controls trace buffer <b>39</b> so as to generate the packet including the difference address of 8 bits. In such a situation, as the trace information of 3 packets is generated and output, the trace information can be reduced by <b>3</b> bytes.
[0114] Selector <b>303</b> can be made such that, when the address information signal is at the L level, it outputs only the lower 8 bits of the present address of 32 bits held in address buffer <b>301</b>, rather than selecting the difference address output from subtracter <b>304</b>.
[0115] As RS-FF <b>37</b> outputs the address information output signal of the H level in the initial state, selector <b>303</b> selects and outputs the address output from buffer <b>305</b> with converted bus width. As a result, the trace information including the address information of 32 bits is output from trace buffer <b>39</b>.
[0116] When the PC value of CPU <b>1</b> matches the target address held in target address register <b>21</b><i>a </i>and the event A is generated, RS-FF <b>38</b> is set and the output signal of the H level is output. In this state, as the output signal of RS-FF <b>37</b> does not change, four addresses of 8 bits with converted bus widths are output to trace buffer <b>39</b>.
[0117] Then, when the PC value of CPU <b>1</b> matches the target address held in target address register <b>21</b><i>b </i>and the event B is generated, RS-FF <b>37</b> is reset and the address information output signal is changed to the L level, whereby the difference address of 8 bits is output to trace buffer <b>39</b>. In this state, as RS-FF <b>38</b> is reset and its output signal of the H level is output, RS-FF <b>37</b> will not be reset even if the event B is generated again.
[0118] Then, when the PC value of CPU <b>1</b> matches the target address held in target address register <b>21</b><i>c </i>and the event C is generated, RS-FF <b>37</b> is set and the address information output signal is set to the H level again, whereby four addresses of 8 bits with converted bus width are output to trace buffer <b>39</b>.
[0119] As described above, according to the trace device in the ninth embodiment of the present invention, the trace information is generated by switching the address with converted bus width and the difference address when the PC value of CPU <b>1</b> matches any of the target addresses set in target address registers <b>21</b><i>a</i>-<b>21</b><i>c</i>. As a result, the amount of the trace information is reduced even when the software is to be analyzed in detail, and the overflow of trace buffer <b>39</b> can be reduced. Therefore, the debugging of the software can be performed in a condition similar to that of the normal operation of CPU <b>1</b> even when the trace device is operating in the full trace mode.
[0120] In addition, the amount of trace information can be reduced at the debugging within the region where the upper 24 bits of the software are the same, if selector <b>303</b> is made to output only the lower 8 bits of the present address of 32 bits held in address buffer <b>301</b> when the address information output signal is at the L level.
[0121] When it is known that the upper 24 bits of the addresses generated in a certain subroutine are the same all the time, for example, the starting address of the subroutine is set in target address register <b>21</b><i>b</i>, and the last address of the subroutine is set in target address register <b>21</b><i>c </i>when the debugging of the subroutine is performed. Thus, the trace information can be generated with addresses of 8 bits when CPU <b>1</b> is executing the processing of the subroutine. Therefore, the debugging of the software can be performed in a condition similar to that of the normal operation of CPU <b>1</b>, even when the trace device is operating in the full trace mode.
[0122] (Tenth embodiment)
[0123]FIG. 10 is a block diagram showing a schematic structure of a semiconductor device having a trace device in a tenth embodiment of the present invention. The semiconductor device includes CPU <b>1</b>, an event unit <b>2</b><i>j </i>and a trace unit <b>3</b><i>j</i>. Herein, portions having the same structure and function as the semiconductor devices in the first to ninth embodiments shown in FIGS. <b>1</b>-<b>9</b> are indicated by the same reference characters.
[0124] Event unit <b>2</b><i>j </i>includes target address register <b>23</b> wherein a target address is set, target data register <b>24</b> wherein target data are set, comparator <b>22</b><i>a </i>to compare the address value output to address bus <b>41</b> with the target address held in target address register <b>23</b>, comparator <b>22</b><i>b </i>to compare the data output to data bus <b>42</b> with the target data held in target data register <b>24</b>, and AND gate <b>25</b>. Herein, target address register <b>23</b> and target data register <b>24</b> are accessible by CPU <b>1</b>.
[0125] Comparator <b>22</b><i>a </i>compares the address value output to address bus <b>41</b> with the target address set in target address register <b>23</b>, and outputs the L level when they mismatch, and outputs the H level when they match. Comparator <b>22</b><i>b </i>compares the data value output to data bus <b>42</b> with the target data set in target data register <b>24</b>, and outputs the L level when they mismatch, and outputs the H level when they match.
[0126] When the output signals of both comparators <b>22</b><i>a </i>and <b>22</b><i>b </i>are at the H level, AND gate <b>25</b> outputs the H level to notify trace unit <b>3</b><i>j </i>of the generation of the event.
[0127] Trace unit <b>3</b><i>j </i>includes switch <b>31</b>, register <b>32</b> wherein a value for switching switch <b>31</b> is set, RS-FF <b>37</b>, trace buffer <b>39</b>, address buffers <b>301</b> and <b>302</b> to hold addresses of 32 bits, selector <b>303</b>, subtracter <b>304</b>, buffer <b>305</b> to convert an address having width of 32 bits to an address having width of 8 bits, and trace output controller <b>306</b>. It is assumed that RS-FF <b>37</b> outputs the output signal of the L level in the initial state.
[0128] When the address information output signal is at the L level, trace output controller <b>306</b> controls trace buffer <b>39</b> to generate the packet including four addresses of 8 bits. In such a situation, the trace information of 6 packets is generated and output as described above.
[0129] When the address information output signal is at the H level, trace output controller <b>306</b> controls trace buffer <b>39</b> to generate the packet including the difference address of 8 bits. In such a situation, the trace information can be reduced by 3 bytes because the trace information of <b>3</b> packets is generated and output. It is to be noted that, selector <b>303</b> may output only the lower 8 bits of the present address of 32 bits held in address buffer <b>301</b> rather than selecting the difference address output from subtracter <b>304</b>, when the address information output signal is at the H level.
[0130] In the initial state, as RS-FF <b>37</b> outputs the address information output signal of the L level, selector <b>303</b> selects and outputs the address output from buffer <b>305</b> with converted bus width. As a result, the trace information including the address information of 32 bits is output from trace buffer <b>39</b>.
[0131] When the address value output to address bus <b>41</b> matches the target address held in target address register <b>23</b>, the data output to data bus <b>42</b> matches the target data held in target data register <b>24</b> and the event is generated, RS-FF <b>37</b> is set and the address information output signal of the H level is output. In this situation, the difference address of 8 bits is output to trace buffer <b>39</b>.
[0132] As described above, according to the trace device in the tenth embodiment of the present invention, the trace information is generated by switching the address with converted bus width and the difference address when the address value output to address bus <b>41</b> matches the target address set in target address register <b>23</b> and the data output to data bus <b>42</b> matches the target data set in target data register <b>24</b>. As a result, the amount of the trace information is reduced even when the software is to be analyzed in detail, and the overflow of trace buffer <b>39</b> can be reduced. Therefore, the debugging of the software can be performed in a condition similar to that of the normal operation of CPU <b>1</b> even when the trace device is operating in the full trace mode.
[0133] In addition, the amount of trace information can be reduced at the debugging within the region where the upper 24 bits of the software are the same, if selector <b>303</b> is made to output only the lower 8 bits of the present address of 32 bits held in address buffer <b>301</b> when the address information output signal is at the H level.
[0134] When CPU <b>1</b> accesses a certain data of a certain address, and when it is known that the upper 24 bits of the addresses of the operand accesses thereafter are the same, for example, the trace information can be generated by setting the certain address in target address register <b>23</b> and setting the certain data in target data register <b>24</b> to make the address of 8 bits at the operand access. Therefore, the debugging of the software can be performed in a condition similar to that of the normal operation of CPU <b>1</b> even when the trace device is operating in the full trace mode.
[0135] It is to be noted that, the output signal of counter <b>33</b> may be used as the event output signal and the address information output signal may be switched when the interrupt request from ICU <b>5</b> is made for a prescribed number of times, as the trace device in the third embodiment shown in FIG. 3. Alternatively, the output signal of AND gate <b>36</b><i>a </i>may be used as the event output signal and the address information output signal may be switched when the event B is generated after the event A, as the trace device in the fifth embodiment shown in FIG. 5. Furthermore, the interrupt request signal output from ICU <b>5</b> may be used as the event output signal, and the address information output signal may be switched when the interrupt request from ICU <b>5</b> is made, as the trace device in the eighth embodiment shown in FIG. 8.
[0136] Although the present invention has been described and illustrated in detail, it is clearly understood that the same is by way of illustration and example only and is not to be taken by way of limitation, the spirit and scope of the present invention being limited only by the terms of the appended claims.
Contents4
11 sheets
Sheet 1 Sheet 2 Sheet 3 Sheet 4 Sheet 5 Sheet 6 Sheet 7 Sheet 8 Sheet 9 Sheet 10 Sheet 11
Every citation, both ways
| Document | Relation | Office | Cited during |
|---|---|---|---|
| US7606999B2 | Cited by | United States of America | Search report |
| US2006150023A1 | Cited by | United States of America | Pre-grant |
| US2006255978A1 | Cited by | United States of America | Pre-grant |
| US7813288B2 | Cited by | United States of America | Applicant |
| US2005108689A1 | Cited by | United States of America | Pre-grant |
| US2005278706A1 | Cited by | United States of America | Pre-grant |
| US8561033B2 | Cited by | United States of America | Search report |
| US7278063B2 | Cited by | United States of America | Search report |
| WO2012021630A3 | Cited by | World Intellectual Property Organization (WIPO) | International search |
| US2010235686A1 | Cited by | United States of America | Pre-grant |
| US2007271448A1 | Cited by | United States of America | Pre-grant |
| US2006129999A1 | Cited by | United States of America | Pre-grant |
| US7496900B2 | Cited by | United States of America | Search report |
| US11016773B2 | Cited by | United States of America | Search report |
| US7523353B2 | Cited by | United States of America | Search report |
| US2008016409A1 | Cited by | United States of America | Pre-grant |
| US7788645B2 | Cited by | United States of America | Search report |
| US2005183075A1 | Cited by | United States of America | Pre-grant |
| US7493527B2 | Cited by | United States of America | Search report |
| US2007121489A1 | Cited by | United States of America | Pre-grant |
| US2005022068A1 | Cited by | United States of America | Pre-grant |
| US9507688B2 | Cited by | United States of America | Applicant |
| US8578216B2 | Cited by | United States of America | Search report |
| US7463653B2 | Cited by | United States of America | Search report |
| WO2012021630A2 | Cited by | World Intellectual Property Organization (WIPO) | International search |
| US2006267816A1 | Cited by | United States of America | Pre-grant |
| US7328429B2 | Cited by | United States of America | Search report |
| US7480833B2 | Cited by | United States of America | Applicant |
| US9495169B2 | Cited by | United States of America | Search report |
| US2004064685A1 | Cited by | United States of America | Pre-grant |
| US8266595B2 | Cited by | United States of America | Applicant |
| US8843898B2 | Cited by | United States of America | Applicant |
| US2004170169A1 | Cited by | United States of America | Pre-grant |
| US8196115B2 | Cited by | United States of America | Applicant |
| US2013283020A1 | Cited by | United States of America | Pre-grant |
| US2008270995A1 | Cited by | United States of America | Pre-grant |
| US2005183070A1 | Cited by | United States of America | Pre-grant |
| US2007168752A1 | Cited by | United States of America | Pre-grant |
| US2012030521A1 | Cited by | United States of America | Pre-grant |
| US2005183067A1 | Cited by | United States of America | Pre-grant |
| US7519961B2 | Cited by | United States of America | Applicant |
| US2003191624A1 | Cites | United States of America | Pre-grant |
| US5448717A | Cites | United States of America | Pre-grant |
| US5724505A | Cites | United States of America | Pre-grant |
| US5751735A | Cites | United States of America | Pre-grant |
| US5889981A | Cites | United States of America | Pre-grant |
| US6145123A | Cites | United States of America | Pre-grant |
| US6594782B1 | Cites | United States of America | Pre-grant |
| US6609247B1 | Cites | United States of America | Pre-grant |
| US6618775B1 | Cites | United States of America | Pre-grant |
2 members in 2 offices
Priority claims3
| Document | Office | Kind | Date |
|---|---|---|---|
| 2002102526 | Japan | A | |
| 2002102526(P) | – | – | – |
| JP20020102526 | – | – | – |
Members2
| Document | Office | Kind | |
|---|---|---|---|
| US2003192034A1 | United States of America | A1 | |
| JP2003296136A | Japan | A |
4 legal events, as the office reported them to INPADOC
Over the term
Point at a mark for the eventEvents
| Event | Code | |
|---|---|---|
| Information on status: application discontinuationABANDONED -- FAILURE TO RESPOND TO AN OFFICE ACTIONSTCB | STCB | |
| AssignmentAS | AS | |
| AssignmentAS | AS | |
| AssignmentAS | AS |
Numbers
- Publication, DOCDB
- 2003192034
- Publication, EPODOC
- US2003192034
- Application
- 10309171
- Application, DOCDB
- 30917102
- Application, EPODOC
- US20020309171
Titles
- English
- Trace device preventing loss of trace information which will be important in debugging
Classification
- CPC, 1
- G06F11/3636
- IPC, 3
- G06F11 28
- G06F9 44
- G06F11 36
- USPC, 2
- 717128000
- 714E11214