Method and system for changing instruction cycle
By dynamically setting the instruction cycle, the problem that pipeline technology cannot take into account the speed of complex and simple instructions is solved, the normal operation of instructions and resource optimization are achieved, and the overall efficiency is improved.
Patent Information
- Application Number
- CN202411009481.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-11-15
AI Technical Summary
When processing computer instructions, existing pipeline technology cannot take into account the differences in running speeds of complex DSP instructions and simple RISC-V instructions, resulting in insufficient running time or wasted resources and reduced overall efficiency.
By obtaining the instruction information of computer instructions, dynamically set the number of clock cycles corresponding to each instruction, adjust the running time of each stage of the pipeline, and ensure that complex instructions have enough time to execute without wasting resources.
It realizes the time to deal with different types of instructions, ensures that all instructions operate normally, improves resource utilization and operation efficiency, and achieves the effect of reducing costs and increasing efficiency.
Smart Images

Figure CN118963836A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of processor technology, and in particular to a method and system for changing an instruction cycle. Background Art
[0002] At present, the processing of computer instructions generally adopts pipeline technology, which refers to a quasi-parallel processing implementation technology in which multiple computer instructions are overlapped and operated when the program is executed. In the CPU, several circuit units with different functions form an instruction processing pipeline, and then a computer instruction is divided into several steps and then executed separately by these circuit units, so that an instruction can be completed in one CPU clock cycle.
[0003] However, when the CPU main frequency is constant, the current pipeline technology is used to process computer instructions. The running time of different pipeline stages of all instructions is uniform, which cannot take into account the slow running speed of complex DSP instructions and the fast running speed of simple RISC-V instructions. If the specified running time is too short, it will lead to insufficient time when running DSP instructions, causing DSP instructions to run abnormally; if the specified running time is too long, it will cause resource waste when running RISC-V instructions, and the overall efficiency will be reduced. Summary of the invention
[0004] The present application provides a method and system for changing the instruction cycle to solve the problem that when the existing pipeline technology processes computer instructions, the running time of different pipeline stages of all instructions is unified, and the specified running time is too short, which will lead to insufficient time when running complex instructions, causing abnormal operation of complex instructions, and the specified running time is too long, which will lead to waste of resources when running simple instructions and reduce the overall efficiency.
[0005] In order to solve the above technical problems, the technical solution adopted in this application is to provide a method for changing the instruction cycle, including the steps of: obtaining computer instructions, decoding the computer instructions, obtaining instruction information of the computer instructions, and generating corresponding operation tasks; according to the instruction information, setting the number of clock cycles required to execute the operation task; sending the operation task to the corresponding stage in the pipeline, and executing the corresponding operation task according to the number of clock cycles.
[0006] In some embodiments, the number of clock cycles required to execute the operation task is set according to the instruction information, specifically including: reading a global time register; if the global time register is empty, or the value in the global time register is 0, then according to the instruction information, the number of clock cycles required to execute the operation task is set locally; if the value in the global time register is greater than 0, then the number of clock cycles required to execute the operation task is set globally.
[0007] In some embodiments, in the step of performing local time setting for the number of clock cycles required to execute the operation task according to the instruction information, the local time setting includes: obtaining instruction characteristics of the corresponding computer instruction according to the instruction information; and setting the number of clock cycles of each stage in the pipeline corresponding to the operation task in real time according to the instruction characteristics; wherein the instruction information includes an instruction opcode and an instruction type identifier, and the instruction characteristics include instruction complexity, instruction latency, and instruction throughput.
[0008] In some embodiments, in the step of performing global time setting for the number of clock cycles required to execute the operation task, the global time setting includes: setting the number of clock cycles of each stage in the pipeline corresponding to the operation task to the value in the global time register.
[0009] In some embodiments, before the step of setting the number of clock cycles required to execute the operation task according to the instruction information, the step is also included: determining whether the computer instruction is a modification instruction; if it is a modification instruction, modifying the global time register; if it is not a modification instruction, executing subsequent steps.
[0010] In some embodiments, it includes the following steps: compiling each code segment in a high-level language program object into a corresponding assembly code; determining the assembly code that complies with global rules, and adding the modification instructions to the assembly code that complies with the global rules; translating each of the assembly codes into corresponding machine codes, and generating a target file based on all the machine codes; wherein the target file contains the computer instructions.
[0011] In some embodiments, the types of computer instructions include RISC-V instruction types and DSP instruction types.
[0012] The present application also provides a system for changing the instruction cycle, comprising a decoding module and an execution module connected in sequence, the decoding module comprising an instruction decoding submodule, a cycle setting submodule and a task issuing submodule connected in sequence; the instruction decoding submodule is used to obtain computer instructions, and is also used to decode the computer instructions, obtain the instruction information of the computer instructions, and generate corresponding operation tasks; the cycle setting submodule is used to set the number of clock cycles required for executing the operation task according to the instruction information; the task issuing submodule is used to issue the operation task; the execution module is used to execute the corresponding operation task according to the number of clock cycles.
[0013] In some embodiments, it also includes a compilation module arranged before the decoding module, the compilation module includes an assembly code generation submodule, an identification submodule, an addition submodule and a machine code generation submodule; the assembly code generation submodule is used to compile each code segment in the high-level language program object into a corresponding assembly code; the identification submodule is used to determine the assembly code that complies with the global rules; the addition submodule is used to add modification instructions to the assembly code that complies with the global rules; the machine code generation submodule is used to translate each of the assembly codes into corresponding machine codes, and generate a target file based on all the machine codes, wherein the target file contains the computer instructions.
[0014] In some embodiments, a clock cycle number estimation module connected to the decoding module is also included; the clock cycle number estimation module is used to receive the instruction information transmitted by the decoding module, and is also used to calculate and feedback the number of clock cycles required for the operation task of the corresponding computer instruction based on the instruction information.
[0015] The beneficial effects of the present application are as follows: the present application discloses a method and system for changing the instruction cycle, the method comprising the steps of obtaining a computer instruction, decoding the computer instruction, obtaining the instruction information of the computer instruction, and generating a corresponding operation task; setting the number of clock cycles required for executing the operation task according to the instruction information; issuing the operation task to the corresponding stage in the pipeline, and executing the corresponding operation task according to the number of clock cycles. The system comprises a decoding module and an execution module connected in sequence, the decoding module comprising an instruction decoding submodule, a cycle setting submodule and a task issuing submodule connected in sequence; the instruction decoding submodule is used to obtain the computer instruction, and is also used to decode the computer instruction, obtain the instruction information of the computer instruction, and generate the corresponding operation task; the cycle setting submodule is used to set the number of clock cycles required for executing the operation task according to the instruction information; the task issuing submodule is used to issue the operation task; the execution module is used to execute the corresponding operation task according to the number of clock cycles. Based on the instruction information, the present application can analyze in real time the number of clock cycles required for each operation task corresponding to each computer instruction, and then dynamically allocate instruction cycles to each stage of the pipeline, and dynamically adjust the running time of different stages of the pipeline, so that when processing different computer instructions, both simple computer instructions and complex computer instructions can be taken into account in terms of running time, so that all computer instructions can run normally, and at the same time, resource utilization is improved, operating efficiency is improved, and the effect of reducing costs and increasing efficiency is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 It is a flowchart of a method for changing an instruction cycle provided by the present application;
[0017] Figure 2 It is a schematic diagram of the composition of the system for changing the instruction cycle provided by the present application;
[0018] Figure 3 It is a schematic diagram of the composition of the compiling module in the system for changing the instruction cycle provided by the present application;
[0019] Figure 4 It is a schematic diagram of the composition of the decoding module in the system for changing the instruction cycle provided by the present application;
[0020] Figure 5 It is a schematic diagram of the composition of the execution module in the system for changing the instruction cycle provided by the present application;
[0021] Figure 6 It is a schematic diagram of executing operation tasks in the method for changing the instruction cycle provided by the present application. DETAILED DESCRIPTION
[0022] In order to facilitate the understanding of the present application, the present application is described in more detail below in conjunction with the accompanying drawings and specific embodiments. The preferred embodiments of the present application are provided in the accompanying drawings. However, the present application can be implemented in many different forms and is not limited to the embodiments described in this specification. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive.
[0023] It should be noted that, unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as those commonly understood by those skilled in the art of the present application. The terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The term "and / or" used in this specification includes any and all combinations of one or more related listed items.
[0024] In order to facilitate the understanding of the present application, some terms that may be involved in the embodiments of the present application are first explained as follows:
[0025] RISC-V: The fifth generation of RISC, is an open source instruction set architecture developed based on the principle of reduced instruction set (RISC: Reduced Instruction Set Computer).
[0026] DSP (Digital Signal Processing): Digital signal processing. DSP processor is used to efficiently perform digital signal processing tasks.
[0027] CLK (Clock): usually means clock, timer or signal.
[0028] IR (Instruction Register): stands for instruction register.
[0029] Clock cycle: It is the most basic and smallest unit of time in the processor. The shortest time for the pulse signal emitted by the clock generator to make a periodic change is the clock cycle.
[0030] Processor main frequency: the number of clock cycles in one second, also known as clock frequency.
[0031] Instruction cycle: The total execution time of a computer instruction is a multiple of the clock cycle.
[0032] Instruction latency: refers to the number of clock cycles required from issuing a computer instruction to the time when the result of the computer instruction can be read. Different computer instructions may have different latencies, so there are fast and slow ones. Some computer instructions have a latency of 1, which means it takes 1 clock cycle to execute, while some have a latency greater than 1, which means it takes multiple clock cycles to execute.
[0033] Pipeline: In a computer, a process is decomposed into several sub-processes, each of which is implemented by a dedicated functional component. Multiple processes are staggered in time and passed through each functional component in turn, so that each sub-process can be carried out in parallel with other sub-processes. This is pipeline technology. Each sub-process and its functional component in the pipeline is called a stage or segment of the pipeline, and the segments are connected to each other to form a pipeline. Applying pipeline technology to the execution process of instructions forms an instruction pipeline.
[0034] Figure 1 The flowchart of the method for changing the instruction cycle provided by the present application is shown, comprising the steps of:
[0035] S1: compile each code segment in the high-level language program object into a corresponding assembly code; determine the assembly code that complies with the global rules, and add modification instructions to the assembly code that complies with the global rules; translate each assembly code into a corresponding machine code, and generate a target file based on all the machine codes; wherein the target file contains computer instructions.
[0036] S2: Obtain computer instructions, decode the computer instructions, obtain instruction information of the computer instructions, and generate corresponding operation tasks.
[0037] S3: According to the instruction information, the number of clock cycles required to execute the operation task is set.
[0038] S4: Send the operation task to the corresponding stage in the pipeline, and execute the corresponding operation task according to the number of clock cycles.
[0039] Based on the instruction information, the present application can analyze in real time the number of clock cycles required for each operation task corresponding to each computer instruction, and then dynamically allocate instruction cycles to each stage of the pipeline, and dynamically adjust the running time of different stages of the pipeline, so that when processing different computer instructions, both simple computer instructions and complex computer instructions can be taken into account in terms of running time, so that all computer instructions can run normally, and at the same time, resource utilization is improved, operating efficiency is improved, and the effect of reducing costs and increasing efficiency is achieved.
[0040] Combine the following Figures 1 to 6 , this application is described in detail with specific embodiments.
[0041] like Figure 1 As shown, the method for changing the instruction cycle provided by the embodiment of the present application is described in detail as follows:
[0042] S1: compile each code segment in the high-level language program object into a corresponding assembly code; determine the assembly code that complies with the global rules, and add modification instructions to the assembly code that complies with the global rules; translate each assembly code into a corresponding machine code, and generate a target file based on all the machine codes; wherein the target file contains computer instructions.
[0043] Combination Figure 2 , Figure 3 , this step is mainly completed by compilation module 1.
[0044] Specifically, firstly, each code segment in the high-level language program object is compiled into corresponding assembly code through the assembly code generation submodule 11.
[0045] Then, the assembly code that complies with the global rule is determined by the identification submodule 12. Complying with the global rule means that the assembly code corresponding to the current code segment can be set with a unified global time, and the global time refers to the unified running time of a code segment.
[0046] For example, in the current code segment, 80% of the code is DSP code, then it is considered that the global time of the corresponding assembly code can be set to more than 2 clock cycles; or in the current code segment, 80% of the code is RISC-V code, then it is considered that the global time of the corresponding assembly code can be set to 1 clock cycle; or in the current code segment, 90% of the code is simple code, then it is considered that the global time of the corresponding assembly code can be set to 1 clock cycle; or in the current code segment, 90% of the code is generally complex code, then it is considered that the global time of the corresponding assembly code can be set to 2 clock cycles; or in the current code segment, 90% of the code is particularly complex code, then it is considered that the global time of the corresponding assembly code can be set to 3 or more clock cycles. In calculating the proportion of different types of code, for non-loop code segments, the number of instructions of each assembly instruction in each assembly code is counted as 1; for loop code segments, the number of instructions = the number of looped assembly instructions × the number of loops.
[0047] Then, by adding submodule 13, a modification instruction is added to the assembly code that complies with the global rules. That is, an instruction to modify the value of the global time register is added in front of the corresponding assembly code, and an instruction to clear the global time register is added after the assembly code. The modification instruction can be a RISC-V instruction or a DSP instruction. Among them, the global time register is used to save the value of the global time. There is only one value saved in the global time register, which can be a binary form of integers such as 0, 1, 2, or it can be empty; 0 or empty means that there is no global time setting, and greater than 0 means that there is a global time setting.
[0048] Furthermore, all assembly codes (including assembly codes that comply with global rules and assembly codes that do not comply with global rules) are input into the machine code generation submodule 14, and each assembly code is translated into corresponding machine code by the machine code generation submodule 14, and a target file is generated according to all the machine codes. The target file contains computer instructions.
[0049] In this embodiment, the types of computer instructions include RISC-V instruction types and DSP instruction types. Among them, the speed difference between RISC-V instructions and DSP instructions is: ① Most RISC-V instructions are simple, fast in execution, but low in efficiency; ② Most DSP instructions are complex, slow in execution, but high in efficiency; ③ One DSP instruction may complete the sum of the tasks completed by several RISC-V instructions. A DSP instruction performs more operations, and generally 5 to 10 RISC-V instructions are equivalent to a complex DSP instruction. ④ Not all RISC-V instructions are fast, and not all DSP instructions are slow.
[0050] S2: Obtain computer instructions, decode the computer instructions, obtain instruction information of the computer instructions, and generate corresponding operation tasks.
[0051] Combination Figures 2 to 4 As shown, this step is mainly completed by the instruction decoding submodule 21 in the decoding module 2.
[0052] Specifically, the instruction decoding submodule 21 obtains the computer instruction from the machine code generating submodule 14 in the compiling module 1, decodes the computer instruction, obtains the instruction information of the computer instruction, and generates the corresponding operation task.
[0053] The instruction information includes an instruction opcode and an instruction type identifier. The instruction type identifier can be used to determine whether the type of the computer instruction is a RISC-V instruction type or a DSP instruction type.
[0054] S3: According to the instruction information, the number of clock cycles required to execute the operation task is set.
[0055] Combination Figure 2 , Figure 4 As shown, this step is mainly completed by the cycle setting submodule 22 in the decoding module 2 and the clock cycle number estimation module 4.
[0056] Specifically, firstly, the cycle setting submodule 22 determines whether the acquired computer instruction is the modification instruction added in S1.
[0057] If it is a modification instruction, the global time register is modified, that is, the content of the global time register is modified according to the modification instruction, including: setting the value in the global time register to the value carried in the modification instruction, or clearing the global time register.
[0058] If it is not a modification instruction, the global time register is read directly.
[0059] If the value read out from the global time register is greater than 0, the global time setting is performed for the number of clock cycles required to execute the operation task, that is, the number of clock cycles of each stage in the pipeline corresponding to the operation task is set to the value in the global time register.
[0060] For example, if the value in the global time register is 1 at this time, the number of clock cycles in each stage of the pipeline corresponding to each operation task generated by the current computer instruction will be set to 1; if the value in the global time register is 3 at this time, the number of clock cycles in each stage of the pipeline corresponding to each operation task generated by the current computer instruction will be set to 3 to maintain consistency.
[0061] If the global time register is read to be empty, or the value in the global time register is 0, then the number of clock cycles required to execute the operation task is set locally according to the instruction information. Specifically, it includes: using the clock cycle number estimation module 4 to obtain the instruction information in the decoding module 2; according to the instruction information, obtaining the instruction characteristics of the corresponding computer instruction, wherein the instruction information includes the instruction operation code and the instruction type identification, and the instruction characteristics include the instruction complexity, instruction delay and instruction throughput; according to the instruction characteristics, the number of clock cycles of each stage in the pipeline corresponding to the operation task is set in real time.
[0062] For example, if it is known through the instruction type identifier and instruction characteristics in the instruction information that the current computer instruction is a simple RISC-V instruction, the number of clock cycles of each stage in the pipeline corresponding to each operation task generated by the current computer instruction is set to 1; if it is known through the instruction type identifier and instruction characteristics in the instruction information that the current computer instruction is a complex DSP instruction, the number of clock cycles of the two stages in the pipeline corresponding to each operation task (such as read operand task and multiplication and addition operation task) generated by the current computer instruction is set to 2 and 3 respectively.
[0063] S4: Send the operation task to the corresponding stage in the pipeline, and execute the corresponding operation task according to the number of clock cycles.
[0064] Combination Figure 2 , Figure 4 , Figure 5 As shown, this step is mainly completed by the task issuing submodule 23 in the decoding module 2 and the execution module 3.
[0065] Specifically, first, each operation task generated in the above steps and its required number of clock cycles are sent to the pipeline control submodule 31 in the execution module 3 through the task sending submodule 23; the pipeline control submodule 31 adds the requirement of completing the corresponding operation task within N clock cycles to the corresponding stage of the pipeline based on the received operation task and its corresponding number of clock cycles, where N represents the current number of clock cycles.
[0066] Furthermore, each issued operation task is executed by the pipeline execution submodule 32 and completed within the specified time.
[0067] For example, combined with Figure 6 As shown, 1T represents 1 clock cycle. Figure 6 A total of 15 clock cycles, i.e., 15T, are shown in FIG. In this embodiment, taking an eight-stage pipeline as an example, F1, F2, D1, D2, R1, R2, E, and W respectively represent eight different stages of the pipeline, corresponding to eight different operation tasks. Among them, the operation task represented by F1 is to load the instruction address; the operation task represented by F2 is to fetch instructions from the bus; the operation task represented by D1 is to identify the instruction boundary; the operation task represented by D2 is to load the instruction into the IR (instruction register); the operation task represented by R1 is to load the operand address; the operation task represented by R2 is to read the operand; the operation task represented by E is to execute; and the operation task represented by W is to write back the result. In one clock cycle, at most eight computer instruction operation tasks will be executed in parallel, such as the eight computer instruction different operation tasks corresponding to the clock cycle of 8T, namely, W, E, R2, R1, D2, D1, F2, and F1. Figure 6 The number of clock cycles for different stages of the pipeline corresponding to each operation task is 1. In actual applications, 2 clock cycles or more clock cycles can also be used, that is, each stage of the pipeline does not necessarily take up only 1 clock cycle. The stage running time is a multiple of the clock cycle, that is, it takes several times the clock cycle to complete a stage of the pipeline. And Figure 6 The running time of the D2 stage and the three stages before it is constant, and the running time of the subsequent stages (R1, R2, E, and W) can be affected by the global time settings and local time settings.
[0068] Corresponding to the method of changing the instruction cycle in the above embodiment, Figure 2 A schematic diagram of the composition of a system for changing an instruction cycle provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0069] refer to Figures 2 to 5The system includes a compiling module 1, a decoding module 2, and an execution module 3 and a clock cycle number estimation module 4 respectively connected to the decoding module 2.
[0070] Specifically, refer to Figure 3 The compilation module 1 includes an assembly code generation submodule 11, an identification submodule 12, an addition submodule 13 and a machine code generation submodule 14. Figure 4 The decoding module 2 includes an instruction decoding submodule 21, a cycle setting submodule 22 and a task issuing submodule 23 connected in sequence. Figure 5 The execution module 3 includes a pipeline control submodule 31 and a pipeline execution submodule 32 which are connected in sequence.
[0071] In this embodiment, the assembly code generation submodule 11 is used to compile each code segment in the high-level language program object into a corresponding assembly code; the identification submodule 12 is used to determine the assembly code that complies with the global rules; the addition submodule 13 is used to add modification instructions to the assembly code that complies with the global rules; the machine code generation submodule 14 is used to translate each assembly code into a corresponding machine code, and generate a target file based on all the machine codes, wherein the target file contains computer instructions.
[0072] The instruction decoding submodule 21 is used to obtain computer instructions, and is also used to decode computer instructions, obtain instruction information of computer instructions, and generate corresponding operation tasks; the cycle setting submodule 22 is used to set the number of clock cycles required to execute the operation task according to the instruction information; the task issuing submodule 23 is used to issue the operation task.
[0073] The clock cycle number estimation module 4 is used to receive the instruction information transmitted by the decoding module 2, and is also used to calculate and feed back the number of clock cycles required for the operation task of the corresponding computer instruction according to the instruction information.
[0074] The execution module 3 is used to execute the corresponding operation task according to the number of clock cycles.
[0075] It should be noted that since the above-mentioned system for changing the instruction cycle is based on the same concept as the embodiment of the method of the present application, its specific functions, the process of each module realizing its respective function and the technical effects brought about can be specifically referred to the description of the embodiment shown in the above-mentioned method for changing the instruction cycle, and will not be repeated here.
[0076] It can be seen that the present application discloses a method and system for changing the instruction cycle, the method comprising the steps of: obtaining computer instructions, decoding the computer instructions, obtaining the instruction information of the computer instructions, and generating corresponding operation tasks; according to the instruction information, setting the number of clock cycles required for executing the operation task; issuing the operation task to the corresponding stage in the pipeline, and executing the corresponding operation task according to the number of clock cycles. The system comprises a decoding module and an execution module connected in sequence, the decoding module comprises an instruction decoding submodule, a cycle setting submodule and a task issuing submodule connected in sequence; the instruction decoding submodule is used to obtain computer instructions, and is also used to decode computer instructions, obtain the instruction information of the computer instructions, and generate corresponding operation tasks; the cycle setting submodule is used to set the number of clock cycles required for executing the operation task according to the instruction information; the task issuing submodule is used to issue the operation task; the execution module is used to execute the corresponding operation task according to the number of clock cycles. Based on the instruction information, the present application can analyze in real time the number of clock cycles required for each operation task corresponding to each computer instruction, and then dynamically allocate instruction cycles to each stage of the pipeline, and dynamically adjust the running time of different stages of the pipeline, so that when processing different computer instructions, both simple computer instructions and complex computer instructions can be taken into account in terms of running time, so that all computer instructions can run normally, and at the same time, resource utilization is improved, operating efficiency is improved, and the effect of reducing costs and increasing efficiency is achieved.
[0077] The above are merely embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structural transformations made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for changing an instruction cycle, characterized in that: Includes steps: Acquire computer instructions, decode the computer instructions, obtain instruction information of the computer instructions, and generate corresponding operation tasks; According to the instruction information, the number of clock cycles required to execute the operation task is set; The operation task is sent to the corresponding stage in the pipeline, and the corresponding operation task is executed according to the number of clock cycles.
2. The method according to claim 1, characterized in that The step of setting the number of clock cycles required for executing the operation task according to the instruction information specifically includes: Read the global time register; If the global time register is empty or the value in the global time register is 0, then according to the instruction information, a local time setting is performed for the number of clock cycles required to execute the operation task; If the value in the global time register is greater than 0, a global time setting is performed for the number of clock cycles required to execute the operation task.
3. The method according to claim 2, characterized in that In the step of performing local time setting for the number of clock cycles required for executing the operation task according to the instruction information, the local time setting includes: According to the instruction information, the instruction characteristics of the corresponding computer instruction are obtained; according to the instruction characteristics, the number of clock cycles of each stage in the pipeline corresponding to the operation task is set in real time; The instruction information includes an instruction opcode and an instruction type identifier, and the instruction characteristics include instruction complexity, instruction latency, and instruction throughput.
4. The method according to claim 2, characterized in that: In the step of performing global time setting for the number of clock cycles required for executing the operation task, the global time setting includes: The number of clock cycles of each stage in the pipeline corresponding to the operation task is set to the value in the global time register.
5. The method according to claim 2, characterized in that: Before the step of setting the number of clock cycles required for executing the operation task according to the instruction information, the step further includes: Determine whether the computer instruction is a modification instruction; if it is a modification instruction, modify the global time register; if it is not a modification instruction, execute subsequent steps.
6. The method according to claim 5, characterized in that It includes the following pre-steps: Compile each code segment in the high-level language program object into corresponding assembly code; Determine the assembly code that complies with the global rule, and add the modification instruction to the assembly code that complies with the global rule; Translate each of the assembly codes into corresponding machine codes, and generate target files according to all of the machine codes; Wherein, the target file contains the computer instructions.
7. The method according to any one of claims 1 to 6, characterized in that: The types of computer instructions include RISC-V instruction types and DSP instruction types.
8. A system for changing an instruction cycle, characterized in that: It includes a decoding module and an execution module connected in sequence, wherein the decoding module includes an instruction decoding submodule, a cycle setting submodule and a task issuing submodule connected in sequence; The instruction decoding submodule is used to obtain computer instructions, and is also used to decode the computer instructions to obtain instruction information of the computer instructions and generate corresponding operation tasks; The cycle setting submodule is used to set the number of clock cycles required to execute the operation task according to the instruction information; The task issuing submodule is used to issue the operation task; The execution module is used to execute the corresponding operation task according to the number of clock cycles.
9. The system according to claim 8, characterized in that It also includes a compiling module arranged before the decoding module, the compiling module includes an assembly code generating submodule, an identifying submodule, an adding submodule and a machine code generating submodule; The assembly code generation submodule is used to compile each code segment in the high-level language program object into a corresponding assembly code; The identification submodule is used to determine the assembly code that complies with the global rule; The adding submodule is used to add modification instructions to the assembly code that complies with the global rule; The machine code generation submodule is used to translate each of the assembly codes into corresponding machine codes, and generate a target file according to all the machine codes, wherein the target file contains the computer instructions.
10. The system according to claim 8 or 9, characterized in that It also includes a clock cycle number estimation module connected to the decoding module; the clock cycle number estimation module is used to receive the instruction information transmitted by the decoding module, and is also used to calculate and feedback the number of clock cycles required for the operation task of the corresponding computer instruction based on the instruction information.
Citation Information
Cited By
Instruction decoding pipeline construction method, electronic equipment and storage medium
CN120255964A
