Method and device for determining capacity of pre-execution instruction historical record table and electronic equipment
By monitoring and optimizing the instruction execution time in the sequential execution processor and determining the capacity of the pre-execution instruction history table, the performance loss and hardware problems caused by capacity mismatch are solved, and the operating efficiency and stability of the processor are improved.
Patent Information
- Application Number
- CN202410441390.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-12
- Publication Date
- 2024-08-30
AI Technical Summary
In sequential execution processors, the capacity of the pre-stored instruction history table does not match the capacity of the code writing and pre-execution instruction history tables, causing instructions to frequently switch between the pre-stored instruction history table and the cache, causing performance loss and hardware damage. .
When the instruction processing space of the register is full, instructions in the loop instruction execution library are called for loop execution processing, the execution time of the instruction is monitored, and instructions that meet the preset duration requirements are used as target instructions, and pre-execution is determined based on the number of target instructions. The size of the instruction history table.
Effectively determine the capacity of the pre-execution instruction history table in the sequential execution processor, optimize the branch instructions in the compiler to match the capacity of the pre-execution instruction history table, and improve the operating efficiency and stability of the processor.
Smart Images

Figure CN118567719A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of controllable software and hardware technology, and in particular to a method, device and electronic equipment for determining the capacity of a pre-execution instruction history record table. Background Art
[0002] In the field of processor technology, the instruction set prediction function improves the processor's computing speed. Its core principle is to add the predicted instructions to the pre-execution instruction history table for pre-execution to improve the computing speed.
[0003] Due to commercial confidentiality and security considerations, most sequential execution processor manufacturers hide the direct call of the pre-stored instruction history table and do not allow users to directly access parameters such as the length of the pre-stored instruction history table and the pre-stored instruction type. In the case where the code writing does not match the capacity of the pre-execution instruction history table, this causes the instructions in the sequential execution processor to repeatedly switch between the "pre-stored instruction history table" and the "cache", causing performance loss and hardware damage.
[0004] Therefore, finding a method to determine the capacity of the pre-execution instruction history table has become a research hotspot. Summary of the invention
[0005] The present invention provides a method, a device and an electronic device for determining the capacity of a pre-execution instruction history record table, which can effectively determine the capacity of the pre-execution instruction history record table in a sequential execution processor.
[0006] The present invention provides a method for determining the capacity of a pre-execution instruction history record table, which is applied to a sequential execution processor, wherein the sequential execution processor at least includes a register and a pre-execution instruction history record table, and the method includes: when the instruction processing space of the register is full, calling instructions in a loop instruction execution library to perform loop execution processing; monitoring the execution time of the instructions; using the instructions whose execution time meets the preset time requirement as target instructions to be executed in the pre-execution instruction history record table; and determining the capacity of the pre-execution instruction history record table based on the number of instructions of the target instructions.
[0007] According to a method for determining the capacity of a pre-execution instruction history record table provided by the present invention, the sequential execution processor includes a data line, an address line and a control line; monitoring the execution time of the instruction is implemented in the following manner: when it is monitored that the level of the data line, the level of the address line and the level of the control line change according to a preset level change requirement, determining that the instruction has been executed; recording the time required for the execution of the instruction, and using the time required for the execution of the instruction as the execution time of the instruction.
[0008] According to a method for determining the capacity of a pre-execution instruction history record table provided by the present invention, the sequential execution processor includes a level storage field for the data line, a level storage field for the address line, and a level storage field for the control line; before monitoring that the level of the data line, the level of the address line, and the level of the control line change according to a preset level change requirement, the method further includes: storing the level of the data line in the level storage field for the data line, storing the level of the address line in the level storage field for the address line, and storing the level of the control line in the level storage field for the control line in real time; reading the level of the data line from the level storage field for the data line, reading the level of the address line from the level storage field for the address line, and reading the level of the control line from the level storage field for the control line; and based on the read level of the data line, the read level of the address line, and the read level of the control line, respectively monitoring whether the level of the data line, the read level of the address line, and the control line change according to the preset level change requirement.
[0009] According to a method for determining the capacity of a pre-execution instruction history record table provided by the present invention, the sequential execution processor is deployed with an electrically erasable storage device, the electrically erasable storage device is respectively connected to the data line, the address line and the control line through an adder circuit, and the electrically erasable storage device is used to record the level of the data line, the level of the address line and the level of the control line; when it is monitored that the level of the data line, the level of the address line and the level of the control line change according to a preset level change requirement, determining that the execution of the instruction is completed specifically includes: based on the electrically erasable storage device detecting that the level of the data line, the level of the address line and the level of the control line change according to a preset level change requirement, determining that the execution of the instruction is completed.
[0010] According to a method for determining the capacity of a pre-execution instruction history record table provided by the present invention, the loop instruction execution library is implemented in the following manner: the instructions are encapsulated in the form of functions into a dynamic link library to obtain the loop instruction execution library, wherein the function at least includes a loop function body, a branch judgment statement function and a delay function.
[0011] According to a method for determining the capacity of a pre-execution instruction history record table provided by the present invention, after determining the capacity of the pre-execution instruction history record table, the method also includes: optimizing the number of branch instructions in the compiler so that the optimized number of instructions matches the capacity of the pre-execution instruction history record table.
[0012] The present invention also provides a device for determining the capacity of a pre-execution instruction history record table, which is applied to a sequential execution processor, wherein the sequential execution processor at least includes a register and a pre-execution instruction history record table, and the device includes: a calling module, which is used to call instructions in a loop instruction execution library for loop execution processing when the instruction processing space of the register is full; a monitoring module, which is used to monitor the execution time of the instructions; a processing module, which is used to use the instructions whose execution time meets the preset time requirement as the target instructions to be executed in the pre-execution instruction history record table; and a determination module, which is used to determine the capacity of the pre-execution instruction history record table based on the number of instructions of the target instruction.
[0013] According to a device for determining the capacity of a pre-execution instruction history record table provided by the present invention, the sequential execution processor includes a data line, an address line and a control line; the monitoring module adopts the following method to monitor the execution time of the instruction: when it is monitored that the level of the data line, the level of the address line and the level of the control line change according to the preset level change requirement, it is determined that the instruction has been executed; the time required for the execution of the instruction is recorded, and the time required for the execution of the instruction is used as the execution time of the instruction.
[0014] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for determining the capacity of a pre-execution instruction history record table as described in any one of the above is implemented.
[0015] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described methods for determining the capacity of a pre-execution instruction history record table.
[0016] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method for determining the capacity of a pre-execution instruction history record table as described in any one of the above is implemented.
[0017] The method, device and electronic device for determining the capacity of the pre-execution instruction history record table provided by the present invention call the instructions in the loop instruction execution library for loop execution processing when the instruction processing space of the register is full; monitor the execution time of the instructions; use the instructions whose execution time meets the preset time requirement as the target instructions to be executed in the pre-execution instruction history record table; and determine the capacity of the pre-execution instruction history record table based on the number of instructions of the target instructions. The method can effectively determine the capacity of the pre-execution instruction history record table in the sequential execution processor, thereby optimizing the branch instructions in the compiler so that the optimized instructions match the capacity of the pre-execution instruction history record table, thereby laying a foundation for improving the operating efficiency and stability of the processor. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0019] Figure 1 This is one of the flow charts of the method for determining the capacity of the pre-execution instruction history record table provided by the present invention;
[0020] Figure 2 It is a flow chart of the execution time of monitoring instructions provided by the present invention;
[0021] Figure 3 It is a schematic diagram of the connection between the clock cycle counter provided by the present invention and the CPU under test;
[0022] Figure 4 This is the second flow chart of the method for determining the capacity of the pre-execution instruction history record table provided by the present invention;
[0023] Figure 5 It is a structural schematic diagram of a device for determining the capacity of a pre-execution instruction history record table provided by the present invention;
[0024] Figure 6 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0025] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0026] The method for determining the capacity of the pre-execution instruction history record table provided by the present invention pre-optimizes instructions during the encoding process, reduces efficiency problems and mechanical failure problems caused by the sequential execution processor switching back and forth between the "pre-execution instruction history record table" and the "cache", and can greatly improve the efficiency of encoding execution. The present invention can be applied to the optimizer design field of compilers and linkers.
[0027] Figure 1 This is one of the flow charts of the method for determining the capacity of the pre-execution instruction history record table provided by the present invention.
[0028] The following will be combined Figure 1 The process of the method for determining the capacity of the pre-execution instruction history record table provided by the present invention is described.
[0029] In an exemplary embodiment of the present invention, the method for determining the capacity of the pre-execution instruction history record table can be applied to a sequential execution processor, for example, the sequential execution processor can be a single chip microcomputer. The sequential execution processor can at least include a register and a pre-execution instruction history record table.
[0030] Combination Figure 1 It can be known that the method for determining the capacity of the pre-execution instruction history record table may include steps 110 to 140, and each step will be introduced below.
[0031] In step 110, when the instruction processing space of the register is full, the instructions in the loop instruction execution library are called to perform loop execution processing.
[0032] In one embodiment, when the instruction processing space of the register in the sequential execution processor is full, the instructions in the loop instruction execution library may be called to perform loop execution processing.
[0033] It should be noted that in a sequential execution processor, after the instruction processing space of the register is full, the execution processing will be performed in the pre-execution instruction history record table. Further, if the instruction processing space of the pre-execution instruction history record table is full, the processing will be performed in the cache. In the application process, if the number of instructions to be executed in the pre-execution instruction history record table does not match the capacity of the pre-execution instruction history record table, there will be efficiency problems and mechanical failure problems caused by switching back and forth between the pre-execution instruction history record table and the cache. Therefore, the present invention can conveniently and quickly determine the capacity of the pre-execution instruction history record table by cyclically executing the instructions in the cyclic instruction execution library.
[0034] In step 120 , the execution time of the instruction is monitored.
[0035] In step 130, instructions whose execution duration meets the preset duration requirement are used as target instructions to be executed in the pre-execution instruction history record table.
[0036] In step 140 , the capacity of the pre-execution instruction history record table is determined based on the instruction quantity of the target instruction.
[0037] In another embodiment, the execution time of the instruction can be monitored. Since the running speed of the pre-execution instruction history record table is much faster than the running speed of the cache, wherein the running speed of the pre-execution instruction history record table is about 5ns, and the running speed of the cache is about 20ns, it can be understood that the running time of the instruction in the pre-execution instruction history record table can be within a preset range, that is, it meets the preset time requirement.
[0038] In another embodiment, the execution time of the instructions can be used to determine which instructions of the loop execution are executed in the pre-execution instruction history table and which are executed in the cache. In the application process, the instructions whose execution time meets the preset time requirement can be used as the target instructions to be executed in the pre-execution instruction history table, and the capacity of the pre-execution instruction history table is determined according to the number of instructions of the target instructions. It is achieved that the capacity of the pre-execution instruction history table in the sequential execution processor can be effectively determined, thereby optimizing the branch instructions in the compiler so that the optimized instructions match the capacity of the pre-execution instruction history table, thereby laying a foundation for improving the operating efficiency and stability of the processor.
[0039] The method for determining the capacity of the pre-execution instruction history record table provided by the present invention, when the instruction processing space of the register is full, calls the instructions in the loop instruction execution library for loop execution processing; monitors the execution time of the instructions; uses the instructions whose execution time meets the preset time requirement as the target instructions to be executed in the pre-execution instruction history record table; and determines the capacity of the pre-execution instruction history record table based on the number of instructions of the target instructions. The method can effectively determine the capacity of the pre-execution instruction history record table in the sequential execution processor, thereby optimizing the branch instructions in the compiler so that the optimized instructions match the capacity of the pre-execution instruction history record table, thereby laying a foundation for improving the operating efficiency and stability of the processor.
[0040] Figure 2 It is a flow chart of the execution time of monitoring instructions provided by the present invention.
[0041] The following will be combined Figure 2 The process of monitoring the execution time of an instruction is described.
[0042] In an exemplary embodiment of the present invention, the sequential execution processor may include data lines, address lines, and control lines. Figure 2 It can be seen that monitoring the execution time of the instruction may include step 210 and step 220, and each step will be introduced below.
[0043] In step 210, when it is monitored that the levels of the data line, the address line and the control line change according to the preset level change requirement, it is determined that the instruction execution is completed.
[0044] In step 220, the time required for the instruction to be executed is recorded, and the time required for the instruction to be executed is used as the execution time of the instruction.
[0045] In one embodiment, the changes in the level of the data line, the level of the address line, and the level of the control line can be monitored. If the changes in the level of the data line, the level of the address line, and the level of the control line all change according to the preset level change requirements, it can be said that the instruction execution is completed. The preset level change requirements may include the order of level changes and the magnitude of level changes.
[0046] Furthermore, in the process of determining the execution and completion of the instruction, the time required for the instruction to be executed can be recorded, and the time required for the instruction to be executed can be used as the execution time of the instruction. Through this embodiment, the execution time of the instruction can be determined quickly and conveniently, thereby laying a foundation for using the instruction whose execution time meets the preset time requirement as the target instruction to be executed in the pre-execution instruction history record table, and determining the capacity of the pre-execution instruction history record table based on the number of instructions of the target instruction.
[0047] In another embodiment of the present invention, a clock cycle counter can also be deployed in the sequential execution processor. Among them, the clock cycle counter can be an electrically erasable flash storage device composed of electrically erasable components that can record the timing wave provided by the CPU (corresponding to the sequential execution processor) timing module, and it is connected to the data line, address line and control line group of the CPU by an adder circuit. The historical records (such as level changes) of the data line, address line, control line and CPU timing can be recorded internally. Among them, the level of the data line, address line, control line and CPU timing recorded by the clock cycle counter can be in the form of Table 1.
[0048] Table 1 The clock cycle counter records the level changes of the data line, address line, control line and CPU timing
[0049]
[0050]
[0051] Since the sequential execution processor executes in sequence, the "pre-execution instruction history table" and "cache" can monitor the relationship between the data line, address line and CPU clock cycle in the memory without triggering instruction pre-storage.
[0052] From Table 1, we can know that: an instruction was executed in the 100th CPU clock cycle (a group of 10 CPU timing waves counts as one cycle), in the 215th clock cycle, the CPU finished executing the instruction and fed the result back to the memory, and in the 324th cycle, another instruction was executed. By repeatedly counting the above data, we can find out how many CPU cycles are required to execute a certain instruction. Due to the existence of the "pre-execution instruction history record table", "cache" and CPU "instruction pre-execution" mechanism, the execution time of instructions in the "pre-execution instruction history record table" and "cache" is different, that is, the CPU cycle time is different. Therefore, the number of instructions that can be pre-executed in the "pre-execution instruction history record table" can be determined based on the execution time of the instruction, that is, the capacity of the pre-execution instruction history record table can be determined to optimize the program construction during encoding.
[0053] Among them, the clock cycle counter is similar to the storage unit of BIOS in implementation, with FLASH for fuse, recording the changes of CPU timing wave, data line and control line.
[0054] In another exemplary embodiment of the present invention, the sequential execution processor may include a level storage field for a data line, a level storage field for an address line, and a level storage field for a control line. Figure 2 Taking the above embodiment as an example, before monitoring that the level of the data line, the level of the address line and the level of the control line change according to the preset level change requirement, the method for determining the capacity of the pre-execution instruction history record table may further include the following steps:
[0055] The level of the data line is stored in the level storage domain of the data line, the level of the address line is stored in the level storage domain of the address line, and the level of the control line is stored in the level storage domain of the control line in real time;
[0056] The level of the data line is read from the level storage domain of the data line, the level of the address line is read from the level storage domain of the address line, and the level of the control line is read from the level storage domain of the control line;
[0057] Based on the read data line level, address line level, and control line level, the data line level, address line level, and control line level are respectively monitored to see whether they change according to preset level change requirements.
[0058] In one embodiment, the four domains of CPU timing, data line group, address line group, and control line can be formatted to record the high and low levels on the four buses to determine the execution effect of the instruction. That is, the level of the data line is stored in the level storage domain of the data line, the level of the address line is stored in the level storage domain of the address line, and the level of the control line is stored in the level storage domain of the control line in real time. Further, the level of the data line can be read by the level storage domain of the data line, the level of the address line can be read by the level storage domain of the address line, and the level of the control line can be read by the level storage domain of the control line; and based on the read level of the data line, the level of the address line, and the level of the control line, the level of the data line, the level of the address line, and the level of the control line are respectively monitored to see whether they change according to the preset level change requirements. In this embodiment, the level of the data line is stored in the level storage domain of the data line, the level of the address line is stored in the level storage domain of the address line, and the level of the control line is stored in the level storage domain of the control line and the corresponding level is read, so that the corresponding level can be read conveniently and accurately and the corresponding level can be monitored.
[0059] In another exemplary embodiment of the present invention, the sequential execution processor is deployed with an electrically erasable storage device, which is respectively connected to the data line, the address line and the control line through an adder circuit, and the electrically erasable storage device is used to record the level of the data line, the level of the address line and the level of the control line. Continuing to use the above-mentioned embodiment as an example to illustrate, when it is monitored that the level of the data line, the level of the address line and the level of the control line change according to the preset level change requirement, it is determined that the execution of the instruction is completed, which can be achieved in the following way:
[0060] The electrically erasable storage device determines that the instruction execution is completed when it detects that the level of the data line, the level of the address line and the level of the control line change according to the preset level change requirement.
[0061] Figure 3 It is a schematic diagram of the connection between the clock cycle counter provided by the present invention and the CPU under test, wherein the CPU under test may correspond to the sequential execution processor in this embodiment.
[0062] In one embodiment, in combination Figure 3 It can be seen that the electrically erasable storage device can be described as a clock cycle counter. The clock cycle counter is an electrically erasable flash storage device composed of electrically erasable components that can record the timing wave provided by the CPU timing module. It is connected to the data line, address line and control line group of the CPU by an adder circuit. The internal data line, address line, control line and CPU timing history can be recorded. Among them, the memory is the memory of the CPU, and the memory controller is a controller used to control the memory.
[0063] In the application process, it can be determined that the instruction execution is completed based on the electrically erasable storage device when it is detected that the level of the data line, the level of the address line, and the level of the control line change according to the preset level change requirements. In other words, in this embodiment, it is based on the electrically erasable storage device, also known as the clock cycle counter, to monitor the level of the data line, the level of the address line, and the level of the control line, and to determine whether the level of the data line, the level of the address line, and the level of the control line change according to the preset level change requirements. Through this embodiment, the level of the data line, the level of the address line, and the level of the control line can be quickly, conveniently, and accurately monitored, and it can be determined whether the level of the data line, the level of the address line, and the level of the control line change according to the preset level change requirements.
[0064] In another exemplary embodiment of the present invention, the loop instruction execution library can be implemented in the following manner:
[0065] The instructions are encapsulated into a dynamic link library in the form of functions to obtain a loop instruction execution library, wherein the function at least includes a loop function body, a branch judgment statement function and a delay function.
[0066] In one embodiment, the loop instruction execution library is a set of instructions that may be recorded in a pre-execution instruction history record table. The instructions may be encapsulated in a dynamic link library in the form of functions so that the operating system can call them smoothly.
[0067] Its main structure is as follows:
[0068] Cache forced clear instruction ()
[0069] Loop function body()
[0070] {
[0071] Branch judgment statement (delay function ())
[0072] Branch judgment statement body 1
[0073] {
[0074] Instruction 1 in branch 1
[0075] Instruction 2 in branch 1
[0076] Instruction 3 in branch 1
[0077] Instruction 4 in branch 1
[0078] Instruction 5 in branch 1
[0079] …
[0080] Instruction n in branch 1
[0081] }
[0082] Branch judgment statement body 2
[0083] {
[0084] Instruction 1 in branch 2
[0085] Instruction 2 in branch 2
[0086] Instruction 3 in branch 2
[0087] Instruction 4 in branch 2
[0088] Instruction 5 in branch 2
[0089] …
[0090] Instruction n in branch 2
[0091] }
[0092] }
[0093] Delay function()
[0094] {
[0095] Memory access instructions
[0096] Long cycle calculation instructions
[0097] Memory write instructions
[0098] }
[0099] Among them, the functions in the loop instruction execution library mainly include: loop function body, branch judgment statement function and delay function.
[0100] The function of the loop function body is a function structure used for repeated instruction calls. In the case of repeated calls, the sequential execution processor will trigger a mechanism to cache some of the repeatedly called instructions into the cache and pre-store the instruction history record table to speed up its operation efficiency.
[0101] The branch judgment statement function is the key element of the loop function body in the loop instruction execution library. It is a general binary selection jump instruction, such as if else in C language. In the process of processing branch jumps, the sequential execution processor may pre-execute some branch judgment statements and store them in the "pre-stored instruction history record table" to speed up execution efficiency.
[0102] The delay function is a set of instruction sets that take a long time to process (commonly known as wasted CPU cycles) during the branch judgment process. It includes two or three parts: memory access and writing instructions and long-cycle calculation instructions. Memory access instructions refer to instructions that force values to be taken from the memory without triggering cache access and instructions in the pre-execution instruction history table; memory access instructions are similar to them, referring to instructions that force writes to the memory; long-cycle calculation instructions refer to instructions whose operations require a considerable number of CPU clock cycles and require the code to be in a waiting state during branch judgment.
[0103] In addition, the functions in the loop instruction execution library can also include cache forced clearing instructions. Among them, the cache forced clearing instruction refers to an instruction that can forcefully clear the pre-execution instruction history table and the cache before running. It can clear the cache and the pre-execution instruction history table to eliminate the influence of other programs on the running results.
[0104] Figure 4 This is the second flow chart of the method for determining the capacity of the pre-execution instruction history record table provided by the present invention.
[0105] The following will be combined Figure 4 Another method for determining the capacity of the pre-execution instruction history table is described below.
[0106] In an exemplary embodiment of the present invention, Figure 4 It can be seen that the method for determining the capacity of the pre-execution instruction history record table may include steps 410 to 450, wherein steps 410 to 440 are respectively the same or similar to steps 110 to 140. For its specific implementation and beneficial effects, please refer to the previous description. In this embodiment, no specific limitation is made. Step 450 will be introduced below.
[0107] In step 450, the instruction quantity of the branch instruction in the compiler is optimized so that the optimized instruction quantity matches the capacity of the pre-execution instruction history record table.
[0108] In one embodiment, the number of branch instructions in the compiler can be optimized so that the optimized number of instructions matches the capacity of the pre-execution instruction history table, thereby avoiding efficiency problems and mechanical failure problems caused by switching back and forth between the "pre-execution instruction history table" and the "cache", and greatly improving the efficiency of code execution.
[0109] According to the above description, the method for determining the capacity of the pre-execution instruction history record table provided by the present invention, when the instruction processing space of the register is full, calls the instructions in the loop instruction execution library for loop execution processing; monitors the execution time of the instructions; uses the instructions whose execution time meets the preset time requirement as the target instructions to be executed in the pre-execution instruction history record table; and determines the capacity of the pre-execution instruction history record table based on the number of instructions of the target instructions. It is realized that the capacity of the pre-execution instruction history record table in the sequential execution processor can be effectively determined, thereby optimizing the branch instructions in the compiler so that the optimized instructions match the capacity of the pre-execution instruction history record table, thereby laying a foundation for improving the operating efficiency and stability of the processor.
[0110] Based on the same concept, the present invention also provides a device for determining the capacity of a pre-execution instruction history record table.
[0111] The following is a description of a device for determining the capacity of a pre-execution instruction history table provided by the present invention. The device for determining the capacity of a pre-execution instruction history table described below and the method for determining the capacity of a pre-execution instruction history table described above can be referred to each other.
[0112] Figure 5 It is a structural schematic diagram of a device for determining the capacity of a pre-execution instruction history record table provided by the present invention.
[0113] In an exemplary embodiment of the present invention, the pre-execution instruction history record table capacity determination device can be applied to a sequential execution processor, and the sequential execution processor at least includes a register and a pre-execution instruction history record table. Figure 5 It can be seen that the apparatus for determining the capacity of the pre-execution instruction history record table may include a calling module 510, a monitoring module 520, a processing module 530, and a determining module 540, each of which will be described below.
[0114] The calling module 510 may be configured to call instructions in the loop instruction execution library to perform loop execution processing when the instruction processing space of the register is full;
[0115] The monitoring module 520 may be configured to monitor the execution time of the instruction;
[0116] The processing module 530 may be configured to use the instruction whose execution time meets the preset time requirement as a target instruction to be executed in the pre-execution instruction history record table;
[0117] The determination module 540 may be configured to determine the capacity of the pre-execution instruction history record table based on the instruction quantity of the target instruction.
[0118] In an exemplary embodiment of the present invention, the sequential execution processor includes a data line, an address line, and a control line;
[0119] The monitoring module 520 may monitor the execution time of the instruction in the following manner:
[0120] When it is monitored that the level of the data line, the level of the address line, and the level of the control line change according to a preset level change requirement, determining that the execution of the instruction is completed;
[0121] The time required for the instruction to be executed is recorded, and the time required for the instruction to be executed is used as the execution time of the instruction.
[0122] In an exemplary embodiment of the present invention, the sequential execution processor includes a level storage field for the data line, a level storage field for the address line, and a level storage field for the control line;
[0123] The monitoring module 520 may also be configured to:
[0124] storing the level of the data line in the level storage domain of the data line, storing the level of the address line in the level storage domain of the address line, and storing the level of the control line in the level storage domain of the control line in real time;
[0125] The level of the data line is read from the level storage domain of the data line, the level of the address line is read from the level storage domain of the address line, and the level of the control line is read from the level storage domain of the control line;
[0126] Based on the read levels of the data line, the address line, and the control line, the levels of the data line, the address line, and the control line are respectively monitored to see whether they change according to preset level change requirements.
[0127] In an exemplary embodiment of the present invention, the sequential execution processor is deployed with an electrically erasable storage device, the electrically erasable storage device is respectively connected to the data line, the address line and the control line through an adder circuit, and the electrically erasable storage device is used to record the level of the data line, the level of the address line and the level of the control line;
[0128] The monitoring module 520 uses the following method to determine that the instruction is executed when the level of the data line, the level of the address line, and the level of the control line are changed according to the preset level change requirement:
[0129] The electrically erasable storage device determines that the instruction has been executed when it monitors that the level of the data line, the level of the address line, and the level of the control line change according to a preset level change requirement.
[0130] In an exemplary embodiment of the present invention, the calling module 510 implements the maintenance of the loop instruction execution library in the following manner:
[0131] The instructions are encapsulated into a dynamic link library in the form of functions to obtain the loop instruction execution library, wherein the function at least includes a loop function body, a branch judgment statement function and a delay function.
[0132] In an exemplary embodiment of the present invention, the determination module 540 may also be configured to:
[0133] The instruction quantity of the branch instruction in the compiler is optimized so that the optimized instruction quantity matches the capacity of the pre-execution instruction history record table.
[0134] Figure 6 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 6 As shown, the electronic device may include: a processor (processor) 610, a communication interface (Communications Interface) 620, a memory (memory) 630 and a communication bus 640, wherein the processor 610, the communication interface 620, and the memory 630 communicate with each other through the communication bus 640. The processor 610 can call the logic instructions in the memory 630 to execute the method for determining the capacity of the pre-execution instruction history record table, which is applied to a sequential execution processor, and the sequential execution processor at least includes a register and a pre-execution instruction history record table. The method includes: when the instruction processing space of the register is full, calling the instructions in the loop instruction execution library for loop execution processing; monitoring the execution time of the instructions; using the instructions whose execution time meets the preset time requirement as the target instructions to be executed in the pre-execution instruction history record table; and determining the capacity of the pre-execution instruction history record table based on the number of instructions of the target instruction.
[0135] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0136] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the pre-execution instruction history record table capacity determination method provided by the above-mentioned methods, which is applied to a sequential execution processor. The sequential execution processor at least includes a register and a pre-execution instruction history record table. The method includes: when the instruction processing space of the register is full, calling the instructions in the loop instruction execution library for loop execution processing; monitoring the execution time of the instructions; using the instructions whose execution time meets the preset time requirement as the target instructions to be executed in the pre-execution instruction history record table; and determining the capacity of the pre-execution instruction history record table based on the number of instructions of the target instruction.
[0137] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for determining the capacity of a pre-execution instruction history record table provided by the above-mentioned methods, and is applied to a sequential execution processor, wherein the sequential execution processor includes at least a register and a pre-execution instruction history record table, and the method includes: when the instruction processing space of the register is full, calling instructions in a loop instruction execution library for loop execution processing; monitoring the execution time of the instructions; using instructions whose execution time meets a preset time requirement as target instructions to be executed in the pre-execution instruction history record table; and determining the capacity of the pre-execution instruction history record table based on the number of instructions of the target instruction.
[0138] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0139] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0140] It is further understood that, although the operations are described in a specific order in the accompanying drawings in the embodiments of the present invention, it should not be understood as requiring the operations to be performed in the specific order or serial order shown, or requiring the execution of all the operations shown to obtain the desired results. In certain environments, multitasking and parallel processing may be advantageous.
[0141] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these 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.
Claims
1. A method for determining the capacity of a pre-execution instruction history table, characterized in that: Applied to a sequential execution processor, the sequential execution processor at least includes a register and a pre-execution instruction history record table, the method includes: When the instruction processing space of the register is full, calling instructions in the loop instruction execution library to perform loop execution processing; monitoring the execution time of the instructions; The instruction whose execution time meets the preset time requirement is used as the target instruction to be executed in the pre-execution instruction history record table; Based on the instruction quantity of the target instruction, the capacity of the pre-execution instruction history record table is determined.
2. The method for determining the capacity of the pre-execution instruction history table according to claim 1, characterized in that: The sequential execution processor includes data lines, address lines and control lines; Monitoring the execution time of the instruction is achieved in the following way: When it is monitored that the level of the data line, the level of the address line, and the level of the control line change according to a preset level change requirement, determining that the execution of the instruction is completed; The time required for the instruction to be executed is recorded, and the time required for the instruction to be executed is used as the execution time of the instruction.
3. The method for determining the capacity of the pre-execution instruction history table according to claim 2, characterized in that: The sequential execution processor includes a level storage domain for the data line, a level storage domain for the address line, and a level storage domain for the control line; Before monitoring that the level of the data line, the level of the address line, and the level of the control line change according to the preset level change requirement, the method further includes: storing the level of the data line in the level storage domain of the data line, storing the level of the address line in the level storage domain of the address line, and storing the level of the control line in the level storage domain of the control line in real time; The level of the data line is read from the level storage domain of the data line, the level of the address line is read from the level storage domain of the address line, and the level of the control line is read from the level storage domain of the control line; Based on the read levels of the data line, the address line, and the control line, the levels of the data line, the address line, and the control line are respectively monitored to see whether they change according to preset level change requirements.
4. The method for determining the capacity of the pre-execution instruction history table according to claim 2 or 3, characterized in that: The sequential execution processor is equipped with an electrically erasable storage device, which is respectively connected to the data line, the address line and the control line through an adder circuit, and is used to record the level of the data line, the level of the address line and the level of the control line; The step of determining that the instruction is executed completely when it is detected that the level of the data line, the level of the address line, and the level of the control line change according to the preset level change requirement specifically includes: The electrically erasable storage device determines that the instruction has been executed when it monitors that the level of the data line, the level of the address line, and the level of the control line change according to a preset level change requirement.
5. The method for determining the capacity of the pre-execution instruction history table according to claim 1, characterized in that: The loop instruction execution library is implemented in the following way: The instructions are encapsulated into a dynamic link library in the form of functions to obtain the loop instruction execution library, wherein the function at least includes a loop function body, a branch judgment statement function and a delay function.
6. The method for determining the capacity of the pre-execution instruction history table according to claim 1, characterized in that: After determining the capacity of the pre-execution instruction history record table, the method further includes: The instruction quantity of the branch instruction in the compiler is optimized so that the optimized instruction quantity matches the capacity of the pre-execution instruction history record table.
7. A device for determining the capacity of a pre-execution instruction history record table, characterized in that: Applied to a sequential execution processor, the sequential execution processor at least includes a register and a pre-execution instruction history record table, the device includes: A calling module, used for calling instructions in a loop instruction execution library to perform loop execution processing when the instruction processing space of the register is full; A monitoring module, used to monitor the execution time of the instruction; A processing module, configured to use the instruction whose execution duration meets the preset duration requirement as a target instruction to be executed in the pre-execution instruction history record table; The determination module is used to determine the capacity of the pre-execution instruction history record table based on the instruction quantity of the target instruction.
8. The device for determining the capacity of the pre-execution instruction history table according to claim 7, characterized in that: The sequential execution processor includes data lines, address lines and control lines; The monitoring module monitors the execution time of the instruction in the following manner: When it is monitored that the level of the data line, the level of the address line, and the level of the control line change according to a preset level change requirement, determining that the execution of the instruction is completed; The time required for the instruction to be executed is recorded, and the time required for the instruction to be executed is used as the execution time of the instruction.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method for determining the capacity of the pre-execution instruction history table according to any one of claims 1 to 6 is implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for determining the capacity of a pre-execution instruction history table according to any one of claims 1 to 6 is implemented.
