Instruction conversion apparatus and instruction conversion method providing power control information, program and circuit for implementing the instruction conversion, and microprocessor for executing the converted instruction
An instruction conversion apparatus for optimizing an instruction program formed of a plurality of instructions to be suitable for execution by a microprocessor that has a plurality of hard ware resources. The apparatus includes a power control information analysis unit for detecting a power controllable hardware resource that does not operate for a certain specific instruction region in the instruction program while the microprocessor is at work, and a power control instruction providing unit for providing the instruction program with an instruction regarding the power control based on the result of the detection made by the power control information analysis unit.
Latest MATSUSHITA ELECTRIC INDUSTRIAL CO., LTD. Patents:
- Cathode active material for a nonaqueous electrolyte secondary battery and manufacturing method thereof, and a nonaqueous electrolyte secondary battery that uses cathode active material
- Optimizing media player memory during rendering
- Navigating media content by groups
- Optimizing media player memory during rendering
- Information process apparatus and method, program, and record medium
This application is a divisional of application Ser. No. 10/342,349, filed on Jan. 15, 2003, which claims priority of Japanese Application No. 2002-21479, filed Jan. 30, 2002, the contents of which are hereby incorporated by reference.
BACKGROUND OF THE INVENTION(1) Field of the Invention
The present invention relates to an instruction conversion apparatus and a method of converting an instruction which provide an object program with a power control information, a program and a circuit for implementing the instruction conversion, furthermore a microprocessor for executing the converted instruction; in microprocessors (including microcomputer, microcontroller and digital signal processor) which read an object program out of an instruction storage unit (instruction memory, instruction cache, etc.), decode it at a decoder to control the hardware resources (processing unit, input unit, output unit, memory unit, control unit, etc) in accordance with the contents and proceed a sequence processing.
(2) Description of the Background Art
Among the microprocessors, there have been two methods of controlling the electric power for saving the power consumption; one method is that through hardware, the other is that through software.
First, a conventional method of controlling the power through hardware is described. In a typical operation of a microprocessor, an instruction decoder acquires instruction code from an instruction memory unit along with progress of a program, decodes the instruction code, and controls the processing operations in accordance with respective instructions. In the power control through hardware, an instruction decoder for extracting information regarding the power control is built in the microprocessor.
Next, a conventional method of controlling the power through software is described. In the method of control through software, a user describing a program judges as to which of the hardware resources can be halted while microprocessor is executing an object program, and writes a power control instruction direct in the program.
In a power control method through hardware, the decoder needs to be structured so that it can decode power control information corresponding to various instruction codes. This naturally expands the size of hardware to a large scale, if a thorough power control is to be performed. Furthermore, if there are many kinds of decodable instructions, power consumption needed for the decoding operation increases. This might result in an increased total power consumption of a microprocessor. Still further, since a power control information can only be extracted at each unit of instruction codes, it is not possible to perform an advanced power control to a succeeding instruction.
In a power control method through software, user is requested to judge as to what time the power control is to be started and ended, and write a power control instruction accordingly into a program. Thus, the development burden of a user is substantial. Furthermore, when number of the point of control increases, it turns out to be difficult to write thorough instructions. Still further, targets of the power control may differ depending on structure of a microprocessor, viz. the memory structure, number of peripheral interface ports, etc. In such a case, an exclusive program will be needed by each of the models. So, it is difficult to share a program in common, or use a program also for other applications. Furthermore, when a number of the power control instructions are written at a point of multiloop or frequent execution, speed of program execution goes down.
SUMMARY OF THE INVENTIONThe present invention addresses the above problems and aims to implement a thorough power control, without inviting an increased hardware size, without causing too much development burden at user, while securing a wide-usability of software.
The above objective is accomplished by an instruction conversion apparatus, which statically analyzes a program when it is compiled or assembled and provides the program with an instruction regarding the power control based on the result of analysis.
The above instruction conversion apparatus can be easily implemented; an information as to which of the hardware resources are put into operation, or not, by an instruction among the instruction program is stored beforehand in an instruction-wise hardware resource table, and thereby detecting a certain specific hardware resource that dose not operate for a certain specific instruction region while a microprocessor is at work.
As to the practical method of providing a power control instruction; it can be made by inserting an instruction regarding the power control, or by replacing an instruction which does not contain a power control instruction with an instruction containing the power control instruction.
In a method of saving the power consumption which is to be implemented by inserting the instructions, the processing speed might be slowed down by increased cycle counts when many instructions are inserted. And the code size increases as a result of inserted instructions. Such drawbacks, however, can be improved by structuring the above instruction conversion apparatus so that a user can determine the level of power control by an option at the compilation or assembling. Namely, the code size and the power control may be adjusted by selecting a number of inserted power control instructions among several steps.
Other objective of the present invention is to analyze an object program prior to decoding and provide an instruction regarding the power control, thereby offering an instruction conversion circuit that can realize a low power consumption while controlling the increase of hardware within a certain scale.
The above objective can be implemented by an instruction conversion circuit, which circuit comprises an instruction-wise hardware resource memory for storing beforehand an information about whether a certain specific hardware resource is put into operation by an instruction code among an object program which is to be executed by a microprocessor; a power control information analysis circuit for detecting, based on the information stored in said instruction-wise hardware resource memory, a hardware resource that does not operate for a certain instruction region while the microprocessor is at work; and a power control instruction providing circuit for providing the object program with, based on the results detected by the instruction-wise hardware resource analysis circuit, an instruction regarding the power control.
Still other objective of the present invention is to offer a microprocessor which can execute a power-optimized object program generated by the above instruction conversion apparatus without incurring an operation error, even when a special processing such as interruption, branching, exception, etc. has arisen.
The above objective can be implemented by providing the microprocessor with a condition reset circuit that resets, at the time when any of the interruption, branching, exception is detected, condition of the power control register to the initial state in which all of the hardware resources operate.
BRIEF DESCRIPTION OF THE DRAWINGS
In the following passages, an instruction row for operating a microprocessor is referred to as “instruction program”, regardless of the language used. A machine language row before decoding, generated as the result of translation of an instruction program into machine language, for execution by a microprocessor is referred to as “object program”. And “object program” is a kind of “instruction program”. All the intermediate programs which are created when generating an object program from an instruction program are also included in the instruction program.
Now, a first exemplary embodiment of the present invention is described in detail referring to the drawings.
(Total Structure of Instruction Conversion Apparatus)
An instruction-wise hardware resource table 103 stores in advance information as to which of the hardware resources in a microprocessor are put into operation by a certain specific instruction.
An instruction-wise hardware resource analysis unit 102 receives instruction program 101 as the input, and refers, at each of the instructions among the instruction program 101, to the instruction-wise hardware resource table 103 in order to extract information as to which of the hardware resources will be put into operation. It outputs an instruction-wise operating hardware resource data 104.
A power control information detection unit 105 receives the instruction-wise operating hardware resource data 104 as the input, and judges, after making a time sequential analysis, as to where a power control instruction such as halting or resuming a hardware resource is to be inserted for reducing the power consumption. It outputs a power control instruction data 106.
Based on the power control instruction data 106, a power control instruction providing unit 107 provides the instruction program 101 with an instruction for halting (decreasing the power of) a hardware resource, resuming (increasing the power of) the hardware resource or the like instruction. The power control instruction providing unit generates a power optimized instruction program 108.
Contents of the power optimized instruction program 108 generated by the power control instruction providing unit 107 are put into an instruction translation unit 109. The instruction translation unit 109 generates and outputs a power optimized object program 110, which is a machine language instruction row to be executed by a microprocessor.
(Detailed Structure of Instruction-Wise Hardware Resource Table)
The instruction-wise hardware resource table 103 is described referring to
(Description on Operation of Instruction-Wise Hardware Resource Analysis Unit)
Referring to
(Operation of Power Control Information Detection Unit)
Referring to
A case of detecting a hardware resource which does not operate for three or more instruction regions is described using the “Memory Read Operation” as an example. In the data row 401 corresponding to “Memory Read Operation”, the “Memory Read Operation” is not needed during a term of four instructions, from the SUB instruction to the STR instruction. The power control information detection unit 105 detects it. Information regarding the detected hardware resource and the haltable region is delivered as the power control instruction data 106 to the power control instruction providing unit 107.
(An Example of Power Control Instruction Providing Unit)
The power control instruction providing unit 107 is described using the same instruction program shown in
The example shown in
The above instruction conversion apparatus is implemented in the form of a computer program, and offered to a microprocessor user as an assembler program. By simply compiling or assembling an instruction program 101, the user can provide as far as a power optimized object program 110. In this way, a user may simply describe an instruction program and assemble it without having any specific regard for the power control in mind, and, as the result, the power consumption of a microprocessor becomes lower than that in the conventional ones.
(Method of Power Control in Microprocessor)
The power consumption is reduced from the conventional by executing a power optimized object program 110 generated by the above-described instruction conversion apparatus.
An instruction memory unit 602 stores a power optimized object program 110 which is generated by an instruction conversion apparatus in the present embodiment. A program counter 601 specifies address of an instruction which is to be executed next in a microprocessor. An instruction decoder 603 acquires from the instruction memory unit 602 an instruction code at the address specified by the program counter 601, and decodes it. An instruction regarding the power control decoded by the instruction decoder 603 is written (608) in a power control register 604. A power control execution unit 605 conducts, depending on condition of the power control register 604, the power control in a microprocessor (halt the clock, change the clock frequency, power-off, change the power supply voltage, suppress the signal variation, etc.). When an instruction to halt data memory, for example, is decoded by the instruction decoder 603, an instruction to halt data memory is written in the power control register 604. Then the microprocessor refers to condition of the power control register 604 prior to the executing, and can halt the data memory. If the memory is used again after the halt, an instruction to release the halt is again written in the power control register 604. Then the microprocessor refers to condition of the power control register 604 prior to the executing, and releases the memory halt.
Namely, by delivering a power optimized object program 110 to the instruction decoder 603, taking out an instruction regarding the power control and writing it in the power control register 604, a power control can be thoroughly conducted without increasing the hardware size, and power consumption of a microprocessor can be reduced.
In a case when a special instruction is given to a microprocessor, the microprocessor might cause an operation error as a result of executing the power optimized object program 110. Such a situation is described in detail below.
During the normal program execution, sequence of executing the instruction has already been fixed. So, by decoding a power optimized object program 110 the instruction regarding power control can be written precisely in the power control register 604. However, when a special instruction, e.g. interruption, branch, exception, etc. has arisen, the sequence of instruction execution goes to be different from the normal sequence; program is not necessarily executed in accordance with the written order. Namely, even when an ADD instruction is to be provided according to the written order, an interruption might require a STR instruction, for example. In such a case, an instruction to use a memory might come as a result of the special instruction, interruption, branch, exception; although the power control register 604 is set to halt a memory after a power optimized object program 110 is decoded. Then, the memory fails to operate, and the microprocessor might not operate normally.
In order to prevent the above situation to happen, a microprocessor in the present embodiment is provided with a PCR condition reset circuit 606. Thereby, the microprocessor does not cause an operation error and can perform a thorough power control, even when a special instruction is given.
As soon as a factor signal 607, interruption, branch, exception, is detected, the PCR condition reset circuit 606 specifies the condition of power control register 604 to be in a state where all of the hardware resources are put into operation (hereinafter referred to as prearranged value). The factor signal 607 can be a signal for exceptionally processing a calculation result (e.g. a signal requesting an exception for an overflowing result), a signal requesting interruption of microprocessor itself (e.g. a DMA transfer interruption, a timer interruption and the like signals raising a request according to the contents), an input signal delivered from outside (e.g. a signal requesting change of the external terminal), etc. When the power control register 604 is set to the predetermined value, a microprocessor can put all the hardware resources into operation. Thus, the microprocessor does not cause an operation error even when interruption, branch, exception or the like special instruction has arisen.
Although the foregoing descriptions have been made based on a first exemplary embodiment of the present invention, it is not the intention of the present invention to limit the scope of application to the above-described examples.
The instruction conversion apparatus in the first embodiment may be offered to a user as a compiler, in a case where a high-level language such as the C language, the FORTLAN is used at the user. Thus a user can describe a program easier by using a high-level language.
An instruction conversion apparatus in the first embodiment can be offered as a separate power control program other than an assembler or a compiler. By executing the power control program, a user may first provide a power optimized instruction program 108 and then a power optimized object program 110 by assembling. In this case, a user can easily confirm where a power control instruction is provided, by comparing an instruction program 101 described by user with the power optimized instruction program 108.
A power control information analysis unit 111 is not limited to the above-described configuration. Any unit would do, in so far as it is capable of detecting a power-controllable instruction region through a static analysis of instruction program. For example, the instruction region needing a power control which is detected by the power control information detection unit 105 is not necessarily required to be consisting of more than three regions; but it can be an instruction region consisting of one or more regions, which may be determined at option depending on a power control level that is optimum to respective application programs and systems operating at a microprocessor.
A power control instruction providing unit 107 is not limited to the one which inserts an instruction as described in the above. Any unit would do in, so far as it provides a power control information based on the power control instruction data 106. The power control instruction providing unit 107 may be the one which is formed as shown in
It is of course possible to conduct a replacement if an instruction containing power control information is already defined, while conducting an insertion for the instruction which is not defined.
The PCR condition reset circuit 606 can be any circuit, in so far as it brings a microprocessor to a normal operating condition. For example, although the reset circuit in the first embodiment is detecting the interruption, branching and exception, it may be the one which detects only the interruption and exception. Even in this case, a microcomputer can perform a normal operation, if an instruction conversion apparatus is set so that it inserts an instruction for resetting the power control register just after a branching instruction.
A PCR condition reset circuit 606 may be the one which detects the interruption, branch, exception, based on the result 609 of decoding by instruction decoder.
Furthermore, a PCR condition reset circuit 606 may be the one which detects the interruption, branch, exception, on the basis of both the result 609 of decoding by instruction decoder and the factor signal 607. Use of the both items together for the detection contributes to make the interruption, branch, exception detection more reliable, as compared to a detection which is conducted based on either one of the two items.
Still further, a PCR condition reset circuit 606 may be the one which conducts the interruption, branch, exception detection based on a change in the condition of program counter, as shown in
A second exemplary embodiment of the present invention is described referring to the drawings.
So according to instruction-wise operating hardware resource data of
In the above-described structure, where a user can select at option a desired level of the power control, number of instructions to be inserted for the power control can be adjusted. Therefore, a user can adopt an optimum level of the power control taking the code size and the execution cycle into consideration.
A power control level judgment unit 901 is not limited to the one having the above-described structure, in which the level of power control is judged by an option. Any other unit would do, in so far as it allows a user to specify a level of the power control at his or her judgment among a plurality of levels. Although the power control information detection unit 105 in the present embodiment 2 controls the level of power control by changing the length of instruction region which is to be judged haltable, method of adjusting the level is not limited to the one described above. An example of other method is; conducting the detection on all of the hardware resources when option is “-P1”, while conducting the detection only on the memory and the data register when option is “-P2”. That is to say, the power control information detection unit 105 changes which hardware resources are targets for the power control in accordance to a level of the power control.
In a case where the power control instruction providing unit 107 is capable of doing both the instruction insertion and the replacement, it may be structured so that it conducts both the insertion and the replacement when option is “-P1”, while only the replacement when option is “-P2”. Since neither the code size nor the execution cycle is increased by the replacement, the option “-P2” provides only a minimum power control, which does not accompany any disadvantage.
Embodiment 3A third exemplary embodiment of the present invention is described referring to the drawings.
In this case, as shown in
A power control instruction providing unit 107 in the present embodiment 3 is not limited to the one which performs the above-described bit insertion. Any other unit would do, in so far as it provides a power control information based on the power control instruction data 106. It may be, for example, the one which inserts a machine language instruction itself.
An instruction conversion apparatus in the present embodiment 3 may be implemented in the form of a computer program, like the one in embodiment 1. It may be offered to a user of microprocessor either as an assembler/compiler or an independent power control program.
Furthermore, it may be provided with a power control level judgment unit, like in the embodiment 2, so that a user can select a level of the power control.
Since an instruction conversion apparatus in the present embodiment 3 converts an object program as it is, it can be offered to a user as a widely-usable compiler/assembler for optimizing the power consumption, which being independent of the language used at the user for a program description.
A microprocessor in the present embodiment 3 may of course contain a PCR condition reset circuit 606, like in the embodiment 1.
Embodiment 4A fourth exemplary embodiment of the present invention is described referring to the drawing.
Thus, an instruction conversion method of the present invention can be implemented also in the form of a circuit.
Embodiment 5A fifth exemplary embodiment of the present invention is described with reference to the drawing.
The embodiment 4 and the embodiment 5 may also be provided with a PCR condition reset circuit. By so doing, the microprocessors can operate normally even when a special instruction sequence has arisen.
The present invention makes it possible to conduct the development of an application program, which being an intrinsic activity, and the power control as separate activities. This alleviates the burden of software development at user. Furthermore, with the present invention, a thorough power control can be implemented easily, maintaining the wide-usabilty of a software and without causing an increase in the software size.
Claims
1. An instruction conversion apparatus for optimizing an instruction program formed of a plurality of instructions to be suitable for execution by a microprocessor that has a plurality of hard ware resources, comprising:
- a power control information analysis unit for detecting a power controllable hardware resource that does not operate for a certain specific instruction region in said instruction program while said microprocessor is at work; and
- a power control instruction providing unit for providing said instruction program with an instruction regarding the power control based on the result of the detection made by said power control information analysis unit.
2. The instruction conversion apparatus of claim 1, further comprising:
- an instruction-wise hardware resource table storage unit for storing information as to which of the hardware resources is put into operation by each of respective instructions among said instruction program; wherein
- said power control information analysis unit detects, based on the information stored in said instruction-wise hardware resource table storage unit, a hardware resource that does not operate for a certain specific instruction region while said microprocessor is at work as the power controllable hardware.
3. The instruction conversion apparatus of claim 2, wherein
- said power control instruction providing unit provides said instruction program with information regarding the power control by inserting an instruction to halt or to resume operation of a hardware resource.
4. The instruction conversion apparatus of claim 2, wherein
- said power control instruction providing unit provides an instruction regarding the power control by inserting in said instruction program an instruction to halt a hardware resource at a location immediately before said certain specific instruction region, and an instruction to resume the hardware resource at the end of said certain specific instruction region.
5. The instruction conversion apparatus of claim 2, wherein
- said power control instruction providing unit provides an instruction regarding the power control by replacing a certain specific instruction among said instruction program with an instruction containing instruction to halt or resume a hardware resource.
6. The instruction conversion apparatus of claim 2, wherein
- said power control instruction providing unit provides an instruction regarding the power control by replacing an instruction among said instruction program locating immediately before the certain specific instruction region with an instruction containing instruction to halt the hardware resource, and an instruction locating at the end of the certain specific instruction region with an instruction containing instruction to resume the hardware resource.
7. (canceled)
8. An instruction conversion apparatus for optimizing an instruction program formed of a plurality of instructions to be suitable for execution by a microprocessor that has a plurality of hard ware resources, comprising:
- a power control information analysis unit for detecting a power controllable hardware resource that does not operate for a certain specific instruction region in said instruction program while said microprocessor is at work;
- a power control instruction providing unit for providing said instruction program with an instruction regarding the power control based on the result of the detection made by said power control information analysis unit, and
- a power control level judgment unit for judging a level of the power control and outputting the judgment result to said power control information analysis unit,
- wherein said power control information analysis unit detects the power-controllable hardware taking the result of judgment by said power control level judgment unit into consideration, and
- wherein said level of the power control corresponds to a length of said certain specific instruction region.
9. An instruction conversion apparatus for optimizing an instruction program formed of a plurality of instructions to be suitable for execution by a microprocessor that has a plurality of hard ware resources, comprising:
- a power control information analysis unit for detecting a power controllable hardware resource that does not operate for a certain specific instruction region in said instruction program while said microprocessor is at work;
- a power control instruction providing unit for providing said instruction program with an instruction regarding the power control based on the result of the detection made by said power control information analysis unit; and
- a power control level judgment unit for judging a level of the power control and outputting the judgment result to said power control information analysis unit,
- wherein said power control information analysis unit detects the power-controllable hardware taking the result of judgment by said power control level judgment unit into consideration, and
- wherein said level of the power control corresponds to which hardware resources are targets for the power control.
10. (canceled)
11. A microprocessor for executing an instruction program converted by instruction conversion apparatus of claim 1.
12. An instruction conversion method for optimizing an instruction program formed of a plurality of instructions to be suitable for execution by a microprocessor, comprising the steps of:
- detecting a power-controllable hardware resource that does not operate for a certain specific instruction region in said instruction program in said instruction region while said microprocessor is at work; and
- providing said instruction program with an instruction regarding the power control based on the result of said detecting step.
13. (canceled)
14. An instruction conversion method for optimizing an instruction program formed of a plurality of instructions to be suitable for execution by a microprocessor comprising the steps of:
- detecting a power-controllable instruction region in said instruction program;
- judging a level of the power control; and
- providing said instruction program with an instruction regarding the power control based on the result of said detecting step and said judging step,
- wherein said level of the power control corresponds to a length of said certain specific instruction region.
15. An instruction conversion method for optimizing an instruction program formed of a plurality of instructions to be suitable for execution by a microprocessor comprising the steps of:
- detecting a power-controllable instruction region in said instruction program;
- judging a level of the power control; and
- providing said instruction program with an instruction regarding the power control based on the result of said detecting step and said judging step
- wherein said level of the power control corresponds to which hardware resources are targets for the power control.
16. An instruction conversion method which converts an instruction program into an object program for execution by a microprocessor, comprising the step of:
- storing beforehand an information as to which of the hardware resources is operated by an instruction among said instruction program in an instruction-wise hardware resource table.
17. The instruction conversion method of claim 16, comprising the steps of:
- referring to instruction-wise resource table recorded in accordance with the instruction conversion method of claim 16 for detecting a hardware resource that dose not operate for a certain specific instruction region while microprocessor is at work, and providing said instruction program with an instruction regarding the power control based on the result of the detection.
18. The instruction conversion method of claim 17, wherein
- instruction regarding the power control is provided by inserting an instruction to halt or resume a hardware resource in said instruction program.
19. The instruction conversion method of claim 17, wherein
- instruction regarding the power control is provided by inserting an instruction to halt a hardware resource in said instruction program at a location immediately before the region where the hardware resource may be stopped, and an instruction to resume the hardware resource at the end of the region where the hardware resource may be stopped.
20. The instruction conversion method of claim 17, wherein
- instruction regarding the power control is provided by replacing an instruction among said instruction program with an instruction containing instruction to halt or resume a hardware resource.
21. The instruction conversion method of claim 17, wherein
- instruction regarding the power control is provided by replacing an instruction among said instruction program locating immediately before the region where a hardware resource may be stopped with an instruction containing instruction to halt the hardware resource, and an instruction locating at the end of the region where the hardware resource may be stopped with an instruction containing instruction to resume the hardware resource.
22. An instruction conversion circuit comprising:
- an instruction-wise hardware resource memory for storing beforehand an information as to whether a hardware resource is put into operation or halt by an instruction code among an object program which is to be executed by a microprocessor,
- a power control information analysis circuit for detecting a hardware resource not operating for a certain specific instruction region while microprocessor is at work based on information stored in said instruction-wise hardware resource memory, and
- a power control instruction providing circuit for providing an object program with an instruction regarding the power control based on result of detection by said instruction-wise hardware resource analysis circuit.
23. A microprocessor for executing a program converted by the instruction conversion circuit of claim 22.
24. The microprocessor of claim 1 1, comprising
- a power control register for storing an information regarding the power control based on decoded result of said instruction decoder, and
- a condition reset circuit for detecting the interruption, branch, exception, and setting condition of said power control register to a state in which all of the hardware resources are put into operation upon detection of the interruption, branch, exception.
25. A program, stored in computer readable memory, for operating a computer to function as
- a power control information analysis unit which refers to an instruction-wise hardware resource table storing beforehand an information as to whether a hardware resource is put into operation or not by an instruction among an instruction program which is to be executed by a microprocessor, for detecting a hardware resource that dose not operate for a certain specific instruction region while microprocessor is at work; and
- a power control instruction providing unit for providing an instruction program with an instruction regarding the power control, based on result of the detection by said instruction-wise hardware resource analysis unit.
Type: Application
Filed: Feb 14, 2007
Publication Date: Sep 6, 2007
Applicant: MATSUSHITA ELECTRIC INDUSTRIAL CO., LTD. (Osaka)
Inventor: Takenobu Tani (Kyoto)
Application Number: 11/705,747
International Classification: G06F 1/00 (20060101);