Instruction Programmable Buffer Design System Based on Processor Debug Architecture
By introducing the instruction programmable buffer design into the processor debugging architecture, the problem of difficulty in controlling the processor to run an instruction or a program in debugging mode is solved, fast and flexible debugging functions are realized, and the needs of the processor debugging system are met.
Patent Information
- Application Number
- CN202210393724.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-15
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2042-04-15
AI Technical Summary
It is difficult for the existing processor debugging system to directly control the processor to run an instruction or a program in debugging mode, and cannot observe in detail the state changes of the processor after each instruction is executed, making it difficult to locate the cause of the exception.
An instruction programmable buffer system based on the processor debugging architecture is designed. By adding an instruction programmable buffer in the debugging module, three methods are provided: instruction transmission ITR register, program buffer PB register group and abstract command, allowing software The debugger downloads instructions or programs to the processor pipeline for execution.
It enables quick and flexible editing and execution of instructions and observation of execution results in debugging mode, covering most functional debugging scenarios. It has the characteristics of simple structure, easy operation and high flexibility.
Smart Images

Figure CN114691520B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of processor core design, and in particular to an instruction programmable buffer design system based on a processor debugging architecture. Background Art
[0002] In the design process of a processor, if there is a lack of a fully functional debugging system, then when the design develops from tool simulation to hardware verification and finally to silicon implementation, the designer's understanding and control of the current state of the processor will drop sharply, and the internal state of the controller during operation is equivalent to a "black box" for the designer. The development and debugging of processor software and hardware will be greatly limited due to the lack of debugging methods.
[0003] For embedded platforms, debugger software usually runs on the host PC, and the processor being debugged is often on an embedded development board. This is a typical scenario for cross-compilation and remote debugging. The debugger software needs hardware support to gain control of the processor and debug it. The hardware architecture of the processor often contains a hardware debugging module. The debugging module communicates with the debugging software on the host through physical media (such as the JTAG interface) and accepts its control. The debugging module then controls the processor core.
[0004] There are two common processor debugging mechanisms: "trace debugging" and "interactive debugging". Trace debugging only tracks and records all program instructions executed by the processor core, and will not interrupt or interfere with the execution process of the processor. However, since the processor runs very fast and can execute millions of instructions per second, the amount of information generated is very huge. The hardware unit of the trace debugger needs to record all instructions, which poses a great challenge to the processing speed requirements, data compression, transmission, and storage. The hardware implementation of the trace debugger involves more complex technology than the interactive debugger, and the hardware overhead is also greater. The trace debugger is often only used in relatively high-end processors.
[0005] Interactive debugging is the most common processor debugging mechanism. From the lowest-end to the highest-end processors, interactive debugging is a must-have feature for almost all processors. The debugger software can directly take control of the processor and debug it in an interactive way. Interactive debugging is disruptive to the operation of the processor, and the results in debug mode and full-speed operation may be different.
[0006] Interactive debugging can directly pause the current processor process to enter the debugging mode, or set breakpoints. When the program runs to the breakpoint, the processor will generate an exception and enter the exception service program of the debugging mode. In the debugging mode, the debugger software obtains control of the processor, can view and change the running status of the processor, can also download and run a program, view the program running status, and after debugging is completed, it can exit the test mode and restore the normal operation of the processor. How to realize an interactive debugging mechanism with simple structure, diverse functions, flexibility and ease of use is a key technical problem that needs to be solved in the design of processor debugging architecture. Summary of the invention
[0007] To this end, the technical problem to be solved by the present invention is to overcome the problem in the prior art that in the debugging mode, software debuggers, in addition to being able to obtain the current running status of the processor, also hope to control the processor to run an instruction or a program, and observe in detail the state changes of the processor after each instruction is run, so as to more intuitively reproduce the scene where the program enters an exception when the processor is running normally and locate the cause of the exception.
[0008] In order to solve the above technical problems, the present invention provides an instruction programmable buffer design system based on a processor debugging architecture. The processor core system constructed in the design system is the basic framework of the present application and serves the instruction programmable buffer. The processor core system includes a debugging interface module, an interface conversion module, and a debugging module. The instruction programmable buffer design is added to the hardware design of the debugging module to provide a way for software debuggers to download instructions to the processor core for execution in debugging mode.
[0009] The register group of the debug interface module contains an operation ACCESS register, the bit field of which is divided into three parts: address, data and read / write type. The interface conversion module converts the operation register value into parallel bus access according to the agreed format. The address, data and read / write type of the parallel bus access operation are determined by the operation register value.
[0010] The debug module contains a parallel bus interface to realize parallel bus communication with the interface conversion module. The debug module realizes the register group related to processor debugging and is directly connected to the processor core through hardware control and data signals. These control and data signals can realize all debugging functions of the debug module on the processor core.
[0011] The present invention implements the design of an instruction programmable buffer in the interactive debugging mechanism of the processor debugging architecture, and provides three methods for controlling the processor to run instructions through a hardware debugging module in the debugging mode. In the debugging mode, the instructions or programs in the instruction programmable buffer can be directly downloaded to the instruction fetch cache queue of the processor pipeline and executed.
[0012] The first implementation method is to use the debug module's instruction transfer ITR register, which can store up to one 32-bit instruction. When you write the instruction you want to execute into this register, the debug module will directly download the instruction to the instruction fetch cache queue of the processor pipeline and then execute the instruction through the pipeline.
[0013] The second implementation method is the debug module's program buffer PB[0:15] register group. This register group can store up to 16 32-bit instructions. Write a program (no more than 16 instructions) to be executed into this register group in advance, then configure the instruction length bit to inform the hardware of the number of instructions to be executed, and finally configure the execution bit. The debug module will download the instructions in the program buffer register group to the pipeline for execution one by one according to the configured number of instructions.
[0014] The third implementation method is the abstract command of the debug module, including the abstract command CMD and the abstract data DATA[0:N] register group. The abstract command actually configures the above registers to allow the debug module to automatically generate fixed-format instructions that can be executed by the processor, and then downloads them to the instruction fetch cache queue of the processor pipeline and executes the instructions through the pipeline. Instructions are generally divided into two types: accessing the processor registers and accessing the memory space. The abstract command type is configured through the abstract command register. When the abstract instruction accesses the processor register, the register index value is configured through the abstract command register, and the register data is configured or returned through the abstract data register. When the abstract instruction accesses the memory space, both the address and data are configured or returned through different abstract data registers.
[0015] The above technical solution of the present invention has the following advantages over the prior art: the instruction programmable buffer design system based on the processor debugging architecture described in the present invention, by adding the above three instruction programmable buffer designs in the debugging module of the processor debugging architecture, allows software debuggers to edit instructions or a program more quickly and flexibly, download them to the processor core for execution, and then observe the execution results. It is also possible to quickly let the processor execute some fixed instructions to access the processor registers or memory space. The design of the instruction programmable buffer covers most functional debugging scenarios, and has the characteristics of simple structure, easy operation, and high flexibility. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to make the contents of the present invention more clearly understood, the present invention is further described in detail below based on specific embodiments of the present invention in conjunction with the accompanying drawings.
[0017] Figure 1 A block diagram of the processor debugging architecture of the present invention;
[0018] Figure 2This is a schematic diagram of the JTAG state jump of the debugging interface module of the present invention;
[0019] Figure 3 This is a structural diagram of the instruction programmable buffer of the debugging module of the present invention. DETAILED DESCRIPTION
[0020] like Figure 1 As shown in the architecture block diagram, this embodiment provides an instruction programmable buffer design system based on a processor debugging architecture. The processor core system constructed in the design system is the basic framework of this application, serving the instruction programmable buffer. The processor core system includes a debugging interface module, an interface conversion module, and a debugging module, wherein an instruction programmable buffer design is added to the hardware design of the debugging module to provide a way for software debuggers to download instructions to the processor core for execution in debugging mode;
[0021] The debug interface module implements the JTAG interface that complies with the IEEEStd 1149.1-2013 protocol standard, including five interface signals: TCK, nRESET, TMS, TDI, and TDO. TCK and nRESET are clock and reset, TMS is used to jump the controller JTAG state machine, and TDI and TDO are serial input and output data respectively. Figure 2 As shown, a complete JTAG access is generally divided into two stages: IR register access and DR register access. IR register access is used to determine the index of the target register to be accessed, and DR register access is to write or read the value of the target register.
[0022] 1. IR register access
[0023] The TMS signal controls the JTAG state machine to jump directly from IDLE to Select-IR. Capture-IR puts the IR value of the last access from the IR register into the scan chain. Shift-IR shifts the IR value of this access from TDI into the scan chain and outputs the IR value of the last access through TDO. Finally, Update-IR puts the IR value of this access from the scan chain into the IR register. In this way, the index of the target register to be accessed is written into the IR register, that is, which target register to be accessed is determined.
[0024] 2. DR register access
[0025] The TMS signal controls the JTAG state machine to jump to Select-DR. Capture-DR puts the DR value of the last access from the DR register into the scan chain. Shift-DR shifts the DR value of this access into the scan chain and outputs the DR value of the last access through TDO. Finally, Update-DR puts the DR value of this access from the scan chain into the DR register. In this way, the read and write data of the target register are processed. The write data is input from TDI and written to the target register, and the read data is output from TDO in the next Shift-DR stage.
[0026] The ACCESS register bit field of the debug interface module contains a 16-bit address, a 32-bit data, and a 2-bit operation type. The interface conversion module converts the value of the ACCESS register into the corresponding APB bus access operation and accesses the debug module register. The address and data of the APB access are determined by address and data. The operation type is divided into read, write, and no operation. The ACCESS register bit field of the debug interface module is shown in the following table:
[0027]
[0028] Generally speaking, the five-stage pipeline processing system of the processor includes instruction fetch, decoding, execution, memory access and write-back stages. In debug mode, the pipeline of the processor is in a paused state. At this time, the instruction to be executed is downloaded directly to the instruction cache queue of the instruction fetch stage through the programmable buffer, and then the valid signal is pulled high to execute the debug instruction alone. The three instruction programmable buffers are implemented in different forms, but they can all download the instructions that the software debugger wants to execute to the instruction fetch queue, such as Figure 3 shown.
[0029] 1. Debug module instruction transfer ITR register
[0030] In debug mode, write the instruction you want to execute to the ITR register. The debug module will directly download the instruction to the instruction fetch cache queue of the processor pipeline and then execute the instruction through the pipeline. The ITR register bit field of the debug module is shown in the following table, which contains the 32-bit instruction itr.
[0031]
[0032] 2. Debug module program buffer PB[0:15] register group
[0033] In debug mode, write the program you want to execute (no more than 16 instructions) into the PB[0:15] register group in advance. The PB register bit field is shown in the following table and contains 32-bit instruction data.
[0034]
[0035] Then configure the instruction length bit to inform the hardware of the number of instructions it wants to execute. The instruction length bit is located in the abstract command control and status register of the debug module. Its bit field is shown in the following table and contains the 5-bit instruction number progbufsize.
[0036]
[0037] Finally, configure the execution bit. The debug module will download the instructions in the program buffer register group to the pipeline for execution one by one according to the configured number of instructions. The execution bit of the program buffer is located in the abstract command register, and its bit field is shown in the following table. Control contains the execution bit of the program buffer.
[0038]
[0039] 3. Abstract commands for debugging modules
[0040] The abstract command configures the abstract command CMD register and the abstract data DATA[0:N] register group to allow the debug module to automatically generate fixed-format instructions that can be executed by the processor, then download them to the instruction fetch cache queue of the processor pipeline and execute the instructions through the pipeline.
[0041] The instruction type of the abstract command is determined by cmdtype, as shown in Table 5. It is generally divided into accessing the processor register and accessing the memory space. When the abstract instruction accesses the processor register, the register index value is configured through the control bit field, and the register data is configured or returned through the abstract data register data0. When the abstract instruction accesses the memory space, the address and data are configured or returned through the abstract data registers data0 and data1, as shown in the following table.
[0042]
[0043] Finally, through the design of three instruction programmable buffers in the debugging module, software debuggers can more conveniently and quickly let the processor run specific instructions in debug mode, thereby debugging software and hardware functions. These three designs can be used alone or in conjunction with each other. The instruction transfer ITR register used alone is similar to single-step debugging; the program buffer register group and abstract commands can be used in conjunction. For example, a program running in the program buffer will use the general registers of the processor, so the general register values can be pre-configured using abstract commands.
[0044] Obviously, the above embodiments are merely examples for clear explanation and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived from these are still within the protection scope of the invention.
Claims
1. An instruction programmable buffer design system based on a processor debugging architecture, wherein the processor core system constructed in the design system is the basic framework of this application, serving the instruction programmable buffer, characterized in that: The processor core system includes a debugging interface module, an interface conversion module, and a debugging module, wherein an instruction programmable buffer design is added to the hardware design of the debugging module to provide a way for software debuggers to download instructions to the processor core for execution in the debugging mode; The debugging interface module includes a serial input data interface signal, an output data interface signal and an internal register group, and is used to receive a serial data sequence from a processor external debugger and convert it into a register access operation according to the protocol agreement; The register group provided in the interface conversion module includes an operation ACCESS register, and the bit field of the register is divided into three parts: address, data and read / write type; the interface conversion module converts the operation ACCESS register value into a parallel bus access according to the agreed format, and the address, data and read / write type of the parallel bus access operation are all determined by the operation ACCESS register value; The debugging module is provided with a parallel bus interface, wherein the parallel bus interface realizes parallel bus communication with the interface conversion module.
2. The instruction programmable buffer design system based on processor debugging architecture according to claim 1, characterized in that: The selection of the internal register group in the debugging interface module is realized by the jump of the state machine, the serial input data interface signal includes the data written into the register, and the serial output data interface signal includes the register data returned to the outside.
3. The instruction programmable buffer design system based on processor debugging architecture according to claim 1, characterized in that: The debugging module implements a register group related to processor debugging, and is directly connected to the processor core through hardware control and data signals. These control and data signals can realize all debugging functions of the debugging module on the processor core; three methods of controlling the processor to run instructions through the hardware debugging module in debugging mode are provided. In debugging mode, instructions or programs in the instruction programmable buffer can be directly downloaded to the instruction fetch cache queue of the processor pipeline and executed.
4. The instruction programmable buffer design system based on processor debugging architecture according to claim 1, characterized in that: The debugging module is also provided with an instruction transfer register which can store at most one 32-bit instruction. When the instruction to be executed is written into the register, the debugging module will directly download the instruction to the instruction fetch cache queue of the processor pipeline and then execute the instruction through the pipeline.
5. The instruction programmable buffer design system based on processor debugging architecture according to claim 1, characterized in that: The debug module is also provided with a program buffer register group that can store up to 16 32-bit instructions. A program that you want to execute, which does not exceed 16 instructions, is written into the register group in advance, and then the instruction length bit is configured to notify the hardware of the number of instructions you want to execute. Finally, the execution bit is configured. The debug module will download the instructions in the program buffer register group to the pipeline for execution one by one according to the configured number of instructions.
6. The instruction programmable buffer design system based on processor debugging architecture according to claim 1, characterized in that: The debugging module also includes an abstract command CMD and an abstract data DATA[0:N] register group. The abstract command actually configures the above registers to allow the debugging module to automatically generate fixed-format instructions executable by the processor, and then downloads them to the instruction fetch cache queue of the processor pipeline and executes the instruction through the pipeline.
7. The instruction programmable buffer design system based on processor debugging architecture according to claim 6, characterized in that: The instructions are divided into two types: accessing the processor's registers and accessing the memory space. The abstract command type is configured through the abstract command register. When the abstract instruction accesses the processor register, the register index value is configured through the abstract command register, and the register data is configured or returned through the abstract data register. When the abstract instruction accesses the memory space, the address and data are configured or returned through different abstract data registers.
