Semiconductor device and debugging system
A semiconductor device with a debug control unit and selector manages data bus access to enable debugging without CPU interruption, addressing the cost and operational disruption issues of conventional systems.
Patent Information
- Application Number
- JP2021513538
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2019-04-10
- Filing Date
- 2020-03-17
- Publication Date
- 2024-08-13
- Estimated Expiration
- 2040-03-17
AI Technical Summary
Conventional debugging systems for semiconductor devices require large-scale circuits like DMA controllers and bus arbitration circuits, which are costly and can disrupt program operations, especially in applications where CPU stoppage is undesirable, such as motor control devices.
A semiconductor device with a data bus, data memory, and a selector, controlled by a debug control unit, allows bidirectional communication without interrupting CPU operations by using a selector to manage access signals, enabling read and write operations without CPU stoppage.
The solution provides a small-scale debug system that can access data buses without affecting program operations, allowing debugging in devices where CPU stoppage is undesirable.
Smart Images

Figure 0007532344000001 
Figure 0007532344000002 
Figure 0007532344000003
Abstract
Description
[Technical field]
[0001] The present invention relates to a semiconductor device and a debugging system. [Background technology]
[0002] 2. Description of the Related Art In a semiconductor device having a CPU or the like for executing a program, a debug system for assisting in debugging the program is often used when developing the program to be executed.
[0003] In debugging, there is a demand for external access to the data memory in a semiconductor device while a program is running. To meet this demand, many debugging systems have a mechanism for accessing the data memory from outside the semiconductor device configured with an LSI or the like, using serial communication or the like, and performing the necessary reading and writing.
[0004] In such cases, the CPU may be temporarily stopped (break) to access the data memory. However, there are some devices where stopping the CPU after program execution has begun can be problematic. For example, in a motor control device, if the CPU stops, it becomes impossible to control the rotation of the motor, and the device may be destroyed. For this reason, in such devices, it may be required to access the data memory periodically without stopping the CPU as much as possible. [Prior art documents] [Patent documents]
[0005] [Patent Document 1] Patent No. 5400443 [Patent Document 2] JP 2004-86447 A Summary of the Invention [Problem to be solved by the invention]
[0006] Since the circuitry mounted on the semiconductor device for debugging purposes is not related to the actual operation of the semiconductor device, it is desirable to make the circuitry as small as possible. Also, it is desirable to perform access to the circuitry in a manner that does not interfere with the operation of the program as much as possible.
[0007] Incidentally, conventional debug systems as typified by Patent Documents 1 and 2 require large-scale circuits such as a DMA controller and a bus arbitration circuit, which is disadvantageous in terms of cost. In addition, conventional debug systems that require a program break may have limited application, such as being difficult to apply to motor control devices. When using a conventional debug system that requires a program break, the break may cause the program to behave differently from the original behavior, and if this has a significant effect on the system operation, debugging may not be performed correctly.
[0008] An object of the present invention is to provide a semiconductor device and a debugging system that can realize access to a data bus related to debugging with a small-scale configuration and without affecting program operations. [Means for solving the problem]
[0009] A semiconductor device according to the present invention is a semiconductor device comprising a data bus, a data memory connected to the data bus, a selector connected to the data bus, a processing unit that executes a program and is capable of accessing the data bus via the selector, and a debug control unit that is configured to enable two-way communication with an external device and is capable of accessing the data bus via the selector, wherein the selector takes one of a first selection state in which the first signal from the processing unit and a second signal from the debug control unit are transmitted to the data bus, and a second selection state in which the second signal is transmitted to the data bus, based on control by the debug control unit, and signals output from the processing unit to the selector include a read enable signal for causing the data memory to perform a read operation and a write enable signal for causing the data memory to perform a write operation, and the debug control unit controls the state of the selector based on the reception state of a predetermined command from the external device and the respective states of the read enable signal and the write enable signal from the processing unit, and accesses the data bus via the selector when the selector is in the second selection state (first configuration).
[0010] In the semiconductor device of the first configuration described above, the debug control unit may be configured (second configuration) such that, when accessing the data bus in response to receipt of the specified command, if the read enable signal or the write enable signal is in an asserted state, the debug control unit waits until both the read enable signal and the write enable signal are in a negated state, and then sets the selector to the second selection state to access the data bus in response to the specified command, and, when accessing the data bus in response to receipt of the specified command, if the read enable signal and the write enable signal are in a negated state, the debug control unit sets the selector to the second selection state without waiting, to access the data bus in response to the specified command (second configuration).
[0011] In the semiconductor device according to the second configuration, the debug control unit may have a circuit that generates a data bus access signal for instructing the debug control unit to enable access to the data bus, and the data bus access signal is switched from a negated state to an asserted state in response to receiving the specified command, and if the read enable signal or the write enable signal is in the asserted state when the data bus access signal is switched from the negated state to the asserted state, the debug control unit waits until both the read enable signal and the write enable signal are in the negated state, and then sets the selector to the second selection state to access the data bus in response to the specified command, and if both the read enable signal and the write enable signal are in the negated state when the data bus access signal is switched from the negated state to the asserted state, the debug control unit sets the selector to the second selection state without waiting, to access the data bus in response to the specified command (third configuration).
[0012] In the semiconductor device of the third configuration above, the debug control unit may be configured to set the selector to the first selection state when the data bus access signal is in a negated state, and in response to receiving the specified command, switch the data bus access signal from the negated state to an asserted state, and then set the selector to the second selection state to access the data bus in accordance with the specified command, and then return the data bus access signal from the asserted state to the negated state, thereby returning the selector to the first selection state (fourth configuration).
[0013] In a semiconductor device according to any of the first to fourth configurations above, the debug control unit may be configured to set the selector to the first selection state before the specified command is received, switch the selector from the first selection state to the second selection state after the specified command is received, and return the selector to the first selection state when access is made to the data bus in response to the specified command (fifth configuration).
[0014] In a semiconductor device of any of the above first to fifth configurations, when a read command is received as the specified command, the debug control unit may be configured (sixth configuration) to perform a read access to the data bus in response to the read command when the selector is in the second selection state, and then transmit the read data obtained from the data memory by the read access to the external device.
[0015] In the semiconductor device of the seventh configuration described above, the data memory may have a plurality of storage areas to which a plurality of addresses are assigned, and one of the plurality of addresses may be specified by the read command, and the debug control unit, in the read access responsive to the read command, may access the data bus via the selector to obtain data in the storage area of the address specified by the read command from the data memory as the read data, and may transmit the read data thus obtained to the external device (seventh configuration).
[0016] In a semiconductor device of any of the above first to fifth configurations, when a write command is received as the specified command, the debug control unit may perform a write access to the data bus in response to the write command when the selector is in the second selection state, and data in response to the write command is written to the data memory by the write access (eighth configuration).
[0017] In the semiconductor device of the eighth configuration described above, the data memory may have a plurality of storage areas to which a plurality of addresses are assigned, and the write command may specify one of the plurality of addresses and also specify write data, and the debug control unit, in the write access responsive to the write command, may access the data bus via the selector to write the write data into the storage area of the address specified in the write command (ninth configuration).
[0018] A debug system according to the present invention has a configuration (tenth configuration) including a semiconductor device according to any one of the first to ninth configurations above, and an external device connected to the semiconductor device and capable of sending the specified command to the debug control unit of the semiconductor device. Effect of the Invention
[0019] According to the present invention, it is possible to provide a semiconductor device and a debugging system that are capable of realizing access to a data bus related to debugging with a small-scale configuration and without affecting program operations. [Brief description of the drawings]
[0020] [Figure 1] 1 is a schematic configuration diagram of a debugging system according to a first embodiment of the present invention. [Diagram 2] FIG. 1 is a diagram showing a data memory provided in an LSI. [Diagram 3] 1A and 1B are explanatory diagrams of read access and read operation according to a first embodiment of the present invention. [Figure 4] 1A and 1B are explanatory diagrams of write access and write operation according to a first embodiment of the present invention. [Diagram 5] 1 is a diagram showing an internal configuration of a debug control unit and its peripheral configuration according to a first embodiment of the present invention. [Figure 6]1 is a diagram showing an example of a timing chart of an LSI responding to reception of a read command according to the first embodiment of the present invention. FIG. [Figure 7] FIG. 11 is a diagram showing another example of a timing chart of the LSI responding to reception of a read command according to the first embodiment of the present invention. [Figure 8] 1 is a diagram showing an example of a timing chart of an LSI responding to reception of a write command according to the first embodiment of the present invention. FIG. [Figure 9] 11 is a diagram showing another example of a timing chart of the LSI responding to reception of a write command according to the first embodiment of the present invention. FIG. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0021] Hereinafter, examples of the embodiments of the present invention will be specifically described with reference to the drawings. In each of the drawings, the same parts are given the same reference numerals, and duplicated descriptions of the same parts are omitted as a rule. In this specification, for the sake of simplicity, a symbol or a code referring to information, a signal, a physical quantity, an element, a part, etc. may be written, and the name of the information, signal, physical quantity, element, part, etc. corresponding to the symbol or code may be omitted or abbreviated. For example, the read enable signal referred to by "RE" described later (see FIG. 1) may be written as the read enable signal RE or may be abbreviated as the signal RE, but they all refer to the same thing.
[0022] <<First embodiment>> A first embodiment of the present invention will be described. Fig. 1 is a schematic configuration diagram of a debugging system 10 according to the first embodiment of the present invention. The debugging system 10 includes an LSI (Large Scale Integration) 11 with a built-in CPU (Central Processing Unit), an external debugging device 12, and a host computer 13 (hereinafter, may be referred to as a host PC 13).
[0023] The LSI 11 as a semiconductor device includes a CPU (Central Processing Unit) 20, a debug control unit 21, a data bus 22, and a selector 27, and also includes, as components connected to the data bus 22, one or more ROMs (Read only memories), one or more RAMs (Random access memories), and one or more peripherals which are one or more peripheral circuits. In Fig. 1, a ROM 23 is shown as one ROM included in the one or more ROMs, a RAM 24 is shown as one RAM included in the one or more RAMs, and a peripheral 25 is shown as one peripheral included in the one or more peripherals. In the following, attention will be paid to the ROM 23, the RAM 24, and the peripheral 25 as the ROM, the RAM, and the peripheral. The peripheral 25 includes a register 26.
[0024] Furthermore, the LSI 11 employs a Harvard architecture. That is, the LSI 11 is provided with a program bus 28 in addition to the data bus 22, and a program memory 29 configured with a flash memory or the like is connected to the program bus 28. The program memory 29 stores programs to be executed by the CPU 20. The CPU 20 accesses the program memory 29 via the data bus 28. In the following description, when a term "program" is simply referred to, it refers to a program stored in the program memory 29.
[0025] The program stored in program memory 29 consists of a bundle of instructions (instruction codes) to be executed by CPU 20. CPU 20 executes the program by sequentially reading out the necessary instructions from program memory 29 via data bus 28 in synchronization with the operating clock of CPU 20, and sequentially executing the sequentially read instructions after decoding, etc.
[0026] The external debug device 12 is connected to the debug control unit 21 via a terminal (not shown) provided on the LSI 11, and functions as an interface between the debug control unit 21 and the host PC 13. The external debug device 12 and the host PC 13 are connected to each other in a manner that allows two-way communication. The host PC 13 runs debug software 14. A user of the debug system 10 can debug a program executed by the CPU 20 by operating the host PC 13 on which the debug software 14 is running.
[0027] 2, for the sake of convenience, a storage circuit provided in the LSI 11, which includes the ROM 23, the RAM 24, and the register 26, will be referred to as a data memory 30. The data memory 30 includes a large number of storage areas capable of storing data of a predetermined size. A predetermined address space is defined for the data memory 30, and a unique address is assigned to each storage area constituting the data memory 30. The storage circuit constituting the data memory 30 may be any one or two of the ROM 23, the RAM 24, and the register 26.
[0028] The selector 27 has a first input section 27a, a second input section 27b and an output section 27c, with the first input section 27a being connected to the CPU 20, the second input section 27b being connected to the debug control section 21 and the output section 27c being connected to the data bus 22. This will be described in detail.
[0029] The CPU 20 and the debug control unit 21 can output a read enable signal, a write enable signal, an address signal, and write data, respectively, and the read enable signal, write enable signal, address signal, and write data output from the CPU 20 are particularly referred to as a read enable signal RE1, a write enable signal WE1, an address signal ADD1, and write data WD1, respectively, and the read enable signal, write enable signal, address signal, and write data output from the debug control unit 21 are particularly referred to as a read enable signal RE2, a write enable signal WE2, an address signal ADD2, and write data WD2, respectively. In other words, the write data can be said to be a signal indicating the write data, and hereinafter, for convenience of description, the write data WD1, WD2 may be written as signals WD1, WD2 (the same applies to the write data WD described later).
[0030] The first input unit 27a is connected to a wiring provided between the CPU 20 and the selector 27 for transmitting the signals RE1, WE1, ADD1, and WD1, and receives the input of the signals RE1, WE1, ADD1, and WD1 from the CPU 20. The second input unit 27b is connected to a wiring provided between the debug control unit 21 and the selector 27 for transmitting the signals RE2, WE2, ADD2, and WD2, and receives the input of the signals RE2, WE2, ADD2, and WD2 from the debug control unit 21.
[0031] A control signal CNT is also supplied from the debug control unit 21 to the selector 27, and the selector 27 selectively connects either the first input unit 27a or the second input unit 27b to the output unit 27c based on the control signal CNT. The control signal CNT is a 1-bit signal that takes a value of "1" or "0". When the value of the control signal CNT is "0", the state of the selector 27 is the CPU selected state, and when the value of the control signal CNT is "1", the state of the selector 27 is the debugger selected state. In the following, the state of the selector 27 in the CPU selected state may be simply expressed as the "CPU selected state", and similarly, the state of the selector 27 in the debugger selected state may be simply expressed as the "debugger selected state". Note that the "debugger" is a general term for parts used in debugging, and can be interpreted as including all or part of the debug control unit 21, the external debug device 12, and the host PC 13.
[0032] In the CPU selection state, the first input unit 27a is connected to the output unit 27c, and as a result, the wiring that propagates the signals RE1, WE1, ADD1, and WD1 is connected to the data bus 22 through the output unit 27c, and those signals RE1, WE1, ADD1, and WD1 are transmitted to the data bus 22. In the debugger selection state, the second input unit 27b is connected to the output unit 27c, and as a result, the wiring that propagates the signals RE2, WE2, ADD2, and WD2 is connected to the data bus 22 through the output unit 27c, and those signals RE2, WE2, ADD2, and WD2 are transmitted to the data bus 22.
[0033] When attention is paid to the state control of the selector 27, the control signal CNT may be called a selector control signal. When attention is paid to the switching function of the signal supplied to the data bus 22, the control signal CNT may be called a data bus control signal or a switching control signal.
[0034] The read enable signal, write enable signal, address signal, and write data output from the output unit 27c are specifically referred to as the read enable signal RE, the write enable signal WE, the address signal ADD, and the write data WD, respectively. Note that the write data (WD, WD1, WD2) is data that is output only when a write access, which will be described later, is executed.
[0035] In the CPU selection state, the first input section 27a is connected to the output section 27c, so that the read enable signal RE1, the write enable signal WE1, the address signal ADD1, and the write data WD1 from the CPU 20 are output from the output section 27c as the read enable signal RE, the write enable signal WE, the address signal ADD, and the write data WD to the data bus 22. In the debugger selection state, the second input section 27b is connected to the output section 27c, so that the read enable signal RE2, the write enable signal WE2, the address signal ADD2, and the write data WD2 from the debug control section 21 are output from the output section 27c to the data bus 22 as the read enable signal RE, the write enable signal WE, the address signal ADD, and the write data WD.
[0036] In this way, the CPU 20 can access the data bus 22 when the selector 27 is in the CPU selection state, and the debug control unit 21 can access the data bus 22 when the selector 27 is in the debugger selection state. Access to the data bus 22 includes read access and write access. A read access or write access to the data bus 22 is, in other words, a read access or write access to the data memory 30 through the data bus 22. Access to the RAM 24 and the register 26 can be either a read access or a write access, but access to the ROM 23 is limited to a read access.
[0037] When the data memory 30 (e.g., RAM 24) receives a read access from the CPU 20 or the debug control unit 21, it performs a read operation of outputting the necessary read data RD to the data bus 22, and when it receives a write access from the CPU 20 or the debug control unit 21, it performs a write operation of storing data corresponding to the write data WD sent via the data bus 22. In other words, the read data can be said to be a signal indicating the read data, and hereinafter, for convenience of description, the read data RD may be written as a signal RD.
[0038] The data bus 22 is made up of a plurality of wires for individually transmitting the signals RE, WE, ADD, RD, and WD (i.e., the signals RE, WE, and ADD, and the data RD and WD). Of the wires constituting the data bus 22, the wire for transmitting the read data RD is connected to each of the CPU 20 and the debug control unit 21. Therefore, when the read data RD is output from the data memory 30 to the data bus 22 in response to a read access, the CPU 20 and the debug control unit 21 can obtain the read data RD.
[0039] The read enable signal (RE, RE1, RE2) is a signal for making the data memory 30 perform a read operation (in other words, a signal that specifies whether or not the data memory 30 is to perform a read operation), and takes either an asserted state (valid state) or a negated state (invalid state). The read enable signal (RE, RE1, RE2) is a 1-bit signal that takes a value of "1" or "0", and in the read enable signal, a value of "1" corresponds to the asserted state, and a value of "0" corresponds to the negated state. A read enable signal (RE, RE1, RE2) having a value of "1", i.e., a read enable signal in an asserted state, is a valid signal that functions as a signal that instructs or permits the execution of a read operation. A read enable signal (RE, RE1, RE2) having a value of "0", i.e., a read enable signal in a negated state, is an invalid signal that does not instruct the execution of a read operation, and has the meaning of a signal that prohibits a read operation. Therefore, the data memory 30 executes a read operation only when it receives a read enable signal RE of "1" from the CPU 20 or the debug control unit 21 via the data bus 22, and does not execute a read operation when the read enable signal RE is "0".
[0040] The write enable signal (WE, WE1, WE2) is a signal for causing the data memory 30 to perform a write operation (in other words, a signal that specifies whether or not the data memory 30 is to perform a write operation), and takes either an asserted state (valid state) or a negated state (invalid state). The write enable signal (WE, WE1, WE2) is a 1-bit signal that takes a value of "1" or "0", and in the write enable signal, a value of "1" corresponds to the asserted state, and a value of "0" corresponds to the negated state. A write enable signal (WE, WE1, WE2) having a value of "1", i.e., a write enable signal in an asserted state, is a valid signal that functions as a signal that instructs or permits the execution of a write operation. A write enable signal (WE, WE1, WE2) having a value of "0", i.e., a write enable signal in a negated state, is an invalid signal that does not instruct the execution of a write operation, and has the meaning of a signal that prohibits a write operation. Therefore, the data memory 30 executes a write operation only when it receives a write enable signal WE of "1" from the CPU 20 or the debug control unit 21 via the data bus 22, and does not execute a write operation when the write enable signal WE is "0".
[0041] The address signals (ADD, ADD1, ADD2) are signals that specify the address of one of the storage areas in the data memory 30, and have a number of bits according to the size of the address space defined in the data memory 30. The read data (RD) is data stored in one of the storage areas in the data memory 30 and read from that storage area. The write data (WD, WD1, WD2) is data to be written to one of the storage areas in the data memory 30. The number of bits of each of the read data and write data is arbitrary (e.g., 8 bits).
[0042] The host PC 13 (in other words, the debug software 14) can issue a predetermined command based on an operation on the host PC 13 by a user of the debug system 10, and the issued predetermined command is transmitted to the debug control unit 21 via the external debug device 12.
[0043] The above-mentioned predetermined commands include a read command that requests the debug control unit 21 to perform a read access, and a write command that requests the debug control unit 21 to perform a write access. In the read command, the access target address is specified. In the write command, the access target address and write data are specified. When a read command is transmitted from the external debug device 12 to the debug control unit 21, a signal indicating the access target address may be added to the read command and transmitted. Similarly, when a write command is transmitted from the external debug device 12 to the debug control unit 21, a signal indicating the access target address and a signal indicating the write data may be added to the write command and transmitted.
[0044] The access target address indicates any address in the address space of the data memory 30. The access target address specified by the read command is an address that is the target of read access by the debug control unit 21, and the access target address specified by the write command is an address that is the target of write access by the debug control unit 21. The write data specified by the write command represents data to be written to the access target address.
[0045] In principle, the debug control unit 21 outputs a control signal CNT of "0" to the selector 27 to set the state of the selector 27 to the CPU selection state. When the debug control unit 21 needs to perform a read access or a write access in response to receiving a read command or a write command, the debug control unit 21 outputs a control signal CNT of "1" to the selector 27, thereby switching the state of the selector 27 from the CPU selection state to the debugger selection state. Then, when the necessary read access or write access is completed, the state of the selector 27 is returned to the CPU selection state.
[0046] When a read command is issued, the debugger selection state of the selector 27 is realized at an appropriate timing, and in the debugger selection state, the debug control unit 21 performs a read access to the data bus 22 in response to the read command, thereby acquiring the stored data in the memory area of the address to be accessed as read data RD. The acquired read data RD is transmitted from the debug control unit 21 to the external debug device 12, and then sent to the host PC 13 via the external debug device 12.
[0047] When a write command is issued, the debugger selection state of the selector 27 is realized at an appropriate timing, and in the debugger selection state, the debug control unit 21 performs a write access to the data bus 22 in response to the write command, thereby writing the write data specified by the write command to the memory area of the address to be accessed.
[0048] Of the signals output from the CPU 20 to the selector 27, a read enable signal RE1 and a write enable signal WE1 are supplied to the debug control unit 21. The timing at which the selector 27 is set to the debugger selection state in response to receiving a read command or a write command is controlled based on the read enable signal RE1 and the write enable signal WE1.
[0049] In short, when the debug control unit 21 receives a read command or a write command, it checks the signals RE1 and WE1. If the signal RE1 or WE1 is in the asserted state ("1"), the CPU 20 is accessing the data bus 22, so it waits until both the signals RE1 and WE1 are in the negated state ("0") before placing the selector 27 in the debugger selection state and performing access according to the received command. On the other hand, if both the signals RE1 and WE1 are in the negated state ("0") when the debug control unit 21 receives a read command or a write command, it immediately places the selector 27 in the debugger selection state without waiting and performs access according to the received command. Before describing the configuration for achieving this, a description will be given of the read access and read operation, and the write access and write operation.
[0050] 3(a) and (b), the read access and read operation will be described. In the CPU selected state, the CPU 20 can perform read access based on the program it is executing, and in the debugger selected state, the debug control unit 21 can perform read access based on a received read command.
[0051] As shown in FIG. 3(a), in a read access in the CPU selected state, the CPU 20 outputs a read enable signal RE1 of “1” and an address signal ADD1 designating one of a plurality of addresses defined in the data memory 30 to the data bus 22 via the selector 27 as the read enable signal RE and the address signal ADD, thereby causing the data memory 30 to perform a read operation.
[0052] 3(b), in a read access in the debugger selected state, the debug control unit 21 outputs a read enable signal RE2 of "1" and an address signal ADD2 specifying one of a plurality of addresses defined in the data memory 30 to the data bus 22 via the selector 27 as the read enable signal RE and the address signal ADD, thereby causing the data memory 30 to perform a read operation. The address specified by the address signal ADD2 matches the address to be accessed specified by the read command.
[0053] In a read operation in response to a read access, the data memory 30 (e.g., RAM 24) reads out data stored in a memory area at an address specified by an address signal ADD input from the CPU 20 or the debug control unit 21 via the data bus 22, and outputs the read data as read data RD to the data bus 22. The read data RD output to the data bus 22 by the read operation is input to the CPU 20 and the debug control unit 21 via wiring between the data bus 22 and the CPU 20 and the debug control unit 21.
[0054] 4(a) and (b), the write access and write operation will be described. In the CPU selection state, the CPU 20 can perform write access based on the program it is executing, and in the debugger selection state, the debug control unit 21 can perform write access based on a received write command.
[0055] As shown in FIG. 4(a), in a write access in the CPU selected state, the CPU 20 outputs a write enable signal WE1 of “1”, an address signal ADD1 specifying one of a plurality of addresses defined in the data memory 30, and write data WD1 to be written to the memory area of the address specified by the address signal ADD1 to the data bus 22 via the selector 27 as the write enable signal WE, the address signal ADD, and the write data WD, thereby causing the data memory 30 to perform a write operation.
[0056] 4(b), in a write access in the debugger selection state, the debug control unit 21 outputs a write enable signal WE2 of "1", an address signal ADD2 specifying one of a plurality of addresses defined in the data memory 30, and write data WD2 to be written to the storage area of the address specified by the address signal ADD2 to the data bus 22 as the write enable signal WE, the address signal ADD, and the write data WD via the selector 27, thereby causing the data memory 30 to perform a write operation. The address specified by the address signal ADD2 matches the address to be accessed specified by the write command. The write data WD2 matches the write data specified by the write command.
[0057] In a write operation in response to a write access, the data memory 30 (e.g., RAM 24) stores data corresponding to the write data WD from the CPU 20 or the debug control unit 21 in a storage area at an address specified by an address signal ADD input from the CPU 20 or the debug control unit 21 via the data bus 22. The stored data in the corresponding storage area after the write operation may match the write data WD, or, depending on the specifications, may not match the write data WD although it is based on the write data WD.
[0058] FIG. 5 shows an example of the internal configuration of the debug control unit 21 together with its peripheral configuration. In the following description, the CPU clock refers to the operation clock of the CPU 20. The CPU clock is referred to by the symbol "CLK". The debugger clock is the operation clock of some circuit elements of the debug control unit 21 and the external debug device 12. Some other circuit elements of the debug control unit 21 (including FFs 53 and 56 and a latch circuit 59 described later) operate in synchronization with the operation clock of the CPU 20. The debugger clock is generated, for example, by a clock generation circuit (not shown) in the external debug device 12 and is provided to the debug control unit 21 via a communication line between the external debug device 12 and the debug control unit 21. The CPU clock and the debugger clock are asynchronous with each other. It does not matter whether the frequencies of the CPU clock and the debugger clock match or not. Usually, the frequency of the debugger clock is lower than the frequency of the CPU clock.
[0059] Any clock, including the debugger clock and the CPU clock, is a square wave signal that alternates between high and low levels periodically. For any clock or signal, the high level has a higher potential than the low level. For any signal, a switch from low to high level is called an up-edge, and the timing of the switch from low to high level is called an up-edge timing. For any signal, a switch from high to low level is called a down-edge, and the timing of the switch from high to low level is called a down-edge timing.
[0060] 5 includes a digital circuit including an OR circuit 51, a one-shot pulse circuit 52, a FF 53, an OR circuit 54, an AND circuit 55, a FF 56, an AND circuit 57, a selector 58, and a latch circuit 59. The input / output signals of the components of the digital circuit and the signals handled by the components of the digital circuit are binary signals having low or high signal levels. First, the input / output signals of each component and the basic operation contents will be described.
[0061] The OR circuit 51 receives the read request signal RD_PLS and the write request signal WR_PLS, and outputs the logical OR signal of the signals RD_PLS and WR_PLS. The signals RD_PLS and WR_PLS are signals synchronized with the debugger clock. The signal RD_PLS is basically at a low level, and when a read command is received, it is at a high level for one clock of the debugger clock (i.e., one period). The signal WR_PLS is basically at a low level, and when a write command is received, it is at a high level for one clock of the debugger clock. Therefore, when a read command or a write command is received by the debug control unit 21, a signal that is at a high level for the length of one clock of the debugger clock is output from the OR circuit 51.
[0062] The one-shot pulse circuit 52 outputs a one-shot pulse signal obtained by synchronizing the output signal of the OR circuit 51 with the CPU clock as the data bus access start signal S_DB_ACS. The signal S_DB_ACS is generally set to low level. When a read command or a write command is received, the function of the circuits 51 and 52 causes the signal S_DB_ACS to go high for one clock (i.e., one cycle) of the CPU clock after a predetermined delay.
[0063] FF53 is an RS type flip-flop that operates in synchronization with the CPU clock, and includes a clock input terminal that receives the CPU clock, a data output terminal (Q terminal), and a set terminal (S terminal) and a reset terminal (R terminal) as synchronous input terminals. In FF53, a data bus access start signal S_DB_ACS is input to the set terminal, a control signal CNT is input to the reset terminal, and a data bus access signal DB_ACS is output from the data output terminal.
[0064] The data bus access signal DB_ACS is a signal for instructing that the debug control unit 21 is allowed to access the data bus 22. The signal DB_ACS is in an asserted state at a high level, and in a negated state at a low level. That is, the high level signal DB_ACS is a valid signal that instructs that the debug control unit 21 is allowed to access the data bus 22, and the low level signal DB_ACS is an invalid signal that does not instruct that the debug control unit 21 is allowed to access the data bus 22.
[0065] If the signal S_DB_ACS is at high level at the rising edge timing of the CPU clock, FF53 sets the signal DB_ACS to high level. After the signal DB_ACS is set to high level, the signal DB_ACS is maintained at high level until the input signal to the reset terminal of FF53 is set to high level. If the control signal CNT is at high level at the rising edge timing of the CPU clock, FF53 sets the signal DB_ACS to low level. After the signal DB_ACS is set to low level, the signal DB_ACS is maintained at low level until the input signal to the set terminal of FF53 is set to high level.
[0066] The OR circuit 54 is connected to a wiring for propagating a read enable signal RE1 and a wiring for propagating a write enable signal WE1, which are provided between the CPU 20 and the selector 27. The OR circuit 54 receives the signals RE1 and WE1 as input signals, and outputs an inverted signal of the logical sum signal of the signals RE1 and WE1. For each of the signals RE1 and WE1, a low level is assigned to a value of "0" (i.e., a negated state), and a high level is assigned to a value of "1" (i.e., an asserted state). Therefore, the OR circuit 54 outputs a high level signal only when the signals RE1 and WE1 are both at a low level ("0"), and outputs a low level signal otherwise.
[0067] The AND circuit 55 outputs a logical product signal of the data bus access signal DB_ACS from the FF53 and the output signal of the OR circuit 54 as the control signal CNT. The control signal CNT is at a high level only when the data bus access signal DB_ACS is at a high level (asserted state) and the read enable signal RE1 and the write enable signal WE1 from the CPU 20 are both at a low level (negated state), and otherwise the control signal CNT is at a low level. In the signal CNT, a low level is assigned to a value of "0" and a low level is assigned to a value of "1". Therefore, the selector 27 is in a CPU selection state when the control signal CNT is at a low level, and in a debugger selection state when the control signal CNT is at a high level. The control signal CNT output from the AND circuit 55 is input to the reset terminal of the FF53 and to the data input terminal of the FF56.
[0068] FF56 is a D-type flip-flop that operates in synchronization with the CPU clock, and has a clock input terminal that receives the CPU clock, a data input terminal (D terminal), and a data output terminal (Q terminal). FF56 captures and holds an input signal (CNT) to its own data input terminal in synchronization with the rising edge of the CPU clock, and outputs the held signal from its own data output terminal. The output signal of FF56 is called a data bus access end signal and is represented by the symbol "END_DB_ACS_D". The data bus access end signal END_DB_ACS_D is a signal that is the control signal CNT delayed by one clock of the CPU clock.
[0069] The AND circuit 57 outputs a logical AND signal of the data bus access end signal END_DB_ACS_D from the FF 56 and the mode signal M_RD provided from a circuit not shown. Therefore, the output signal of the AND circuit 57 becomes high level only when the signals END_DB_ACS and M_RD are both at high level, and becomes low level otherwise. When the debug control unit 21 performs a read access in response to receiving a read command, the mode signal M_RD is at high level, and otherwise the mode signal M_RD is at low level.
[0070] The selector 58 has a first input terminal, a second input terminal, and an output terminal, and when the output signal of the AND circuit 57 is at a low level, the selector 58 outputs data applied to the first input terminal from its output terminal, and when the output signal of the AND circuit 57 is at a high level, the selector 58 outputs data applied to the second input terminal from its output terminal. The output data of the latch circuit 59 is input to the first input terminal of the selector 58. The second input terminal of the selector 58 is connected to a wiring for propagating the read data RD in the data bus 22. Therefore, when the read data RD is output from the data memory 30 to the data bus 22, the read data RD is input to the second input terminal of the selector 58.
[0071] The latch circuit 59 has a clock input terminal that receives the CPU clock, a data input terminal (D terminal) connected to the output terminal of the selector 58, and a data output terminal (Q terminal) connected to a first input terminal of the selector 58. The latch circuit 59 is composed of D-type flip-flops the number of which is the number of bits of the read data RD. The latch circuit 59 latches (takes in and holds) data from the output terminal of the selector 58 in synchronization with the rising edge of the CPU clock, and outputs the latched data from its own data output terminal. The output data from the data output terminal of the latch circuit 59 is called debugger read data, and is referred to by the symbol "DB_RD".
[0072] The latch of the read data RD in the latch circuit 59, which is realized when the output signal of the AND circuit 57 becomes high level, is maintained until the output signal of the AND circuit 57 next becomes high level after the output signal of the AND circuit 57 becomes low level through cooperation of the above-mentioned selector 58 and latch circuit 59.
[0073] The flow of operations related to reception of a read command or a write command will now be described. When a read command or a write command is not received, the signals S_DB_ACS and DB_ACS are maintained at a low level, the selector 27 is in a CPU selection state, and only the CPU 20 can access the data bus 22.
[0074] When the debug control unit 21 receives a read command or a write command, the data bus access start signal S_DB_ACS is set to a high level, requesting the debug control unit 21 to start accessing the data bus 22, and this request is transmitted to the AND circuit 55 as a high-level data bus access signal DB_ACS.
[0075] On the other hand, when the debug control unit 21 receives a read command, a signal for read access is output from the debug control unit 21 to the selector 27. The signal for read access consists of an address signal ADD2 corresponding to the read command and a read enable signal RE2 of "1". At this time, the address specified by the address signal ADD2 matches the access target address specified by the read command. The output of the signal for read access to the selector 27 starts simultaneously with the rising edge of the signal DB_ACS or before the rising edge of the signal DB_ACS occurs, and ends when the read access in response to the read command is completed.
[0076] On the other hand, when the debug control unit 21 receives a write command, a signal for write access is output from the debug control unit 21 to the selector 27. The signal for write access is composed of an address signal ADD2 and write data WD2 corresponding to the write command, and a write enable signal WE2 of "1". At this time, the address specified by the address signal ADD2 matches the access target address specified by the write command. The write data WD2 matches the write data specified by the write command. The output of the signal for write access to the selector 27 starts simultaneously with the rising edge of the signal DB_ACS or before the rising edge of the signal DB_ACS occurs, and ends when the write access in response to the write command is completed.
[0077] Even if the data bus access signal DB_ACS is at a high level, when either the read enable signal RE1 or the write enable signal WE1 from the CPU 20 is at a high level, this means that the CPU 20 is accessing the data bus 22 in some way, so the CPU selection state is maintained so as not to impede the access of the CPU 20, and actual access by the debug control unit 21 is awaited.
[0078] When the data bus access signal DB_ACS is at a high level, if the read enable signal RE1 and the write enable signal WE1 from the CPU 20 are both at a low level, this means that the CPU 20 is not accessing the data bus 22, and therefore the AND circuit 55 outputs a high level control signal CNT to realize the debugger selection state of the selector 27, and executes the desired access (read access or write access) by the debug control unit 21. The desired access here is realized by outputting the above-mentioned read access signals (ADD2, RE2) to the data bus 22 via the selector 27 if a read command has been received, and is realized by outputting the above-mentioned write access signals (ADD2, WD2, WE2) to the data bus 22 via the selector 27 if a write command has been received.
[0079] When the control signal CNT is set to high level, the signal DC_ACS is cleared (i.e., switched to low level) at the next rising edge of the CPU clock by the function of FF 53. At this point, the desired access (read access or write access) by the debug control unit 21 is completed.
[0080] When the debug control unit 21 performs a read access, the read data RD corresponding to the read access appears on the data bus 22 at a timing delayed by one CPU clock from the read access. Therefore, the read data RD is latched in the latch circuit 59 using a signal (END_DB_ACS_D) that is a one-clock delayed version of the control signal CNT. The latched read data RD is transmitted from the debug control unit 21 to the external debug device 12 as debugger read data DB_RD, and is then transmitted to the host PC 13 via the external debug device 12.
[0081] It is also possible to adopt a configuration in which the read data RD is output to the data bus 22 at the time when the address signal ADD is input to the data bus 22 together with the write enable signal RE of "1" without synchronizing with the CPU clock. In this case, it is not necessary to generate a signal (END_DB_ACS_D) that is a delayed version of the control signal CNT, and it is sufficient to have the latch circuit 59 latch the read data RD at the timing when the control signal CNT is at a high level.
[0082] In this manner, the debug control unit 21 is configured to control the state of the selector 27 based on the reception state of a specified command (read command or write command) from the external debug device 12 and the states of the read enable signal RE1 and the write enable signal WE1 from the CPU 20, and to access the data bus 22 via the selector 27 when the selector 27 is in the debugger selection state.
[0083] This makes it possible to construct a debugging system that can access the data bus 22 with a small configuration and without affecting the program operation of the CPU 20 at all.
[0084] Specifically, when the debug control unit 21 accesses the data bus 22 in response to receiving a predetermined command, if the signal RE1 or WE1 is in an asserted state (high level), the debug control unit 21 waits until both signals RE1 and WE1 are in a negated state (low level), then sets the selector 27 to a debugger selection state and performs access to the data bus 22 in response to the predetermined command. That is, a standby operation is performed to wait until both signals RE1 and WE1 are in a negated state, and when both signals RE1 and WE1 are in a negated state, the selector 27 is set to a debugger selection state and performs access to the data bus 22 in response to the predetermined command. When the debug control unit 21 accesses the data bus 22 in response to receiving a specified command, if the signals RE1 and WE1 are both in the negated state, the debug control unit 21 can immediately set the selector 27 to the debugger selection state and access the data bus 22 in response to the specified command without going through the above-mentioned waiting period (without going through the waiting operation).
[0085] More specifically, the debug control unit 21 has circuits (51, 52, 53) that generate a data bus access signal DB_ACS for instructing the debug control unit 21 to enable access to the data bus 22. In response to receiving a predetermined command, the data bus access signal DB_ACS is switched from a negated state (low level) to an asserted state (high level). Then, if the signal RE1 or WE1 from the CPU 20 is in the asserted state (high level) when the data bus access signal DB_ACS is switched from the negated state to the asserted state, the debug control unit 21 waits until both signals RE1 and WE1 are negated (low level), then sets the selector 27 to the debugger selection state and performs access to the data bus 22 in response to a predetermined command. That is, a standby operation is performed to wait until both signals RE1 and WE1 are negated, and when both signals RE1 and WE1 are negated, the selector 27 is set to the debugger selection state and performs access to the data bus 22 in response to the predetermined command. On the other hand, if signals RE1 and WE1 are both in the negated state when the data bus access signal DB_ACS is switched from the negated state (low level) to the asserted state (high level), the debug control unit 21 can immediately set the selector 27 to the debugger selection state and access the data bus 22 in accordance with a specified command without going through the above-mentioned waiting period (without going through the waiting operation).
[0086] Also, assuming the above configuration, the debug control unit 21 sets the selector 27 to the CPU selection state when the data bus access signal DB_ACS is in a negated state (low level). Then, in response to receiving a predetermined command, the debug control unit 21 switches the data bus access signal DB_ACS from the negated state (low level) to the asserted state (high level), and then sets the selector 27 to the debugger selection state and performs access to the data bus 22 in accordance with the predetermined command, and then returns the data bus access signal DB_ACS from the asserted state (high level) to the negated state (low level), thereby returning the selector 27 to the CPU selection state.
[0087] As a result, the selector 27 is basically set to the CPU selection state, and the debugger selection state is realized without impeding the operation of the CPU 20 only when the debug control unit 21 needs to access the data bus 22. In other words, there is no effect on the operation of the CPU 20.
[0088] As can be understood from the above description, when a read command is received, the debug control unit 21 performs read access in response to the read command to the data bus 22 via the selector 27 by outputting a signal for read access in the debugger selection state (in other words, performs read access in response to the read command to the data memory 30 via the selector 27 and the data bus 22). In detail, in this read access, the debug control unit 21 performs access to the data bus 22 via the selector 27 to obtain data in a storage area of an address (address to be accessed) designated by the read command from the data memory 30 as read data RD (in other words, performs access to the data memory 30 via the selector 27 and the data bus 22), and transmits the read data RD obtained thereby to the external debug device 12.
[0089] On the other hand, when a write command is received, the debug control unit 21 performs a write access in response to the write command to the data bus 22 via the selector 27 by outputting a signal for write access in the debugger selection state (in other words, performs a write access in response to the write command to the data memory 30 via the selector 27 and the data bus 22). In detail, in this write access, the debug control unit 21 performs an access to the data bus 22 via the selector 27 to write the write data specified by the write command to a storage area of an address (address to be accessed) specified by the write command (in other words, performs an access to the data memory 30 via the selector 27 and the data bus 22).
[0090] [Timing chart] Figures 6 and 7 show timing charts of the LSI 11 responding to reception of a read command, and Figures 8 and 9 show timing charts of the LSI 11 responding to reception of a write command. However, Figures 6, 7, 8, and 9 show timing charts in cases C_R1, C_R2, C_W1, and C_W2, respectively. Case C_R1 in FIG. 6 is a case in which no contention occurs between the debug control unit 21 and the access of the CPU 20 when the debug control unit 21 attempts to perform a read access. Case C_R2 in FIG. 7 is a case in which a conflict occurs between the debug control unit 21 and the access of the CPU 20 when the debug control unit 21 attempts to perform a read access. Case C_W1 in FIG. 8 is a case in which no contention occurs between the debug control unit 21 and the access of the CPU 20 when the debug control unit 21 attempts to perform a write access. Case C_W2 in FIG. 9 is a case in which a conflict occurs between the debug control unit 21 and the access of the CPU 20 when the debug control unit 21 attempts to perform a write access.
[0091] Waveforms y1 to y19 shown in Figures 6 to 9 show the same signal waveforms in Figures 6 to 9, but the details of those waveforms are partially different in Figures 6 to 9. First, what each waveform indicates will be described.
[0092] Waveform y1 indicates the waveform of the debugger clock, and waveform y5 indicates the waveform of the CPU clock. As described above, a part of the debug control unit 21 operates in synchronization with the debugger clock, and takes in an input signal to itself, changes the level of a signal to be output, or changes its own state at the rising edge of the debugger clock. The remaining part of the debug control unit 21 and the CPU 20 operate in synchronization with the CPU clock, and take in an input signal to itself, change the level of a signal to be output, or change its own state at the rising edge of the CPU clock. As time passes, timings t1, t2, t3, t4, t5, t6, and t7 occur in this order. Timing t1 is one rising edge timing in the debugger clock. At each of timings t2, t3, t4, t5, t6, and t7, an rising edge of the CPU clock occurs. The time lengths between timings t2 and t3, between timings t3 and t4, between timings t4 and t5, between timings t5 and t6, and between timings t6 and t7 are all equal to one cycle of the CPU clock.
[0093] A waveform y2 represents debugger data, and is a schematic representation of a signal transmitted from the external debugging device 12 to the debug control unit 21. The debugger data includes data constituting a read command or a write command.
[0094] A waveform y3 is a waveform of a read request signal RD_PLS based on a read command, and a waveform y4 is a write request signal WR_PLS based on a write command (see also FIG. 5).
[0095] The CPU 20 is provided with a program counter that counts and designates the address (hereinafter referred to as the program memory address) in the program memory 29 where the next instruction to be fetched is stored, and only when the program memory read enable signal is at high level, the program memory address is synchronized with the CPU clock using the program counter and is updated sequentially at the cycle of the CPU clock. In Figures 6 to 9, "y6" represents the time series change of the program memory address, and "y7" represents the program memory read enable signal. In the section assumed in Figures 6 to 9, the program memory read enable signal is maintained at high level.
[0096] The operation of reading and acquiring a necessary instruction from the program memory 29 is called fetching. Among the states indicating the execution state of a program in the CPU 20, the state in which the instructions constituting the program are fetched and executed is called the fetch state. In the fetch state, the CPU 20 fetches and latches an instruction indicated in a program memory address. In Figs. 6 to 9, "y8" represents the time series change of the instruction (instruction code) latched through the fetch, and "y9" represents the time series change of the state of the state machine. The state machine is composed of registers provided in the CPU 20, and controls the execution state of the program in the CPU 20. In the section assumed in Figs. 6 to 9, the state of the CPU 20 is maintained in the fetch state.
[0097] 6 to 9, waveforms y10 and y11 respectively indicate the waveforms of the read enable signal RE1 and the write enable signal WE1 from the CPU 20. In FIG. 6 to 9, waveforms y12, y13, y14, and y18 respectively indicate the waveforms of the data bus access start signal S_DB_ACS, the data bus access signal DB_ACS, the control signal CNT, and the data bus access end signal END_DB_ACS_D by the debug control unit 21. In FIG. 6 to 9, waveforms y15 and y16 respectively indicate the waveforms of the read enable signal RE and the write enable signal WE on the data bus 22. "y17" indicates the read data RD appearing on the data bus 22, and "y19" indicates the debugger read data DB_RD latched by the latch circuit 59 (see FIG. 5). In "y17" and "y19", data RD and DB_RD that do not have significant values are illustrated as "0".
[0098] ---Case C_R1-- The operation in case C_R1 of Fig. 6 will be described. In case C_R1, a pulse is generated in the read request signal RD_PLS starting from timing t1 based on the reception of a read command (an up edge occurs in the read request signal RD_PLS at timing t1). The pulse of the read request signal RD_PLS is synchronized with the CPU clock, generating a pulse in the data bus access start signal S_DB_ACS. That is, the signal S_DB_ACS goes high between timings t2 and t3. Then, an up edge occurs in the data bus access signal DB_ACS at timing t3 due to the function of FF53 in Fig. 5.
[0099] 6, the CPU 20 does not access the data bus 22 in the clock period between timings t3 and t4 (i.e., signals RE1 and WE1 are both at low level). Therefore, an up-edge also occurs in the control signal CNT at timing t3. When an up-edge occurs in the control signal CNT, a down-edge occurs in the data bus access signal DB_ACS and the control signal CNT at the up-edge timing t4 of the next CPU clock due to the function of FF53.
[0100] As described above, the output of the read access signal from the debug control unit 21 to the selector 27 is performed simultaneously with the rising edge of the signal DB_ACS or before the rising edge of the signal DB_ACS occurs. Therefore, in the section where the control signal CNT is at a high level (i.e., between timings t3 and t4), the signal RE2 of "1" included in the read access signal from the debug control unit 21 (i.e., the signal RE2 at a high level) appears on the data bus 22 as the signal RE.
[0101] During the next clock period between timings t4 and t5, the read data RD output from the data memory 30 based on the read access signal from the debug control unit 21 appears on the data bus 22, and the signal END_DB_ACS_D goes high by the function of FF 56. As a result, the read data RD that appeared on the data bus 22 between timings t4 and t5 is latched as debugger read data DB_RD by the latch circuit 59 in response to the rising edge of the CPU clock at timing t5.
[0102] ---Case C_R2-- The following describes the operation in case C_R2 in Fig. 7. In case C_R2 in Fig. 7, the operation up to the occurrence of a rising edge in the data bus access signal DB_ACS at timing t3 is the same as that in case C_R1 in Fig. 6.
[0103] 7, the CPU 20 performs a read access to the data bus 22 during the clock period between timings t3 and t4 (i.e., the signal RE1 is at a high level). Therefore, although the data bus access signal DB_ACS is at a high level between timings t3 and t4, the control signal CNT is maintained at a low level. The high level of the signal RE between timings t3 and t4 is based on the high level of the signal RE1 from the CPU 20.
[0104] 7, the CPU 20 does not access the data bus 22 in the clock period between timings t4 and t5 (i.e., signals RE1 and WE1 are both at low level). Therefore, an up edge occurs in the control signal CNT at timing t4. When an up edge occurs in the control signal CNT, a down edge occurs in the data bus access signal DB_ACS and the control signal CNT at the up edge timing t5 of the next CPU clock due to the function of FF53. In the period when the control signal CNT is at high level (i.e., between timings t4 and t5), the signal RE2 of "1" (i.e., the signal RE2 at high level) included in the signal for read access from the debug control unit 21 appears on the data bus 22 as the signal RE.
[0105] During the next clock period between timings t5 and t6, the read data RD output from the data memory 30 based on the read access signal from the debug control unit 21 appears on the data bus 22, and the signal END_DB_ACS_D goes high by the function of FF 56. As a result, the read data RD that appeared on the data bus 22 between timings t5 and t6 is latched as debugger read data DB_RD by the latch circuit 59 in response to the rising edge of the CPU clock at timing t6.
[0106] In case C_R2 in FIG. 7, the period between timings t3 and t4 corresponds to a period during which the signal RE1 and the signal WE1 are both waiting until they are negated ("0"). The length of the wait is one cycle of the CPU clock in the example of FIG. 7, but it may extend to multiple cycles of the CPU clock. Also, the cause of the wait is the signal RE1 at a high level in the example of FIG. 7, but it may be WE1 at a high level.
[0107] 6 and 7, the CPU 20 does not need to stop the execution of the program, and the fetch state is maintained and instructions are executed sequentially, including while the debug control unit 21 is accessing the data bus 22. The transmission of the debugger read data DB_RD to the external debug device 12 is also performed in parallel with the execution of the program by the CPU 20, and does not affect the execution of the program by the CPU 20.
[0108] ---Case C_W1-- The operation in case C_W1 of Fig. 8 will be described. In case C_W1, a pulse is generated in the write request signal WR_PLS starting from timing t1 based on the reception of a write command (an up edge occurs in the write request signal WR_PLS at timing t1). The pulse of the write request signal WR_PLS is synchronized with the CPU clock, generating a pulse in the data bus access start signal S_DB_ACS. That is, the signal S_DB_ACS becomes high level between timings t2 and t3. Then, an up edge occurs in the data bus access signal DB_ACS at timing t3 due to the function of FF53 in Fig. 5.
[0109] 8, the CPU 20 does not access the data bus 22 in the clock period between timings t3 and t4 (i.e., signals RE1 and WE1 are both at low level). Therefore, an up-edge also occurs in the control signal CNT at timing t3. When an up-edge occurs in the control signal CNT, a down-edge occurs in the data bus access signal DB_ACS and the control signal CNT at the up-edge timing t4 of the next CPU clock due to the function of FF53.
[0110] As described above, the output of the signal for write access from the debug control unit 21 to the selector 27 is performed simultaneously with the rising edge of the signal DB_ACS or before the rising edge of the signal DB_ACS occurs. Therefore, in the section where the control signal CNT is at a high level (i.e., between timings t3 and t4), the signal WE2 of "1" included in the signal for write access from the debug control unit 21 (i.e., the signal WE2 at a high level) appears on the data bus 22 as the signal WE, and the write access of the debug control unit 21 based on the write command is executed in that section.
[0111] During the next clock period between timings t4 and t5, the signal END_DB_ACS_D goes high due to the function of FF56, but the signal END_DB_ACS_D does not function significantly when a write access is executed.
[0112] ---Case C_W2-- An explanation will be given of the operation in case C_W2 in Fig. 9. In case C_W2 in Fig. 9, the operation up to the occurrence of a rising edge in the data bus access signal DB_ACS at timing t3 is the same as that in case C_W1 in Fig. 8.
[0113] 9, the CPU 20 performs a read access to the data bus 22 during the clock period between timings t3 and t4 (i.e., the signal RE1 is at a high level). Therefore, although the data bus access signal DB_ACS is at a high level between timings t3 and t4, the control signal CNT is maintained at a low level. The high level of the signal RE between timings t3 and t4 is based on the high level of the signal RE1 from the CPU 20.
[0114] 9, the CPU 20 does not access the data bus 22 in the clock period between timings t4 and t5 (i.e., signals RE1 and WE1 are both at low level). Therefore, an up edge occurs in the control signal CNT at timing t4. When an up edge occurs in the control signal CNT, a down edge occurs in the data bus access signal DB_ACS and the control signal CNT at the up edge timing t5 of the next CPU clock due to the function of FF53. In the period in which the control signal CNT is at high level (i.e., between timings t4 and t5), the signal WE2 of "1" (i.e., signal WE2 at high level) included in the signal for write access from the debug control unit 21 appears on the data bus 22 as the signal WE, and the write access of the debug control unit 21 based on the write command is executed in that period.
[0115] During the next clock period between timings t5 and t6, the signal END_DB_ACS_D goes high due to the function of FF56, but the signal END_DB_ACS_D does not function significantly when a write access is executed.
[0116] In case C_W2 in FIG. 9, the period between timings t3 and t4 corresponds to a period during which the signal RE1 and the signal WE1 are both waiting until they are negated ("0"). The length of the wait is one cycle of the CPU clock in the example of FIG. 9, but it may extend to multiple cycles of the CPU clock. Also, the cause of the wait is the signal RE1 at a high level in the example of FIG. 9, but it may be WE1 at a high level.
[0117] In either case C_W1 of FIG. 8 or case C_W2 of FIG. 9, the CPU 20 does not need to stop the execution of the program, and the fetch state is maintained and instructions are executed sequentially, including while the debug control unit 21 is accessing the data bus 22.
[0118] <<Second embodiment>> A second embodiment of the present invention will be described. In the second embodiment, some applied techniques and modified techniques that can be applied to the above-mentioned first embodiment will be described. The second embodiment includes the following examples EX2_1 to EX2_5.
[0119] [Example EX2_1] An embodiment EX2_1 will be described. Two or more CPUs 20 that access the data bus 22 may be provided in the LSI 11. In this case, an arbitration circuit (not shown) is provided in the LSI 11 to prevent two or more CPUs 20 from simultaneously accessing the data bus 22. By the function of the arbitration circuit, the right to access the data bus 22 is given to one of the two or more CPUs 20, and only the output signal and output data of the CPU 20 that has been given the right to access the data bus 22 is transmitted to the data bus 22.
[0120] When the method of the first embodiment is applied to such a configuration, it may be considered that the signals RE1, WE1, ADD1, and WD1 are supplied to the selector 27 from the CPU 20 to which access authority has been granted.
[0121] [Example EX2_2] An embodiment EX2_2 will be described. In the configuration of Fig. 1, the CPU 20 is an example of a processing unit that accesses the data bus 22, but in the present invention, such a processing unit is not limited to a CPU, and any part that accesses the data bus 22 can be a processing unit. As shown in the embodiment EX2_1, when two or more CPUs 20 are provided in the LSI 11, it can be considered that the processing unit is composed of two or more CPUs 20 and an arbitration circuit, or the CPU 20 to which access authority is granted corresponds to the processing unit.
[0122] [Example EX2_3] The embodiment EX2_3 will be described. The relationship between the high level and the low level may be reversed for any signal without compromising the above-mentioned gist. In relation to this, it is optional to adopt either positive logic or negative logic for any signal.
[0123] [Example EX2_4] Example EX2_4 will be described. Each circuit element constituting LSI11 is formed in the form of a semiconductor integrated circuit, and the semiconductor integrated circuit is sealed in a case (package) made of resin to form a semiconductor device. However, a circuit equivalent to the circuit in LSI11 may be formed using multiple discrete components.
[0124] [Example EX2_5] The embodiment EX2_5 will be described. The debug system according to the present invention includes a semiconductor device exemplified by an LSI 11 and an external device connected to the semiconductor device. The external device here may be understood to refer to the external debug device 12 in the configuration of FIG. 1, or may be understood to include both the external debug device 12 and the host PC 13.
[0125] The embodiments of the present invention can be modified in various ways as appropriate within the scope of the technical ideas set forth in the claims. The above embodiments are merely examples of the present invention, and the meanings of the terms of the present invention and each component are not limited to those described in the above embodiments. The specific numerical values shown in the above description are merely examples, and can be changed to various numerical values as a matter of course. [Explanation of symbols]
[0126] 10 Debugging System 11 LSI 12 External Debugging Devices 13 Host Computer 14 Debugging Software 20 CPU 21 Debug control section 22 Data Bus 23 ROM 24 RAM 25 Peripherals 26 Registers 27 Selector 28 Program Bus 29 Program Memory 30 Data Memory
Claims
1. A semiconductor device comprising: a data bus; a data memory connected to the data bus; a selector connected to the data bus; a processing unit that executes the program by sequentially executing each instruction constituting the program in synchronization with a clock and is capable of accessing the data bus via the selector; and a debug control unit configured to enable bidirectional communication with an external device and capable of accessing the data bus via the selector, Based on the control by the debug control unit, the selector takes on either a first selected state in which the first signal from the processing unit and the second signal from the debug control unit are transmitted to the data bus, or a second selected state in which the second signal is transmitted to the data bus. The signals output from the processing unit to the selector include a read enable signal for causing the data memory to perform a read operation, and a write enable signal for causing the data memory to perform a write operation. The debug control unit controls the state of the selector based on the reception status of a predetermined command from the external device and the states of the read enable signal and the write enable signal from the processing unit, and when the selector is in the second selection state, it accesses the data bus via the selector, and when accessing the data bus in response to the reception of the predetermined command, it keeps the selector in the second selection state for the duration of one clock cycle and performs access to the data bus according to the predetermined command, and then returns the selector to the first selection state. The data memory performs the read operation or the write operation in response to the first signal in the first selected state, and performs the read operation or the write operation in response to the second signal in the second selected state. Of the multiple wires constituting the data bus, which are connected to the selector and the data memory respectively, the wires for transmitting the read data read from the data memory by the read operation corresponding to the first signal or the second signal are connected to the processing unit and the debug control unit respectively. Semiconductor equipment.
2. The debugging control unit, When accessing the data bus in response to the reception of the predetermined command, if the read enable signal or the write enable signal is asserted, wait until both the read enable signal and the write enable signal are negated, then set the selector to the second selection state for the duration of one clock cycle, perform access to the data bus according to the predetermined command, and then return the selector to the first selection state. When accessing the data bus in response to the reception of the predetermined command, if both the read enable signal and the write enable signal are in a negated state, the selector is moved to the second selected state for the duration of one clock cycle without waiting, and access is performed to the data bus according to the predetermined command, after which the selector is returned to the first selected state. The semiconductor device according to claim 1.
3. The debug control unit has a circuit that generates a data bus access signal to instruct the debug control unit to enable access to the data bus, In response to the receipt of the predetermined command, the data bus access signal is switched from a negate state to an asserted state. The debugging control unit, If the read enable signal or the write enable signal is asserted when the data bus access signal is switched from the negate state to the asserted state, wait until both the read enable signal and the write enable signal are in the negate state, then set the selector to the second selection state for the duration of one clock cycle, perform access to the data bus according to the predetermined command, and then return the selector to the first selection state. If, when the data bus access signal is switched from the negated state to the asserted state, both the read enable signal and the write enable signal are in the negated state, the selector is moved to the second selected state for the duration of one clock cycle without waiting, and access is performed to the data bus according to the predetermined command, after which the selector is returned to the first selected state. The semiconductor device according to claim 2.
4. The debugging control unit, When the data bus access signal is in a negate state, the selector is set to the first selected state. After switching the data bus access signal from the negate state to the asserted state in response to the reception of the predetermined command, the selector is set to the second selected state for the duration of one clock cycle, and access is performed to the data bus according to the predetermined command. This returns the data bus access signal from the asserted state to the negate state, thereby returning the selector to the first selected state. The semiconductor device according to claim 3.
5. The debug control unit sets the selector to the first selection state before the predetermined command is received, switches the selector from the first selection state to the second selection state after the predetermined command is received, and returns the selector to the first selection state when access to the data bus corresponding to the predetermined command is performed. or semiconductor device according to any one of claims 1 to 4.
6. When a read command is received as the predetermined command, The debug control unit performs a read access to the data bus in accordance with the read command when the selector is in the second selection state, and then transmits the read data obtained from the data memory by the read access to the external device. , the semiconductor device according to any one of claims 1 to 5.
7. The aforementioned data memory has multiple storage areas to which multiple addresses are assigned. In the aforementioned read command, one of the above multiple addresses is specified. The debug control unit, in response to the read command, performs an access to the data bus via the selector to obtain data from the data memory as read data from the storage area at the address specified by the read command, and transmits the read data obtained thereby to the external device. The semiconductor device according to claim 6.
8. When a write command is received as the predetermined command, The debug control unit performs write access to the data bus in accordance with the write command when the selector is in the second selection state. The aforementioned write access causes data corresponding to the write command to be written to the data memory. , the semiconductor device according to any one of claims 1 to 5.
9. The aforementioned data memory has multiple storage areas to which multiple addresses are assigned. In the aforementioned write command, one of the multiple addresses is specified, along with the write data. The debug control unit, in response to the write command, performs an access to the data bus via the selector to write the write data to the storage area at the address specified by the write command. The semiconductor device according to claim 8.
10. The read data read from the data memory by the read operation corresponding to the first signal or the second signal is acquired by the processing unit and the debug control unit, respectively. A semiconductor device according to any one of claims 1 to 9.
11. A semiconductor device according to any one of claims 1 to 10, The device comprises an external device connected to the semiconductor device and capable of transmitting the predetermined command to the debug control unit of the semiconductor device. , a debugging system.
Citation Information
Patent Citations
Method of assembling marine structure by using old tire
JP1979000443A
Microcomputer
JP1996286947A
Microprocessor and debugging device
JP2000242523A
microcomputer
JP2001056803A
microcomputer
JP2004086447A
