Processor and instruction execution method

By introducing a current acquisition module and arbitration module into the processor, predicting and avoiding current mutations, the voltage change problem caused by the processor current mutation is solved, and the effect of reducing power consumption and improving stability is achieved.

CN119556985AActive Publication Date: 2025-03-04CHENGDU HAIGUANG INTEGRATED CIRCUIT DESIGN CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411612219.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-12
Publication Date
2025-03-04
Estimated Expiration
2044-11-12

AI Technical Summary

Technical Problem

The processor may experience a sudden change in current when executing instructions, causing the voltage to change beyond the normal operating range, which may cause the processor to be abnormal or damaged.

Method used

Design a processor, including a decoder, a computing unit, a current acquisition module and an arbitration module. The current acquisition module obtains the instantaneous current prediction value of the operation unit to execute the instruction in advance. The arbitration module determines whether to insert NOP instructions into the operation unit based on the prediction value and the preset threshold value to avoid sudden current changes.

Benefits of technology

By predicting current mutations and inserting NOP instructions, the processor power consumption is reduced, the current mutation behavior is avoided, and the processor stability and computing power are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119556985A_ABST
    Figure CN119556985A_ABST
Patent Text Reader

Abstract

The invention provides a processor, which comprises a decoder used for decoding an instruction to obtain a decoding result; the operation unit is used for performing operation according to the decoding result obtained by the decoder; the current acquisition module is used for acquiring instruction information from the decoder before the operation unit performs operation every time, and acquiring an instantaneous current predicted value of an instruction to be executed from the stored instruction current set according to the instruction information; and the arbitration module is connected with the current acquisition module and is used for judging whether to insert the NOP instruction into the arithmetic unit or not according to the instantaneous current predicted value of the instruction to be executed acquired by the current acquisition module and a preset threshold value. According to the invention, current abrupt change can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of chip design, and in particular to a processor and an instruction execution method. Background Art

[0002] The current in the processor will increase or decrease as instructions are executed, and the sudden change in current will cause a change in voltage in the circuit. When the current suddenly increases, the voltage will produce a voltage drop; when the current suddenly decreases, there will be a voltage increase. If the voltage change exceeds the normal operating range of the processor, it may cause the processor to be abnormal or damaged. Therefore, the problem of sudden current changes should be avoided as much as possible when designing the processor. Summary of the invention

[0003] In view of this, the present invention provides a processor and an instruction execution method, which can avoid sudden current changes when the processor executes instructions.

[0004] In a first aspect, the present invention provides a processor, the processor comprising:

[0005] A decoder is used to decode the instruction and obtain a decoding result;

[0006] A calculation unit, used for performing calculation according to the decoding result obtained by the decoder;

[0007] A current acquisition module, used for acquiring instruction information from the decoder before the operation unit performs operation, and acquiring the instantaneous current prediction value of the instruction to be executed from the stored instruction current set according to the instruction information;

[0008] an arbitration module, connected to the current acquisition module, and configured to determine whether to insert a NOP instruction into the operation unit according to an instantaneous current prediction value of an instruction to be executed acquired by the current acquisition module and a preset threshold;

[0009] The arithmetic unit is also used to execute the inserted NOP instruction.

[0010] Optionally, the current acquisition module includes a first configuration interface, and the first configuration interface is used to configure the command current set.

[0011] Optionally, the arbitration module is specifically used to:

[0012] Calculating the sum of the instantaneous current prediction values ​​of the instructions to be executed acquired by the current acquisition module to obtain the total instantaneous current value of a single operation of the operation unit;

[0013] Sequentially counting window current values ​​of each time window based on the total instantaneous current value of the single operation, wherein the time window is configured by a time window coefficient;

[0014] Compare the difference between two adjacent statistical window current values ​​and a preset threshold value. If the difference between the current statistical window current value and the last statistical window current value is greater than the preset threshold value, insert a NOP instruction into the operation unit; if the difference between the current statistical window current value and the last statistical window current value is less than the preset threshold value, cancel inserting the NOP instruction into the operation unit.

[0015] Optionally, the window current value counted for the first time by the arbitration module is the sum of the total instantaneous current values ​​of all single operations within the time window starting from the first clock cycle. Starting from the window current value counted for the second time, the window current value counted this time is obtained based on the window current value counted last time and the total instantaneous current value of a single operation calculated most recently.

[0016] Optionally, the window current value counted this time and the window current value counted last time satisfy the relationship:

[0017] Current_window[n]=(1-Alpha)*Current_window[n-1]+Alpha*Current_inst, n≥2, where Current_window[n] is the window current value of this statistic, Current_window[n-1] is the window current value of the previous statistic, Alpha is the time window coefficient between 0 and 1, and Current_inst is the total instantaneous current value of a single operation obtained by the most recent calculation.

[0018] Optionally, the arbitration module includes a second configuration interface and a third configuration interface, the second configuration interface is used to configure a preset threshold, and the third configuration interface is used to configure a time window coefficient.

[0019] Optionally, the frequency of inserting NOP instructions into the computing unit by the arbitration module satisfies the relationship:

[0020] freq_NOP=(Current_window[n]-Current_window[n-1]-X) / X, n≥2, where freq_NOP is the frequency of inserting NOP instructions, Current_window[n] is the window current value counted this time, Current_window[n-1] is the window current value counted last time, and X is the preset threshold.

[0021] Optionally, the arbitration module is specifically used to:

[0022] Calculating the sum of the instantaneous current prediction values ​​of the instructions to be executed acquired by the current acquisition module to obtain the total instantaneous current value of a single operation of the operation unit;

[0023] Compare the total instantaneous current value of the single operation with a preset threshold value. If the total instantaneous current value of the single operation is greater than the preset threshold value, insert a NOP instruction into the operation unit; if the total instantaneous current value of the single operation is less than the preset threshold value, cancel inserting the NOP instruction into the operation unit.

[0024] Optionally, the decoder is used to temporarily store the decoding result after obtaining the decoding result, and send the decoding result to the operation unit after receiving a decoding result sending instruction;

[0025] The arbitration module is further configured to send the decoding result sending instruction to the decoder after determining whether to insert a NOP instruction into the operation unit.

[0026] In a second aspect, the present invention provides an instruction execution method of a processor, the method comprising:

[0027] Before the operation unit performs operation, the instruction information is obtained from the decoder, and the instantaneous current prediction value of the instruction to be executed is obtained from the stored instruction current set according to the instruction information;

[0028] Whether to insert a NOP instruction into the operation unit is determined according to the instantaneous current prediction value of the instruction to be executed and a preset threshold.

[0029] Optionally, judging whether to insert a NOP instruction into the operation unit according to the instantaneous current prediction value of the instruction to be executed and a preset threshold value includes:

[0030] Calculating the sum of the instantaneous current prediction values ​​of the instructions to be executed to obtain the total instantaneous current value of a single operation of the operation unit;

[0031] Sequentially counting window current values ​​of each time window based on the total instantaneous current value of the single operation, wherein the time window is configured by a time window coefficient;

[0032] Compare the difference between two adjacent statistical window current values ​​and a preset threshold value. If the difference between the current statistical window current value and the last statistical window current value is greater than the preset threshold value, insert a NOP instruction into the operation unit; if the difference between the current statistical window current value and the last statistical window current value is less than the preset threshold value, cancel inserting the NOP instruction into the operation unit.

[0033] Optionally, the first statistical window current value is the sum of the total instantaneous current values ​​of all single operations within the time window starting from the first clock cycle. Starting from the second statistical window current value, the statistical window current value is obtained based on the last statistical window current value and the most recently calculated total instantaneous current value of a single operation.

[0034] Optionally, the window current value counted this time and the window current value counted last time satisfy the relationship:

[0035] Current_window[n]=(1-Alpha)*Current_window[n-1]+Alpha*Current_inst, n≥2, where Current_window[n] is the window current value of this statistic, Current_window[n-1] is the window current value of the previous statistic, Alpha is the time window coefficient between 0 and 1, and Current_inst is the total instantaneous current value of a single operation obtained by the most recent calculation.

[0036] Optionally, judging whether to insert a NOP instruction into the operation unit according to the instantaneous current prediction value of the instruction to be executed and a preset threshold value includes:

[0037] Calculating the sum of the instantaneous current prediction values ​​of the instructions to be executed to obtain the total instantaneous current value of a single operation of the operation unit;

[0038] Compare the total instantaneous current value of the single operation with a preset threshold value. If the total instantaneous current value of the single operation is greater than the preset threshold value, insert a NOP instruction into the operation unit; if the total instantaneous current value of the single operation is less than the preset threshold value, cancel inserting the NOP instruction into the operation unit.

[0039] The processor and instruction execution method provided by the present invention, before the operation unit performs the operation, the current acquisition module obtains in advance the instantaneous current prediction value of the instruction to be executed by the operation unit; the arbitration module determines whether to insert the NOP instruction into the operation unit according to the instantaneous current prediction value of the instruction to be executed and the preset threshold. After the NOP instruction is inserted, the operation unit executes the NOP instruction, which will lower the average power consumption and can avoid the current mutation behavior in advance. Compared with the prior art, the present invention can predict the current mutation, insert the NOP instruction before the large current is generated, reduce the power consumption of the processor, and avoid the current mutation behavior. It can further bring the following beneficial effects: under the same processor frequency, the required stable voltage will be further reduced, so the corresponding processor power consumption will be reduced, and under the same rated power consumption, the corresponding computing power or throughput will be further increased. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 A schematic diagram of the structure of a multi-transmit processor according to an embodiment of the present invention;

[0041] Figure 2 It is a structural schematic diagram of a single transmission processor according to another embodiment of the present invention;

[0042] Figure 3The figure is a flowchart of an instruction execution method of a processor according to an embodiment of the present invention. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only 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.

[0044] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0045] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0046] The execution of instructions in the processor usually consists of five parts: instruction fetch, decoding, execution, memory access, and write back. The instruction fetch operation is completed by the instruction address generation unit and the instruction cache unit, the decoding operation is completed by the decoder, the execution operation is completed by the operation unit (including the arithmetic logic unit and the floating point unit), the memory access operation is completed by the memory management unit, and the write back operation is completed by the register write back unit. The current mutation is mainly caused by the execution operation.

[0047] The embodiment of the present invention provides a processor, such as Figure 1 As shown, the processor includes:

[0048] N decoders 111-11N are used to decode instructions and obtain decoding results;

[0049] N operation units 121-12N, used for performing operations according to the decoding results obtained by the decoder;

[0050] N current acquisition modules 131-13N, each current acquisition module 131-13N is used to obtain instruction information from each decoder 111-11N before each operation unit 121-12N performs operation, and obtain the instantaneous current prediction value of the instruction to be executed by each operation unit 121-12N from the stored instruction current set according to the instruction information;

[0051] The arbitration module 14 is connected to each current acquisition module 131-13N, and is used to determine whether to insert a NOP instruction into each operation unit 121-12N according to the instantaneous current prediction value of the instruction to be executed acquired by each current acquisition module 131-13N and a preset threshold value;

[0052] Each of the operation units 121 - 12N is also used to execute the inserted NOP instruction.

[0053] The NOP (No Operation) instruction, also known as a null instruction or no operation instruction, takes up one instruction execution cycle but does not perform any logical operations. This instruction consumes very little power.

[0054] Figure 1 A structure of a multi-issue processor is used as an example for explanation. For a multi-issue processor, multiple decoders are included. For example, a dual-issue processor includes two decoders, a quad-issue processor includes four decoders, and so on. An N-issue processor includes N decoders, and these N decoders can work simultaneously to decode N instructions. Correspondingly, the multi-issue processor will have multiple computing units and multiple current acquisition modules, and multiple current acquisition modules and arbitration modules are connected.

[0055] As an implementation method, refer to Figure 1 Each current acquisition module 131-13N includes a first configuration interface, and the first configuration interface is used to configure a command current set, and the command current set includes instantaneous current prediction values ​​of all commands. The configured command current set is stored in each current acquisition module 131-13N.

[0056] It can be understood that the instruction current sets configured by each current acquisition module 131-13N are the same, and different current acquisition modules work in parallel. The instantaneous current prediction values ​​finally obtained are different, which are related to the specific instructions. The current acquisition module obtains instruction information from the decoder, and the instruction information can indicate which instruction the decoder is decoding. In this way, the current acquisition module can know which instruction the corresponding decoder is decoding, and also know which instruction the operation unit is going to execute, and find the instantaneous current prediction value of the instruction to be executed by the operation unit from the instruction current set.

[0057] As an implementation manner, the arbitration module 14 is specifically used for:

[0058] Calculate the sum of the instantaneous current prediction values ​​of the instructions to be executed acquired by the current acquisition modules 131-13N to obtain the total instantaneous current value of a single operation of the operation units 121-12N;

[0059] Compare the total instantaneous current value of a single operation with the preset threshold. If the total instantaneous current value of a single operation is greater than the preset threshold, insert a NOP instruction into the operation units 121 to 12N. If the total instantaneous current value of a single operation is less than the preset threshold, cancel inserting the NOP instruction into the operation units 121 to 12N.

[0060] In the above embodiment, if the total instantaneous current value of a single operation is greater than the preset threshold, it means that a large current will be generated, and a NOP instruction is inserted into the operation unit. In this way, when the subsequent operation unit executes the NOP instruction, the current generated will be reduced, the power consumption of the processor is reduced, and the current mutation behavior is avoided in time.

[0061] Because the execution of an instruction is usually at the nanosecond level, and the current mutation is usually at the microsecond level, if only the total instantaneous current value of a single operation is compared with the preset threshold, NOP instructions may be frequently inserted. Therefore, a time window can be added to the arbitration module 14, and the time window can be configured by the time window coefficient Alpha.

[0062] As an implementation manner, the arbitration module 14 is specifically used for:

[0063] Calculate the sum of the instantaneous current prediction values ​​of the instructions to be executed acquired by the current acquisition modules 131-13N to obtain the total instantaneous current value of a single operation of the operation units 121-12N;

[0064] The window current values ​​of each time window are counted in sequence based on the total instantaneous current value of a single operation, and the time window is configured by the time window coefficient;

[0065] Compare the difference between two adjacent window current values ​​and the preset threshold. If the difference between the window current value counted this time and the window current value counted last time is greater than the preset threshold, insert a NOP instruction into the operation units 121~12N; if the difference between the window current value counted this time and the window current value counted last time is less than the preset threshold, cancel inserting the NOP instruction into the operation units 121~12N.

[0066] It can be understood that if the difference between the current window value counted this time and the window current value counted last time is greater than the preset threshold, it means that a large current will be generated, and a NOP instruction will be inserted into the operation unit. In this way, when the subsequent operation unit executes the NOP instruction, the current generated will be reduced, and the current mutation behavior will be avoided in time. If the difference between the current window current value counted this time and the window current value counted last time is less than the preset threshold, it means that no large current will be generated and there is no need to insert the NOP instruction.

[0067] It is further explained that in this embodiment, the arbitration module 14 inserts the NOP instruction into the operation units 121-12N in the following ways, but not limited to:

[0068] Mode 1: The arbitration module 14 directly inserts NOP instructions into the operation units 121 - 12N.

[0069] Mode 2: the arbitration module 14 sends an instruction to insert a NOP instruction to the decoders 111 - 11N. After receiving the instruction, the decoders 111 - 11N insert the NOP instruction to the operation units 121 - 12N.

[0070] The window current value of each statistical time window of the arbitration module 14 is defined as follows:

[0071] The first statistical window current value is the sum of the total instantaneous current values ​​of all single operations in the time window starting from the first clock cycle. Starting from the second statistical window current value, the current statistical window current value is based on the last statistical window current value and the most recently calculated total instantaneous current value of a single operation.

[0072] As an implementation method, the window current value counted this time and the window current value counted last time satisfy the relationship:

[0073] Current_window[n]=(1-Alpha)*Current_window[n-1]+Alpha*Current_inst, n≥2, where Current_window[n] is the window current value of this statistic, Current_window[n-1] is the window current value of the previous statistic, Alpha is the time window coefficient between 0 and 1, and Current_inst is the total instantaneous current value of a single operation obtained by the most recent calculation.

[0074] Regarding the time window coefficient Alpha, its meaning is that the reciprocal of Alpha is equal to the number of clock cycles included in the time window.

[0075] For example, Alpha = 0.01, which is equivalent to a time window containing 100 clock cycles. The first statistical time window is from the 1st clock cycle to the 100th clock cycle. The first statistical window current value Current_window[1] is the sum of the total instantaneous current values ​​of all single operations from the 1st clock cycle to the 100th clock cycle.

[0076] The second statistical time window is from the 2nd clock cycle to the 101st clock cycle, and the second statistical window current value satisfies the relationship:

[0077] Current_window[2]=(1-Alpha)*Current_window[1]+Alpha*Current_inst

[0078] , Current_inst is the total instantaneous current value of a single operation obtained by the most recent calculation.

[0079] The third statistical time window is from the 3rd clock cycle to the 102nd clock cycle, and the window current value of the second statistical window satisfies the relationship:

[0080] Current_window[3]=(1-Alpha)*Current_window[2]+Alpha*Current_inst

[0081] , Current_inst is the total instantaneous current value of a single operation obtained by the most recent calculation.

[0082] It should be noted that Current_inst is a variable. Similarly, the window current value of each time window is counted.

[0083] As an implementation method, refer to Figure 1 The arbitration module 14 includes a second configuration interface and a third configuration interface, wherein the second configuration interface is used to configure a preset threshold, and the third configuration interface is used to configure a time window coefficient Alpha, wherein the preset threshold and the time window coefficient are configured according to system requirements.

[0084] As an implementation mode, the frequency of the arbitration module 14 inserting NOP instructions into the operation units 121-12N satisfies the relationship:

[0085] freq_NOP=(Current_window[n]-Current_window[n-1]-X) / X, n≥2, where freq_NOP is the frequency of inserting NOP instructions, Current_window[n] is the window current value counted this time, Current_window[n-1] is the window current value counted last time, and X is the preset threshold.

[0086] For example, Current_window[n]=800A, Current_window[n-1]=200A, X=500A, and the calculation result is 1 / 5, that is, one NOP instruction is inserted into five instructions.

[0087] A processor provided by an embodiment of the present invention, before the operation unit performs operation, the current acquisition module obtains in advance the instantaneous current prediction value of the instruction to be executed by the operation unit; the arbitration module determines whether to insert the NOP instruction into the operation unit according to the instantaneous current prediction value of the instruction to be executed and the preset threshold. After the NOP instruction is inserted, the operation unit executes the NOP instruction, which will lower the average power consumption and avoid the current mutation behavior in advance. Compared with the prior art, the embodiment of the present invention can predict the current mutation, insert the NOP instruction in advance, and avoid the current mutation behavior. Further, the following beneficial effects can be brought about: under the same processor frequency, the required stable voltage will be further reduced, so the corresponding processor power consumption will be reduced, and under the same rated power consumption, the corresponding computing power or throughput will be further increased.

[0088] In the embodiment of the present invention, after the decoder obtains the decoding result, it will not send it to the operation unit immediately. After the arbitration module obtains the arbitration result, the decoder will send the decoding result to the operation unit regardless of whether the NOP instruction needs to be inserted.

[0089] As an implementation method, you can refer to Figure 1 , the decoders 111 to 11N are used to temporarily store the decoding results after obtaining the decoding results, and send the decoding results to the operation units 121 to 12N after receiving the decoding result sending instruction;

[0090] The arbitration module 14 is further configured to send a decoding result sending instruction to the decoders 111 - 11N after determining whether to insert a NOP instruction into the operation units 121 - 12N.

[0091] Further, in one embodiment, for a single-issue processor, such as Figure 2 As shown, it includes a decoder 211, an operation unit 221, a current acquisition module 231 and an arbitration module 24. The functions of each module can refer to the multi-issue processor. In particular, since there is only one current acquisition module 231, for the arbitration module 24, the instantaneous current prediction value of an instruction to be executed obtained by the current acquisition module 231 is the total instantaneous current value of a single operation.

[0092] In this embodiment, the decoder 211 is used to temporarily store the decoding result after obtaining the decoding result, and send the decoding result to the operation unit 221 after receiving the decoding result sending instruction;

[0093] The arbitration module 24 is further configured to send a decoding result sending instruction to the decoder 211 after determining whether to insert a NOP instruction into the operation unit 221 .

[0094] It should also be noted that the modules involved in the above embodiments (including the decoder, the operation unit, the current acquisition module, and the arbitration module) are all functional modules implemented by hardware. As an implementation method, the current acquisition module can be integrated into the decoder.

[0095] The following is an explanation of how to obtain the instruction current set. After the processor is designed, the instruction power consumption verification pattern will be constructed through software design. Each instruction needs to construct a test pattern, and then the power consumption of each instruction is tested under the same test conditions (main frequency, voltage is consistent). This test will make all the computing units inside the processor run, and a corresponding power consumption table will be obtained:

[0096] instruction Total power consumption instruction1 Power1 Instruction 2 Power2 …… …… instructionn Power

[0097] Because the processor power consumption consists of dynamic power consumption and static power consumption. The static power consumption is mainly caused by leakage current. The static power consumption will be measured during the processor production stage, so this value is a known value. The dynamic power consumption mainly comes from the energy loss during the switching process, which is the main part that needs to be estimated and controlled. Different instructions involve different logic gate state changes, different memory access states, etc., so different dynamic power consumption will be generated.

[0098] The power consumption expression is as follows: Power = Power_dynamic + Power_static, where Power represents the total power consumption, Power_dynamic represents the dynamic power consumption, and Power_static represents the static power consumption.

[0099] In addition, assuming that the total number of computing units of the current processor is K and the operating voltage is V, an instantaneous current prediction value of the instruction executed on each computing unit can be derived:

[0100] Instruction_coeff1 = (Power1 - Power_static) / K / V, Instruction_coeff1 represents the instantaneous current prediction value generated by each operation unit executing instruction 1;

[0101] Instruction_coeff2 = (Power2-Power_static) / K / V, where Instruction_coeff2 represents the instantaneous current prediction value generated by each operation unit executing instruction 2;

[0102] And so on.

[0103] Instruction_coeffn=(Powern-Power_static) / K / V, where Instruction_coeffn represents the instantaneous current prediction value generated by each operation unit executing instruction n;

[0104] Instruction_coeff1, Instruction_coeff2, ..., Instruction_coeffn together constitute an instruction current set, which is configured to the current acquisition module.

[0105] On the other hand, an embodiment of the present invention provides an instruction execution method of a processor, such as Figure 3 As shown, the method comprises the following steps:

[0106] S31, before the operation unit performs operation, obtain instruction information from the decoder, and obtain the instantaneous current prediction value of the instruction to be executed from the stored instruction current set according to the instruction information;

[0107] S32. Determine whether to insert a NOP instruction into the operation unit according to the instantaneous current prediction value of the instruction to be executed and a preset threshold value.

[0108] As an implementation manner, judging whether to insert a NOP instruction into the operation unit according to the instantaneous current prediction value of the instruction to be executed and a preset threshold value includes:

[0109] Calculate the sum of the instantaneous current prediction values ​​of the instructions to be executed to obtain the total instantaneous current value of a single operation of the operation unit;

[0110] The window current values ​​of each time window are counted in sequence based on the total instantaneous current value of a single operation, and the time window is configured by the time window coefficient;

[0111] Compare the difference between two adjacent statistical window current values ​​with the preset threshold. If the difference between the current statistical window value and the last statistical window current value is greater than the preset threshold, insert a NOP instruction into the operation unit. If the difference between the current statistical window current value and the last statistical window current value is less than the preset threshold, cancel inserting the NOP instruction into the operation unit.

[0112] As an implementation method, the first statistical window current value is the sum of the total instantaneous current values ​​of all single operations within the time window starting from the first clock cycle. Starting from the second statistical window current value, the statistical window current value is based on the last statistical window current value and the most recently calculated total instantaneous current value of a single operation.

[0113] As an implementation method, the window current value counted this time and the window current value counted last time satisfy the relationship:

[0114] Current_window[n]=(1-Alpha)*Current_window[n-1]+Alpha*Current_inst, n≥2, where Current_window[n] is the window current value of this statistic, Current_window[n-1] is the window current value of the previous statistic, Alpha is the time window coefficient between 0 and 1, and Current_inst is the total instantaneous current value of a single operation obtained by the most recent calculation.

[0115] As an implementation manner, judging whether to insert a NOP instruction into the operation unit according to the instantaneous current prediction value of the instruction to be executed and a preset threshold value includes:

[0116] Calculate the sum of the instantaneous current prediction values ​​of the instructions to be executed to obtain the total instantaneous current value of a single operation of the operation unit;

[0117] The total instantaneous current value of a single operation is compared with a preset threshold. If the total instantaneous current value of a single operation is greater than the preset threshold, a NOP instruction is inserted into the operation unit; if the total instantaneous current value of a single operation is less than the preset threshold, the insertion of the NOP instruction into the operation unit is cancelled.

[0118] The instruction execution method of the processor of the embodiment of the present invention can be implemented based on the processor of the aforementioned embodiment, and can achieve the same technical effect. Compared with the prior art, the embodiment of the present invention can predict the current mutation, insert the NOP instruction before the large current is generated, reduce the power consumption of the processor, and avoid the current mutation behavior. Further, it can bring the following beneficial effects: under the same processor frequency, the required stable voltage will be further reduced, so the corresponding processor power consumption will be reduced, and under the same rated power consumption, the corresponding computing power or throughput will be further increased.

[0119] 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 processor, characterized in that: The processor comprises: A decoder is used to decode the instruction and obtain a decoding result; A calculation unit, used for performing calculation according to the decoding result obtained by the decoder; A current acquisition module, used for acquiring instruction information from the decoder before the operation unit performs operation, and acquiring the instantaneous current prediction value of the instruction to be executed from the stored instruction current set according to the instruction information; an arbitration module, connected to the current acquisition module, and configured to determine whether to insert a NOP instruction into the operation unit according to an instantaneous current prediction value of an instruction to be executed acquired by the current acquisition module and a preset threshold; The arithmetic unit is also used to execute the inserted NOP instruction.

2. The processor according to claim 1, characterized in that The current acquisition module includes a first configuration interface, and the first configuration interface is used to configure the command current set.

3. The processor according to claim 1, wherein: The arbitration module is specifically used for: Calculating the sum of the instantaneous current prediction values ​​of the instructions to be executed acquired by the current acquisition module to obtain the total instantaneous current value of a single operation of the operation unit; Sequentially counting window current values ​​of each time window based on the total instantaneous current value of the single operation, wherein the time window is configured by a time window coefficient; Compare the difference between two adjacent statistical window current values ​​and a preset threshold value. If the difference between the current statistical window current value and the last statistical window current value is greater than the preset threshold value, insert a NOP instruction into the operation unit; if the difference between the current statistical window current value and the last statistical window current value is less than the preset threshold value, cancel inserting the NOP instruction into the operation unit.

4. The processor according to claim 3, characterized in that The first window current value counted by the arbitration module is the sum of the total instantaneous current values ​​of all single operations within the time window starting from the first clock cycle. Starting from the second window current value counted, the window current value counted this time is based on the window current value counted last time and the total instantaneous current value of a single operation calculated most recently.

5. The processor according to claim 4, characterized in that The window current value counted this time and the window current value counted last time satisfy the relationship: Current_window[n]=(1-Alpha)*Current_window[n-1]+Alpha*Current_inst, n≥2, where Current_window[n] is the window current value of this statistic, Current_window[n-1] is the window current value of the previous statistic, Alpha is the time window coefficient between 0 and 1, and Current_inst is the total instantaneous current value of a single operation obtained by the most recent calculation.

6. The processor according to claim 3, characterized in that The arbitration module includes a second configuration interface and a third configuration interface, the second configuration interface is used to configure a preset threshold, and the third configuration interface is used to configure a time window coefficient.

7. The processor according to claim 3, characterized in that: The frequency of the arbitration module inserting the NOP instruction into the computing unit satisfies the relationship: freq_NOP=(Current_window[n]-Current_window[n-1]-X) / X, n≥2, where freq_NOP is the frequency of inserting NOP instructions, Current_window[n] is the window current value counted this time, Current_window[n-1] is the window current value counted last time, and X is the preset threshold.

8. The processor according to claim 1, wherein: The arbitration module is specifically used for: Calculating the sum of the instantaneous current prediction values ​​of the instructions to be executed acquired by the current acquisition module to obtain the total instantaneous current value of a single operation of the operation unit; Compare the total instantaneous current value of the single operation with a preset threshold value. If the total instantaneous current value of the single operation is greater than the preset threshold value, insert a NOP instruction into the operation unit; if the total instantaneous current value of the single operation is less than the preset threshold value, cancel inserting the NOP instruction into the operation unit.

9. The processor according to claim 1, wherein: The decoder is used to temporarily store the decoding result after obtaining the decoding result, and send the decoding result to the operation unit after receiving the decoding result sending instruction; The arbitration module is further configured to send the decoding result sending instruction to the decoder after determining whether to insert a NOP instruction into the operation unit.

10. A method for executing instructions of a processor, characterized in that: The method comprises: Before the operation unit performs operation, the instruction information is obtained from the decoder, and the instantaneous current prediction value of the instruction to be executed is obtained from the stored instruction current set according to the instruction information; Whether to insert a NOP instruction into the operation unit is determined according to the instantaneous current prediction value of the instruction to be executed and a preset threshold.

11. The method according to claim 10, characterized in that The step of determining whether to insert a NOP instruction into the operation unit according to the instantaneous current prediction value of the instruction to be executed and a preset threshold value comprises: Calculating the sum of the instantaneous current prediction values ​​of the instructions to be executed to obtain the total instantaneous current value of a single operation of the operation unit; Sequentially counting window current values ​​of each time window based on the total instantaneous current value of the single operation, wherein the time window is configured by a time window coefficient; Compare the difference between two adjacent statistical window current values ​​and a preset threshold value. If the difference between the current statistical window current value and the last statistical window current value is greater than the preset threshold value, insert a NOP instruction into the operation unit; if the difference between the current statistical window current value and the last statistical window current value is less than the preset threshold value, cancel inserting the NOP instruction into the operation unit.

12. The method according to claim 11, characterized in that The first statistical window current value is the sum of the total instantaneous current values ​​of all single operations in the time window starting from the first clock cycle. Starting from the second statistical window current value, the current statistical window current value is based on the last statistical window current value and the most recently calculated total instantaneous current value of a single operation.

13. The method according to claim 12, characterized in that The window current value counted this time and the window current value counted last time satisfy the relationship: Current_window[n]=(1-Alpha)*Current_window[n-1]+Alpha*Current_inst, n≥2, where Current_window[n] is the window current value of this statistic, Current_window[n-1] is the window current value of the previous statistic, Alpha is the time window coefficient between 0 and 1, and Current_inst is the total instantaneous current value of a single operation obtained by the most recent calculation.

14. The method according to claim 10, characterized in that The step of determining whether to insert a NOP instruction into the operation unit according to the instantaneous current prediction value of the instruction to be executed and a preset threshold value comprises: Calculating the sum of the instantaneous current prediction values ​​of the instructions to be executed to obtain the total instantaneous current value of a single operation of the operation unit; Compare the total instantaneous current value of the single operation with a preset threshold value. If the total instantaneous current value of the single operation is greater than the preset threshold value, insert a NOP instruction into the operation unit; if the total instantaneous current value of the single operation is less than the preset threshold value, cancel inserting the NOP instruction into the operation unit.

Citation Information

Patent Citations

  • Arithmetic processing device, information processing device, and method for controlling same

    CN102652297A

  • Method and apparatus for handling transfer of guarded instructions in a computer system

    US20040158695A1

  • Very Long Instruction Word (VLIW) Processor with Power Management, and Apparatus and Method of Power Management Therefor

    US20120151192A1

  • Forward conditional branch event for profile-guided-optimization (PGO)

    US20230315453A1

  • MECHANISM TO CONTROL di / dt FOR A MICROPROCESSOR

    WO2002003185A2