A system simulation testing method, apparatus, equipment, and non-volatile storage medium.
By creating virtual devices and configuring interface drivers in the system simulation environment, precise control over the log generation method of the processor simulation module is achieved, solving the problems of full logs occupying storage space and low performance analysis efficiency, and improving the efficiency and accuracy of simulation testing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-31
- Publication Date
- 2026-03-10
AI Technical Summary
In existing technologies, the log generation method in computer simulation testing cannot be flexibly configured, resulting in full logs occupying a large amount of storage space, affecting the efficiency of performance analysis, and the log configuration triggered by breakpoints affects the execution of the test program.
By creating a first virtual device with a command conversion module in the system simulation environment, configuring a user interface and interface driver for the processor simulation module, the conversion of user control commands to processor control commands is realized, and the log generation behavior is precisely controlled.
It reduces redundant data, lowers the complexity of performance analysis, improves simulation efficiency, and avoids the problem of asynchronous operation between the processor simulation module and the hardware module, enabling flexible log generation and performance analysis.
Smart Images

Figure CN120950412B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer simulation testing, and in particular to a system simulation testing method, device, equipment and nonvolatile storage medium. BACKGROUND
[0002] With the increasing complexity of computer systems, the role of software and hardware joint simulation testing is becoming increasingly prominent. Through a computer simulator, a computer simulation system can be built on a host computer, and a hardware simulation module can be added to the system. As the test is executed, the processor provides a detailed record of the software execution process, and the processor simulation module in the computer simulation system also has this function. However, the tracking log output by the processor simulation module during the simulation process is usually a full log, which records all aspects of the test program execution. The full log not only occupies a large amount of storage space, but also greatly affects the efficiency of performance analysis.
[0003] How to configure the log generation method in computer simulation testing is a technical problem that needs to be solved by those skilled in the art. SUMMARY
[0004] The present application provides a system simulation testing method, device, equipment and nonvolatile storage medium to at least solve the problem that the log generation method in computer simulation testing cannot be configured in the related art.
[0005] The present application provides a system simulation testing method, comprising:
[0006] invoking a computer simulator to create a first virtual device with a command conversion function module in a system simulation environment, configuring a user interface and a first interface for connecting a processor simulation module in the system simulation environment for the first virtual device;
[0007] configuring a first virtual device driver for invoking the first interface for the processor simulation module;
[0008] converting a user control command received by the user interface into a processor control command based on the first virtual device and sending it to the processor simulation module through the first interface, so that the processor simulation module executes the processor control command when performing a simulation test in the system simulation environment;
[0009] wherein the user control command includes a log generation command.
[0010] The present application also provides a system simulation testing device, comprising:
[0011] A creation unit is used to call a computer simulator to create a first virtual device with a command conversion function module in a system simulation environment, and to configure a user interface and a first interface for connecting to the processor simulation module in the system simulation environment for the first virtual device.
[0012] A configuration unit is configured to configure a first virtual device driver for the processor emulation module to call the first interface;
[0013] The control unit is configured to convert user control commands received by the user interface into processor control commands based on the first virtual device and send them to the processor simulation module through the first interface, so that the processor simulation module executes the processor control commands when performing simulation tests in the system simulation environment.
[0014] The user control commands include log generation commands.
[0015] The present invention also provides an electronic device, comprising: a memory for storing a computer program; and a processor for executing the computer program to implement the steps of any of the above-described system simulation test methods.
[0016] The present invention also provides a non-volatile storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any of the above-described system simulation test methods.
[0017] Through this invention, in a system simulation environment, a first virtual device with a command conversion function module is created using a computer simulator. A user interface and a first interface for connecting to a processor simulation module are configured. The processor simulation module is then configured with a first virtual device driver for calling the first interface. Based on the first virtual device, user control commands, including log generation commands, received by the user interface are converted into processor control commands and sent to the processor simulation module through the first interface. This allows the processor simulation module to execute processor control commands during simulation testing in the system simulation environment. By configuring the log generation method at the processor execution level, the log generation behavior of the processor simulation module during test program execution can be precisely controlled, rather than simply outputting the full log. This reduces data redundancy, lowers the complexity of performance analysis, and reduces the impact of log generation on system simulation efficiency.
[0018] The present invention also provides a method for creating and configuring a first virtual device, thereby enabling the receiving of software control instructions through a first interface, controlling the generation of logs by the processor simulation module, and flexibly processing user-inputted control commands, reducing unnecessary data interference, and improving the accuracy and efficiency of performance analysis.
[0019] This invention can also generate logs online and call performance analysis tools online to output performance analysis results based on test logs. It can realize online performance analysis by dynamically adjusting the log generation method, which helps testers obtain performance analysis results in a timely manner.
[0020] The present invention can also send a synchronization command to the processor simulation module through the first virtual device, so that when the processor simulation module pauses the simulation test due to log generation, it can control the hardware simulation module connected to the processor simulation module to pause the operation in a cross-triggered manner based on the synchronization command, and control the hardware simulation module to start when the log recording is completed and the simulation test is restarted, thereby avoiding the problem of the processor simulation module being out of sync with other hardware simulation modules when the log is paused due to log generation, that is, avoiding the log generation affecting the execution of the test process. Attached Figure Description
[0021] To more clearly illustrate the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 A flowchart of a system simulation testing method provided in an embodiment of the present invention;
[0023] Figure 2 An architecture diagram of a system simulation environment provided in an embodiment of the present invention;
[0024] Figure 3 This is a schematic diagram illustrating how a performance analysis tool can be invoked to output performance analysis results, as provided in an embodiment of the present invention. Detailed Implementation
[0025] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of the present invention.
[0026] It should be noted that, in the description of this invention, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., used in this invention are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0027] To enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0028] In computer simulation testing, open-source computer architecture simulators (hereinafter referred to as computer simulators) can be used to realize system simulation modeling, which can realize the simulation of complex software and hardware systems. For example, the General Execution-driven Multiprocessor Simulator (GEM5) is an open-source simulator that supports system-level and central processing unit (CPU) microarchitecture level, supports multiple instruction set architectures, and is currently widely used.
[0029] During computer simulation testing, processor architectures typically provide detailed logs of the software execution process. This allows developers to track and record various information during program execution, such as function calls, branch decisions, cache hits, and memory accesses, aiding in performance analysis and optimization, as well as troubleshooting and fault diagnosis. For example, the ARM architecture provides the Timestamped Activity Recording and Monitoring for ARM Cores (Tarmac Trace) tracing mechanism, which records detailed information about the software's running status and performance data on ARM architecture CPUs. Developers can use in-depth analysis of these logs to obtain key performance indicators during software execution, providing a basis for performance optimization.
[0030] However, during simulation, the logging functionality provided by the processor architecture has many shortcomings.
[0031] First, the logging function in processor architecture is merely a low-level debugging tool. It consumes significant resources, meticulously recording every detail of instruction execution and hardware register state changes. Furthermore, during processor simulation, logging is typically full or statically configured, leading to the following problems: data redundancy (full logs consume substantial storage resources, increasing data analysis complexity); lack of flexible control (the log scope cannot be adjusted in real-time according to user needs during simulation (e.g., specific code segments, memory addresses, register operations); and uncontrollable performance overhead (log generation can significantly slow down simulation, making it difficult to balance debugging needs with simulation efficiency).
[0032] The debugging interface provided by the processor architecture only supports breakpoint-triggered logging. For example, the debugging tool (gdbserver) interface of Gem5 can receive breakpoint configurations to record logs when the processor simulation module executes simulation tests at specific locations. However, this configuration cannot adjust the log granularity or filtering conditions, and this breakpoint interrupts from the underlying level of the processor simulation module, which will directly affect the execution of the test program.
[0033] To configure the log generation method in computer simulation testing, this invention provides a system simulation testing method, apparatus, device, and non-volatile storage medium. In the system simulation environment, a first virtual device with a command conversion module is created using a computer simulator. A user interface and a first interface for connecting to a processor simulation module are configured. A first virtual device driver for calling the first interface is configured for the processor simulation module. Based on the first virtual device, user control commands, including log generation commands, received by the user interface are converted into processor control commands and sent to the processor simulation module through the first interface. This allows the processor simulation module to execute processor control commands during simulation testing in the system simulation environment. This configuration of the log generation method at the processor execution level allows for precise control of the log generation behavior of the processor simulation module when executing test programs, rather than simply outputting the full log. This reduces data redundancy, lowers the complexity of performance analysis, and minimizes the impact of log generation on system simulation efficiency.
[0034] The embodiments of the present invention provide a system simulation testing method. The method is described in detail below in conjunction with the execution flow of the system simulation testing method.
[0035] Figure 1 A flowchart of a system simulation testing method provided in an embodiment of the present invention.
[0036] like Figure 1As shown, the system simulation testing method provided in this embodiment of the invention may include: S101: calling a computer simulator to create a first virtual device with a command conversion function module in the system simulation environment, configuring a user interface and a first interface for connecting to the processor simulation module in the system simulation environment for the first virtual device.
[0037] S102: Configure the processor emulation module with the first virtual device driver for calling the first interface.
[0038] S103: Based on the first virtual device, the user control commands received by the user interface are converted into processor control commands and sent to the processor simulation module through the first interface, so that the processor simulation module executes the processor control commands when performing simulation tests in the system simulation environment.
[0039] Among these, user control commands include log generation commands.
[0040] In practical implementation, a system simulation environment is pre-built using a computer simulator. Within this environment, a simulation subsystem is constructed that includes multi-level caching, a self-developed hardware acceleration engine, and a high-speed interconnect bus. For example, in the GEM5 Redundant Arrays of Independent Disks (RAID) simulation environment, configuration files can be modified and custom modules added. Hardware acceleration engines, including a high-speed serial computer expansion bus (Peripheral Component Interconnect Express, PCIe) interface, a Direct Memory Access (DMA) module, an Accelerator Data Operation (ACC) module, and an Input / Output Processor (IOP), can be added. The communication mechanism between each acceleration engine and the CPU can be optimized to ultimately complete the construction of the simulation system.
[0041] For S101, the function of creating a custom device based on computer virtual devices is to add a first virtual device in the system simulation environment and define the function module of the first virtual device to include at least a command conversion function module, which is used to convert user control commands into processor control commands. The user control commands include at least a log generation command to configure the log generation strategy of the processor simulation module.
[0042] Configure a user interface and a first interface for the first virtual device to establish communication between the first virtual device and the user, as well as between the first virtual device and the processor emulation module.
[0043] For S102, a first virtual device driver is configured in the processor emulation module so that the processor emulation module can communicate with the first virtual device based on the first interface.
[0044] For S103, based on the first virtual device, user control commands are converted into processor control commands that can be executed by the processor simulation module, and the processor control commands are transmitted to the processor simulation module to configure the log generation strategy during the simulation test process from the processor execution level.
[0045] The system simulation testing method provided in this invention creates a first virtual device with a command conversion function module in a system simulation environment using a computer simulator. It configures a user interface and a first interface for connecting to a processor simulation module, and configures a first virtual device driver for the processor simulation module to call the first interface. Based on the first virtual device, user control commands received by the user interface, including log generation commands, are converted into processor control commands and sent to the processor simulation module through the first interface. This allows the processor simulation module to execute processor control commands during simulation testing in the system simulation environment. By configuring the log generation method at the processor execution level, the log generation behavior of the processor simulation module during test program execution can be precisely controlled, rather than simply outputting the full log. This reduces data redundancy, lowers the complexity of performance analysis, and reduces the impact of log generation on system simulation efficiency.
[0046] Figure 2 This is an architecture diagram of a system simulation environment provided in an embodiment of the present invention.
[0047] Based on the above embodiments, in the system simulation testing method provided by the embodiments of the present invention, S101 calls a computer simulator to create a first virtual device in the system simulation environment, and configures a user interface and a first interface for connecting to the processor simulation module in the system simulation environment for the first virtual device. This may include: calling the computer simulator to create the underlying class structure of the first virtual device, the underlying class structure including register variables, register read / write control parameters, and conversion logic corresponding to user control commands corresponding to the first interface; creating a device object corresponding to the first virtual device and configuring the corresponding device control parameters; adding an instance of the first virtual device in the configuration script of the system simulation environment, and connecting the first virtual device to the processor simulation module.
[0048] In practical implementation, a custom device is added in the system simulation environment to receive and implement software control of the processor and provide real-time feedback on the working status of the simulation subsystem, serving as the first virtual device.
[0049] Taking the GEM5+ARM simulation system as an example, a custom device of the SimpleDevice class can be added to the device model. It defines three sets of registers to receive control commands and internal status feedback sent by the software, so as to dynamically control the ARM Tarmac logging to be turned on or off during the operation of the software under test.
[0050] Specifically, first, a C++ class is created to define the device's underlying structure. Members include three sets of register variables, as well as control logic implementations for register read / write and Tarmac logging (enabling and disabling). Next, a Python class for device control is defined, providing instantiation control of the device object and required parameters. Then, in the system configuration script, an instance of the first virtual device is added and connected to the system bus.
[0051] By following the steps above, a first virtual device is added to GEM5. The next step is to define the software abstraction of this first virtual device to provide a control interface for the application layer software.
[0052] In this embodiment of the invention, configuring a first virtual device driver for calling the first interface in S102 may include: creating a control interface function for the first virtual device based on the register mapping of the first virtual device, so as to configure the first virtual device driver according to the control interface function; wherein, the control interface function includes an initialization interface function for the first virtual device, a control interface function for the first virtual device, and a status query interface function for the first virtual device.
[0053] In practical implementation, based on the software development process and the register mapping of the first virtual device, a set of control interface functions is defined. These functions may include defining device initialization and log generation strategies, such as the log generation location (start and end points) of the code under test, cache hit statistics, memory command statistics, and simulation subsystem working status queries.
[0054] In this embodiment of the invention, step S103, which converts user control commands received from the user interface into processor control commands based on the first virtual device and sends them to the processor emulation module through the first interface, so that the processor emulation module executes the processor control commands when performing simulation testing in the system simulation environment, may include: converting log generation commands into code instrumentation locations based on the first virtual device, and sending the code instrumentation locations to the processor emulation module through the first interface, so that the processor emulation module configures log generation control parameters for the program code under test according to the code instrumentation locations, and executes the log generation control parameters when executing the program code under test; wherein, the log generation control parameters include at least one of the following: log generation location of the program code under test, log tracking granularity, and log statistics parameter type.
[0055] In some optional embodiments of the present invention, converting the log generation command into a code instrumentation location based on the first virtual device and sending the code instrumentation location to the processor simulation module through the first interface may include: converting the log generation command into a code instrumentation location based on the first virtual device, adding the code of the program to be tested to the system simulation environment, recompiling the system simulation environment, and sending the code instrumentation location to the processor simulation module.
[0056] For example Figure 2 As shown, depending on the needs of debugging or performance analysis, the device initialization interface is called before the code segment under test to set the log recording start position to start logging and the log recording end position to end logging. Then, the program code under test is ported to the system simulation environment containing the first virtual device.
[0057] Then, the system simulation environment is rebuilt. Taking GEM5 as an example, an SConscript script is created, and the command sconsbuild / ARM / gem5.opt is executed to recompile Gem5, so that the custom device code is added to the GEM5 binary file.
[0058] Therefore, it is possible to achieve such Figure 2 The architecture shown builds a system simulation environment based on the host machine's hardware resources. The simulation subsystem can include one or more processor simulation modules, which can be single-core or multi-core processors. The simulation subsystem may also include bus interconnects and other interface controllers.
[0059] In the first virtual device, the first interface may include a bus interface and a register interface. The register interface provides a software control interface, receiving user control commands (such as starting performance statistics recording) and current status feedback. The bus interface enables the first virtual device to connect to the simulation subsystem. The functional module is used to implement user control commands, that is, to convert user-inputted user control commands into processor control commands that the processor simulation module can recognize and execute. Based on this method, the log generation method can be dynamically adjusted.
[0060] The first virtual device driver, as the software abstraction of the first virtual device, provides three types of interfaces to the upper-layer software: an initialization interface, responsible for controlling the initial state of the first virtual device, such as releasing the internal state machine reset signal; a control interface, implementing the execution of user control commands, such as enabling and disabling Tarmac performance data statistics; and a status query interface, assisting the software in confirming the working status of the first virtual device.
[0061] The test program is the program code under test running in the processor simulation module. Through the first virtual device provided in this embodiment of the invention, it is possible to control the opening and closing of performance data statistics at the beginning and end of the code segment under test, as well as to query the working status of the first virtual device.
[0062] Based on the system simulation environment, during the execution of the program code under test by the processor simulation module, log generation commands in the processor control commands are identified. When the corresponding location of the program code under test is reached, test logs are recorded based on the log generation function of the processor simulation module. After preprocessing such as format conversion, effective information related to software performance, such as instruction execution time, cache command rate, and memory access frequency, is extracted. Based on the performance analysis results, software optimization strategies are formulated, such as partial code refactoring, algorithm improvement, and hardware and software resource adjustment. The optimization effects are then iteratively verified using the system simulation environment.
[0063] The above embodiments of the present invention describe a method for controlling log generation by inserting it into the code of the program under test. Although this method can accurately record runtime data for the code segment under test, it lacks dynamic interactivity. In some optional embodiments of the present invention, step S103, which converts the user control command received by the user interface into a processor control command based on the first virtual device and sends it to the processor emulation module through the first interface, may further include: converting the user control command into a target processor control command based on the first virtual device and sending it to the processor emulation module. The type of the target processor control command includes at least one of command line, script, and graphical user interface (GUI). By transmitting user commands to the processor emulation module through command line, script, graphical user interface, etc., more real-time adjustments to the log generation method can be achieved when adjusting the log generation method, without requiring a restart of the system emulation environment.
[0064] In the above embodiments, control instructions from the software are received through a register interface, but the application scenarios of this method are limited. In some alternative embodiments of the present invention, configuring a first virtual device driver for the processor emulation module to call the first interface in S102 may further include: configuring communication parameters for the first virtual device to communicate with the processor emulation module via memory mapping. The first virtual device communicates directly with the processor hardware through memory-mapped I / O, allowing the custom device to retain a certain degree of flexibility.
[0065] Figure 3 This is a schematic diagram illustrating how a performance analysis tool can be invoked to output performance analysis results, as provided in an embodiment of the present invention.
[0066] In this embodiment of the invention, the processor simulation module in S103 executes processor control commands when performing simulation tests in the system simulation environment, which may include: generating test logs according to log generation commands during the simulation test in the system simulation environment; and calling performance analysis tools to output performance analysis results based on the test logs.
[0067] In practice, different simulation system startup commands are executed according to the characteristics of the program code under test. During the operation of the simulation system, processor running data is recorded and logged to the log file.
[0068] In this embodiment of the invention, a script can be written to parse the generated log file, remove irrelevant information, and convert data such as timestamps, instruction execution processes, hardware resource usage, cache hits, and memory access statistics into a unified format for subsequent analysis. Then, a performance analysis tool is called to perform performance analysis. This tool can be Lauterbach Trace32, FlameGraph, etc. For example, using Lauterbach Trace32, the original Tarmac log data and the compiled ELF image of the target software are imported to generate performance data graphs including function interface call context, interrupt context, and timing. Using FlameGraph, the processed log data is input to generate visual program performance and CPU utilization charts to assist in analyzing program performance bottlenecks and function call hotspots.
[0069] In addition to performance analysis solutions based on third-party tools, data mining algorithms can also be used to perform correlation analysis on performance indicators in log data, find the relationship between instruction execution time and cache hit rate, build a software performance model based on regression analysis, and predict performance under different input data scales.
[0070] By using the above analysis methods, we can confirm whether the target code's performance meets the requirements. If not, we need to develop targeted performance optimization strategies. Based on the analysis results, we can identify potential performance bottlenecks, such as unreasonable memory access and caching configurations in the software. We can then optimize the code, adjust the data structure layout, and add a data prefetching mechanism. Next, we can rerun the optimized software in a simulation system and compare the performance data to verify the effectiveness of the optimization strategies until the performance requirements are finally met.
[0071] Based on the first virtual device provided in this embodiment of the invention, the log generation method of the processor simulation module can be dynamically adjusted. Furthermore, with the generation of log files, performance analysis can be performed more flexibly. For example, during the log generation process, performance analysis tools can be synchronously invoked to output performance analysis results, which can then be displayed on the user interface. This improves the real-time nature of the performance analysis results output, facilitating online observation of the system simulation environment by testers.
[0072] Based on the above embodiments, in the system simulation testing method provided by the embodiments of the present invention, the user control command may further include a synchronization command. In S103, when the processor simulation module executes the processor control command during simulation testing in the system simulation environment, it may include: when the processor simulation module executes the simulation test in the system simulation environment, upon reaching the log generation position corresponding to the log generation command and pausing the simulation test, controlling the hardware simulation module connected to the processor simulation module to pause operation using a cross-trigger method based on the synchronization command, and controlling the hardware simulation module to start when log recording is completed and the simulation test is restarted.
[0073] In the process of controlling the log generation position of the processor emulation module by using breakpoint-triggered logging in related technologies, since the processor emulation module is interrupted directly from the bottom layer to generate logs, when the processor emulation module pauses the execution of the code under test, other hardware modules connected to the processor emulation module will not stop working. This will lead to the processor emulation module being out of sync with other hardware modules, which will affect the execution of the code under test.
[0074] In this embodiment of the invention, a synchronization command can also be sent to the processor simulation module through the first virtual device. This allows the processor simulation module to control the hardware simulation module connected to the processor simulation module to pause operation based on the synchronization command when the simulation test is paused due to log generation. When the log recording is completed and the simulation test is restarted, the hardware simulation module can be controlled to start. This avoids the problem of the processor simulation module being out of sync with other hardware simulation modules when the log is paused due to log generation, i.e., it avoids the log generation affecting the execution of the test process.
[0075] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.
[0076] Embodiments of the present invention also provide a system simulation testing apparatus, which may include: a creation unit, configured to call a computer simulator to create a first virtual device with a command conversion function module in a system simulation environment, and configure a user interface and a first interface for connecting to a processor simulation module in the system simulation environment for the first virtual device; a configuration unit, configured to configure a first virtual device driver for the processor simulation module to call the first interface; and a control unit, configured to convert user control commands received by the user interface into processor control commands based on the first virtual device and send them to the processor simulation module through the first interface, so that the processor simulation module executes the processor control commands when performing simulation testing in the system simulation environment; wherein, the user control commands include log generation commands.
[0077] In this embodiment of the invention, the creation unit calls a computer simulator to create a first virtual device in a system simulation environment, and configures a user interface and a first interface for connecting to the processor simulation module in the system simulation environment for the first virtual device. This may include: calling the computer simulator to create the underlying class structure of the first virtual device, the underlying class structure including register variables corresponding to the first interface, register read / write control parameters, and conversion logic corresponding to user control commands; creating a device object corresponding to the first virtual device and configuring the corresponding device control parameters; adding an instance of the first virtual device in the configuration script of the system simulation environment, and connecting the first virtual device to the processor simulation module.
[0078] In this embodiment of the invention, the configuration unit configures a first virtual device driver for the processor emulation module to call the first interface, which may include: creating a control interface function for the first virtual device based on the register mapping of the first virtual device, so as to configure the first virtual device driver according to the control interface function; wherein, the control interface function includes an initialization interface function for the first virtual device, a control interface function for the first virtual device, and a status query interface function for the first virtual device.
[0079] In this embodiment of the invention, the control unit converts user control commands received from the user interface into processor control commands based on a first virtual device and sends them to the processor emulation module through a first interface, so that the processor emulation module executes the processor control commands when performing simulation testing in the system simulation environment. This can include: converting log generation commands into code instrumentation locations based on the first virtual device, and sending the code instrumentation locations to the processor emulation module through the first interface, so that the processor emulation module configures log generation control parameters for the program code under test according to the code instrumentation locations, and executes the log generation control parameters when executing the program code under test; wherein, the log generation control parameters include at least one of the following: log generation location of the program code under test, log tracking granularity, and log statistics parameter type.
[0080] In this embodiment of the invention, the control unit converts the log generation command into a code instrumentation location based on the first virtual device and sends the code instrumentation location to the processor simulation module through the first interface. This may include: converting the log generation command into a code instrumentation location based on the first virtual device, adding the code to be tested to the system simulation environment, and then recompiling the system simulation environment to send the code instrumentation location to the processor simulation module.
[0081] In this embodiment of the invention, the processor simulation module executes processor control commands when performing simulation tests in the system simulation environment, which may include: generating test logs according to log generation commands during the simulation test in the system simulation environment; and calling performance analysis tools to output performance analysis results based on the test logs.
[0082] In this embodiment of the invention, the user control command further includes a synchronization command; when the processor simulation module executes the processor control command during simulation testing in the system simulation environment, it may include: when the processor simulation module executes the simulation test in the system simulation environment, upon reaching the log generation position corresponding to the log generation command and pausing the simulation test, controlling the hardware simulation module connected to the processor simulation module to pause operation based on the synchronization command using a cross-triggered method, and controlling the hardware simulation module to start when the log recording is completed and the simulation test is restarted.
[0083] For a description of the features in the embodiment corresponding to the system simulation testing device, please refer to the relevant description of the embodiment corresponding to the system simulation testing method, which will not be repeated here.
[0084] Embodiments of the present invention also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above-described system simulation test method embodiments.
[0085] Embodiments of the present invention also provide a non-volatile storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above-described system simulation test method embodiments when running.
[0086] In one exemplary embodiment, the aforementioned non-volatile storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0087] Embodiments of the present invention also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above-described system simulation testing method embodiments.
[0088] Embodiments of the present invention also provide another computer program product, including a non-volatile storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above-described system simulation test method embodiments.
[0089] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0090] The above provides a detailed description of the system simulation testing method, apparatus, equipment, and non-volatile storage medium provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only intended to help understand the method and core ideas of the present invention. It should be noted that those skilled in the art can make various improvements and modifications to the present invention without departing from its principles, and these improvements and modifications also fall within the protection scope of the present invention.
Claims
1. A system simulation test method, characterized by, The method comprises the following steps: calling a computer simulator to create a first virtual device with a command conversion function module in a system simulation environment, configuring a user interface for the first virtual device and a first interface for connecting a processor simulation module in the system simulation environment; configuring a first virtual device driver for the processor simulation module to call the first interface; based on the first virtual device, converting a user control command received by the user interface into a processor control command and sending it to the processor simulation module through the first interface, so that the processor simulation module executes the processor control command when performing a simulation test in the system simulation environment; wherein the user control command includes a log generation command; calling a computer simulator to create a first virtual device in a system simulation environment, configuring a user interface for the first virtual device and a first interface for connecting a processor simulation module in the system simulation environment, comprising: calling the computer simulator to create a bottom class structure of the first virtual device, the bottom class structure including register variables corresponding to the first interface, register read-write control parameters, and conversion logic corresponding to the user control command; creating a device object corresponding to the first virtual device and configuring corresponding device control parameters; adding an instance of the first virtual device in a configuration script of the system simulation environment, and connecting the first virtual device with the processor simulation module; based on the first virtual device, converting a user control command received by the user interface into a processor control command and sending it to the processor simulation module through the first interface, so that the processor simulation module executes the processor control command when performing a simulation test in the system simulation environment, comprising: based on the first virtual device, converting the log generation command into a code insertion location, sending the code insertion location to the processor simulation module through the first interface, so that the processor simulation module configures log generation control parameters for the to-be-tested program code according to the code insertion location, to execute the log generation control parameters when executing the to-be-tested program code; wherein the log generation control parameters include at least one of log generation location, log tracking granularity, and log statistical parameter type for the to-be-tested program code.
2. The system simulation test method of claim 1, wherein, configuring a first virtual device driver for the processor simulation module to call the first interface, comprising: based on the register mapping of the first virtual device, creating a control interface function of the first virtual device to configure the first virtual device driver according to the control interface function; wherein the control interface function includes an initialization interface function of the first virtual device, a control interface function of the first virtual device, and a state query interface function of the first virtual device.
3. The system simulation test method of claim 1, wherein, based on the first virtual device, converting the log generation command into a code insertion location, sending the code insertion location to the processor simulation module through the first interface, comprising: recompile the system simulation environment to send the code insertion position to the processor emulation module based on the first virtual device converting the log generation command into the code insertion position.
4. The system simulation test method of claim 1, wherein, The processor emulation module executes the processor control command when the system simulation environment performs the simulation test, including: The processor emulation module generates a test log according to the log generation command during the process of the system simulation environment performing the simulation test; The performance analysis tool is called to output a performance analysis result based on the test log.
5. The system simulation test method of claim 1, wherein, The user control command further includes a synchronization command; The processor emulation module executes the processor control command when the system simulation environment performs the simulation test, including: The processor emulation module controls the hardware emulation module connected with the processor emulation module to suspend running in a cross-triggered manner based on the synchronization command when reaching the log generation position corresponding to the log generation command and suspending the simulation test, and controls the hardware emulation module to start when completing log recording and restarting the simulation test.
6. A system simulation test apparatus characterized by comprising: including: The creating unit is configured to call a computer simulator to create a first virtual device with a command conversion function module in a system simulation environment, configure a user interface for the first virtual device, and configure a first interface for connecting a processor emulation module in the system simulation environment; The configuration unit is configured to configure a first virtual device driver for calling the first interface for the processor emulation module; The control unit is configured to convert a user control command received by the user interface into a processor control command based on the first virtual device and send the processor control command to the processor emulation module through the first interface, so that the processor emulation module executes the processor control command when the system simulation environment performs a simulation test. The user control command includes a log generation command. The creating unit is configured to call a computer simulator to create a first virtual device in a system simulation environment, configure a user interface for the first virtual device, and configure a first interface for connecting a processor emulation module in the system simulation environment, including: The creating unit is configured to call a computer simulator to create a first virtual device in a system simulation environment, configure a user interface for the first virtual device, and configure a first interface for connecting a processor emulation module in the system simulation environment, including: The creating unit is configured to call a computer simulator to create a first virtual device in a system simulation environment, configure a user interface for the first virtual device, and configure a first interface for connecting a processor emulation module in the system simulation environment, including: The creating unit is configured to call a computer simulator to create a first virtual device in a system simulation environment, configure a user interface for the first virtual device, and configure a first interface for connecting a processor emulation module in the system simulation environment, including: The control unit is configured to convert a user control command received by the user interface into a processor control command based on the first virtual device and send the processor control command to the processor emulation module through the first interface, so that the processor emulation module executes the processor control command when the system simulation environment performs a simulation test. translating the log generation command into a code instrumentation location based on the first virtual device, and sending the code instrumentation location to the processor emulation module through the first interface, so that the processor emulation module configures log generation control parameters for the to-be-tested program code according to the code instrumentation location, to execute the log generation control parameters when the to-be-tested program code is executed. The log generation control parameters include at least one of a log generation location, a log tracking granularity, and a log statistical parameter type of the to-be-tested program code.
7. An electronic device, comprising: The system simulation test method comprises the steps of: a memory for storing a computer program; a processor for executing the computer program to implement the steps of the system simulation test method according to any one of claims 1 to 5.
8. A non-volatile storage medium, comprising: The non-volatile storage medium stores a computer program, and the computer program is executed by the processor to implement the steps of the system simulation test method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Simulation debugging method and device for processor
CN102567196A
Embedded operating system-based simulation debugging system and method
CN103186458A
Distributed interactive simulation time sequence verification method and system
CN115422033A
System and apparatus for managing test procedures within a hardware-in-the-loop simulation system
US20100250220A1