This application relates to the communications field, and in particular, to a method for determining a voltage of a processor of a terminal, and a terminal.
In a terminal powered by a battery, system power consumption is a very important problem. During running, power consumption of a central processing unit (CPU) accounts for a main part of system power consumption. Therefore, when a running speed of the CPU is ensured, usually the CPU is set to work at a minimum voltage, to reduce the system power consumption.
Currently, there are usually two methods for measuring a minimum working voltage of a CPU in a terminal. In one method, a machine, for example, automatic test equipment (Automatic Test Equipment, ATE) for mass production of CPUs is used to measure hundreds of different CPUs for statistical analysis and calibration. Specifically, different CPUs may be classified by using data of a statistical model. For example, the CPUs may be classified into a relatively fast low-voltage category and a relatively slow high-voltage category, that is, a category of a relatively fast running speed and a relatively low working voltage and a category of a relatively slow running speed and a relatively high working voltage. A statistical value of a minimum working voltage is measured for each category of CPUs. Because of differences between the different CPUs, the statistical model has a relatively great error, and a margin needs to be added in advance to ensure stable mass production. In addition, because a running environment in the machine for mass production of CPUs is different from a running environment in a terminal to which a CPU is actually applied, and during calibration, a statistical model of a large quantity of samples is used, an error may be generated in the calibration process. Consequently, an extra margin needs to be added again, to ensure more stable mass production. Further, an aging phenomenon occurs in a CPU, but an aging status cannot be reflected in the machine. Therefore, when CPUs are produced by using this method, a margin for aging further needs to be added in advance, to ensure that after a mass-produced CPU is used in a terminal for a period of time, the CPU can still maintain good performance.
In the other method, a machine for mass production of CPUs, for example, ATE, is used to test and calibrate each CPU, to determine a minimum working voltage of each CPU. Compared with the first method, although this method reduces an error of a CPU statistical model, an error caused by calibration and aging still cannot be resolved. In addition, because each CPU needs to be tested in the mass production machine to determine a minimum working voltage, in this method, a testing time and testing costs of the mass production machine are greatly increased.
This application provides a method for determining a voltage of a processor of a terminal, and a terminal, to more accurately measure a minimum working voltage of a processor.
According to a first aspect, a method for determining a voltage of a processor of a terminal is provided. The terminal includes an auxiliary processor and a CPU. The method includes: in a switch-on process of the terminal, after completing system initialization, determining, by the auxiliary processor, a minimum working voltage of the CPU; setting, by the auxiliary processor, a current voltage of the CPU to the minimum working voltage; and completing, by the CPU at the minimum working voltage, the switch-on process of the terminal, and controlling the terminal to work.
Therefore, in the method for determining a voltage of a processor of a terminal in this application, in the switch-on process of the terminal, the auxiliary processor determines the minimum working voltage of the CPU, and can enable the terminal to be switched on and work normally. Compared with that a testing machine measures a minimum working voltage of a processor during production of the processor, a testing time and testing costs can be reduced, testing precision can be improved, and a minimum working voltage of a processor can be more accurately tested. In addition, an error of a calibration margin when testing is performed on the machine and an error caused by aging of the processor can be overcome.
Optionally, the CPU may work at multiple frequencies, and then, when measuring the minimum working voltage of the CPU, the auxiliary processor may measure a minimum working voltage corresponding to each working frequency. For example, there are four working frequencies of the CPU: 1 GHz, 1.5 GHz, 2 GHz, and 2.5 GHz. Then, minimum working voltages corresponding to the working frequencies of 1 GHz, 1.5 GHz, 2 GHz, and 2.5 GHz are separately measured, so that a corresponding minimum working voltage is set according to a working frequency when the CPU works.
Optionally, because a temperature of a running environment of the CPU may change, a temperature of a current running environment may be recorded when the minimum working voltage of the CPU is measured, so that a temperature compensation is made for the minimum working voltage when a temperature of the CPU changes.
With reference to the first aspect, in an implementation of the first aspect, the determining a minimum working voltage of the CPU includes: determining, by the auxiliary processor, an initial working voltage V0 at which the CPU can work normally; decreasing, by the auxiliary processor, a current voltage of the CPU from Vi−1 to Vi, where a value of i is successively 1, 2, 3, . . . ; and when the auxiliary processor determines that the CPU can work normally at the voltage of Vi, decreasing, by the auxiliary processor, the current voltage of the CPU from Vi to Vi+1; or when the auxiliary processor determines that the CPU cannot work normally at the voltage of Vi, determining, by the auxiliary processor, that the minimum working voltage of the CPU is Vi−1.
It should be understood that for the first testing of a working voltage of the CPU, that is, no testing has been previously performed on the minimum working voltage of the CPU, the auxiliary processor determines the initial working voltage V0 of the CPU, and the initial working voltage may be obtained by a process monitor (process monitor). The process monitor is configured to mark a running speed of the CPU, and determine, according to a correspondence between the running speed and the working voltage, that a working voltage corresponding to the running speed is the initial working voltage of the CPU.
It should be understood that for non-first testing of a working voltage of the CPU, that is, testing of a minimum working voltage has been previously performed when the CPU is switched on, when testing of a minimum working voltage is performed again after the CPU is switched on, the auxiliary processor may determine the current initial working voltage of the CPU by using a voltage value that is saved when the minimum working voltage is measured last time.
Optionally, the auxiliary processor may save, in a storage unit, a working voltage that is obtained after each voltage testing during each switch-on, and the CPU may save, in the storage unit, a testing result eigenvalue corresponding to each working voltage, so that the auxiliary processor obtains the testing result eigenvalue for comparison.
With reference to the first aspect and the foregoing implementation, in another implementation of the first aspect, the determining a minimum working voltage of the CPU includes: determining, by the auxiliary processor, an initial working voltage V0 at which the CPU cannot work normally; increasing, by the auxiliary processor, the current voltage of the CPU from Vi−1 to Vi, where a value of i is successively 1, 2, 3, . . . ; and when the auxiliary processor determines that the CPU cannot work normally at the voltage of Vi, increasing, by the auxiliary processor, the current voltage of the CPU from Vi to Vi+1; or when the auxiliary processor determines that the CPU can work normally at the voltage of Vi, determining, by the auxiliary processor, that the minimum working voltage of the CPU is Vi.
It should be understood that if the auxiliary processor determines the initial working voltage of the CPU, and the initial working voltage cannot enable the CPU to work normally, that is, the initial working voltage is lower than the minimum working voltage of the CPU, the minimum working voltage may be obtained by increasing the voltage.
It should be understood that the working voltage of the CPU is decreased from the initial working voltage V0 to V1, and then, is decreased from Vi−1 to Vi, where a value of i is successively 1, 2, 3, . . . . Alternatively, the working voltage of the CPU is increased from the initial working voltage V0 to V1, and then, is increased from Vi−1 to Vi, where a value of i is successively 1, 2, 3, . . . . A difference between any two consecutive working voltages Vi−1 and Vi may be set according to an actual situation, and differences may be the same or may be different.
It should be understood that the setting of a difference between tested voltages may affect accuracy of testing a minimum working voltage. A voltage generating a relatively small difference is selected for measurement, so that a more accurate minimum working voltage can be obtained.
With reference to the first aspect and the foregoing implementations, in another implementation of the first aspect, the determining a minimum working voltage of the CPU includes: determining, by the auxiliary processor, a working voltage domain (V0, V1) of the CPU, where the CPU cannot work normally at the voltage of V0, and can work normally at the voltage of V1; determining, by the auxiliary processor, m voltage values within the working voltage domain (V0, V1), and performing voltage measurement for the CPU for m times; determining, by the auxiliary processor, n voltage values within the working voltage domain (V0, V1) according to the m times of voltage measurement, where the CPU can work normally at each of the n voltage values, and n is less than or equal to m; and determining, by the auxiliary processor, a smallest voltage value in the n voltage values as the minimum working voltage of the CPU.
It should be understood that the auxiliary processor determines, within the working voltage domain (V0, V1), the m voltage values for voltage measurement. Optionally, any voltage value V2 may be selected from (V0, V1). For example, V2 is an average value of V0 and V1. The auxiliary processor sets the voltage of the CPU to V2, and determines whether the CPU can work normally at the voltage of V2. If the CPU can work normally at the voltage of V2, the auxiliary processor can determine that the minimum working voltage of the CPU is located within the range of (V0, V1). If the CPU cannot work normally at the voltage of V2, the auxiliary processor can determine that the minimum working voltage of the CPU is located within a range of (V2, V1). The auxiliary processor continues to determine, within the new determined range, a new voltage value for measurement. A range of the minimum working voltage of the CPU is constantly narrowed until it is determined after m times of measurement that the minimum working voltage of the CPU is located within a range of (Vi, Vj). Then, it is determined that the minimum working voltage of the CPU is Vj.
It should be understood that, in the foregoing method, there may be n voltage values during m times of measurement, where n is less than or equal to m, so that the CPU can work normally at each of the n voltage values, and the finally determined minimum working voltage Vj of the CPU is a smallest value in the n voltage values. Therefore, the foregoing method may be extended. For example, any m voltage values within the working voltage domain (V0, V1) of the CPU are determined for separate measurement. Then, in a measurement process of the m voltage values, there may be n voltage values in the m voltage values, where each of the n voltage values can enable the CPU to work normally, and n is less than or equal to m. In this case, the auxiliary processor may determine that a smallest value in the n voltage values is the minimum working voltage of the CPU.
In this way, a quantity of times of testing is limited when the minimum working voltage of the CPU is determined, so that the range of the minimum working voltage of the CPU can be constantly narrowed, and a more accurate minimum working voltage can be determined.
With reference to the first aspect and the foregoing implementations, in another implementation of the first aspect, the method further includes: when the auxiliary processor has obtained, within a preset time, a testing result eigenvalue Ti that is determined by the CPU at the voltage of Vi, and Ti is the same as a preset value, determining, by the auxiliary processor, that the CPU can work normally at the voltage of Vi; when the auxiliary processor has obtained Ti within the preset time, and Ti is not the same as the preset value, determining, by the auxiliary processor, that the CPU cannot work normally at the voltage of Vi; and when the auxiliary processor has not obtained Ti within the preset time, determining, by the auxiliary processor, that the CPU cannot work normally at the voltage of Ti.
In this way, the preset time is set. For example, a timer is set. It is determined according to the preset time whether the CPU can work normally, thereby improving the testing efficiency.
According to a second aspect, a terminal is provided, configured to perform the method in the first aspect or any possible implementation of the first aspect. Specifically, the terminal includes a CPU and an auxiliary processor. The auxiliary processor is configured to determine a minimum working voltage of the CPU. The auxiliary processor is further configured to set a current voltage of the CPU to the minimum working voltage. The CPU is configured to: complete, at the minimum working voltage, a switch-on process of the terminal, and control the terminal to work.
According to a third aspect, a computer readable medium is provided, configured to store a computer program. The computer program includes an instruction used to perform the method in the first aspect or any possible implementation of the first aspect.
The following clearly describes the technical solutions in the embodiments of this application with reference to the accompanying drawings in the embodiments of this application.
S110. In a switch-on process of the terminal, after completing system initialization, the auxiliary processor determines a minimum working voltage of the CPU.
It should be understood that, in the prior art, the terminal usually completes the switch-on process of the terminal by using only one CPU. In the switch-on process of the terminal, the CPU controls and performs the entire switch-on process of the terminal, and after the terminal is switched on, controls the terminal to work normally. In this embodiment of this application, the switch-on process of the terminal is completed by means of two processors. The two processors may be referred to as the CPU and the auxiliary processor. The two processors complete, in the switch-on process of the terminal, a process of measuring a minimum working voltage of the CPU. After the terminal is switched on, the CPU controls the terminal to work and run normally. Optionally, the auxiliary processor may be another CPU. That is, the terminal may include two CPUs.
Specifically, the switch-on process of the terminal may be divided into two parts according to a time order. One part is a system initialization process of the terminal, and the other part is a switch-on and running process of a system. The auxiliary processor is mainly used for the first part of the switch-on process of the terminal, that is, the system initialization process. After the system initialization is completed, the auxiliary processor measures a minimum voltage of the CPU. The system initialization process is similar to that in the prior art, and may include a power-on process of each part of the terminal, and an initialization process of a memory. The memory may be a dynamic random access memory (Dynamic Random Access Memory, DRAM). After the auxiliary processor completes the system initialization, the CPU may enter a voltage testing mode, and the minimum working voltage of the CPU is measured.
Similar to a processor of an existing terminal, the CPU may be a multi-core processor. When a minimum working voltage of the target processor is measured, a minimum working voltage of each core in the multiple cores included in the CPU is measured, or the multiple cores are considered as an entirety, and the minimum working voltage of the CPU is measured and is used as a minimum working voltage of each core. Therefore, in this embodiment of this application, when the minimum working voltage of the CPU is measured, the CPU may be any core of the processor, or may refer to multiple cores of the processor. This is not limited in this embodiment of this application.
In this embodiment of this application, after completing the system initialization, the auxiliary processor measures the minimum working voltage of the CPU. Specifically, as shown in
Optionally, the working system may include a storage unit. The storage unit may be a static random access memory (Static Random Access Memory, DRAM), or may be a flash memory (Flash EEPROM Memory). The working system may further include a peripheral system (Peripheral System). The peripheral system includes another component that enables the system of the terminal to work normally, other than the storage unit, for example, an I2C (Inter-Integrated Circuit) bus, or a clock source (Clock source).
Optionally, the testing system includes a storage unit. The storage unit may be a DRAM, or may be a flash memory. The testing system may further include other components, for example, a counter, configured to record a quantity of times of testing during voltage testing of the CPU, and a system interruption controller, configured for information exchange between the CPU and another processor such as the auxiliary processor.
Specifically, the auxiliary processor may determine the minimum working voltage of the CPU in multiple manners. For example, as shown in
S210. The auxiliary processor completes system initialization in the switch-on process of the terminal.
In this way, the CPU may enter a voltage testing mode, and the auxiliary processor may start testing the minimum working voltage of the CPU.
S220. The auxiliary processor sets a voltage for the CPU when testing starts.
Specifically, for the first round of voltage testing during current switch-on, the auxiliary processor first determines an initial working voltage V0 of the CPU.
Specifically, it may be determined first whether measurement of a minimum working voltage is performed for the CPU for the first time. When it is determined that the measurement of a minimum working voltage is performed for the CPU for the first time, for example, measurement of a minimum working voltage is performed for the CPU in the terminal for the first time in the first switch-on process of the terminal, the CPU may obtain the initial working voltage by using a process monitor (process monitor). The process monitor may be configured to mark a running speed of the CPU, and by using a correspondence between the running speed and a working voltage, for example, by looking up a mapping table between the running speed and a working voltage, determine that a working voltage corresponding to the running speed is the initial working voltage of the CPU.
When it is determined that measurement of a minimum working voltage has been previously performed for the CPU, a tested voltage value saved during previous measurement of a minimum working voltage of the CPU may be obtained by reading the storage unit, and the initial working voltage is set according to the tested voltage value. The storage unit may be configured to store a tested voltage value saved during measurement of a minimum working voltage of the CPU. The tested voltage value may include a minimum working voltage obtained by means of measurement during each switch-on of the CPU, or may include a voltage value that is set each time a minimum working voltage is measured. Optionally, the storage unit may be a DRAM, or may be a register (Register). In this embodiment of this application, after the CPU enters the testing mode, first, the initial working voltage is set for the CPU. The initial working voltage can enable the CPU to work normally. Optionally, if the CPU cannot work normally at the initial working voltage, the working voltage of the CPU may be increased, so that the increased working voltage can enable the CPU to work normally. Further, the increased working voltage is regarded as the initial working voltage, so that the initial working voltage can enable the CPU to work normally.
Optionally, for the other voltage testing after the first round of voltage testing during the current switch-on, the auxiliary processor may update the current voltage of the CPU according to each determined voltage value, so that the CPU enters a new round of voltage testing.
S230. The auxiliary processor starts a timer when a target processor enters current voltage testing.
Specifically, when the auxiliary processor determines a current working voltage for the target processor, and starts to perform the current voltage testing, the auxiliary processor starts the timer for timing, so that the auxiliary processor can determine whether running of the CPU at the current voltage is completed, or whether an error occurs on the CPU at the current voltage.
Optionally, in an embodiment, the timer may be set in the terminal, and it is determined by using the timer whether the CPU can work normally. Specifically, after the CPU enters the voltage testing mode, for any measurement process, for example, it is measured whether the CPU can work normally at the working voltage of Vi, when the working voltage of the CPU is set to Vi, the auxiliary processor may start the timer. When the timer does not expire, the auxiliary processor may continue to perform S240, and when the timer expires, the auxiliary processor performs S260.
Optionally, a time of the timer may be set according to a time application. For example, the time that is set for the timer needs to be greater than a time within which the CPU runs a complete process in a normal case, and determines a testing result eigenvalue, so that the auxiliary processor can determine, by using the timer, whether the CPU works normally.
S240. The CPU runs at a currently specified working voltage Vi, and determines a testing result eigenvalue Ti, and the auxiliary processor obtains the testing result eigenvalue Ti.
In this embodiment of this application, it may be determined, by using the testing result eigenvalue, whether the CPU can work normally at the current voltage. Specifically, the CPU may run any program, and the CPU may determine a testing result eigenvalue obtained after the running. For example, for any voltage testing, the voltage of the CPU is Vi. Correspondingly, the CPU determines the testing result eigenvalue Ti obtained after the running, and saves the testing result eigenvalue Ti into a storage unit of the testing system, so that the auxiliary processor obtains the testing result eigenvalue, and continues to perform S250. Optionally, if the auxiliary processor reads the storage unit, but does not obtain the testing result eigenvalue Ti generated at the voltage of Vi, the auxiliary processor may return to S230, and determines whether the timer expires. When the timer expires, if the auxiliary processor has not obtained the testing result eigenvalue Ti generated at the current voltage of Vi, the auxiliary processor may perform S260.
S250. The auxiliary processor compares the obtained testing result eigenvalue with a preset value.
Specifically, for any voltage testing, the auxiliary processor obtains the testing result eigenvalue Ti obtained when the current voltage of the CPU is Vi, and compares the testing result eigenvalue Ti with the preset value. When the obtained testing result eigenvalue Ti is the same as the preset value, it indicates that the CPU can work normally at the voltage, and the auxiliary processor decreases the voltage from Vi to Vi+1, that is, updates the current voltage of the CPU to Vi+1, and continues to perform S220, that is, performs a new round of voltage testing until it is determined that the CPU cannot work normally. If the obtained testing result Ti is not the same as the preset value, it indicates that the CPU cannot work normally at the voltage, and S260 is performed, that is, the minimum working voltage of the CPU is determined.
S260. The auxiliary processor determines the minimum working voltage of the CPU.
After the timer expires, when the auxiliary processor has not obtained the testing result eigenvalue of the CPU at the current voltage, or the auxiliary processor obtains though comparison that the testing result eigenvalue of the CPU at the current voltage is not the same as the preset value, the auxiliary processor can determine that the CPU cannot work normally at the current voltage, and can determine a previous voltage value of the CPU as the minimum working voltage value. Specifically, if the current voltage of the CPU is set to Vi, but the auxiliary processor has not obtained the testing result eigenvalue Ti corresponding to Vi when the timer expires, that is, the CPU has not determined the testing result eigenvalue Ti within the time that is set for the timer, or the auxiliary processor has obtained the testing result eigenvalue Ti corresponding to the voltage Vi, but the testing result eigenvalue Ti is not the same as the preset value, the auxiliary processor can determine that the CPU cannot work normally, and determines that the minimum working voltage of the CPU is Vi−1.
Optionally, in an embodiment, using the first voltage testing during current switch-on as an example, first, the initial working voltage is set for the CPU, and after it is determined that the CPU can work normally at the initial working voltage, the working voltage of the CPU is decreased from the initial working voltage value V0 to V1, and it is determined whether the CPU can work normally at the working voltage of V1.
When the timer does not expire, the auxiliary processor obtains a testing result eigenvalue T1 generated when the voltage of the CPU is V1. If the auxiliary processor has obtained the testing result eigenvalue T1, and learns by means of comparison that the testing result eigenvalue T1 generated at the working voltage of V1 is the same as the preset value, the auxiliary processor can determine that the CPU can work normally at the working voltage of V1, continues to decrease the working voltage from V1 to V2, and continues to determine whether the CPU can work normally at the working voltage. When the auxiliary processor learns by means of comparison that the testing result eigenvalue Ti generated at the working voltage of Vi is not the same as the preset value, the auxiliary processor can determine that the CPU cannot work normally at the working voltage of Vi, and determine that the minimum working voltage of the CPU is Vi−1.
When the timer expires, if the auxiliary processor has not obtained the testing result eigenvalue T1 generated when the voltage of the CPU is V1, that is, the CPU has not determined the testing result eigenvalue T1 within the preset time of the timer, the auxiliary processor determines that the CPU cannot work normally at the voltage of V1, and determine that the minimum working voltage of the CPU is V0. Similarly, when the CPU can work normally at the voltage of V1, the auxiliary processor continues to decrease the voltage for testing. For any testing thereafter, the voltage Vi is set for the CPU. When the timer expires, if the auxiliary processor has not obtained the testing result eigenvalue Ti generated at the voltage of Vi, the auxiliary processor can determine that the CPU cannot work normally, and determine that the minimum working voltage of the CPU is Vi−1.
It should be understood that, in this embodiment, under the premise that the initial working voltage can enable the CPU to work normally, the tested voltage is decreased to determine the minimum working voltage. That is, the initial working voltage is greater than the minimum working voltage. Similarly, the premise may be set to that the initial working voltage cannot enable the CPU to work normally, the tested voltage is increased to determine the minimum working voltage. That is, the initial working voltage is less than the minimum working voltage.
Specifically, the initial working voltage V0 is set to a relatively low value, so that the CPU cannot work normally at the voltage, and the voltage value is increased to V1. When it is determined according to the foregoing method, that the CPU still cannot work normally at the voltage of V1, the voltage value continues to be increased to V2, until the voltage value is increased to Vi, and the CPU can work normally. In this case, the minimum working voltage of the CPU is Vi.
It should be understood that the working voltage of the CPU is decreased from the initial working voltage V0 to V1, and then, is decreased from Vi−1 to Vi, where a value of i is successively 1, 2, 3, . . . . Alternatively, the working voltage of the CPU is increased from the initial working voltage V0 to V1, and then, is increased from Vi−1 to Vi, where a value of i is successively 1, 2, 3, . . . . A difference between any two consecutive working voltages Vi−1 and Vi may be set according to an actual situation, and differences may be the same or may be different. Specifically, if it is considered to ensure accuracy of measuring the minimum working voltage of the CPU, a difference between Vi−1 and Vi may be set to a relatively small value. However, this may increase a quantity of times of testing, leading to relatively long duration of the testing process. If duration of the testing process or a testing speed is considered, a difference between Vi−1 and Vi may be set to a relatively large value. However, this may affect testing precision, and an error is caused to the minimum working voltage value obtained by means of testing. Therefore, the testing precision and the testing efficiency may be considered to select an appropriate voltage difference.
Optionally, in an embodiment, voltage measurement may be performed in both a voltage increasing manner and a voltage decreasing manner. Specifically, the auxiliary processor determines a working voltage domain (V0, V1) of the CPU. The CPU cannot work normally at the voltage of V0, and can work normally at the voltage of V1. That is, the working voltage domain (V0, V1) includes the minimum working voltage value of the CPU. The auxiliary processor may determine the minimum working voltage of the CPU by means of multiple measurements. For example, the auxiliary processor may first determine any voltage value V2 within the working voltage domain (V0, V1). For example, V2 is an average value of V0 and V1. The auxiliary processor sets the voltage of the CPU to V2, and determines, according to a determining process similar to that in
There may be n voltage values during m times of measurement, where n is less than or equal to m, so that the CPU can work normally at each of the n voltage values, and the finally determined minimum working voltage Vj of the CPU is a smallest value in the n voltage values. Therefore, the foregoing method may be further extended as: The auxiliary processor determines, within the working voltage domain (V0, V1) of the CPU, any m voltage values for measurement. The CPU cannot work normally at the voltage of V0, and can work normally at the voltage of V1. That is, the working voltage domain (V0, V1) includes the minimum working voltage value of the CPU. Then, in a measurement process of the m voltage values, there may be n voltage values in the m voltage values, where each of the n voltage values can enable the CPU to work normally, and n is less than or equal to m. In this case, the auxiliary processor may determine that a smallest value in the n voltage values is the minimum working voltage of the CPU.
It should be understood that a quantity m of times of measurement that is performed by the auxiliary processor for the CPU may be set according to an actual situation. For example, if measurement accuracy is considered, a value of m may be set to a relatively large value. However, in this way, a quantity of times of testing is excessively large, affecting testing duration and affecting a switch-on time of the terminal. If the switch-on time is considered, a value of m may be set to a relatively small value. However, this may affect testing precision. Therefore, multiple factors may be considered to set the quantity m of times of measurement.
In this embodiment of this application, the CPU may work at multiple working frequencies. Therefore, the measuring a minimum working voltage of the CPU includes: measuring a minimum working voltage of the CPU in a corresponding working frequency. For example, the working frequencies of the CPU include 1 GHz, 1.5 GHz, 2 GHz, and 2.5 GHz, and minimum working voltages of the CPU in the working frequencies of 1 GHz, 1.5 GHz, 2 GHz, and 2.5 GHz are separately measured, so that when the CPU works, a corresponding minimum working voltage is set according to a working frequency. For example, when the working frequency of the CPU is 1 GHz, the working voltage of the CPU is set to the minimum working voltage corresponding to the working frequency of 1 GHz.
In this embodiment of this application, the CPU may further include a temperature sensor (temperature sensor). The temperature sensor measures a temperature of a working environment of the CPU. After determining the minimum working voltage of the CPU, the auxiliary processor may record the temperature of the working environment of the CPU at the same time, and obtain a minimum working voltage in this temperature, so that when the temperature of the working environment of the CPU changes, the auxiliary processor makes temperature compensation for the working voltage. In this way, it can be ensured that when the CPU works at the minimum working voltage, even if the temperature changes, temperature compensation can still be made to ensure that the CPU works normally.
In this embodiment of this application, the CPU may further include a voltage sensor (voltage sensor). When the system runs, it may be determined by using the voltage sensor whether a voltage sag occurs. When a level of the voltage sag is relatively large, a frequency of the CPU may be decreased, avoiding system abnormality of the CPU caused by an excessively high level of voltage sag.
S120. The auxiliary processor sets a current voltage of the CPU to the minimum working voltage.
S130. The CPU completes, at the minimum working voltage, the switch-on process of the terminal, and controls the terminal to work.
In this embodiment of this application, after the minimum working voltage of the CPU is determined, that is, testing for the CPU is completed, the CPU may enter the normal working mode by means of the working system. The CPU is enabled to work at the minimum working voltage, so that the CPU continues to complete a second part of the switch-on process of the terminal, to complete the switch-on and running process of the system, for example, complete starting of an operating system of the terminal. Therefore, the switch-on process of the terminal is completed, the terminal enters the normal working mode, and the CPU continues to control the terminal to run normally. Optionally, after the CPU enters the normal working mode, the auxiliary processor transfers a right of controlling the terminal to the CPU. The CPU controls the terminal to run. At the same time, the auxiliary processor may assist the terminal in performing another work, so that the terminal runs normally. Alternatively, the auxiliary processor does not perform another work. This embodiment of this application is not limited thereto.
It should be understood that, in the embodiments of this application, sequence numbers of the processes do not represent an execution sequence. The execution sequence of the processes should be determined according to the functions and internal logic. The sequence numbers should not constitute any limitation on the implementation processes of the embodiments of this application.
Therefore, in the method for determining a voltage of a processor of a terminal in this embodiment of this application, in the switch-on process of the terminal, the auxiliary processor completes system initialization, measures the minimum working voltage of the CPU, and completes the final switch-on and running process of the terminal by using the CPU working at the minimum working voltage, so that the terminal is switched on and works normally. Compared with that a minimum working voltage of a processor is measured by using a testing machine during production of the processor, in the present invention, a testing time and testing costs can be reduced, testing precision can be improved, and a minimum working voltage of a processor can be more accurately tested. In addition, an error of a calibration margin when testing is performed on the machine and an error caused by aging of the processor can be overcome.
The foregoing has described in detail, with reference to
As shown in
The auxiliary processor 320 is configured to: in a switch-on process of the terminal, after completing system initialization, determine a minimum working voltage of the CPU 310.
The auxiliary processor 320 is further configured to set a current voltage of the CPU 320 to the minimum working voltage.
The CPU 310 is configured to: complete, at the minimum working voltage, the switch-on process of the terminal, and control the terminal to work.
Therefore, in the terminal in this embodiment of this application, in the switch-on process of the terminal, the auxiliary processor completes system initialization, measures the minimum working voltage of the CPU, and completes the final switch-on and running process of the terminal by using the CPU working at the minimum working voltage, so that the terminal is switched on and works normally. Compared with that a minimum working voltage of a processor is measured by using a testing machine during production of the processor, in the present invention, a testing time and testing costs can be reduced, testing precision can be improved, and a minimum working voltage of a processor can be more accurately tested. In addition, an error of a calibration margin when testing is performed on the machine and an error caused by aging of the processor can be overcome.
Optionally, the auxiliary processor 320 is specifically configured to: determine an initial working voltage V0 at which the CPU 310 can work normally; decrease the current voltage of the CPU 310 from Vi−1 to Vi, where a value of i is successively 1, 2, 3, . . . ; and when determining that the CPU 310 can work normally at the voltage of Vi, decrease the current voltage of the CPU 310 from Vi to Vi+1; or when determining that the CPU 310 cannot work normally at the voltage of Vi, determine that the minimum working voltage of the CPU 310 is Vi−1.
Optionally, the auxiliary processor 320 is specifically configured to: determine an initial working voltage V0 at which the CPU 310 cannot work normally; increase the current voltage of the CPU 310 from Vi−1 to Vi, where a value of i is successively 1, 2, 3, . . . ; and when determining that the CPU 310 cannot work normally at the voltage of Vi, increase the current voltage of the CPU 310 from Vi to Vi−1; or when determining that the CPU 310 can work normally at the voltage of Vi, determine that the minimum working voltage of the CPU 310 is Vi.
Optionally, the auxiliary processor 320 is specifically configured to: determine a working voltage domain (V0, V1) of the CPU 310, where the CPU 310 cannot work normally at the voltage of V0, and can work normally at the voltage of V1; determine m voltage values within the working voltage domain (V0, V1), and perform voltage measurement for the CPU 310 for m times; determine n voltage values within the working voltage domain (V0, V1) according to the m times of voltage measurement, where the CPU 310 can work normally at each of the n voltage values, and n is less than or equal to m; and determine a smallest voltage value in then voltage values as the minimum working voltage of the CPU 310.
Optionally, the auxiliary processor 320 is specifically configured to: when the auxiliary processor has obtained, within a preset time, a testing result eigenvalue Ti that is determined by the CPU 310 at the voltage of Vi, and Ti is the same as a preset value, determine that the CPU 310 can work normally at the voltage of Vi; when the auxiliary processor has obtained Ti within the preset time, and Ti is not the same as the preset value, determine that the CPU 310 cannot work normally at the voltage of Vi; and when the auxiliary processor has not obtained Ti within the preset time, determine that the CPU 310 cannot work normally at the voltage of Vi.
Optionally, the terminal may further include a storage unit 330. The storage unit 330 is configured to store the current working voltage Vi of the CPU 310 and a corresponding testing result eigenvalue Ti, so that the auxiliary processor 320 obtains the working voltage Vi and the testing result eigenvalue Ti, and determines whether the CPU 310 can work normally.
It should be understood that, in this embodiment of this application, the auxiliary processor 320 may be a CPU, or the auxiliary processor 320 may be another general purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or another programmable logic device, discrete gate or transistor logic device, discrete hardware component, or the like. The general purpose processor may be a microprocessor or the processor may be any conventional processor, or the like.
The storage unit 330 may include a read-only memory and a random access memory, and provide an instruction and data for the CPU 310 and the auxiliary processor 320. A part of the storage unit 330 may further include a non-volatile random access memory. For example, the storage unit 330 may further store information about a device type.
In an implementation process, steps in the foregoing methods can be implemented by using a hardware integrated logical circuit in the CPU 310 or the auxiliary processor 320, or by using instructions in a form of software. The steps of the methods disclosed with reference to the embodiments of this application may be directly performed by a hardware processor, or may be performed by using a combination of hardware in the processor and a software module. The software module may be located in a mature storage medium in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, or the like. The storage medium is located in the storage unit 330, and the CPU 310 or the auxiliary processor 320 may read information in the storage unit 330 and completes the steps in the foregoing methods in combination with hardware of the processor. To avoid repetition, details are not described herein again.
It should be understood that the terminal 300 according to this embodiment of this application may correspondingly perform the method 100 and the method 200 in the embodiments of this application, and the foregoing and other operations and/or functions of the components in the terminal 300 are separately used for implementing the corresponding process of the method in
Therefore, in the terminal in this embodiment of this application, in the switch-on process of the terminal, the auxiliary processor completes system initialization, measures the minimum working voltage of the CPU, and completes the final switch-on and running process of the terminal by using the CPU working at the minimum working voltage, so that the terminal is switched on and works normally. Compared with that a minimum working voltage of a processor is measured by using a testing machine during production of the processor, in the present invention, a testing time and testing costs can be reduced, testing precision can be improved, and a minimum working voltage of a processor can be more accurately tested. In addition, an error of a calibration margin when testing is performed on the machine and an error caused by aging of the processor can be overcome.
A person of ordinary skill in the art may be aware that, in combination with the examples described in the embodiments disclosed in this specification, method steps and units may be implemented by electronic hardware, computer software, or a combination thereof. To clearly describe the interchangeability between the hardware and the software, the foregoing has generally described steps and compositions of each embodiment according to functions. Whether the functions are performed by hardware or software depends on particular applications and design constraint conditions of the technical solutions. A person of ordinary skill in the art may use different methods to implement the described functions for each particular application, but it should not be considered that the implementation goes beyond the scope of this application.
Methods or steps described in the embodiments disclosed in this specification may be implemented by hardware, a software program executed by a processor, or a combination thereof. The software program may reside in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
This application is described in detail with reference to the accompanying drawings and in combination with the example embodiments, but this application is not limited thereto. Various equivalent modifications or replacements can be made to the embodiments of this application by a person of ordinary skill in the art without departing from the spirit and essence of this application, and the modifications or replacements shall fall within the scope of this application.
Number | Date | Country | Kind |
---|---|---|---|
201610210836.3 | Apr 2016 | CN | national |
This application is a continuation of International Application No. PCT/CN2016/108852, filed on Dec. 7, 2016, which claims priority to Chinese Patent Application No. 201610210836.3, filed on Apr. 6, 2016, The disclosures of the aforementioned applications are hereby incorporated by reference in their entireties.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2016/108852 | Dec 2016 | US |
Child | 16151448 | US |