Testing method, device, equipment and readable storage medium for debugging module

By building software simulation models and test cases in the test platform, the testing process of debugging modules is simplified, the cumbersome testing problems in the existing technology are solved, and the testing convenience and efficiency are improved.

CN118363873BActive Publication Date: 2024-11-08BEIJING INSTITUTE OF OPEN SOURCE CHIP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410781134.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-18
Publication Date
2024-11-08
Estimated Expiration
2044-06-18

AI Technical Summary

Technical Problem

The testing process of debugging modules in the prior art is complicated, and it is necessary to build complex debugging scenarios and build a variety of debugging commands and kernel codes.

Method used

By building software simulation models in the test platform, including JTAG read and write models, processor core models and memory models, we obtain target test tasks, build target test cases, and test debug modules based on these use cases, avoiding the construction of real scenarios and manual design of test cases requirements.

Benefits of technology

It simplifies the testing process of debugging modules, improves the convenience of scenario construction and test case construction, and reduces the complexity and time cost of testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118363873B_ABST
    Figure CN118363873B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a debugging module testing method, device, equipment and readable storage medium, the method comprising: constructing a software simulation model running in the test platform; the software simulation model comprises a JTAG read-write model for testing registers in the debugging module, a processor core model for testing data reading and writing, and a memory model for testing memory access; according to the type of the software simulation model, respectively obtaining target test tasks corresponding to different types in a preset test task library; there is at least one pre-constructed test task in the test task library; according to the target test task, constructing a target test case of the debugging module; based on the target test case, testing the debugging module. The present invention can improve the testing convenience of the debugging module.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a testing method, device, electronic equipment and readable storage medium for a debugging module. Background Art

[0002] During the development of the processor, the processor will be returned to the chip at the end of the development, which means that the chip will be packaged and assembled as a whole. After the chip is returned, it is difficult to observe the internal operating status of the processor. It is necessary to use the on-chip debug module (DM) to read and write the processor's registers, memory, and perform other control operations to understand the internal status of the processor. Therefore, it is necessary to ensure that the on-chip debug module has relevant read, write and control functions.

[0003] At present, the debugging scenario is built, which includes the host computer, on-chip debugging module and processor core, and the debugging commands input by the host computer to the on-chip debugging module and the code use cases on the kernel side are constructed to test the on-chip debugging module.

[0004] However, the current solution not only requires the construction of a specific scenario of a host computer, an on-chip debugging module, and a processor core, but also requires the construction of related debugging commands and kernel codes separately, which makes the testing process of the on-chip debugging module very cumbersome. Summary of the invention

[0005] The embodiments of the present invention provide a debugging module testing method, device, electronic device and readable storage medium, which can solve the problem of cumbersome debugging module testing process in related technologies.

[0006] In order to solve the above problem, an embodiment of the present invention discloses a debugging module testing method, which is applied to a testing platform, wherein the testing platform is connected to the debugging module, and the method includes:

[0007] Constructing a software simulation model running in the test platform; the software simulation model includes a JTAG read-write model for testing registers in the debug module, a processor core model for testing data reading and writing, and a memory model for testing memory access;

[0008] According to the type of the software simulation model, target test tasks corresponding to different types are respectively obtained in a preset test task library; the test task library has at least one pre-built test task;

[0009] According to the target test task, construct the target test case of the debugging module;

[0010] The debugging module is tested based on the target test case.

[0011] Optionally, the step of constructing a target test case of the debugging module according to the target test task includes:

[0012] According to the target test tasks corresponding to the JTAG read-write model, the processor core model and the memory model, corresponding sub-test cases are constructed respectively;

[0013] Based on the sub-test case, a target test case including the sub-test case is obtained.

[0014] Optionally, a reference model is also run in the test platform; the step of testing the debugging module based on the target test case includes:

[0015] Inputting the target test case into the debugging module and the reference model, and acquiring the test data output by the debugging module and the reference data output by the reference model;

[0016] The test data is compared with the reference data, and a test result is generated according to the comparison result.

[0017] Optionally, the step of inputting the target test case into the debugging module and the reference model, and acquiring the test data output by the software simulation model and the reference data output by the reference model includes:

[0018] Inputting the target test case into the software simulation model to obtain a test signal output by the software simulation model;

[0019] Inputting the test signal into the debugging module to obtain the test data output by the debugging module;

[0020] The test signal is input into the reference model to obtain reference data output by the reference model.

[0021] Optionally, the target test case includes sub-test cases corresponding to each software simulation model; the step of inputting the target test case into the software simulation model to obtain a test signal output by the software simulation model includes:

[0022] In the target test case, determining sub-test cases corresponding to different software simulation models respectively;

[0023] The sub-test case is input into the corresponding software simulation model to obtain the test signal output by the software simulation model.

[0024] Optionally, the software simulation model is the JTAG read-write model, and the sub-test cases corresponding to the JTAG read-write model include a register address setting task and a register reading task;

[0025] The step of inputting the target test case into the software simulation model and obtaining the test signal output by the software simulation model comprises:

[0026] Inputting the sub-test case into the JTAG read-write model, executing the register address setting task through the JTAG read-write model, and obtaining the address setting signal output by the JTAG read-write model;

[0027] The register reading task is performed through the JTAG read-write model to obtain the target register reading signal output by the JTAG read-write model.

[0028] Optionally, the step of inputting the test signal into the debugging module and obtaining the test data output by the debugging module includes:

[0029] The address setting signal is input to the debugging module to obtain the target address output by the debugging module; the debugging module is used to set the value of the instruction register in the debugging module to the target register address in response to the address setting signal;

[0030] The target register read signal is input into the debugging module to obtain the value of the target register output by the debugging module; the debugging module is used to respond to the target register read signal and read and output the value of the target register according to the target register address indicated by the instruction register.

[0031] Optionally, the software simulation model is the processor core model, and the sub-test cases corresponding to the processor core model include a data writing task and a data reading task;

[0032] The step of inputting the sub-test case into the corresponding software simulation model and obtaining the test signal output by the software simulation model comprises:

[0033] Inputting the sub-test case into the processor core model, executing the data writing task through the processor core model, and obtaining the data writing signal and the data to be written output by the processor core model;

[0034] The data reading task is performed through the JTAG read-write model to obtain the data reading signal output by the processor core model.

[0035] Optionally, the step of inputting the test signal into the debugging module and obtaining the test data output by the debugging module includes:

[0036] Inputting the data write signal and the data to be written into the debugging module, and obtaining a write confirmation signal output by the debugging module; the debugging module is used to generate and output the write confirmation signal after writing the data to be written into the preset storage area;

[0037] The data read signal is input into the debugging module to obtain the target data output by the debugging module; the debugging module is used to read and output the target data according to the data read signal.

[0038] Optionally, the software simulation model is the memory model and the JTAG read-write model, the first sub-test case corresponding to the memory model includes a memory modeling task, and the second sub-test case corresponding to the JTAG read-write model includes a data reading task;

[0039] The step of inputting the sub-test case into the corresponding software simulation model and obtaining the test signal output by the software simulation model comprises:

[0040] Inputting the first sub-test case into the memory model, executing the memory modeling task through the memory model to construct a simulated memory; the simulated memory stores a preset value;

[0041] The second sub-test case is input into the JTAG read-write model, the data reading task is performed through the JTAG read-write model, and a data reading signal output by the JTAG read-write model is obtained.

[0042] Optionally, the step of inputting the test signal into the debugging module and obtaining the test data output by the debugging module includes:

[0043] The data read signal is input into the debugging module to obtain the preset value output by the debugging module; the debugging module is used to read and output the preset value in the simulation memory according to the data read signal.

[0044] On the other hand, an embodiment of the present invention discloses a testing device for a debugging module, which is applied to a testing platform, wherein the testing platform is connected to the debugging module, and the device comprises:

[0045] A model building module, used to build a software simulation model running in the test platform; the software simulation model includes a JTAG read-write model for testing registers in the debug module, a processor core model for testing data reading and writing, and a memory model for testing memory access;

[0046] A test task module, used to obtain target test tasks corresponding to different types in a preset test task library according to the type of the software simulation model; the test task library has at least one pre-built test task;

[0047] A test case module, used to construct a target test case of the debugging module according to the target test task;

[0048] The debugging test module is used to test the debugging module based on the target test case.

[0049] Optionally, the step of constructing a target test case of the debugging module according to the target test task includes:

[0050] According to the target test tasks corresponding to the JTAG read-write model, the processor core model and the memory model, corresponding sub-test cases are constructed respectively;

[0051] Based on the sub-test case, a target test case including the sub-test case is obtained.

[0052] Optionally, a reference model is also run in the test platform; a debugging test module includes:

[0053] A reference data submodule, used for inputting the target test case into the debugging module and the reference model, and obtaining the test data output by the debugging module and the reference data output by the reference model;

[0054] The comparison test submodule is used to compare the test data with the reference data and generate a test result according to the comparison result.

[0055] Optional, reference data submodule, including:

[0056] A test signal unit, used to input the target test case into the software simulation model and obtain a test signal output by the software simulation model;

[0057] A test data unit, used for inputting the test signal into the debugging module and obtaining the test data output by the debugging module;

[0058] A reference data unit is used to input the test signal into the reference model to obtain reference data output by the reference model.

[0059] Optionally, the target test case includes sub-test cases corresponding to each software simulation model; the test signal unit includes:

[0060] Respectively determining sub-units for determining sub-test cases corresponding to different software simulation models in the target test case;

[0061] The sub-test case input sub-unit is used to input the sub-test case into the corresponding software simulation model and obtain the test signal output by the software simulation model.

[0062] Optionally, the software simulation model is the JTAG read-write model, and the sub-test cases corresponding to the JTAG read-write model include a register address setting task and a register reading task;

[0063] Test signal unit, comprising:

[0064] An address setting signal subunit, used for inputting the sub-test case into the JTAG read-write model, executing the register address setting task through the JTAG read-write model, and obtaining the address setting signal output by the JTAG read-write model;

[0065] The target read signal subunit is used to execute the register read task through the JTAG read-write model and obtain the target register read signal output by the JTAG read-write model.

[0066] Optional, test data unit, including:

[0067] An address setting data subunit is used to input the address setting signal into the debugging module to obtain the target address output by the debugging module; the debugging module is used to set the value of the instruction register in the debugging module to the target register address in response to the address setting signal;

[0068] The target read data subunit is used to input the target register read signal into the debug module to obtain the value of the target register output by the debug module; the debug module is used to respond to the target register read signal and read and output the value of the target register according to the target register address indicated by the instruction register.

[0069] Optionally, the software simulation model is the processor core model, and the sub-test cases corresponding to the processor core model include a data writing task and a data reading task;

[0070] Test signal unit, comprising:

[0071] A data writing signal subunit, used for inputting the sub-test case into the processor core model, executing the data writing task through the processor core model, and obtaining the data writing signal and the data to be written output by the processor core model;

[0072] The first read signal subunit is used to execute the data read task through the JTAG read-write model and obtain the data read signal output by the processor core model.

[0073] Optional, test data unit, including:

[0074] A data writing subunit, inputting the data writing signal and the data to be written into the debugging module, and obtaining a writing confirmation signal output by the debugging module; the debugging module is used to generate and output the writing confirmation signal after writing the data to be written into the preset storage area;

[0075] The data reading subunit is used to input the data reading signal into the debugging module to obtain the target data output by the debugging module; the debugging module is used to read and output the target data according to the data reading signal.

[0076] Optionally, the software simulation model is the memory model and the JTAG read-write model, the first sub-test case corresponding to the memory model includes a memory modeling task, and the second sub-test case corresponding to the JTAG read-write model includes a data reading task;

[0077] Test signal unit, comprising:

[0078] A simulated memory subunit, used for inputting the first sub-test case into the memory model, and executing the memory modeling task through the memory model to construct a simulated memory; the simulated memory stores preset values;

[0079] The second read signal sub-unit is used to input the second sub-test case into the JTAG read-write model, execute the data read task through the JTAG read-write model, and obtain the data read signal output by the JTAG read-write model.

[0080] Optional, test data unit, including:

[0081] The memory data subunit is used to input the data reading signal into the debugging module to obtain the preset value output by the debugging module; the debugging module is used to read and output the preset value in the analog memory according to the data reading signal.

[0082] On the other hand, an embodiment of the present invention further discloses an electronic device, which includes a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store executable instructions, and the executable instructions enable the processor to execute the test method of the aforementioned debugging module.

[0083] The embodiment of the present invention further discloses a readable storage medium. When instructions in the readable storage medium are executed by a processor of an electronic device, the electronic device can execute the aforementioned testing method of the debugging module.

[0084] The embodiment of the present invention includes the following advantages: by constructing a software simulation model running in a test platform; the software simulation model includes a JTAG read-write model for testing and reading registers in a debug module, a processor core model for testing data reading and writing, and a memory model for testing memory access; according to the type of the software simulation model, in a preset test task library, target test tasks corresponding to different types are obtained respectively; there is at least one pre-constructed test task in the test task library; according to the target test task, a target test case of the debug module is constructed; based on the target test case, the debug module is tested. On the one hand, a virtual software simulation model including a JTAG read-write model, a processor core model, and a memory model can be constructed in the test platform, without the need for an actual host computer and a processor core, avoiding the need to construct a real debugging scene, and improving the convenience of scene construction; on the other hand, according to different software simulation models, the test tasks corresponding to the software simulation model can be determined in the preset test task library to form a test case, and then based on the test case and the test platform, the debug module is directly debugged, avoiding the need to manually design different test cases according to different debugging scenarios, improving the convenience of test case construction, and ultimately improving the convenience of debugging module testing. BRIEF DESCRIPTION OF THE DRAWINGS

[0085] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0086] Figure 1 It is a structural schematic diagram of the existing debugging scenario of the present invention;

[0087] Figure 2 is a flowchart of the steps of an embodiment of a method for testing a debugging module of the present invention;

[0088] Figure 3 is a schematic diagram of the test platform of the present invention and its software simulation model;

[0089] Figure 4 It is a structural schematic diagram of the test platform of the present invention;

[0090] Figure 5 is a bit field schematic diagram of a target register of the present invention;

[0091] Figure 6 It is an interaction timing diagram of the JTAG read-write model and the debugging module of the present invention;

[0092] Figure 7 is an interactive timing diagram of the read-write direct media interface of the present invention;

[0093] Figure 8 It is an interactive timing diagram of the JTAG read-write model, the processor core model and the debugging module of the present invention;

[0094] Fig. 9 It is an interactive timing diagram of the JTAG read-write model, memory model and debugging module of the present invention;

[0095] Fig.10 is a structural block diagram of a test device for a debugging module provided by an example of the present invention;

[0096] Fig.11 It is a structural block diagram of an electronic device for testing a debugging module provided by an example of the present invention. DETAILED DESCRIPTION

[0097] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0098] The terms "first", "second", etc. in the specification and claims of the present invention are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable when appropriate, so that the embodiments of the present invention can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, the term "and / or" in the specification and claims is used to describe the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. In the embodiments of the present invention, the term "multiple" refers to two or more, and other quantifiers are similar.

[0099] The debugging module is a functional module used to perform memory debugging on the processor cores and related on-chip components, including core operation control, register access, memory access, breakpoint debugging, and single-step debugging functions. The on-chip debugging module is a protocol converter, data exchange path, and control path between the processor core and the remote debugging host computer. Therefore, if you want to observe the operating status of the processor core and debug the core through the debugging module, you need to perform pre-functional verification of the on-chip debugging module.

[0100] The current testing process is to construct a debugging scenario and use a debugging host computer (Debug Host) for debugging. The debugging host computer is the computer and its related programs that serve as the main control during debugging. The debugging host computer generates enough signal stimulation input to the debugging module through a large number of test cases to verify that the debugging module has the function of interacting with the processor core and memory. This testing process requires the construction of a corresponding code compilation environment to construct binary code cases on the processor core side, and the construction of corresponding host computer debugging commands. The process is relatively cumbersome.

[0101] like Figure 1 , which is a schematic diagram of the structure of an existing debugging scenario provided by an embodiment of the present invention; Figure 1 The system includes a host computer 101, an interface 102, a debugging module 103 and a processor core 104. The host computer 101 inputs a test stimulus to the debugging module 103 through the interface 102, and the debugging module 103 includes a debugging conversion module. The debugging module 103 interacts with the processor core 104 based on the test stimulus. The processor core 104 is a fifth-generation reduced instruction set computer (RISC-V, Reduced Instruction Set Computer RISC V) processor core.

[0102] Method Embodiment

[0103] Reference Figure 2 , shows a flowchart of a method for testing a debugging module according to an embodiment of the present invention, which is applied to a testing platform, wherein the testing platform is connected to the debugging module, and the method may specifically include the following steps:

[0104] Step 201, construct a software simulation model running in the test platform; the software simulation model includes a JTAG read and write model for testing registers in the debug module, a processor core model for testing data reading and writing, and a memory model for testing memory access.

[0105] Among them, the software simulation model is established to simulate the operating environment of the module to be tested.

[0106] In an embodiment of the present invention, a test platform can be written based on the Universal Verification Methodology (UVM) library provided by the Register-Transfer Level (RTL) simulation tool. The UVM library is a verification platform development framework based on the SV language (System Verilog) class library. The reusable components in the library can be used to build a functional verification environment with a standardized hierarchy and interface. The test platform can be connected to a debugging module, i.e., an on-chip debugging module. The debugging module can be composed of the top layer of the on-chip debugging module and all its referenced submodules. The debugging module can also be called a device under testing (DUT).

[0107] A software simulation model running in the test platform can be built based on the SV language. The software simulation model can be a JTAG read-write model, which can communicate and interact with the debug module through the Joint Test Action Group (JTAG) interface; the software simulation model can be a processor core model, which can be a system bus software module and can have a bus master function (master). The processor core model is used to simulate the operation of the processor core, such as the central processing unit (CPU) on the system bus, and the processor core model also communicates with the debug module through the interface. The software simulation model can be a memory model, which can also be a system bus software module and can have a bus slave function (slave) to simulate the operation of the memory, such as the memory, on the system bus, and the memory model also communicates with the debug module through the interface.

[0108] Figure 3 Schematic diagram of a debugging module and a software simulation model provided by an embodiment of the present invention: Figure 3 The JTAG read / write model 301, the processor core model 302, and the memory model 303 are included. The JTAG read / write model 301, the processor core model 302, and the memory model 303 are all connected to the debugging module 304 and communicate with the debugging module 304. Figure 3 The software simulation model overcomes the disadvantage of introducing real processors and real memory, which makes compilation and operation slow. The bus functional model achieves the same purpose. It is no longer necessary to build a verification platform across programming languages, making the compilation and operation of the test platform fast.

[0109] Step 202, according to the type of the software simulation model, respectively obtain target test tasks corresponding to different types in a preset test task library; the test task library has at least one pre-built test task;

[0110] In an embodiment of the present invention, the types of software simulation models may include three types, namely, JTAG read-write model, processor core model, and memory model. There is at least one pre-built test task in the test task library, and the test task is used to generate a test stimulus, i.e., a test signal, when executed by the software simulation model. There may be different test tasks for different software simulation models, i.e., each software simulation model may execute different test tasks. According to the type of software simulation model, target test tasks corresponding to different types are obtained in the test task library respectively.

[0111] For example, for the JTAG read-write model, since the JTAG interface can be used to communicate with the debug module, the JTAG interface can output the test clock signal (TCK, Test Clock), test mode selection signal (TMS, TestMode Select), test data input signal (TDI, Test Data In), test data output signal (TDO, Test Data Out), and asynchronous reset output signal JTAG_reset signal. For these signals, there can be corresponding test tasks, for example, there can be clock signal tasks, and the specific implementation of the clock signal task is as follows:

[0112] task tck_generator(JTAG_vif);

[0113] JTAG_vif.tck<= 0;

[0114] forever begin

[0115] #rand_ns JTAG_vif.tck<= ~ JTAG_vif .tck;

[0116] end

[0117] endtask

[0118] The above clock signal task indicates that the clock signal output in the JTAG interface is first assigned a low level, and then enters a loop to continuously invert the clock output signal in the JTAG interface at intervals.

[0119] TMS is a single-bit state control signal. Together with TCK, it constitutes the condition for the state transfer of the JTAG test access port (TAP) state machine inside the debug module. The TMS signal is sampled and takes effect on the rising edge of TCK.

[0120] It can also include the following tasks: task run_idle(), used to keep the JTAG TAP state machine in an idle state; task reset_by_tms(), used to operate the tms signal to reset the JTAG TAP; task reset_by_reset(), used to operate the reset signal to reset the debug module as a whole; task set_ir(bit[4:0] reg_addr,bitfrom_logic_reset), used to select different operations to set the instruction register according to the initial state of the JTAG TAP state machine; task bypass(), used to select the bypass register and scan it; task read_idcode(), used to scan and read the identification code register (IDCODE); task read_dtmcs(), used to scan and read the transport module control and status (DTMCS, Debug Transport Module Control State) register; task set_dmi(7'haddr, 32'hdata,2'hopcode), used to scan and set the direct media interface (DMI, Direct Media Interface) register; task read_dmi() is used to scan and read the DMI interface registers.

[0121] Among them, the IDCODE register is used to identify the processor manufacturer and the version supported by the on-chip debugging module; the DMI register is used to obtain the core status information, core operation control, and data and instruction exchange to which the on-chip debugging module is connected; the DTMCS register stores the address width and debugging clock number information of the DMI interface.

[0122] For the processor core model, the test tasks may include task bus_write(), which is used to initiate a write request on the bus, determine the write handshake and transmit the write data; task bus_read(), which is used to initiate a read request on the bus, determine the read handshake and receive the read data. For the memory model, the test tasks may include task set_sbcs(), which is used to set the System Bus Access Control and Status (SBCS) register. It is understandable that the above test tasks are only examples, and the test tasks can be modified or added according to specific test needs.

[0123] Step 203, constructing a target test case of the debugging module according to the target test task;

[0124] In the embodiment of the present invention, according to different software simulation models, the target test task obtained in the test task library can be used to construct a test case used when testing the debugging module. The target test case includes the test task obtained in step 102.

[0125] It is understandable that the test task library may also include test cases, which already include several test tasks. Then, when obtaining the target test task to build the target test case, more complex test cases can be built directly based on the existing test cases to achieve complex debugging test functions, such as building more complex test cases through class inheritance.

[0126] Step 204: testing the debugging module based on the target test case.

[0127] In an embodiment of the present invention, the debugging module is tested based on the target test case, and the target test case can be directly input into the debugging module, and the debugging module responds to the target test case to execute the test task to complete the test of the debugging module. Alternatively, the test user is input into the software simulation model, and the software simulation model outputs a test signal after executing the test task, and then the test signal is input into the debugging module, and the debugging module responds to the test signal to perform corresponding operations to complete the test. How to test the debugging module based on the target test case is not specifically limited here.

[0128] In summary, the embodiments of the present invention include the following advantages: by constructing a software simulation model running in a test platform; the software simulation model includes a JTAG read-write model for testing and reading registers in a debug module, a processor core model for testing data reading and writing, and a memory model for testing memory access; according to the type of the software simulation model, in a preset test task library, target test tasks corresponding to different types are obtained respectively; there is at least one pre-built test task in the test task library; according to the target test task, a target test case of the debug module is constructed; based on the target test case, the debug module is tested. On the one hand, a virtual software simulation model including a JTAG read-write model, a processor core model, and a memory model can be constructed in the test platform, without the need for an actual host computer and a processor core, avoiding the need to construct a real debugging scenario, and improving the convenience of scenario construction; on the other hand, according to different software simulation models, the test task corresponding to the software simulation model can be selected in the preset test task library to form a test case, and then based on the test case and the test platform, the debug module is directly debugged, avoiding the need to manually design different test cases according to different debugging scenarios, improving the convenience of test case construction, and ultimately improving the convenience of debugging module testing.

[0129] Optionally, step 203: constructing a target test case of the debugging module according to the target test task may include:

[0130] Step 2031, construct corresponding sub-test cases according to the target test tasks corresponding to the JTAG read-write model, the processor core model and the memory model;

[0131] Step 2032: Based on the sub-test case, obtain a target test case including the sub-test case.

[0132] In an embodiment of the present invention, when the software simulation model includes a JTAG read / write model, a processor core model, and a memory model, the corresponding target test task can be obtained according to each type of software simulation model. Then, according to the target test task corresponding to each type of software simulation model, sub-test cases corresponding to the JTAG read / write model, the processor core model, and the memory model can be constructed. Based on the sub-test cases, a target test case including several sub-test cases is obtained.

[0133] By implementing the embodiment of the present invention, corresponding sub-test cases are constructed respectively through the target test tasks corresponding to the JTAG read-write model, the processor core model and the memory model, and a target test case including the sub-test cases is obtained. In the subsequent test case execution, different sub-test cases can be assigned to different software simulation models, so that some software simulation models are prevented from executing the test tasks that other models should execute, thereby improving the accuracy of testing the debugging module.

[0134] Optionally, a reference model is also running in the test platform; Step 204: Testing the debugging module based on the target test case includes:

[0135] Step 2041, input the target test case into the debugging module and the reference model, and obtain the test data output by the debugging module and the reference data output by the reference model;

[0136] Step 2042, compare the test data with the reference data, and generate a test result based on the comparison result.

[0137] In the embodiment of the present invention, the reference model may also be a software simulation model constructed in the test platform based on the SV language. The reference model is based on the test case, outputs the reference result corresponding to the test case, and the reference result can be used as the correct answer corresponding to the test case.

[0138] The target test case can be input into the debugging module and the reference model respectively, and the test data output by the debugging module and the reference data output by the reference model can be obtained. After receiving the test case, the debugging module can execute the test case, and then respond to the test case based on the internal hardware structure to obtain the output test data. After receiving the test case, the debugging module can directly obtain the reference data corresponding to the test case based on the software calculation method.

[0139] For example, a test case can be to instruct the debug module to read a register data of the processor core. After receiving the test case, the debug module needs to perform a debugging process based on the internal hardware structure example and the RISC-V debug specification, and finally obtain the register data in the processor, i.e., the test data. The reference model can directly extract the relevant parameters of the register read in the test case, and directly obtain the result, i.e., the reference data, from the processor core model.

[0140] At this time, the test data is compared with the reference data. If the test data is consistent with the reference data, it is considered that the relevant functions of the debugging module are normal, that is, the test of the relevant functions has passed; if the test data is inconsistent with the reference data, it is considered that the relevant functions of the debugging module cannot work normally, that is, the test of the relevant functions has failed.

[0141] In addition, the test platform may also include a counter, which is used to score according to the comparison result between the test result and the addition result. When the test result is consistent with the addition result, 0 points are scored; when the test result is inconsistent with the addition result, 1 point is scored. Finally, the counter can count the errors in the debugging module.

[0142] Figure 4 is a schematic diagram of the structure of a test platform provided by an embodiment of the present invention; Figure 4 The test platform 40 includes a JTAG read / write model 401, a processor core model 402, a memory model 403, a debugging module 404, a reference model 405, and a counter 406. The JTAG read / write model 401, the processor core model 402, and the memory model 403 input test signals to the reference model 405 and the debugging module 404, and the reference model 405 and the debugging module 404 input test data to the counter 406.

[0143] Optionally, step 2041: inputting the target test case into the debugging module and the reference model, and acquiring the test data output by the software simulation model and the reference data output by the reference model may include:

[0144] Step A1, inputting the target test case into the software simulation model, and obtaining a test signal output by the software simulation model;

[0145] Step A2, inputting the test signal into the debugging module, and obtaining the test data output by the debugging module;

[0146] Step A3: input the test signal into the reference model to obtain reference data output by the reference model.

[0147] In an embodiment of the present invention, the target test case may be input into the JTAG read / write model, the processor core model and the memory model, and the JTAG read / write model, the processor core model and the memory model may execute the corresponding partial test case after receiving the target test case, that is, execute the test tasks in the corresponding partial test case. The execution of each test task generates at least one test signal.

[0148] The test platform obtains the test signal output by the software simulation model, inputs the test signal into the debugging module, and obtains the test data output by the debugging module. It is understandable that the order in which the respective test cases are executed between the software simulation models may be different. For example, each software simulation model obtains the target test case, and the JTAG read-write model may first execute the test task corresponding to its own type in the target test case, and then the test signal output by the JTAG read-write model may be first obtained, and the signal may be input into the debugging module and the reference model. Then, the processor core model may execute the test task corresponding to its own type in the target test case. Similarly, the processor core model finally executes the test task corresponding to its own type in the target test case. Through the sequential execution of the JTAG read-write model, the processor core model and the memory model, a large number of test signals are avoided from being input into the debugging module at the same time, thereby reducing the signal processing pressure of the debugging module.

[0149] Optionally, the target test case includes sub-test cases corresponding to each software simulation model; Step A1: the step of inputting the target test case into the software simulation model and obtaining the test signal output by the software simulation model includes:

[0150] Step B1, in the target test case, determining sub-test cases corresponding to different software simulation models respectively;

[0151] Step B2: input the sub-test case into the corresponding software simulation model to obtain the test signal output by the software simulation model.

[0152] In the embodiment of the present invention, the target test case is input into the software simulation model by first splitting the target test case according to the type of the software simulation model to obtain sub-test cases corresponding to each software simulation model, and then inputting the sub-test cases into the corresponding JTAG read-write model, processor core model and memory model.

[0153] Each software simulation model will only obtain its own corresponding sub-test cases and execute these sub-test cases to output test signals.

[0154] The embodiment of the present invention is implemented by determining the sub-test cases corresponding to different software simulation models in the target test case; inputting the sub-test cases into the corresponding software simulation model, and obtaining the test signal output by the software simulation model. This can avoid the software simulation model from being unable to determine the test task corresponding to its own type from the complete target test case, thereby avoiding the specific software simulation model from executing the wrong test task, and improving the accuracy of testing the debugging module.

[0155] Optionally, the software simulation model is the JTAG read-write model, and the sub-test cases corresponding to the JTAG read-write model include a register address setting task and a register reading task;

[0156] Step A1: inputting the sub-test case into the corresponding software simulation model to obtain the test signal output by the software simulation model, including:

[0157] Step A11, inputting the sub-test case into the JTAG read-write model, executing the register address setting task through the JTAG read-write model, and acquiring the address setting signal output by the JTAG read-write model;

[0158] Step A12, executing the register reading task through the JTAG read-write model, and obtaining the target register reading signal output by the JTAG read-write model.

[0159] In the embodiment of the present invention, when the software simulation model is a JTAG read-write model, the sub-test cases corresponding to the JTAG read-write model include a register address setting task and a register reading task. The sub-test cases including the register address setting task and the register reading task are input into the JTAG read-write model.

[0160] The JTAG read-write model can generate an address setting signal and obtain the address setting signal by executing a register address setting task; and can generate a target register read signal and obtain the address target register read signal by executing a register read task.

[0161] The register address setting task may be to set the register in the debug module, such as the instruction register. The address setting signal output by the JTAG read / write model when executing the register address setting task may be an address setting request, which may carry the content to be set to the register, and the content may be the address corresponding to the target register to be read. The target register may be a register in the debug transmission module, such as the IDCODE register and the DTMCS register. The debug transmission module is a submodule in the debug module, which is used to convert data of different formats and structures.

[0162] The JTAG read / write model executes a register read task. The target register read signal output by the JTAG read / write model when executing a register address setting task may be a register read request. The register read request may carry the address corresponding to the target register previously set.

[0163] Optionally, step A2: inputting the test signal into the debugging module to obtain the test data output by the debugging module includes:

[0164] Step A21, inputting the address setting signal into the debugging module to obtain the target address output by the debugging module; the debugging module is used to set the value of the instruction register in the debugging module as the target register address in response to the address setting signal;

[0165] Step A22, input the target register read signal to the debug module to obtain the value of the target register output by the debug module; the debug module is used to respond to the target register read signal and read and output the value of the target register according to the target register address indicated by the instruction register.

[0166] In an embodiment of the present invention, the debugging module receives an address setting signal, and according to the address corresponding to the target register carried in the address setting signal, sets the value of the instruction register to the address, for example, 0×01. After setting the instruction register, the debugging module can output the target address, and the JTAG read-write model can read the instruction register.

[0167] The debugging module continues to receive the target register read signal. The debugging module can obtain the register pointed to by the address, such as the IDCODE register and the DTMCS register, according to the address in the target register read signal, such as 0×01 or 0×10, and output the value of the register, which can be output through the JTAG interface. When the IDCODE and DTMCS registers are 32 bits, the JTAG read-write model can read the register value on the JTAG interface after shifting 32 bits.

[0168] Figure 5 It is a bit field diagram of the target register provided by the embodiment of the present invention; when the target register is an identification code register, the first bit field 5101 is used to indicate the hardware version information, the second bit field 5102 is used to indicate the production department, the third bit field 5103 is used to indicate the manufacturer, and the fourth bit field 5104 is used to indicate whether the relevant debugging protocol is supported. When the target register is a transmission conversion module control and status register, the fifth bit field 5201 is used to indicate the status of the transmission conversion module, and other bit fields (not shown) include: the abits bit field is used to indicate the address bit width of the DMI interface, the idle bit field is used to indicate the minimum interval between two DMI register scans, and the dmireset bit field and the dmihardreset bit field are used to reset the DMI interface.

[0169] Figure 6 It is an interaction timing diagram between the JTAG read-write model and the debugging module provided by an embodiment of the present invention;

[0170] Step S1, the JTAG read / write model inputs a test mode selection signal to reset the DTM module of the debugging module.

[0171] Step S2, the JTAG read / write model sets the instruction register to 0×01, which is the address of the identification code register;

[0172] Step S3, the debugging module returns the value of the instruction register, that is, the address of the identification code register;

[0173] Step S4, the JTAG read / write model inputs a signal to read the target register;

[0174] Step S5, the debugging module outputs the value of the target register, that is, the value of the identification code register;

[0175] Step S6, the JTAG read / write model sets the instruction register to 0×10, which is the address of the debug conversion module state and control register;

[0176] Step S7, the debugging module returns the value of the instruction register, that is, the debugging conversion module state and the address of the control register;

[0177] Step S8, the JTAG read / write model inputs a signal to read the target register;

[0178] Step S9: The debugging module outputs the value of the target register, that is, the debug conversion module state and the value of the control register.

[0179] After reading the DTMCS register, the DMI address width and idle clock number requirements of the verified on-chip debug module can be obtained, and then the DMI interface can be accessed. By reading and writing the debug registers mounted on the DMI interface, the status information of the core connected to the on-chip debug module can be obtained, the operation of the core can be controlled, and data and instructions can be exchanged.

[0180] Figure 7 is an interactive timing diagram of a read-write direct media interface provided by an embodiment of the present invention;

[0181] Step C1, the JTAG read / write model inputs a test mode selection signal to reset the DTM module of the on-chip debugging module.

[0182] Step C2, the JTAG read / write model sets the instruction register to 0×11, which is the address of the serial shift register of the direct media interface;

[0183] Step C3, the debugging module returns the value of the instruction register;

[0184] Step C4, the JTAG read / write model initiates a write direct media interface request, the address is 0x11, the request type is read, and the write value defaults to 0. This request is used to update the serial shift register;

[0185] Step C5, the debugging module outputs the last updated value of the serial shift register;

[0186] Step C6, the JTAG read / write model initiates a read direct media interface request;

[0187] Step C7: the debugging module outputs a return value.

[0188] Optionally, the software simulation model is the processor core model, and the sub-test cases corresponding to the processor core model include a data writing task and a data reading task; step A1: inputting the sub-test cases into the corresponding software simulation model to obtain the test signal output by the software simulation model, including:

[0189] Step A13, inputting the sub-test case into the processor core model, executing the data writing task through the processor core model, and acquiring the data writing signal and the data to be written output by the processor core model;

[0190] Step A14, executing the data reading task through the JTAG read-write model to obtain the data reading signal output by the processor core model.

[0191] In an embodiment of the present invention, when the software simulation model is a processor core model, the sub-test cases corresponding to the processor core model include a data writing task "task bus_write()" and a data reading task "task bus_read()". The sub-test cases including the data writing task and the data reading task are input into the processor core model.

[0192] The processor core model performs data writing tasks, and can generate data writing signals and data to be written. The processor core model initiates data writing signals on the bus, determines the write handshake and transmits the data to be written. The processor core model performs data reading tasks, generates and outputs data reading signals, determines the read handshake and accepts the read data. The processor core model can read and write the core operation status registers inside the debugging module, such as the exception status register (EXCEPTION). Through these registers of the debugging module, the current kernel status can be determined, such as whether the kernel is suspended, whether the current kernel executes the integration instruction, whether the current kernel executes the ebreak instruction, and whether the current kernel executes the dret instruction. These registers can be accessed by initiating requests on the bus for system bus access. The kernel reports its kernel status by writing these registers, and the debugging module can also change its internal running state machine based on the kernel status.

[0193] For example, when the processor core model reads the ebreak instruction, the process of reporting the kernel status to the debug module is started. The processor core model can read the exception handler that needs to be executed corresponding to the ebreak instruction through the system bus. The exception handler is located in the storage area of ​​the debug module, such as the read-only memory (ROM). Then the processor core model can first initiate a write signal on the bus to write the EXCEPTION register to 0. The write signal can be sent to the debug module and the JTAG read-write model at the same time, so that the JTAG read-write model can read the various core operation status registers in the debug module to determine the kernel's operation status.

[0194] Figure 8 It is an interactive timing diagram of a JTAG read-write model, a processor core model, and a debugging module provided by an embodiment of the present invention;

[0195] Step D1, the JTAG read / write model inputs a test mode selection signal;

[0196] Step D2, the processor core model issues a bus read / write request;

[0197] Step D3, the processor core model reads the storage area of ​​the debugging module;

[0198] Step D4, the processor core model writes the exception status register;

[0199] Step D5, outputting the value of the core operation status control register to the JTAG read-write model.

[0200] In addition, the core can also be controlled through the debugging module. The JTAG read-write model can send a kernel debugging suspension request to the debugging module. It can be understood that this request can also be generated based on the execution of the test task. Then, after receiving the kernel debugging suspension request, the debugging module can send a debugging interrupt signal to the processor core model. After receiving the debugging interrupt signal, the processor core model can determine the corresponding instruction in the storage area of ​​the debugging module, perform bus reading and writing according to the instruction semantics, and report to the debugging module that the debugging has been suspended. If the ebreak instruction is executed, the task of simulating the execution of the instruction is executed, and the debugging mode is still maintained. The JTAG read-write model writes a recovery request for the current debugging core to the debugging module. The processor core model requires recovery from the debugging mode according to the value of the status flag register (FLAG, FLAGS Register) (each 8 bits controls 1 core, and the 0th and 1st bits are 1 to indicate recovery), and then runs the task of simulating the execution of the dret instruction. Finally, the JTAG read-write model reads the HALTED register of the debugging module to determine the status of the core and the execution of the last debugging operation.

[0201] Optionally, the step of inputting the test signal into the debugging module and obtaining the test data output by the debugging module includes:

[0202] Step A23, inputting the data write signal and the data to be written into the debugging module, and obtaining a write confirmation signal output by the debugging module; the debugging module is used to generate and output the write confirmation signal after writing the data to be written into the preset storage area;

[0203] Step A24, inputting the data reading signal into the debugging module to obtain the target data output by the debugging module; the debugging module is used to read and output the target data according to the data reading signal.

[0204] In an embodiment of the present invention, a data write signal and data to be written may be input to a debugging module through a bus. The debugging module responds to the data write signal, writes the data to be written into a storage area, and then generates a write confirmation signal to indicate that the data has been written. After receiving a data read signal, the debugging module may obtain target data according to information carried in the data read signal, such as address information, and then output the target data, for example, by returning it to the processor core model through a bus.

[0205] By implementing the embodiments of the present invention, the operations and requests of the processor core are simulated by the processor core model, so that the interaction between the processor core and the debugging module can be realized without configuring the actual processor, so that the core-related functions of the debugging module can be tested without the processor core, thereby improving the convenience of debugging module testing.

[0206] Optionally, the software simulation model is the memory model and the JTAG read-write model, the first sub-test case corresponding to the memory model includes a memory modeling task, and the second sub-test case corresponding to the JTAG read-write model includes a data reading task;

[0207] Step A1, inputting the sub-test case into the corresponding software simulation model to obtain the test signal output by the software simulation model, includes:

[0208] Step A15, inputting the first sub-test case into the memory model, and executing the memory modeling task through the memory model to construct a simulated memory; the simulated memory stores a preset value;

[0209] Step A16: input the second sub-test case into the JTAG read-write model, execute the data reading task through the JTAG read-write model, and obtain the data reading signal output by the JTAG read-write model.

[0210] In an embodiment of the present invention, when the software simulation model is a memory model and a JTAG read-write model, the first sub-test case corresponding to the memory model includes a memory modeling task, and the second sub-test case corresponding to the JTAG read-write model includes a data reading task. The first sub-test case is input into the memory model. The second sub-test case is input into the JTAG read-write model.

[0211] The memory model performs memory modeling tasks, builds simulated memory and stores a preset value in the simulated memory. According to the requirements of the slave end of the system bus, a state machine is implemented in the driver of the memory model, which is responsible for judging read and write requests, outputting handshake responses and performing data transmission. The read address can be input into the simulated memory, and the simulated memory can return relevant data such as a pre-stored preset value, and then put the relevant data on the bus according to the state machine. The JTAG read and write model performs the data reading task in the second sub-test case and outputs the data reading signal, which will not be repeated here.

[0212] Optionally, the step of inputting the test signal into the debugging module and obtaining the test data output by the debugging module includes:

[0213] The data read signal is input into the debugging module to obtain the preset value output by the debugging module; the debugging module is used to read and output the preset value in the simulation memory according to the data read signal.

[0214] In the embodiment of the present invention, the data read signal may be a request to read the data storage registers including the sbdata0 register and the sbdata1 register, and the data read signal is input to the debugging module, and the debugging module reads and outputs the preset value in the analog memory in response to the data read signal. It is understandable that the data obtained by the debugging module when reading the analog memory may not be the preset value. If the data obtained by the debugging module is not the preset value, it means that the reading and writing functions of the debugging module for the analog memory cannot be implemented normally.

[0215] In addition, it is also possible to test whether the debugging module can write data to the memory normally. In the JTAG read-write model, a request to write the address storage registers including the sbaddress0 register and the sbaddress1 register is issued. In the JTAG read-write model, a request to write the data storage registers including the sbdata0 register and the sbdata1 register can also be issued to store the data to be written in the data storage registers. The JTAG read-write model can also issue a request to write the SBCS register to control the behavior mode of the direct system bus function, including single read, single write, continuous read, continuous write, and whether the address is self-incremented. Based on the behavior mode determined by the JTAG read-write model by writing the SBCS register, the debugging module can write the data to be written into the simulated memory and respond on the bus.

[0216] Fig. 9 It is an interactive timing diagram of a JTAG read / write model, a memory model, and a debugging module provided by an embodiment of the present invention;

[0217] Step E1, the JTAG read / write model inputs a test mode selection signal;

[0218] Step E2, JTAG read / write model write address register;

[0219] Step E3, JTAG read / write model writes data to the storage register;

[0220] Step E4, the JTAG read / write model writes the system bus access control and status register;

[0221] Step E5, the JTAG read-write model reads the system bus access control and status register;

[0222] Step E6, the debugging module returns the value of the system bus access control and status register;

[0223] Step E7, the debugging module issues a memory request;

[0224] Step E8, the memory model returns a memory request response result;

[0225] Step E9, the JTAG read / write model reads the system bus access control and status register;

[0226] Step E10, the debugging module returns the value of the system bus access control and status register;

[0227] Step E11, the JTAG read-write model reads the data storage register;

[0228] Step E12: the debugging module returns the value of the data storage register.

[0229] The embodiment of the present invention is implemented to construct a simulated memory through a memory model, and to store preset values ​​in the simulated memory. The debug module interacts with the simulated memory, and obtains the preset values ​​to determine whether the memory access function of the debug module can be normally implemented, thereby improving the convenience of testing the debug module. At the same time, various test tasks can be combined into various situations that may be encountered when the debug module performs memory access, such as reading a memory address, writing another, writing an address, reading the same address, writing to consecutive addresses, reading consecutive addresses, reading several consecutive addresses and then writing one of the addresses, and various possible permutations and combinations. When in use, memory access requests can be combined at will and responses can be given to fully test the memory access function of the on-chip debug module.

[0230] It is understandable that for different scenarios of debugging module testing, such as interacting with registers in the debugging module through the JTAG read / write model, interacting with the debugging module through the processor core model simulating the behavior of the kernel, and interacting with the debugging module through the memory model simulating the behavior of the memory, the test cases and test tasks can be flexibly modified and added or deleted. For example, the following tasks can also be included:

[0231] task JTAG_warm_up(); used to read IDCODE, DTMCS, and set the instruction register to activate the on-chip debugging module function;

[0232] Task JTAG_data_fill(); used to fill the data register with initial value;

[0233] task prepare_data(); used to randomly generate data register contents;

[0234] Task prepare_cmd(); used to randomly generate program buffer instruction content;

[0235] task set_abcmd(bit postexec, bit tranfer, bit write); used to set the abstractcommand register content;

[0236] task check_abcs(); used to interpret the contents of the SBCS register to determine whether the instruction error is normal;

[0237] task set_sbcs(); used to set the SBCS register;

[0238] task check_sbcs(); used to interpret the contents of the SBCS register to determine whether the operation is completed;

[0239] task clear_allreq(); used to clear all requests;

[0240] task set_hartsel(int i); used to select the core identity number (ID, Identitydocument) to be debugged;

[0241] task set_hartgroup(); used to select the core group to be debugged;

[0242] task give_debug_interrupt(); used to issue a debug interrupt to the selected core or core group;

[0243] task give_debug_reset(); used to reset the selected core or core group;

[0244] task give_debug_ndreset(); used to reset components of non-debug modules;

[0245] task give_debug_resume(); used to resume the selected core or core group;

[0246] task debugInterrupt_handle(int i); / Simulation of kernel debugging pause;

[0247] task give_a_ebreak(); used to simulate the kernel running the ebreak instruction;

[0248] task give_a_resumeing(int i); used to simulate the kernel running the dret instruction;

[0249] task give_a_haveInReset(); used to simulate the kernel reset;

[0250] task read_whereto(); used to read and parse the whereto register;

[0251] task read_flags(); used to read and parse the FLAGs register;

[0252] task read_abstract_inst(); used to read the register where the instruction generated by the abstract command is located;

[0253] task read_programbuffer(); used to read programbuffer registers;

[0254] Through the above or more test tasks, a corresponding test signal can be generated, and the test signal is input to the debug module, and the test scenario of the real construction can be simulated, so that no other actual hardware, such as a processor core, is required to complete the functional test of the debug module, thereby improving the convenience of the debug module test. In addition, the test platform of the present invention has high reusability and can be reused in debug modules of different specifications for functional verification, and the test case does not have to be constructed from scratch. If the interface protocol or specification changes, it is implemented by modifying the method on one side of the interface, keeping the method name unchanged, and there is no need to modify the test case, so as to realize the decoupling of the test case and the interface. By flexibly constructing illegal use cases, random use cases, and mixed use cases to verify the on-chip debug module, it is easier to find problems with the debug module.

[0255] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0256] Device Embodiment

[0257] Reference Fig.10 , shows a structural block diagram of a test device for a debugging module of the present invention, which is applied to a test platform, the test platform is connected to the debugging module, and the device 1000 includes:

[0258] A model building module 1001 is used to build a software simulation model running in the test platform; the software simulation model includes a JTAG read-write model for testing registers in the debug module, a processor core model for testing data reading and writing, and a memory model for testing memory access;

[0259] The test task module 1002 is used to obtain target test tasks corresponding to different types in a preset test task library according to the type of the software simulation model; the test task library has at least one pre-built test task;

[0260] A test case module 1003 is used to construct a target test case of the debugging module according to the target test task;

[0261] The debugging test module 1004 is used to test the debugging module based on the target test case.

[0262] Optionally, the step of constructing a target test case of the debugging module according to the target test task includes:

[0263] According to the target test tasks corresponding to the JTAG read-write model, the processor core model and the memory model, corresponding sub-test cases are constructed respectively;

[0264] Based on the sub-test case, a target test case including the sub-test case is obtained.

[0265] Optionally, a reference model is also run in the test platform; a debugging test module includes:

[0266] A reference data submodule, used for inputting the target test case into the debugging module and the reference model, and obtaining the test data output by the debugging module and the reference data output by the reference model;

[0267] The comparison test submodule is used to compare the test data with the reference data and generate a test result according to the comparison result.

[0268] Optional, reference data submodule, including:

[0269] A test signal unit, used to input the target test case into the software simulation model and obtain a test signal output by the software simulation model;

[0270] A test data unit, used for inputting the test signal into the debugging module and obtaining the test data output by the debugging module;

[0271] A reference data unit is used to input the test signal into the reference model to obtain reference data output by the reference model.

[0272] Optionally, the target test case includes sub-test cases corresponding to each software simulation model; the test signal unit includes:

[0273] Respectively determining sub-units for determining sub-test cases corresponding to different software simulation models in the target test case;

[0274] The sub-test case input sub-unit is used to input the sub-test case into the corresponding software simulation model and obtain the test signal output by the software simulation model.

[0275] Optionally, the software simulation model is the JTAG read-write model, and the sub-test cases corresponding to the JTAG read-write model include a register address setting task and a register reading task;

[0276] Test signal unit, comprising:

[0277] An address setting signal subunit, used for inputting the sub-test case into the JTAG read-write model, executing the register address setting task through the JTAG read-write model, and obtaining the address setting signal output by the JTAG read-write model;

[0278] The target read signal subunit is used to execute the register read task through the JTAG read-write model and obtain the target register read signal output by the JTAG read-write model.

[0279] Optional, test data unit, including:

[0280] An address setting data subunit is used to input the address setting signal into the debugging module to obtain the target address output by the debugging module; the debugging module is used to set the value of the instruction register in the debugging module to the target register address in response to the address setting signal;

[0281] The target read data subunit is used to input the target register read signal into the debug module to obtain the value of the target register output by the debug module; the debug module is used to respond to the target register read signal and read and output the value of the target register according to the target register address indicated by the instruction register.

[0282] Optionally, the software simulation model is the processor core model, and the sub-test cases corresponding to the processor core model include a data writing task and a data reading task;

[0283] Test signal unit, comprising:

[0284] A data writing signal subunit, used for inputting the sub-test case into the processor core model, executing the data writing task through the processor core model, and obtaining the data writing signal and the data to be written output by the processor core model;

[0285] The first read signal subunit is used to execute the data read task through the JTAG read-write model and obtain the data read signal output by the processor core model.

[0286] Optional, test data unit, including:

[0287] A data writing subunit, inputting the data writing signal and the data to be written into the debugging module, and obtaining a writing confirmation signal output by the debugging module; the debugging module is used to generate and output the writing confirmation signal after writing the data to be written into the preset storage area;

[0288] The data reading subunit is used to input the data reading signal into the debugging module to obtain the target data output by the debugging module; the debugging module is used to read and output the target data according to the data reading signal.

[0289] Optionally, the software simulation model is the memory model and the JTAG read-write model, the first sub-test case corresponding to the memory model includes a memory modeling task, and the second sub-test case corresponding to the JTAG read-write model includes a data reading task;

[0290] Test signal unit, comprising:

[0291] A simulated memory subunit, used for inputting the first sub-test case into the memory model, and executing the memory modeling task through the memory model to construct a simulated memory; the simulated memory stores preset values;

[0292] The second read signal sub-unit is used to input the second sub-test case into the JTAG read-write model, execute the data read task through the JTAG read-write model, and obtain the data read signal output by the JTAG read-write model.

[0293] Optional, test data unit, including:

[0294] The memory data subunit is used to input the data reading signal into the debugging module to obtain the preset value output by the debugging module; the debugging module is used to read and output the preset value in the analog memory according to the data reading signal.

[0295] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0296] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0297] Regarding the processor in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0298] Reference Fig.11 , is a structural block diagram of an electronic device for testing a debugging module provided by an embodiment of the present invention. Fig.11As shown, the electronic device includes: a processor, a memory, a communication interface and a communication bus, and the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store executable instructions, and the executable instructions enable the processor to execute the testing method of the debugging module of the aforementioned embodiment.

[0299] The processor may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other editable devices, transistor logic devices, hardware components or any combination thereof. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor.

[0300] The communication bus may include a path for transmitting information between the memory and the communication interface. The communication bus may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The communication bus may be divided into an address bus, a data bus, and a control bus. For ease of representation, Fig.11 The fact that only one line is used in the diagram does not mean that there is only one bus or only one type of bus.

[0301] The memory can be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or it can be an EEPROM (Electrically ErasableProgrammable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory), a magnetic tape, a floppy disk, and an optical data storage device.

[0302] The embodiment of the present invention also provides a non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device (server or terminal), the processor can execute Figure 2 The test method of the debug module is shown.

[0303] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0304] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage) containing computer-usable program codes.

[0305] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0306] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing terminal device to operate in a predictable manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0307] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0308] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0309] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0310] The above is a detailed introduction to the testing method, device, electronic device and readable storage medium of a debugging module provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for a person skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A testing method for a debugging module, It is characterized in that Applied to a test platform, the test platform is connected to a debugging module, the method comprises: Constructing a software simulation model running in the test platform; the software simulation model includes a JTAG read-write model for testing registers in the debug module, a processor core model for testing data reading and writing, and a memory model for testing memory access; According to the type of the software simulation model, target test tasks corresponding to different types are respectively obtained in a preset test task library; the test task library has at least one pre-built test task; According to the target test task, construct the target test case of the debugging module; Based on the target test case, testing the debugging module; The step of testing the debugging module based on the target test case includes: The target test case is input into the memory model and the JTAG read-write model, wherein the memory model is used to perform the memory modeling task in the target test case to construct a simulated memory, wherein the simulated memory stores preset values; and the JTAG read-write model is used to perform the data reading task in the target test case to output a data reading signal; The data read signal is input to the debugging module to test the debugging module; the debugging module is used to receive and respond to the data read signal, read and output the preset value in the simulation memory.

2. The method according to claim 1, It is characterized in that The step of constructing a target test case of the debugging module according to the target test task includes: According to the target test tasks corresponding to the JTAG read-write model, the processor core model and the memory model, corresponding sub-test cases are constructed respectively; Based on the sub-test case, a target test case including the sub-test case is obtained.

3. The method according to claim 1, It is characterized in that A reference model is also run in the test platform; the step of testing the debugging module based on the target test case includes: Inputting the target test case into the debugging module and the reference model, and acquiring the test data output by the debugging module and the reference data output by the reference model; The test data is compared with the reference data, and a test result is generated according to the comparison result.

4. The method according to claim 3, It is characterized in that The step of inputting the target test case into the debugging module and the reference model, and acquiring the test data output by the software simulation model and the reference data output by the reference model comprises: Inputting the target test case into the software simulation model to obtain a test signal output by the software simulation model; Inputting the test signal into the debugging module to obtain the test data output by the debugging module; The test signal is input into the reference model to obtain reference data output by the reference model.

5. The method according to claim 4, It is characterized in that The target test case includes sub-test cases corresponding to each software simulation model; the step of inputting the target test case into the software simulation model to obtain the test signal output by the software simulation model includes: In the target test case, determining sub-test cases corresponding to different software simulation models respectively; The sub-test case is input into the corresponding software simulation model to obtain the test signal output by the software simulation model.

6. The method according to claim 5, It is characterized in that The software simulation model is the JTAG read-write model, and the sub-test cases corresponding to the JTAG read-write model include a register address setting task and a register reading task; The step of inputting the target test case into the software simulation model and obtaining the test signal output by the software simulation model comprises: Inputting the sub-test case into the JTAG read-write model, executing the register address setting task through the JTAG read-write model, and obtaining the address setting signal output by the JTAG read-write model; The register reading task is performed through the JTAG read-write model to obtain the target register reading signal output by the JTAG read-write model.

7. The method according to claim 6, It is characterized in that The step of inputting the test signal into the debugging module and obtaining the test data output by the debugging module comprises: The address setting signal is input to the debugging module to obtain the target address output by the debugging module; the debugging module is used to set the value of the instruction register in the debugging module to the target register address in response to the address setting signal; The target register read signal is input into the debugging module to obtain the value of the target register output by the debugging module; the debugging module is used to respond to the target register read signal and read and output the value of the target register according to the target register address indicated by the instruction register.

8. The method according to claim 5, It is characterized in that The software simulation model is the processor core model, and the sub-test cases corresponding to the processor core model include a data writing task and a data reading task; The step of inputting the sub-test case into the corresponding software simulation model and obtaining the test signal output by the software simulation model comprises: Inputting the sub-test case into the processor core model, executing the data writing task through the processor core model, and obtaining the data writing signal and the data to be written output by the processor core model; The data reading task is performed through the JTAG read-write model to obtain the data reading signal output by the processor core model.

9. The method according to claim 8, It is characterized in that The step of inputting the test signal into the debugging module and obtaining the test data output by the debugging module comprises: Inputting the data write signal and the data to be written into the debugging module, and obtaining a write confirmation signal output by the debugging module; the debugging module is used to generate and output the write confirmation signal after writing the data to be written into the preset storage area; The data read signal is input into the debugging module to obtain the target data output by the debugging module; the debugging module is used to read and output the target data according to the data read signal.

10. A test device for a debugging module, It is characterized in that Applied to a test platform, the test platform is connected to a debugging module, and the device comprises: A model building module, used to build a software simulation model running in the test platform; the software simulation model includes a JTAG read-write model for testing registers in the debug module, a processor core model for testing data reading and writing, and a memory model for testing memory access; A test task module, used to obtain target test tasks corresponding to different types in a preset test task library according to the type of the software simulation model; the test task library has at least one pre-built test task; A test case module, used to construct a target test case of the debugging module according to the target test task; A debugging test module, used to test the debugging module based on the target test case; The debugging test module includes: A simulated memory reading submodule, used for inputting the target test case into the memory model and the JTAG read-write model, wherein the memory model is used for executing the memory modeling task in the target test case to construct a simulated memory, wherein the simulated memory stores preset values; and the JTAG read-write model is used for executing the data reading task in the target test case to output a data reading signal; The debug memory read submodule is used to input the data read signal into the debug module to test the debug module; the debug module is used to receive and respond to the data read signal, read and output the preset value in the simulation memory.

11. An electronic device, It is characterized in that The electronic device comprises a processor, a memory, a communication interface and a communication bus, and the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store executable instructions, and the executable instructions enable the processor to execute the testing method of the debugging module according to any one of claims 1 to 9.

12. A readable storage medium, It is characterized in that When the instructions in the readable storage medium are executed by a processor of an electronic device, the processor is enabled to execute the testing method of the debugging module as claimed in any one of claims 1 to 9.