Instruction set simulation method, device, and computer equipment
By obtaining and converting program files and directly executing the simulation assembly instruction set in the hardware acceleration chip, the problem of low simulation efficiency and large CPU burden in the prior art is solved, and the further implementation is achieved Efficient simulation and lower CPU burden.
Patent Information
- Application Number
- CN202210168015.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-23
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2042-02-23
AI Technical Summary
The execution efficiency of existing instruction set simulation technology is low, resulting in excessive CPU processing burden and affecting user experience.
By obtaining program files independent of the operating system on the hardware acceleration chip, loading the file path into the function function code, converting it into a simulated assembly instruction set, and directly executing it to achieve the target function, reducing the CPU burden.
It improves the instruction set simulation efficiency, reduces the CPU processing burden, and improves the user experience.
Smart Images

Figure CN114546596B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of computer hardware acceleration chips, and in particular to an instruction set simulation method, apparatus, computer equipment and storage medium. Background Art
[0002] Nowadays, instruction set simulation technology has become an important part of the field of computer science and technology. Whether it is system development, hardware simulation testing, the development of instruction set simulators, or the application of security software, instruction set simulation technology is indispensable. However, even if it has been widely used, it cannot avoid the obvious disadvantage of low execution efficiency of instruction set simulation technology.
[0003] At present, there are many solutions, such as static multi-core simulation, preprocessing of introduced instructions, dynamic decoding cache, multi-threaded C function generation and dynamic scheduling, which are used to shorten the operation cycle and improve the operation efficiency. However, from the perspective of the machine itself, the implementation of the simulation instruction set is based on the application layer, so there is a burden on the CPU. Therefore, when the technology is applied to software, it will inevitably have a serious impact on the machine itself. For example, when security products are performing security testing, they use a large number of simulation instructions to simulate the execution of malicious files, causing the machine to freeze and seriously affecting the user experience. Summary of the invention
[0004] The embodiments of the present application provide an instruction set simulation method, apparatus, computer device and storage medium for improving the efficiency of instruction set simulation while reducing the processing burden of a CPU.
[0005] An embodiment of the present invention provides an instruction set simulation method, which is applied to a hardware acceleration chip, wherein the logic function of the hardware acceleration chip is independent of an operating system of an electronic device, and the method includes:
[0006] Obtain the program file of the target function to be executed;
[0007] Loading the file path of the program file into the function code corresponding to the target function;
[0008] Convert the function code of the file path loaded with the program file into a corresponding simulation assembly instruction set;
[0009] The simulation assembly instruction set is executed to realize the execution of the target function on the program file.
[0010] An embodiment of the present invention provides an instruction set simulation device, which is applied to a hardware acceleration chip, wherein the logic function of the hardware acceleration chip is independent of an operating system of an electronic device, and the device includes:
[0011] An acquisition module is used to acquire the program file of the target function to be executed;
[0012] A loading module, used for loading the file path of the program file into the function code corresponding to the target function;
[0013] A conversion module, used for converting the function code of the file path loaded with the program file into a corresponding simulation assembly instruction set;
[0014] The execution module is used to execute the simulation assembly instruction set to realize the execution of the target function on the program file.
[0015] A computer device comprises a central processing unit, a memory, a hardware acceleration chip and a computer program stored in the memory and executable on the hardware acceleration chip. The hardware acceleration chip implements the instruction set simulation method when executing the computer program.
[0016] A computer-readable storage medium stores a computer program, and the computer program implements the above instruction set simulation method when executed by a hardware acceleration chip.
[0017] The present invention provides an instruction set simulation method, device, computer equipment and storage medium, firstly obtaining a program file of a target function to be executed, then loading the file path of the program file into a function function code corresponding to the target function; converting the function function code loaded with the file path of the program file into a corresponding simulation assembly instruction set; and executing the simulation assembly instruction set to implement the target function execution on the program file. Since the logic function of the hardware acceleration chip in the invention is independent of the operating system of the electronic device, and it is used to perform the calculation of at least one target function, after obtaining the program file of the target function, the hardware acceleration chip directly executes the simulation assembly instruction set to implement the target function execution on the program file, so that the present invention can improve the instruction set simulation efficiency while reducing the CPU processing burden. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 A flow chart of an instruction set simulation method provided by this application;
[0019] Figure 2 Another instruction set simulation method flow chart provided by this application;
[0020] Figure 3 A schematic diagram of the structure of an instruction set simulation device provided in this application
[0021] Figure 4 A schematic diagram of a computer device provided for this application. DETAILED DESCRIPTION
[0022] In order to better understand the above-mentioned technical scheme, the technical scheme of the embodiments of the present application is described in detail below through the accompanying drawings and specific embodiments. It should be understood that the embodiments of the present application and the specific features in the embodiments are detailed descriptions of the technical scheme of the embodiments of the present application, rather than limitations on the technical scheme of the present application. In the absence of conflict, the embodiments of the present application and the technical features in the embodiments may be combined with each other.
[0023] See also Figure 1 An instruction set emulation method provided by an embodiment of the present invention is applied to a hardware acceleration chip. The logic function of the hardware acceleration chip is independent of the operating system of the electronic device, that is, the hardware acceleration chip in this embodiment is not controlled by the operating system, and it has all the rights to control the electronic device. The method uses the hardware acceleration chip as the execution subject to perform the following steps S101-S104:
[0024] Step S101, obtaining a program file of a target function to be executed.
[0025] Among them, the calculation amount of the target function exceeds the preset value, or the calculation time of the target function exceeds the preset time. The preset value and preset time can be set according to actual needs, and this embodiment does not make specific limitations on this.
[0026] In this embodiment, if the program file is a shelled file, the corresponding target function is the shelling function; if the target file is a compressed file, the corresponding target function is the decompression function. It can be understood that the target function in this embodiment is not limited to the shelling function and the decompression function, but can also include other functions whose calculation amount exceeds the preset value or the calculation time exceeds the preset time. This embodiment does not specifically limit the target function.
[0027] Step S102, loading the file path of the program file into the function code corresponding to the target function.
[0028] Among them, the file path of the program file is the path where the program file is stored in the computer device. This embodiment can obtain the corresponding program code by loading the file path of the program file into the function function code corresponding to the target function, so as to convert the obtained program code into the corresponding simulation assembly instruction set.
[0029] It should be noted that in this embodiment, different functions correspond to different function function codes. After determining the corresponding target function, the file path of the program file of the target function to be executed is obtained, and then the file path is loaded into the corresponding function function code to obtain the function function code loaded with the file path of the program file.
[0030] Step S103, converting the function code of the file path loaded with the program file into a corresponding simulation assembly instruction set.
[0031] The simulation assembly instruction set includes multiple assembly instructions, which may be asynchronous execution instructions or sequential execution instructions, etc., which are not specifically limited in this embodiment. Specifically, if the assembly instruction is an asynchronous execution instruction, the assembly instruction can be executed under different hardware acceleration chips, and if the assembly instruction is a sequential execution instruction, the assembly instruction can only be executed under one hardware acceleration chip.
[0032] Step S104, executing the simulation assembly instruction set to implement the target function of the program file.
[0033] In this embodiment, the hardware acceleration chip is used to perform calculations of at least one target function. The target function is one of the preset functions corresponding to the hardware acceleration chip. It should be noted that the hardware acceleration chip in this embodiment is different from the central processing unit, that is, the hardware acceleration chip is not controlled by the operating system, and is used to execute the program file of the preset function, and the execution of the preset function requires more time or more calculation.
[0034] Specifically, the present embodiment may include multiple hardware acceleration chips, each of which is used to execute one or more program files of functions; of course, the multiple hardware acceleration chips in the present embodiment may be chips with the same processing capabilities or chips with different processing capabilities. In addition, for the multiple hardware acceleration chips in the present embodiment, each hardware acceleration chip may be managed by a hardware acceleration management chip, that is, computing tasks are assigned to the hardware acceleration chips by the hardware acceleration management chip.
[0035] Furthermore, if the multiple hardware acceleration chips in this embodiment are chips with different processing capabilities, the hardware acceleration management chip needs to determine the amount of calculation required for the simulation assembly instruction set after obtaining the simulation assembly instruction set corresponding to the program file, and then allocate the corresponding hardware acceleration chip to the simulation assembly instruction set based on the determined amount of calculation, so that the allocated hardware acceleration chip has sufficient processing power to execute the assembly instructions in the simulation assembly instruction set.
[0036] In an optional embodiment provided by the present invention, the method further includes: determining whether the target function is a preset function; if the target function is a preset function, executing a simulation assembly instruction set to realize the execution of the target function on the program file; if the target function is not a preset function, transmitting the simulation assembly instruction set to the central processing unit, so that the central processing unit executes the simulation assembly instruction set to realize the execution of the target function on the program file. Among them, the preset function is a pre-configured function, and the preset function can specifically be a decompression function and an unpacking function. In this embodiment, after obtaining the program file of the target function to be executed, it is determined whether the target function belongs to one of the preset functions. If so, the simulation assembly instruction set is executed to realize the execution of the target function on the program file; if not, the simulation assembly instruction set is transmitted to the central processing unit, so that the central processing unit executes the simulation assembly instruction set.
[0037] In an optional embodiment provided by the present invention, after obtaining the program file of the target function to be executed, the method further includes: determining whether the program file is a file of a preset type; if the program file is a file of a preset type, executing the simulation assembly instruction set to implement the target function on the program file; if the program file is not a file of a preset type, transmitting the simulation assembly instruction set to a central processing unit so that the central processing unit executes the simulation assembly instruction set to implement the target function on the program file. Among them, the preset type of file can specifically be a compressed file or a shelled file, which is not specifically limited in this embodiment.
[0038] In an optional embodiment provided by the present invention, the method also includes: determining the data volume of the program file; if the data volume of the program file is greater than a preset value, executing the simulation assembly instruction set to implement the target function of the program file; if the data volume of the program file is less than or equal to the preset value, transmitting the simulation assembly instruction set to a central processing unit so that the central processing unit executes the simulation assembly instruction set to implement the target function of the program file.
[0039] Among them, the preset quantity can be set according to data requirements, such as the preset quantity can be 1G, 5G, 10G, etc., which is not specifically limited in this embodiment. In this embodiment, after obtaining the program file of the target function to be executed, it is also necessary to determine the data volume of the program file. If the data volume is greater than the preset value, the hardware acceleration chip executes the simulation assembly instruction set; if the data volume is less than or equal to the preset value, it means that even if the program file is the target function, due to its small data volume, executing the program file will not take up a large amount of computing or computing time, so the corresponding simulation assembly instruction set can be transmitted to the central processing unit, so that the central processing unit executes the simulation assembly instruction set.
[0040] The embodiment of the present invention provides an instruction set simulation method, which first obtains a program file of a target function to be executed, then loads the file path of the program file into a function function code corresponding to the target function; converts the function function code loaded with the file path of the program file into a corresponding simulation assembly instruction set; and executes the simulation assembly instruction set to execute the target function on the program file. Since the logic function of the hardware acceleration chip in the invention is independent of the operating system of the electronic device, and it is used to perform calculations of at least one target function, after obtaining the program file of the target function, the hardware acceleration chip directly executes the simulation assembly instruction set to execute the target function on the program file, so that the processing burden of the CPU can be reduced while improving the efficiency of instruction set simulation through the present invention.
[0041] See also Figure 2 Another instruction set emulation method provided by an embodiment of the present invention is applied to a hardware acceleration management chip. The logic function of the hardware acceleration management chip is independent of the operating system of the electronic device. The hardware acceleration management chip has all the rights to control the electronic device and is used to manage one or more hardware acceleration chips. The method uses the hardware acceleration management chip as the execution subject to perform the following method. Specifically, the method includes steps S201 to S209:
[0042] Step S201, obtaining a program file of a target function to be executed.
[0043] Among them, the calculation amount of the target function exceeds the preset value.
[0044] Step S202, loading the file path of the program file into the function code corresponding to the target function.
[0045] Step S203, converting the function code of the file path loaded with the program file into a corresponding simulation assembly instruction set.
[0046] It should be noted that steps S201 to S203 are Figure 1 The descriptions of the corresponding steps in are the same and will not be repeated in this embodiment.
[0047] Step S204: determine whether there is an idle hardware acceleration chip.
[0048] It should be noted that the present embodiment includes multiple hardware acceleration chips. After obtaining the corresponding simulation assembly instruction set, it is necessary to determine whether there is an idle hardware acceleration chip at the current moment, that is, to determine whether there is a hardware acceleration chip without computing tasks. If there is an idle hardware acceleration chip, jump to step S205 to continue execution; if there is no idle hardware acceleration chip, jump to step S206 to continue execution.
[0049] Step S205: If there is an idle hardware acceleration chip, the idle hardware acceleration chip executes the simulation assembly instruction set to implement the target function of the program file.
[0050] For this embodiment, if it is determined that there is an idle hardware acceleration chip, the hardware acceleration management chip transfers the simulation assembly instruction set to the idle hardware acceleration chip, so that the idle hardware acceleration chip can immediately execute the simulation assembly instruction set to execute the target function of the program file, avoiding the situation of waiting for the execution of the simulation assembly instruction set, thereby improving the execution efficiency of the simulation set instructions through this embodiment.
[0051] Step S206: If there is no idle hardware acceleration chip, obtain the utilization rate of each hardware acceleration chip respectively; and determine whether the minimum utilization rate is less than the preset utilization rate.
[0052] The utilization rate is used to indicate the resource usage of the hardware acceleration chip. The preset utilization rate can be set according to the actual situation. For example, the preset utilization rate can be 30%, 40%, 50%, etc. This embodiment does not make any specific limitation on this.
[0053] Step S207: If the minimum utilization is less than the preset utilization, the hardware acceleration chip with the minimum utilization executes the simulation assembly instruction set to implement the target function of the program file.
[0054] For example, there are three hardware acceleration chips: hardware acceleration chip 1, hardware acceleration chip 2 and hardware acceleration chip 3. The hardware acceleration management chip determines that the utilization of hardware acceleration chip 1 is 56%, the utilization of hardware acceleration chip 2 is 30%, and the utilization of hardware acceleration chip 3 is 20%. If the preset utilization is 50%, the hardware acceleration chip 2 has the lowest utilization. If the utilization of the hardware acceleration chip 2 is less than the preset utilization of 50%, the hardware acceleration management chip transmits the simulation assembly instruction set to the hardware acceleration chip 2, so that the hardware acceleration chip 2 executes the simulation assembly instruction set.
[0055] Step S208: If the minimum utilization is greater than or equal to the preset utilization, determine whether the utilization of the CPU is less than the preset utilization.
[0056] Among them, step S208 is a parallel step of step S207, that is, after determining that the minimum utilization is greater than or equal to the preset utilization, it is determined whether the utilization of the central processing unit is less than the preset utilization. If the utilization of the central processing unit is less than the preset utilization, jump to step S209 to continue execution.
[0057] Step S209, if the utilization rate of the central processing unit is less than the preset utilization rate, the simulation assembly instruction set is transmitted to the central processing unit, and the central processing unit executes the simulation assembly instruction set to implement the target function of executing the program file.
[0058] For the embodiment of the present invention, after obtaining the simulation assembly instruction set, the hardware acceleration management chip needs to determine whether there is an idle hardware acceleration chip. If there is an idle hardware acceleration chip, the simulation assembly instruction set is directly transferred to the idle hardware acceleration chip for execution; if there is no idle hardware acceleration chip, the hardware acceleration management chip needs to determine the chip that executes the simulation assembly instruction set based on the execution status of each hardware acceleration chip and the central processing unit, that is, if there is a hardware acceleration chip that can execute the simulation assembly instruction set (a hardware acceleration chip with a utilization rate less than a preset utilization rate), the hardware acceleration management chip transfers the simulation assembly instruction set to the hardware acceleration chip for execution; if there is no simulation assembly instruction set, it is necessary to determine whether the simulation assembly instruction set is executed by the central processing unit based on the utilization rate of the central processing unit, so that the waiting time of the simulation assembly instruction set can be reduced through the present invention, thereby improving the execution efficiency of the simulation instruction set.
[0059] Furthermore, in this embodiment, if it is determined that the utilization rate of the central processing unit is less than the preset utilization rate, the hardware acceleration chip and / or the central processing unit that executes the simulation assembly instruction set can be determined in the following two ways:
[0060] 1. If the utilization rate of the central processing unit is greater than or equal to the preset utilization rate, the hardware acceleration management chip monitors the utilization rate of the hardware acceleration chip in real time; obtains the latest hardware acceleration chip whose utilization rate is less than the preset utilization rate; transmits the simulation assembly instruction set to the latest hardware acceleration chip whose utilization rate is less than the preset utilization rate, so that the latest hardware acceleration chip whose utilization rate is less than the preset utilization rate executes the simulation assembly instruction set.
[0061] Specifically, the hardware acceleration management chip of this embodiment can obtain the utilization of each hardware acceleration chip at a preset time interval, so as to obtain the latest hardware acceleration chip whose utilization is less than the preset utilization. The preset time interval can be 1 second, 2 seconds or 3 seconds.
[0062] 2. If the utilization rate of the central processing unit is greater than or equal to the preset utilization rate, the hardware acceleration management chip determines whether the instructions in the simulation assembly instruction set are asynchronous execution instructions; if so, determines the instructions in the simulation assembly instruction set whose execution time exceeds the preset time; transmits the instructions whose execution time exceeds the preset time to the hardware acceleration chip, so that the hardware acceleration chip executes the instructions whose execution time exceeds the preset time; transmits the instructions whose execution time is less than or equal to the preset time to the central processing unit, so that the central processing unit executes the instructions whose execution time is less than or equal to the preset time.
[0063] Among them, the asynchronous execution instruction is an instruction that can be executed asynchronously, that is, it can be executed in different chips, and its execution order is not determined. In this embodiment, the simulation assembly instruction set may include multiple subsets, each subset corresponds to instruction type information, and the instruction type information may be an asynchronous execution instruction, a sequential execution instruction (including the order of execution), etc.
[0064] For example, the simulation assembly instruction set includes three subsets: subset 1, subset 2 and subset 3, among which subset 1 and subset 2 are executed sequentially, and subset 3 is the asynchronous execution instruction of subset 1 and subset 2, that is, subset 1 and subset 2 need to be placed in a hardware acceleration chip for execution, and subset 3 can be executed in a different hardware acceleration chip. Specifically, in this example, subset 1 and subset 2 can be transferred to the hardware acceleration chip so that the hardware acceleration chip executes the instructions in subset 1 and subset 2; subset 3 can be transferred to the central processing unit or other hardware acceleration chips so that the central processing unit or other hardware acceleration chips execute the instructions in subset 3.
[0065] It should be noted that in this example, the hardware acceleration chips for executing subset 1 and subset 2 can be determined through steps S206 and S207, and the execution subset 3 can be a central processing unit or other hardware acceleration chips. Similarly, the hardware acceleration chip can also be determined through S206 and S207, but the utilization rate of the hardware acceleration chip determined here is higher than the utilization rate of the hardware acceleration chips corresponding to subset 1 and subset 2.
[0066] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0067] In one embodiment, an instruction set simulation device is provided, and the instruction set simulation device corresponds one-to-one to the instruction set simulation method in the above embodiment. Figure 3As shown, the device is applied to a hardware acceleration chip, the logic function of the hardware acceleration chip is independent of the operating system of the electronic device, and the functional modules of the instruction set simulation device are described in detail as follows:
[0068] An acquisition module 31 is used to acquire a program file of a target function to be executed;
[0069] A loading module 32, used for loading the file path of the program file into the function code corresponding to the target function;
[0070] A conversion module 33, used for converting the function code of the file path loaded with the program file into a corresponding simulation assembly instruction set;
[0071] The execution module 34 is used to execute the simulation assembly instruction set to realize the execution of the target function on the program file.
[0072] In an optional embodiment, the apparatus further comprises: a determination module 35;
[0073] A determination module 35, used to determine whether the program file is a file of a preset type;
[0074] An execution module 34, configured to execute the simulation assembly instruction set if the program file is a file of a preset type, so as to implement the target function of the program file;
[0075] The execution module 34 is used to transmit the simulation assembly instruction set to the central processing unit if the program file is not a file of a preset type, so that the central processing unit executes the simulation assembly instruction set to implement the target function of the program file.
[0076] In an optional embodiment, the determination module 35 is used to determine whether the target function is a preset function;
[0077] An execution module 34, configured to execute the simulation assembly instruction set if the target function is a preset function, so as to implement execution of the target function on the program file;
[0078] The execution module 34 is used to transmit the simulation assembly instruction set to the central processing unit if the target function is not a preset function, so that the central processing unit executes the simulation assembly instruction set to realize the execution of the target function on the program file.
[0079] In an optional embodiment, the execution module 34 is specifically configured to:
[0080] Determine whether there is an idle hardware acceleration chip;
[0081] If there is an idle hardware acceleration chip, the simulation assembly instruction set is executed by the idle hardware acceleration chip to implement the target function of the program file;
[0082] If there is no idle hardware acceleration chip, obtain the utilization rate corresponding to each hardware acceleration chip; determine whether the minimum utilization rate is less than the preset utilization rate;
[0083] If the minimum utilization is less than the preset utilization, the simulation assembly instruction set is executed by a hardware acceleration chip with the minimum utilization to implement the target function of the program file.
[0084] In an optional embodiment, the determination module 35 is used to determine whether the utilization of the central processing unit is less than the preset utilization if the minimum utilization is greater than or equal to the preset utilization;
[0085] The execution module 34 is used to transmit the simulation assembly instruction set to the central processing unit if the utilization rate of the central processing unit is less than the preset utilization rate, so that the central processing unit executes the simulation assembly instruction set to realize the execution of the target function of the program file.
[0086] In an optional embodiment, the acquisition module 31 is used to monitor the utilization rate of the hardware acceleration chip in real time if the utilization rate of the central processing unit is greater than or equal to the preset utilization rate;
[0087] An acquisition module 31 is used to acquire the latest hardware acceleration chip whose utilization rate is less than a preset utilization rate;
[0088] The execution module 34 is used to execute the simulation assembly instruction set through the latest hardware acceleration chip whose utilization is less than the preset utilization, so as to realize the execution of the target function on the program file.
[0089] In an optional embodiment, the determination module 35 is used to determine whether the instruction in the simulation assembly instruction set is an asynchronous execution instruction if the utilization rate of the central processing unit is greater than or equal to the preset utilization rate;
[0090] A determination module 35 is configured to determine, if yes, the instructions in the simulation assembly instruction set whose execution time exceeds a preset time;
[0091] An execution module 34, configured to execute the instruction whose execution time exceeds a preset time through a hardware acceleration chip;
[0092] The execution module 34 is used to transmit the instruction whose execution time is less than or equal to the preset time to the central processing unit, so that the central processing unit executes the instruction whose execution time is less than or equal to the preset time.
[0093] In an optional embodiment, the target function to be executed of the program file includes at least one of the following: an unpacking function and a decompression function.
[0094] For the specific definition of the instruction set simulation device, please refer to the definition of the instruction set simulation method above, which will not be repeated here. Each module in the above-mentioned device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a hardware acceleration chip in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the hardware acceleration chip can call and execute the operations corresponding to the above modules.
[0095] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus, and the processor includes a central processing unit and a hardware acceleration chip. Among them, the hardware acceleration chip of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. When the computer program is executed by the hardware acceleration chip, an instruction set simulation method is implemented.
[0096] In one embodiment, a computer device is provided, including a central processing unit, a memory, a hardware acceleration chip, and a computer program stored in the memory and executable on the hardware acceleration chip. When the hardware acceleration chip executes the computer program, the following steps are implemented:
[0097] Obtain the program file of the target function to be executed;
[0098] Loading the file path of the program file into the function code corresponding to the target function;
[0099] Convert the function code of the file path loaded with the program file into a corresponding simulation assembly instruction set;
[0100] The simulation assembly instruction set is executed to realize the execution of the target function on the program file.
[0101] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a hardware acceleration chip, the following steps are implemented:
[0102] Obtain the program file of the target function to be executed;
[0103] Loading the file path of the program file into the function code corresponding to the target function;
[0104] Convert the function code of the file path loaded with the program file into a corresponding simulation assembly instruction set;
[0105] The simulation assembly instruction set is executed to realize the execution of the target function on the program file.
[0106] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0107] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0108] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention.
Claims
1. An instruction set simulation method, It is characterized in that The method is applied to a hardware acceleration chip, the logic function of the hardware acceleration chip is independent of the operating system of the electronic device, and the method includes: Obtain the program file of the target function to be executed; Loading the file path of the program file into the function code corresponding to the target function; Convert the function code of the file path loaded with the program file into a corresponding simulation assembly instruction set; The simulation assembly instruction set is executed to realize the execution of the target function on the program file.
2. The method according to claim 1, It is characterized in that After obtaining the program file of the target function to be executed, the method further includes: Determining whether the program file is a file of a preset type; If the program file is a file of a preset type, executing the simulation assembly instruction set to implement the target function of the program file; If the program file is not a file of a preset type, the simulation assembly instruction set is transmitted to a central processing unit, so that the central processing unit executes the simulation assembly instruction set to implement the target function of the program file.
3. The method according to claim 1, It is characterized in that The method further comprises: Determining whether the target function is a preset function; If the target function is a preset function, executing the simulation assembly instruction set to implement the target function on the program file; If the target function is not a preset function, the simulation assembly instruction set is transmitted to a central processing unit, so that the central processing unit executes the simulation assembly instruction set to implement the target function on the program file.
4. The method according to claim 3, It is characterized in that The executing the simulation assembly instruction set to realize the execution of the target function on the program file includes: Determine whether there is an idle hardware acceleration chip; If there is an idle hardware acceleration chip, the simulation assembly instruction set is executed by the idle hardware acceleration chip to implement the target function of the program file; If there is no idle hardware acceleration chip, obtain the utilization rate corresponding to each hardware acceleration chip; determine whether the minimum utilization rate is less than the preset utilization rate; If the minimum utilization is less than the preset utilization, the simulation assembly instruction set is executed by a hardware acceleration chip with the minimum utilization to implement the target function of the program file.
5. The method according to claim 4, It is characterized in that The method further comprises: If the minimum utilization is greater than or equal to the preset utilization, determining whether the utilization of the central processing unit is less than the preset utilization; If the utilization rate of the central processing unit is less than the preset utilization rate, the simulation assembly instruction set is transmitted to the central processing unit, so that the central processing unit executes the simulation assembly instruction set to realize the execution of the target function on the program file.
6. The method according to claim 5, It is characterized in that The method further comprises: If the utilization rate of the central processing unit is greater than or equal to the preset utilization rate, the utilization rate of the hardware acceleration chip is monitored in real time; Get the latest hardware acceleration chip whose utilization is less than the preset utilization; The simulation assembly instruction set is executed by a hardware acceleration chip whose latest utilization is less than a preset utilization, so as to realize execution of a target function on the program file.
7. The method according to claim 5, It is characterized in that The method further comprises: If the utilization rate of the central processing unit is greater than or equal to the preset utilization rate, determining whether the instruction in the simulation assembly instruction set is an asynchronous execution instruction; If yes, determining the instruction in the simulation assembly instruction set whose execution time exceeds the preset time; Executing, by means of a hardware acceleration chip, instructions whose execution time exceeds a preset time; The instruction whose execution time is less than or equal to the preset time is transmitted to the central processing unit, so that the central processing unit executes the instruction whose execution time is less than or equal to the preset time.
8. The method according to any one of claims 1 to 7, It is characterized in that The target function to be executed of the program file includes at least one of the following: an unpacking function and a decompression function.
9. An instruction set simulation device, It is characterized in that The device is applied to a hardware acceleration chip, the logic function of the hardware acceleration chip is independent of the operating system of the electronic device, and the device includes: An acquisition module is used to acquire the program file of the target function to be executed; A loading module, used for loading the file path of the program file into the function code corresponding to the target function; A conversion module, used for converting the function code of the file path loaded with the program file into a corresponding simulation assembly instruction set; The execution module is used to execute the simulation assembly instruction set to realize the execution of the target function on the program file.
10. A computer device comprising a central processing unit, a memory, a hardware acceleration chip, and a computer program stored in the memory and executable on the hardware acceleration chip. It is characterized in that When the hardware acceleration chip executes the computer program, the instruction set simulation method according to any one of claims 1 to 8 is implemented.
11. A computer-readable storage medium storing a computer program. It is characterized in that When the computer program is executed by a hardware acceleration chip, the instruction set emulation method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Enhancing speed of simulation of an IC design while testing scan circuitry
CN101828120A
Debugging analysis method for stack overflow vulnerabilities of MIPS instruction set program
CN112347487A
Methods, systems, and apparatuses for a multiprocessor boot flow for a faster boot process
EP3901768A1
Testing system, testing method, test program and computer readable recording medium recorded with test program
JP2002268918A
