JP2012256263A - Power control method, electronic apparatus, program and generation method of program - Google Patents

Power control method, electronic apparatus, program and generation method of program Download PDF

Info

Publication number
JP2012256263A
JP2012256263A JP2011129767A JP2011129767A JP2012256263A JP 2012256263 A JP2012256263 A JP 2012256263A JP 2011129767 A JP2011129767 A JP 2011129767A JP 2011129767 A JP2011129767 A JP 2011129767A JP 2012256263 A JP2012256263 A JP 2012256263A
Authority
JP
Japan
Prior art keywords
function
division
memory
power control
memory area
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP2011129767A
Other languages
Japanese (ja)
Other versions
JP5776347B2 (en
Inventor
Toshiki Obara
俊樹 小原
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2011129767A priority Critical patent/JP5776347B2/en
Publication of JP2012256263A publication Critical patent/JP2012256263A/en
Application granted granted Critical
Publication of JP5776347B2 publication Critical patent/JP5776347B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Power Sources (AREA)
  • Devices For Executing Special Programs (AREA)
  • Memory System (AREA)

Abstract

PROBLEM TO BE SOLVED: To reduce power consumption by memory.SOLUTION: A processor 2 controls power control states of plural memory areas 3a,3b to which functions in a program executed by the processor 2 are allocated and which have the power control states of a normal state and a power-saving state, so that, during the execution of a function fa arranged in a memory area 3a, the memory area 3a is put into the power-saving state and the memory area 3b is put into the normal state immediately before a function fb arranged in a memory area 3b is invoked.

Description

本発明は、電力制御方法、電子装置、プログラム及びプログラムの生成方法に関する。   The present invention relates to a power control method, an electronic apparatus, a program, and a program generation method.

プロセッサとメモリを有するシステムにおいて、プロセッサに供給されるプログラムの内容に応じて、メモリの消費電力を削減するように、プロセッサがメモリの動作を制御する方法が知られている。特に、プロセッサとメモリを有するシステムを半導体1チップに搭載するSOC(System On Chip)の消費電力を削減するメモリ制御方法が注目されつつある。   In a system having a processor and a memory, a method is known in which the processor controls the operation of the memory so as to reduce the power consumption of the memory in accordance with the contents of a program supplied to the processor. In particular, a memory control method for reducing the power consumption of an SOC (System On Chip) in which a system having a processor and a memory is mounted on a single semiconductor chip is drawing attention.

たとえば、OS(Operating System)がアプリケーションプログラムに対する主記憶のメモリ領域の割り当て及び解放の状況を調べ、メモリ領域の状況に応じて主記憶に対する電源供給を制御する方法が知られている。   For example, a method is known in which an OS (Operating System) examines the allocation and release status of a memory area of a main memory for an application program and controls the power supply to the main memory according to the status of the memory area.

また、ソースプログラムを、ループを単位とする各フェーズ及び各フェーズで参照する参照データを抽出することで分割する手法も知られている。この手法では、各フェーズの参照データの記憶に要するメモリ領域を、プロセッサ内のキャッシュメモリとプロセッサ外のオンチップメモリとに配分して電力削減を図っている。   There is also known a method of dividing a source program by extracting each phase in units of loops and reference data referenced in each phase. In this method, a memory area required for storing reference data of each phase is distributed to a cache memory in the processor and an on-chip memory outside the processor to reduce power.

また、ソースプログラムから命令同士の呼び出し関係を表すコールグラフを作成し、利用頻度の高い命令群とそれ以外の命令群とに分類し、利用頻度の高い命令群を常時電力が供給されるメモリ領域(メモリバンク)へ配置する方法が知られている。この方法により、電力供給先となるメモリバンクを頻繁に切り替えるような事態が避けられ、効率的な電力制御が図られる。   In addition, a call graph that represents the call relationship between instructions from the source program is created and classified into frequently used instruction groups and other instruction groups, and the frequently used instruction groups are always supplied with power. A method of arranging in (memory bank) is known. By this method, a situation in which the memory bank as the power supply destination is frequently switched is avoided, and efficient power control is achieved.

特開平9−212416号公報JP-A-9-212416 特開2008−102733号公報JP 2008-102733 A 特開2010−257437号公報JP 2010-257437 A

しかし、従来の手法では、プログラムの構造によっては、省電力にできるメモリ領域が制限され、消費電力の削減効果が減少する場合があった。
たとえば、利用頻度の高い命令群を常時電力が供給されるメモリバンクへ配置する手法では、利用頻度の低い命令群は省電力状態と通常状態の電力制御が行われるメモリバンクに配置される。この手法では、ある関数の実行のために一度、省電力状態から通常状態としたメモリバンクはその関数の実行が完了するまでは通常状態とされる。そのため、ある関数の実行時に別のメモリバンクに配置されている関数を呼び出して実行している間も、呼び出し元の関数が配置されているメモリバンクは通常状態のままである。したがって、このような呼び出し関係の多いプログラムでは、十分に消費電力の削減を行うことが難しかった。
However, in the conventional method, depending on the structure of the program, the memory area that can save power is limited, and the effect of reducing power consumption may be reduced.
For example, in a method of arranging a frequently used instruction group in a memory bank to which power is always supplied, a less frequently used instruction group is arranged in a memory bank in which power control is performed in a power saving state and a normal state. In this method, a memory bank that has been once changed from a power saving state to a normal state for execution of a certain function is set to a normal state until the execution of the function is completed. Therefore, the memory bank in which the caller function is placed remains in a normal state while a function placed in another memory bank is called and executed when a certain function is executed. Therefore, it has been difficult to sufficiently reduce the power consumption in such a program having many calling relationships.

発明の一観点によれば、以下のような電力制御方法が提供される。この電力制御方法は、プロセッサで実行されるプログラム中の関数が割り当てられ、通常状態と省電力状態の電力制御状態をもつ複数のメモリ領域のうち、第1のメモリ領域に配置される第1の関数の実行時、第2のメモリ領域に配置される第2の関数が呼び出される直前に、前記第1のメモリ領域を前記省電力状態、前記第2のメモリ領域を前記通常状態とするように、前記プロセッサが前記複数のメモリ領域の電力制御状態を制御する。   According to one aspect of the invention, the following power control method is provided. In this power control method, a function in a program executed by a processor is assigned, and a first memory area is arranged in a first memory area among a plurality of memory areas having a power control state of a normal state and a power saving state. When executing the function, immediately before the second function arranged in the second memory area is called, the first memory area is set to the power saving state, and the second memory area is set to the normal state. The processor controls the power control state of the plurality of memory areas.

また、発明の一観点によれば、以下のようなプログラムの生成方法が提供される。このプログラムの生成方法は、通常状態と省電力状態の電力制御状態をもつ複数のメモリ領域の前記電力制御状態を制御するプログラムを生成するものであり、コンピュータが、プログラム中の関数の前記複数のメモリ領域への割り当てを決定し、前記複数のメモリ領域のうち、第1のメモリ領域に配置される第1の関数において、第2のメモリ領域に配置される第2の関数の呼び出し命令の直前に、前記第1のメモリ領域を前記省電力状態、前記第2のメモリ領域を前記通常状態とする命令を挿入する。   According to another aspect of the invention, the following program generation method is provided. The program generation method generates a program for controlling the power control state of a plurality of memory areas having a power control state of a normal state and a power saving state, and a computer performs the plurality of functions in the program. The allocation to the memory area is determined, and in the first function arranged in the first memory area among the plurality of memory areas, immediately before the call instruction of the second function arranged in the second memory area An instruction for inserting the first memory area into the power saving state and inserting the second memory area into the normal state is inserted.

開示の電力制御方法、電子装置、プログラム及びプログラムの生成方法によれば、メモリによる消費電力を削減することができる。   According to the disclosed power control method, electronic device, program, and program generation method, power consumption by the memory can be reduced.

第1の実施の形態の電力制御方法及び電子装置の一例を示す図である。It is a figure which shows an example of the electric power control method and electronic device of 1st Embodiment. 第2の実施の形態の電子装置の一例を示す図である。It is a figure which shows an example of the electronic device of 2nd Embodiment. メモリ部に格納されているプログラムのコードの一例を示す図である。It is a figure which shows an example of the code | cord | chord of the program stored in the memory part. func1()→func2()→func1()の順で関数が実行される場合のメモリバンクの電力制御状態の例を示す図である。It is a figure which shows the example of the power control state of a memory bank in case a function is performed in order of func1 ()-> func2 ()-> func1 (). func3()→func2()→func3()の順で関数が実行される場合のメモリバンクの電力制御状態の例を示す図である。It is a figure which shows the example of the power control state of a memory bank in case a function is performed in order of func3 ()-> func2 ()-> func3 (). プログラムを生成するコンピュータの一例を示す図である。It is a figure which shows an example of the computer which produces | generates a program. プログラム生成方法の一例を示すフローチャートである。It is a flowchart which shows an example of the program production | generation method. メモリマップ作成処理の一例を示すフローチャートである。It is a flowchart which shows an example of a memory map creation process. メモリバンク構成情報の一例を示す図である。It is a figure which shows an example of memory bank structure information. 静的コールグラフの一例を示す図である。It is a figure which shows an example of a static call graph. 関数サイズ情報の一例を示す図である。It is a figure which shows an example of function size information. プログラム分割処理の一例を示すフローチャートである。It is a flowchart which shows an example of a program division | segmentation process. 分割作業用テーブルの一例を示す図である。It is a figure which shows an example of the table for division | segmentation work. 再帰検出処理の一例を示すフローチャートである。It is a flowchart which shows an example of a recursion detection process. 初期化後の配列変数visited[f]の例を示している。An example of an array variable visited [f] after initialization is shown. サブルーチンAの処理の一例を示すフローチャートである。It is a flowchart which shows an example of the process of a subroutine A. サブルーチンBの処理の一例を示すフローチャートである。7 is a flowchart illustrating an example of processing of a subroutine B. 複数の再帰部を含む静的コールグラフの例を示す図である。It is a figure which shows the example of the static call graph containing a some recursion part. 更新された配列変数visited[f]の例を示す図である。It is a figure which shows the example of the updated array variable visited [f]. 関数f9aについてまで更新された、配列変数visited[f]の例を示す図である。It is a figure which shows the example of the array variable visited [f] updated to the function f9a. 関数f9aにおける配列変数visited[f]が変更された例を示す図である。It is a figure which shows the example by which the array variable visited [f] in the function f9a was changed. 分割処理の一例を示すフローチャートである。It is a flowchart which shows an example of a division | segmentation process. 分割作業用テーブルの更新例を示す図である。It is a figure which shows the example of an update of the table for division | segmentation work. 1つ目の再帰部の検出後に行われる分割処理後の分割作業用テーブルの例を示す図である。It is a figure which shows the example of the table for a division | segmentation operation | work after the division process performed after the detection of the 1st recursive part. 更新された配列変数visited[f]の例を示す図である。It is a figure which shows the example of the updated array variable visited [f]. ステップS79の処理で出力される分割作業用テーブルの例を示す図である。It is a figure which shows the example of the division | segmentation work table output by the process of step S79. 分割情報の例を示す図である。It is a figure which shows the example of division | segmentation information. 再帰部の分割案作成処理の一例を示すフローチャートである。It is a flowchart which shows an example of the division plan creation process of a recursive part. 分割案入りの分割情報の例を示す図である。It is a figure which shows the example of the division information containing a division plan. テーブルtbl1の例を示す図である。It is a figure which shows the example of table tbl1. テーブルtbl2の例を示す図である。It is a figure which shows the example of table tbl2. 関数割り当て処理の一例を示すフローチャートである。It is a flowchart which shows an example of a function allocation process. 初期化後の変数m_rest[M]の一例を示す図である。It is a figure which shows an example of the variable m_rest [M] after initialization. 初期化後の分割情報の一例を示す図である。It is a figure which shows an example of the division information after initialization. 初期化時の割り当て情報の一例を示す図である。It is a figure which shows an example of the allocation information at the time of initialization. 割り当て情報の更新例を示す図である。It is a figure which shows the example of an update of allocation information. 分割情報の更新例を示す図である。It is a figure which shows the example of an update of division | segmentation information. 出力される割り当て情報の例を示す図である。It is a figure which shows the example of the allocation information output. アドレス計算処理の一例を示すフローチャートである。It is a flowchart which shows an example of an address calculation process. 出力されるメモリマップの一例を示す図である。It is a figure which shows an example of the memory map output. 電力制御コード挿入処理の一例を示すフローチャートである。It is a flowchart which shows an example of a power control code insertion process. 第3の実施の形態における関数割り当て処理の一例を示すフローチャートである。It is a flowchart which shows an example of the function allocation process in 3rd Embodiment. 初期化後の分割情報の一例を示す図である。It is a figure which shows an example of the division information after initialization. 分割情報の更新例を示す図である。It is a figure which shows the example of an update of division | segmentation information. 割り当て情報の更新例を示す図である。It is a figure which shows the example of an update of allocation information. 第4の実施の形態における関数割り当て処理の一例を示すフローチャートである。It is a flowchart which shows an example of the function allocation process in 4th Embodiment. 早見表の一例を示す図である。It is a figure which shows an example of a quick reference table. 早見表の更新例を示す図である。It is a figure which shows the example of an update of a quick reference table. 早見表作成処理の例を示すフローチャートである。It is a flowchart which shows the example of a quick reference table preparation process. 早見表の更新処理の例を示すフローチャートである。It is a flowchart which shows the example of the update process of a quick reference table.

以下、本発明の実施の形態を、図面を参照しつつ説明する。
(第1の実施の形態)
図1は、第1の実施の形態の電力制御方法及び電子装置の一例を示す図である。
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
(First embodiment)
FIG. 1 is a diagram illustrating an example of a power control method and an electronic apparatus according to the first embodiment.

第1の実施の形態の電力制御方法は、図1に示すような電子装置1で実行される。電子装置1は、プロセッサ2と複数のメモリ領域3a,3bを有している。各メモリ領域3a,3bには、プロセッサ2で実行されるプログラム中の関数が割り当てられている。   The power control method of the first embodiment is executed by an electronic device 1 as shown in FIG. The electronic device 1 includes a processor 2 and a plurality of memory areas 3a and 3b. Functions in a program executed by the processor 2 are assigned to the memory areas 3a and 3b.

ここで、メモリ領域3aに配置されている関数faは、メモリ領域3bに配置されている関数fbへの呼び出し命令を含むものとする。このような関数fa,fbを含むプログラムを実行する際、プロセッサ2は、たとえば、図1のフローチャートに示されているような電力制御を実行する。   Here, it is assumed that the function fa arranged in the memory area 3a includes a call instruction to the function fb arranged in the memory area 3b. When executing the program including such functions fa and fb, the processor 2 executes power control as shown in the flowchart of FIG. 1, for example.

なお、メモリ領域3a,3bの電力制御状態には、通常状態と省電力状態とがある。通常状態は、たとえば、メモリ領域3a,3bへのライトやリードが行われる際の電力制御状態であり、省電力状態は、たとえば、メモリ領域3a,3bに記憶されている内容を保持するための、通常状態よりも低い電圧が印加されている状態である。   Note that the power control states of the memory areas 3a and 3b include a normal state and a power saving state. The normal state is a power control state when, for example, writing or reading to the memory areas 3a and 3b is performed, and the power saving state is, for example, for holding the contents stored in the memory areas 3a and 3b. In this state, a voltage lower than the normal state is applied.

関数faの実行時、メモリ領域3aの電力制御状態は通常状態、メモリ領域3bの電力制御状態は省電力状態になっているものとする。
関数faの実行が開始されると、プロセッサ2は、関数fbの呼び出し命令の直前で、メモリ領域3aを省電力状態とし、メモリ領域3bを通常状態に遷移させる(ステップS1)。
When the function fa is executed, it is assumed that the power control state of the memory area 3a is a normal state and the power control state of the memory area 3b is a power saving state.
When the execution of the function fa is started, the processor 2 sets the memory area 3a to the power saving state and makes the memory area 3b transition to the normal state immediately before the call instruction of the function fb (step S1).

関数fbの実行時は、関数faの処理は中断されているため、メモリ領域3aを省電力状態とすることで、電子装置1の消費電力を削減することができる。
関数faの実行時において、関数fbへの呼び出し命令が実行されると(ステップS2)、通常状態となっているメモリ領域3bに割り当てられている関数fbの実行が開始される(ステップS3)。
Since the processing of the function fa is interrupted when the function fb is executed, the power consumption of the electronic device 1 can be reduced by setting the memory area 3a to the power saving state.
When a call instruction to the function fb is executed during the execution of the function fa (step S2), the execution of the function fb assigned to the memory area 3b in the normal state is started (step S3).

その後、プロセッサ2は、関数faへの復帰直前(関数fbの終了直前)に、メモリ領域3aを通常状態に遷移させる(ステップS4)。関数fbの実行が終了すると、関数faへの復帰が行われる(ステップS5)。   After that, the processor 2 changes the memory area 3a to the normal state immediately before returning to the function fa (just before the end of the function fb) (step S4). When the execution of the function fb is completed, a return to the function fa is performed (step S5).

関数faの復帰が行われると、プロセッサ2は、メモリ領域3bを省電力状態に遷移させる(ステップS6)。
その後、関数faの残りの処理が実行され(ステップS7)、関数faの実行が終了する。
When the function fa is restored, the processor 2 shifts the memory area 3b to the power saving state (step S6).
Thereafter, the remaining processing of the function fa is executed (step S7), and the execution of the function fa ends.

なお、ステップS1の処理を行う命令は、関数fa内において、たとえば、関数fbの呼び出し命令の直前に記述されている。また、ステップS4の処理を行う命令は、関数fb内において、たとえば、関数fbの終了命令の直前に記述されている。また、ステップS6の処理を行う命令は、関数fa内において、たとえば、関数fbの呼び出し命令の直後に記述されている。詳細は後述する。   Note that the instruction for performing the process of step S1 is described in the function fa, for example, immediately before the instruction for calling the function fb. Further, the instruction for performing the process of step S4 is described in the function fb, for example, immediately before the end instruction of the function fb. Further, the instruction for performing the process of step S6 is described in the function fa, for example, immediately after the calling instruction for the function fb. Details will be described later.

このような関数fa,fbを含むプログラムを、プロセッサ2が実行することで、上記のような電力制御方法が実行される。
以上のような電力制御方法によれば、呼び出し元の関数が割り当てられているメモリ領域を、呼び出し先の関数の実行時に省電力状態とし、関数の実行を中断しているメモリ領域を省電力状態としている。これにより、呼び出し関係の多いプログラムを実行する場合であっても、メモリ領域3a,3bによる消費電力を削減でき、その結果、低消費電力の電子装置1が得られる。
When the processor 2 executes such a program including the functions fa and fb, the power control method as described above is executed.
According to the power control method as described above, the memory area to which the caller function is assigned is set to the power saving state when the callee function is executed, and the memory area in which the function execution is suspended is set to the power saving state. It is said. As a result, even when a program having a lot of calling relationships is executed, the power consumption by the memory areas 3a and 3b can be reduced, and as a result, the low power consumption electronic device 1 can be obtained.

(第2の実施の形態)
図2は、第2の実施の形態の電子装置の一例を示す図である。
電子装置50は、たとえば、メモリ装置、SOC(System On Chip)などの半導体装置、またはコンピュータなどである。
(Second Embodiment)
FIG. 2 is a diagram illustrating an example of an electronic device according to the second embodiment.
The electronic device 50 is, for example, a memory device, a semiconductor device such as an SOC (System On Chip), or a computer.

電子装置50は、メモリ部10、プロセッサ20、制御レジスタ部30、電力制御部40、バス41、電源線42を有している。
メモリ部10は、SRAM(Static Random Access Memory)またはDRAM(Dynamic Random Access Memory)などであり、複数のメモリバンク11−0,11−1,11−2,11−3,…,11−nを有する。メモリバンク11−0〜11−nは、命令コード用メモリ12またはデータ用メモリ13として機能する。メモリバンク11−0〜11−nは、バス41を介してプロセッサ20に接続されている。
The electronic device 50 includes a memory unit 10, a processor 20, a control register unit 30, a power control unit 40, a bus 41, and a power supply line 42.
The memory unit 10 is an SRAM (Static Random Access Memory) or a DRAM (Dynamic Random Access Memory) or the like, and includes a plurality of memory banks 11-0, 11-1, 11-2, 11-3,. Have. The memory banks 11-0 to 11-n function as the instruction code memory 12 or the data memory 13. The memory banks 11-0 to 11-n are connected to the processor 20 via the bus 41.

プロセッサ20は、たとえば、CPU(Central Processing Unit)、DSP(Digital Signal Processor)などであり、プロセッサコア21とメモリコントローラ22を有している。プロセッサコア21はメモリコントローラ22を用いて、メモリバンク11−0〜11−nへのデータまたは命令コードの書き込みまたは読み出しを制御する。   The processor 20 is, for example, a CPU (Central Processing Unit), a DSP (Digital Signal Processor), and the like, and includes a processor core 21 and a memory controller 22. The processor core 21 uses the memory controller 22 to control writing or reading of data or instruction codes to the memory banks 11-0 to 11-n.

制御レジスタ部30は、プロセッサ20からの電源制御信号に応じて、メモリバンク11−0〜11−nの電力制御状態を記憶する。制御レジスタ部30は、たとえば、各メモリバンク11−1〜11−nの電力制御状態を記憶する複数のレジスタc0,c1,c2,c3,…,cnを有している。   The control register unit 30 stores the power control state of the memory banks 11-0 to 11-n according to the power supply control signal from the processor 20. The control register unit 30 includes, for example, a plurality of registers c0, c1, c2, c3,..., Cn that store the power control states of the memory banks 11-1 to 11-n.

たとえば、図2に示すように、レジスタc0〜cnのうち、レジスタc0,c2に“1”が設定され、後のレジスタc1,c3〜cnに“0”が設定されると、メモリバンク11−0,11−2の電力制御状態が通常状態となり、メモリバンク11−1,11−3〜11−nの電力制御状態が省電力状態となる。   For example, as shown in FIG. 2, when "1" is set in the registers c0 and c2 and "0" is set in the subsequent registers c1 and c3 to cn, the memory bank 11- The power control state of 0, 11-2 becomes the normal state, and the power control state of the memory banks 11-1, 11-3 to 11-n becomes the power saving state.

電力制御部40は、メモリバンク11−0〜11−nと電源線42間に接続された電力制御回路40−0,40−1,40−2,40−3,…,40−nを有している。電力制御回路40−0〜40−nは、制御レジスタ部30からの信号に応じて、メモリバンク11−0〜11−nの電源状態を制御する。なお、電源状態には、たとえば、電源切断状態と省電力供給状態と通常電力供給状態とがある。   The power control unit 40 includes power control circuits 40-0, 40-1, 40-2, 40-3,..., 40-n connected between the memory banks 11-0 to 11-n and the power supply line 42. is doing. The power control circuits 40-0 to 40-n control the power supply states of the memory banks 11-0 to 11-n according to signals from the control register unit 30. The power supply state includes, for example, a power-off state, a power saving supply state, and a normal power supply state.

電源切断状態では、電源線42と各メモリバンク11−0〜11−nとの間の接続が切断されている。省電力供給状態では、電源線42からの電源が、電圧を低下させて各メモリバンク11−0〜11−nへ供給されている。通常電力供給状態では、電源線42からの電源が、電圧を保持しながら各メモリバンク11−0〜11−nへ供給されている。   In the power-off state, the connection between the power supply line 42 and each of the memory banks 11-0 to 11-n is disconnected. In the power saving supply state, the power from the power supply line 42 is supplied to the memory banks 11-0 to 11-n with a reduced voltage. In the normal power supply state, the power from the power supply line 42 is supplied to the memory banks 11-0 to 11-n while maintaining the voltage.

電源切断状態では、各メモリバンク11−0〜11−nにおいて、データの保持も、読み出し及び書き込みも行われない。省電力供給状態では、各メモリバンク11−0〜11−nにおいて、データ保持が行われる。通常電力供給状態では、各メモリバンク11−0〜11−nにおいて、データ保持、読み出しまたは書き込みが行われる。   In the power-off state, no data is held, and neither reading nor writing is performed in each of the memory banks 11-0 to 11-n. In the power saving supply state, data is held in each of the memory banks 11-0 to 11-n. In the normal power supply state, data retention, reading, or writing is performed in each of the memory banks 11-0 to 11-n.

なお、制御レジスタ部30において、“0”が設定されている場合に、上記の電源状態のうち、電源切断状態と省電力供給状態の何れかが、たとえば、電力制御回路40−0〜40−nにより決定される。   Note that, when “0” is set in the control register unit 30, any one of the power-off state and the power-saving supply state among the above-described power states is, for example, the power control circuits 40-0 to 40-. determined by n.

このような電子装置50において、メモリ部10には、たとえば、以下のようなプログラムが格納されている。
図3は、メモリ部に格納されているプログラムのコードの一例を示す図である。
In such an electronic device 50, for example, the following program is stored in the memory unit 10.
FIG. 3 is a diagram illustrating an example of program codes stored in the memory unit.

図3の例では、関数としてfunc1()、func2()、func3()が示されている。また、図3の例では、メモリバンク11−0〜11−nの数を8つ(つまり、n=7)としている。   In the example of FIG. 3, func1 (), func2 (), and func3 () are shown as functions. In the example of FIG. 3, the number of memory banks 11-0 to 11-n is eight (that is, n = 7).

func1()は、func2()の呼び出し命令(call func2())を含み、メモリバンク11−1に配置される。さらに、func1には、func2()の呼び出し命令の直前に、メモリバンク11−1の電力制御状態を省電力状態に遷移させ、メモリバンク11−2の電力制御状態を通常状態に遷移させる命令(電力制御コード)が記述されている。また、呼び出し命令の直後に、メモリバンク11−2〜11−7の電力制御状態を省電力状態に遷移させる電力制御コードが記述されている。   func1 () includes a call instruction (call func2 ()) of func2 () and is arranged in the memory bank 11-1. Further, func1 has an instruction to change the power control state of the memory bank 11-1 to the power saving state and to change the power control state of the memory bank 11-2 to the normal state immediately before the calling instruction of func2 (). Power control code). In addition, immediately after the call instruction, a power control code for transitioning the power control state of the memory banks 11-2 to 11-7 to the power saving state is described.

func1において呼び出されるfunc2()は、メモリバンク11−2に配置される。func2には、func2()の終了を示す“end function”の直前に、func2の呼び出し命令が含まれているメモリバンク11−1,11−3の電力制御状態を通常状態に遷移させる電力制御コードが記述されている。   func2 () called in func1 is arranged in the memory bank 11-2. In func2, a power control code for shifting the power control state of the memory banks 11-1 and 11-3 including the calling instruction of func2 to the normal state immediately before “end function” indicating the end of func2 (). Is described.

func3は、func2()の呼び出し命令を含み、メモリバンク11−3に配置される。さらに、func3には、func2()の呼び出し命令の直前に、メモリバンク11−3の電力制御状態を省電力状態に遷移させ、メモリバンク11−2の電力制御状態を通常状態に遷移させる電力制御コードが記述されている。また、呼び出し命令の直後に、メモリバンク11−1,11−2,11−4〜11−7の電力制御状態を省電力状態に遷移させる電力制御コードが記述されている。   func3 includes a call instruction of func2 () and is arranged in the memory bank 11-3. Furthermore, in func3, immediately before the call instruction to func2 (), the power control for changing the power control state of the memory bank 11-3 to the power saving state and for changing the power control state of the memory bank 11-2 to the normal state. The code is written. In addition, immediately after the call instruction, a power control code for transitioning the power control state of the memory banks 11-1, 11-2, 11-4 to 11-7 to the power saving state is described.

電子装置50は、以上のようなプログラムを実行することで、メモリバンク11−0〜11−nの電力制御を行う。
以下、図3に示したプログラムの実行時による電子装置50による電力制御方法の例を説明する。
The electronic device 50 performs power control of the memory banks 11-0 to 11-n by executing the program as described above.
Hereinafter, an example of a power control method by the electronic device 50 when the program shown in FIG. 3 is executed will be described.

図4は、func1()→func2()→func1()の順で関数が実行される場合のメモリバンクの電力制御状態の例を示す図である。
図4では、プログラムの各コードの実行時におけるメモリバンク11−0〜11−7の電力制御状態を示している。メモリバンク番号の0〜7は、それぞれ、メモリバンク11−0〜11−7を示している。
FIG. 4 is a diagram illustrating an example of a power control state of the memory bank when functions are executed in the order of func1 () → func2 () → func1 ().
FIG. 4 shows the power control state of the memory banks 11-0 to 11-7 when each code of the program is executed. Memory bank numbers 0 to 7 indicate memory banks 11-0 to 11-7, respectively.

なお、メモリバンク11−0には、メイン関数が配置され、電力制御状態が常時、通常状態となっている。また、図4中において最初にfunc1を実行する際には、メモリバンク11−0,11−1以外のメモリバンク11−2〜11−7の電力制御状態は省電力状態となっているものとする。すなわち、図2に示した制御レジスタ部30のレジスタc0〜c7は、“11000000”となっている。   Note that the main function is arranged in the memory bank 11-0, and the power control state is always the normal state. In FIG. 4, when func1 is executed for the first time, the power control states of the memory banks 11-2 to 11-7 other than the memory banks 11-0 and 11-1 are in the power saving state. To do. That is, the registers c0 to c7 of the control register unit 30 shown in FIG.

プロセッサ20によるfunc1()の実行時において、func2()の呼び出し命令の直前で、メモリバンク11−1の電力制御状態を省電力状態へ遷移させ、メモリバンク11−2の電力制御状態を通常状態へ遷移させる電力制御コードが実行される。このときプロセッサ20は、制御レジスタ部30のレジスタc0〜c7を、“10100000”と書き換える。これにより、func2()の呼び出し命令の実行時には、メモリバンク11−1の電力制御状態が省電力状態となり、メモリバンク11−2の電力制御状態が通常状態となる。   During the execution of func1 () by the processor 20, the power control state of the memory bank 11-1 is changed to the power saving state immediately before the call instruction of func2 (), and the power control state of the memory bank 11-2 is changed to the normal state. The power control code for making a transition to is executed. At this time, the processor 20 rewrites the registers c0 to c7 of the control register unit 30 as “10100000”. As a result, when the call instruction of func2 () is executed, the power control state of the memory bank 11-1 becomes the power saving state, and the power control state of the memory bank 11-2 becomes the normal state.

func2()の実行が進み、終了直前において、メモリバンク11−1,11−3を通常状態へ遷移させる電力制御コードが実行される。このときプロセッサ20は、制御レジスタ部30のレジスタc0〜c7を、“11110000”と書き換える。これにより、func2()の終了時(func1()への復帰時)には、メモリバンク11−0〜11−3の電力制御状態が通常状態となり、メモリバンク11−4〜11−7の電力制御状態が省電力状態のままとなる。このようにすることで、実行状況を参照せずに、func1()、func3()のどちらに復帰しても省電力状態のメモリバンクにアクセスするという問題を発生させないようになっている。   The execution of func2 () proceeds, and immediately before the end, the power control code for shifting the memory banks 11-1 and 11-3 to the normal state is executed. At this time, the processor 20 rewrites the registers c0 to c7 of the control register unit 30 as “11110000”. As a result, at the end of func2 () (when returning to func1 ()), the power control state of the memory banks 11-0 to 11-3 becomes the normal state, and the power of the memory banks 11-4 to 11-7 The control state remains in the power saving state. By doing so, the problem of accessing the memory bank in the power saving state does not occur even if it returns to either func1 () or func3 () without referring to the execution status.

func1()への復帰後には、func1()においてfunc2()の呼び出し命令の直後の、メモリバンク11−2〜11−7の電力制御状態を省電力状態に遷移させる電力制御コードが実行される。このときプロセッサ20は、制御レジスタ部30のレジスタc0〜c7を、“11000000”と書き換える。これにより、メモリバンク11−0,11−1以外のメモリバンク11−2〜11−7の電力制御状態が省電力状態となる。func1()へ復帰したという情報を追加されたため、省電力状態とするメモリバンクを増やすことができた。   After the return to func1 (), the power control code for changing the power control state of the memory banks 11-2 to 11-7 to the power saving state immediately after the call instruction of func2 () is executed in func1 (). . At this time, the processor 20 rewrites the registers c0 to c7 of the control register unit 30 as “11000000”. As a result, the power control states of the memory banks 11-2 to 11-7 other than the memory banks 11-0 and 11-1 become the power saving state. Since information indicating that the function has been returned to func1 () has been added, it is possible to increase the number of memory banks in the power saving state.

図5は、func3()→func2()→func3()の順で関数が実行される場合のメモリバンクの電力制御状態の例を示す図である。
図4と同様に、プログラムの各コードの実行時におけるメモリバンク11−0〜11−7の電力制御状態を示している。メモリバンク番号の0〜7は、それぞれ、メモリバンク11−0〜11−7を示している。また、図4と同様に、メモリバンク11−0には、メイン関数が配置され、電力制御状態が常時、通常状態となっている。
FIG. 5 is a diagram illustrating an example of the power control state of the memory bank when functions are executed in the order of func3 () → func2 () → func3 ().
Similarly to FIG. 4, the power control states of the memory banks 11-0 to 11-7 at the time of executing each code of the program are shown. Memory bank numbers 0 to 7 indicate memory banks 11-0 to 11-7, respectively. Similarly to FIG. 4, the main function is arranged in the memory bank 11-0, and the power control state is always the normal state.

なお、図5中において最初にfunc3を実行する際には、メモリバンク11−0,11−3以外のメモリバンク11−1,11−2,11−4〜11−7の電力制御状態は省電力状態となっているものとする。すなわち、図2に示した制御レジスタ部30のレジスタc0〜c7は、“10010000”となっている。   In FIG. 5, when func3 is executed for the first time, the power control states of the memory banks 11-1, 11-2, 11-4 to 11-7 other than the memory banks 11-0 and 11-3 are omitted. Assume that it is in a power state. That is, the registers c0 to c7 of the control register unit 30 shown in FIG. 2 are “10010000”.

プロセッサ20によるfunc3()の実行時において、func2()の呼び出し命令の直前で、メモリバンク11−2の電力制御状態を通常状態へ遷移させ、メモリバンク11−3の電力制御状態を省電力状態へ遷移させる電力制御コードが実行される。このときプロセッサ20は、制御レジスタ部30のレジスタc0〜c7を、“10100000”と書き換える。これにより、func2()の呼び出し命令の実行時には、メモリバンク11−3の電力制御状態が省電力状態となり、メモリバンク11−2の電力制御状態が通常状態となる。   At the time of execution of func3 () by the processor 20, the power control state of the memory bank 11-2 is changed to the normal state immediately before the call instruction of func2 (), and the power control state of the memory bank 11-3 is changed to the power saving state The power control code for making a transition to is executed. At this time, the processor 20 rewrites the registers c0 to c7 of the control register unit 30 as “10100000”. As a result, when the call instruction of func2 () is executed, the power control state of the memory bank 11-3 becomes the power saving state, and the power control state of the memory bank 11-2 becomes the normal state.

func2()の実行が進み、終了直前において、メモリバンク11−1,11−3を通常状態へ遷移させる電力制御コードが実行される。このときプロセッサ20は、制御レジスタ部30のレジスタc0〜c7を、“11110000”と書き換える。これにより、func2()の終了時(func3()への復帰時)には、メモリバンク11−0〜11−3の電力制御状態が通常状態となり、メモリバンク11−4〜11−7の電力制御状態が省電力状態のままとなる。このようにすることで、実行状況を参照せずに、func1()、func3()のどちらに復帰しても省電力状態のメモリバンクにアクセスするという問題を発生させないようになっている。   The execution of func2 () proceeds, and immediately before the end, the power control code for shifting the memory banks 11-1 and 11-3 to the normal state is executed. At this time, the processor 20 rewrites the registers c0 to c7 of the control register unit 30 as “11110000”. As a result, at the end of func2 () (at the time of returning to func3 ()), the power control state of the memory banks 11-0 to 11-3 becomes the normal state, and the power of the memory banks 11-4 to 11-7 The control state remains in the power saving state. By doing so, the problem of accessing the memory bank in the power saving state does not occur even if it returns to either func1 () or func3 () without referring to the execution status.

func3()への復帰後には、func3()においてfunc2()の呼び出し命令の直後の、メモリバンク11−1,11−2,11−4〜11−7の電力制御状態を省電力状態に遷移させる電力制御コードが実行される。このときプロセッサ20は、制御レジスタ部30のレジスタc0〜c7を、“10010000”と書き換える。これにより、メモリバンク11−0,11−3以外のメモリバンク11−1,11−2,11−4〜11−7の電力制御状態が省電力状態となる。func3()へ復帰したという情報を追加されたため、省電力状態とするメモリバンクを増やすことができた。   After returning to func3 (), the power control state of the memory banks 11-1, 11-2, 11-4 to 11-7 immediately after the calling instruction of func2 () in func3 () is changed to the power saving state. The power control code to be executed is executed. At this time, the processor 20 rewrites the registers c0 to c7 of the control register unit 30 as “10010000”. As a result, the power control states of the memory banks 11-1, 11-2, 11-4 to 11-7 other than the memory banks 11-0 and 11-3 become the power saving state. Since information indicating that the function has been returned to func3 () has been added, it is possible to increase the number of memory banks in the power saving state.

以上のような電力制御方法によれば、呼び出し元の関数が割り当てられているメモリバンクを、呼び出し先の関数の実行時に省電力状態とし、メイン関数以外の関数の実行を中断しているメモリバンクを省電力状態としている。これにより、呼び出し関係の多いプログラム、特に複数の関数が同一の関数を呼び出す構造を含むプログラムを実行する場合であっても、プログラムのメモリバンクへの配置の工夫をせずに、電子装置50のメモリ部10による消費電力を削減でき、その結果、低消費電力の電子装置50が得られる。   According to the power control method as described above, the memory bank to which the caller function is assigned is placed in the power saving state when the callee function is executed, and the execution of functions other than the main function is suspended. Is in a power saving state. As a result, even when a program having a lot of calling relationships, particularly a program including a structure in which a plurality of functions call the same function, is executed, the electronic device 50 can be arranged without devising arrangement of the program in the memory bank. The power consumption by the memory unit 10 can be reduced, and as a result, the low power consumption electronic device 50 can be obtained.

次に、図3に示したような電力制御コードが挿入されたプログラムを生成する方法について詳細に説明する。
(プログラム生成方法)
図6は、プログラムを生成するコンピュータの一例を示す図である。
Next, a method for generating a program in which the power control code as shown in FIG. 3 is inserted will be described in detail.
(Program generation method)
FIG. 6 is a diagram illustrating an example of a computer that generates a program.

コンピュータ100は、CPU101によって装置全体が制御されている。CPU101には、バス108を介してRAM102と複数の周辺機器が接続されている。
RAM102は、コンピュータ100の主記憶装置として使用される。RAM102には、CPU101に実行させるOSのプログラムやアプリケーションプログラムの少なくとも一部が一時的に格納される。また、RAM102には、CPU101による処理に用いる各種データが格納される。
The entire computer 100 is controlled by a CPU 101. The CPU 101 is connected to the RAM 102 and a plurality of peripheral devices via the bus 108.
The RAM 102 is used as a main storage device of the computer 100. The RAM 102 temporarily stores at least a part of OS programs and application programs to be executed by the CPU 101. The RAM 102 stores various data used for processing by the CPU 101.

バス108に接続されている周辺機器としては、ハードディスクドライブ(HDD:Hard Disk Drive)103、グラフィック処理装置104、入力インタフェース105、光学ドライブ装置106、及び通信インタフェース107がある。   Peripheral devices connected to the bus 108 include a hard disk drive (HDD) 103, a graphic processing device 104, an input interface 105, an optical drive device 106, and a communication interface 107.

HDD103は、内蔵したディスクに対して、磁気的にデータの書き込み及び読み出しを行う。HDD103は、コンピュータ100の二次記憶装置として使用される。HDD103には、OSのプログラム、アプリケーションプログラム、及び各種データが格納される。なお、二次記憶装置としては、フラッシュメモリなどの半導体記憶装置を使用することもできる。   The HDD 103 magnetically writes and reads data to and from the built-in disk. The HDD 103 is used as a secondary storage device of the computer 100. The HDD 103 stores an OS program, application programs, and various data. Note that a semiconductor storage device such as a flash memory can also be used as the secondary storage device.

グラフィック処理装置104には、モニタ104aが接続されている。グラフィック処理装置104は、CPU101からの命令にしたがって、画像をモニタ104aの画面に表示させる。モニタ104aとしては、CRT(Cathode Ray Tube)を用いた表示装置や液晶表示装置などがある。   A monitor 104 a is connected to the graphic processing device 104. The graphic processing device 104 displays an image on the screen of the monitor 104a in accordance with a command from the CPU 101. Examples of the monitor 104a include a display device using a CRT (Cathode Ray Tube) and a liquid crystal display device.

入力インタフェース105には、キーボード105aとマウス105bとが接続されている。入力インタフェース105は、キーボード105aやマウス105bから送られてくる信号をCPU101に送信する。なお、マウス105bは、ポインティングデバイスの一例であり、他のポインティングデバイスを使用することもできる。他のポインティングデバイスとしては、タッチパネル、タブレット、タッチパッド、トラックボールなどがある。   A keyboard 105 a and a mouse 105 b are connected to the input interface 105. The input interface 105 transmits signals sent from the keyboard 105a and the mouse 105b to the CPU 101. Note that the mouse 105b is an example of a pointing device, and other pointing devices can also be used. Examples of other pointing devices include a touch panel, a tablet, a touch pad, and a trackball.

光学ドライブ装置106は、レーザ光などを利用して、光ディスク106aに記録されたデータの読み取りを行う。光ディスク106aは、光の反射によって読み取り可能なようにデータが記録された可搬型の記録媒体である。光ディスク106aには、DVD(Digital Versatile Disc)、DVD−RAM、CD−ROM(Compact Disc Read Only Memory)、CD−R(Recordable)/RW(ReWritable)などがある。   The optical drive device 106 reads data recorded on the optical disc 106a using laser light or the like. The optical disk 106a is a portable recording medium on which data is recorded so that it can be read by reflection of light. The optical disk 106a includes a DVD (Digital Versatile Disc), a DVD-RAM, a CD-ROM (Compact Disc Read Only Memory), a CD-R (Recordable) / RW (ReWritable), and the like.

通信インタフェース107は、ネットワーク107aに接続されている。通信インタフェース107は、ネットワーク107aを介して、他のコンピュータまたは通信機器との間でデータの送受信を行う。   The communication interface 107 is connected to the network 107a. The communication interface 107 transmits / receives data to / from other computers or communication devices via the network 107a.

以上のようなハードウェア構成によって、以下に示すプログラム生成方法が実現される。
図7は、プログラム生成方法の一例を示すフローチャートである。
With the hardware configuration as described above, the following program generation method is realized.
FIG. 7 is a flowchart illustrating an example of a program generation method.

まず、たとえば、CPU101により実現されるコンパイラに、プログラム(ソースコード)d1が入力され、コンパイルが行われると、その結果としてプログラム(アセンブリ)d2が生成される(ステップS10)。   First, for example, when a program (source code) d1 is input to a compiler realized by the CPU 101 and compilation is performed, a program (assembly) d2 is generated as a result (step S10).

その後、CPU101は、プログラムd2と、プログラムd2を組み込む電子装置の各メモリバンクの開始アドレスや容量を含むメモリバンク構成情報d3とをもとに、メモリマップd4を作成する(ステップS11)。メモリマップd4には、プログラムd2のどの関数をどのメモリバンクのアドレスに割り当てるのかが示されている。   Thereafter, the CPU 101 creates a memory map d4 based on the program d2 and the memory bank configuration information d3 including the start address and capacity of each memory bank of the electronic device incorporating the program d2 (step S11). The memory map d4 indicates which function of the program d2 is assigned to which memory bank address.

次に、CPU101は、メモリマップd4をもとに、プログラムd2に前述したような電力制御コードを挿入し、電力制御コード入りプログラム(アセンブリ)d5を生成する(ステップS12)。   Next, the CPU 101 inserts the power control code as described above into the program d2 based on the memory map d4, and generates a program (assembly) d5 containing the power control code (step S12).

続いてCPU101により実現されるアセンブラにより、電力制御コード入りプログラムd5がアセンブルされ、電力制御コード入りプログラム(オブジェクト)d6が生成される(ステップS13)。さらに、CPU101により実現されるリンカにより、メモリマップd4に基づき、標準ライブラリや数値計算ライブラリなど他のライブラリとのリンクが行われ、電力制御コード入りプログラム(バイナリ)d7が生成され(ステップS14)、プログラム生成処理が終了する。   Subsequently, the power control code-containing program d5 is assembled by the assembler realized by the CPU 101, and a power control code-containing program (object) d6 is generated (step S13). Further, the linker realized by the CPU 101 is linked with another library such as a standard library or a numerical calculation library based on the memory map d4 to generate a program (binary) d7 containing a power control code (step S14). The program generation process ends.

以下、ステップS11及びステップS12の処理の詳細を説明する。
(メモリマップ作成処理)
図8は、メモリマップ作成処理の一例を示すフローチャートである。
Hereinafter, details of the processing of step S11 and step S12 will be described.
(Memory map creation process)
FIG. 8 is a flowchart illustrating an example of the memory map creation process.

まず、CPU101は、プログラム(アセンブリ)d2とメモリバンク構成情報d3とをもとに、静的コールグラフd10及び関数サイズ情報d11を作成する(ステップS20)。   First, the CPU 101 creates a static call graph d10 and function size information d11 based on the program (assembly) d2 and the memory bank configuration information d3 (step S20).

図9は、メモリバンク構成情報の一例を示す図である。
メモリバンク構成情報d3には、各メモリバンクの開始アドレスと、容量の情報が含まれている。たとえば、メモリバンク番号0のメモリバンクの開始アドレスは0x0000であり、容量は4.0KBである。
FIG. 9 is a diagram illustrating an example of the memory bank configuration information.
The memory bank configuration information d3 includes information about the start address and capacity of each memory bank. For example, the start address of the memory bank with memory bank number 0 is 0x0000, and the capacity is 4.0 KB.

図10は、静的コールグラフの一例を示す図である。
静的コールグラフd10には、プログラム(アセンブリ)d2における関数の呼び出し関係が示されている。たとえば、メイン関数(関数main)により呼び出される関数として、関数f1a,f1bがあることが示されている。
FIG. 10 is a diagram illustrating an example of a static call graph.
The static call graph d10 shows a function calling relationship in the program (assembly) d2. For example, it is shown that there are functions f1a and f1b as functions called by the main function (function main).

図11は、関数サイズ情報の一例を示す図である。
関数サイズ情報には、各関数のコードサイズが含まれている。たとえば、関数mainのコードサイズは0.1KBであり、関数f1aのコードサイズは1.0KBである。
FIG. 11 is a diagram illustrating an example of function size information.
The function size information includes the code size of each function. For example, the code size of the function main is 0.1 KB, and the code size of the function f1a is 1.0 KB.

以上のような静的コールグラフd10と関数サイズ情報d11が作成されると、これらの情報をもとに、プログラム分割が行われる(ステップS21)。ステップS21の処理では、CPU101は、静的コールグラフd10から再帰部となっている関数とそれ以外の関数とを検出し、分割する。また、CPU101は、各分割部の合計のコードサイズを算出し、各分割部に含まれる関数やコードサイズを含む分割情報d12を生成する。   When the static call graph d10 and the function size information d11 as described above are created, program division is performed based on these information (step S21). In the process of step S21, the CPU 101 detects and divides a function that is a recursion unit and other functions from the static call graph d10. Further, the CPU 101 calculates the total code size of each division unit, and generates division information d12 including the function and code size included in each division unit.

続いて、CPU101は、作成した分割情報d12をもとに、再帰部の分割案d13を作成する(ステップS22)。ステップS22の処理では、再帰部となっている関数群を任意の2関数で分割した際の、両方の関数群の合計コードサイズが算出される。分割する2関数と、分割によって得られる両方の関数群の合計コードサイズが分割案d13の1つとして、たとえば、RAM102に保存される。詳細は後述する。   Subsequently, the CPU 101 creates a recursive division proposal d13 based on the created division information d12 (step S22). In the process of step S22, the total code size of both function groups when the function group serving as the recursive part is divided into two arbitrary functions is calculated. The total code size of the two functions to be divided and both function groups obtained by the division is stored in, for example, the RAM 102 as one of the division plans d13. Details will be described later.

その後、CPU101は、作成した分割情報d12、分割案d13とメモリバンク構成情報d3とをもとに、電力制御対象の電子装置の各メモリバンクに割り当てる関数を決定し、割り当て情報d14を生成する(ステップS23)。   Thereafter, the CPU 101 determines a function to be assigned to each memory bank of the electronic device to be controlled based on the created division information d12, division plan d13, and memory bank configuration information d3, and generates allocation information d14 ( Step S23).

そして、CPU101は、生成した割り当て情報d14とメモリバンク構成情報d3をもとに、各関数の開始アドレスを算出し、算出した開始アドレスをもとにメモリマップd4を作成する(ステップS24)。以上によりメモリマップ作成処理が終了する。   Then, the CPU 101 calculates the start address of each function based on the generated allocation information d14 and memory bank configuration information d3, and creates a memory map d4 based on the calculated start address (step S24). Thus, the memory map creation process ends.

次に、上記のメモリマップ作成処理におけるプログラム分割処理、再帰部の分割案作成処理、関数割り当て処理について、さらに詳細に説明する。
(プログラム分割処理)
図12は、プログラム分割処理の一例を示すフローチャートである。
Next, the program division process, the recursive division division plan creation process, and the function allocation process in the memory map creation process will be described in more detail.
(Program division processing)
FIG. 12 is a flowchart illustrating an example of the program dividing process.

CPU101において、図10に示したような静的コールグラフd10の入力が行われると(ステップS30)、準備処理が行われる(ステップS31)。準備処理では、CPU101は、後述する分割作業用テーブルを作成し、各関数の分割名の初期値を与える。その後、CPU101は、静的コールグラフd10から再帰となっている関数群を検出する(ステップS32)。再帰となっている関数群が検出されると、分割処理が行われる(ステップS33)。分割処理では、CPU101は、再帰となっている関数群とそれ以外の関数群への分割を行い、分割作業用テーブルの分割名を更新する。その後、ステップS32の処理に戻る。   When the CPU 101 inputs the static call graph d10 as shown in FIG. 10 (step S30), preparation processing is performed (step S31). In the preparation process, the CPU 101 creates a division work table, which will be described later, and gives an initial value of the division name of each function. Thereafter, the CPU 101 detects a recursive function group from the static call graph d10 (step S32). When a recursive function group is detected, a dividing process is performed (step S33). In the division process, the CPU 101 divides the function group into a recursive function group and other function groups, and updates the division name of the division work table. Thereafter, the process returns to step S32.

ステップS32の処理で、再帰となっている関数群が検出されない場合、CPU101は、その時点での分割作業用テーブルの情報をもとに、分割情報d12を生成し出力し(ステップS34)、たとえば、RAM102に格納し、プログラム分割処理を終了する。   If no recursive function group is detected in the process of step S32, the CPU 101 generates and outputs division information d12 based on the information in the division work table at that time (step S34). Then, the program is stored in the RAM 102, and the program dividing process is terminated.

以下、図12のステップS31,S32,S33の詳細を説明する。
(準備処理)
図12のステップS31の準備処理では、以下に示すような分割作業用テーブルが作成される。
Details of steps S31, S32, and S33 in FIG. 12 will be described below.
(Preparation process)
In the preparation process in step S31 of FIG. 12, a division work table as shown below is created.

図13は、分割作業用テーブルの一例を示す図である。
分割作業用テーブルには、静的コールグラフd10に含まれる関数と、その関数に対する分割名が含まれる。準備処理の段階では、分割名の初期値として、たとえば、図13のように“MAIN”が与えられる。詳細は後述するが、再帰部やそれ以外の部分として分割された後には、異なった分割名に変更される。
FIG. 13 is a diagram illustrating an example of the division work table.
The division work table includes a function included in the static call graph d10 and a division name for the function. In the stage of the preparation process, for example, “MAIN” is given as an initial value of the division name as shown in FIG. Although details will be described later, after being divided as a recursive part or other parts, it is changed to a different division name.

(再帰検出処理)
図14は、再帰検出処理の一例を示すフローチャートである。
以下に示す例では、静的コールグラフd10から深さ優先探索により、再帰(閉路)となっている関数群を検出する例が示されている。
(Recursion detection processing)
FIG. 14 is a flowchart illustrating an example of the recursion detection process.
In the example shown below, an example is shown in which a function group that is recursive (closed) is detected from the static call graph d10 by depth-first search.

たとえば、RAM102に記憶されている静的コールグラフd10と分割作業用テーブルがCPU101に入力されると(ステップS40)、初期化が行われる(ステップS41)。   For example, when the static call graph d10 and the divided work table stored in the RAM 102 are input to the CPU 101 (step S40), initialization is performed (step S41).

初期化処理では、CPU101は、メイン関数からの探索の経路で関数fを通ったか否かを示す配列変数visited[f]を初期化する。
図15は、初期化後の配列変数visited[f]の例を示している。
In the initialization process, the CPU 101 initializes an array variable visited [f] indicating whether or not the function f has been passed through the search path from the main function.
FIG. 15 shows an example of the array variable visited [f] after initialization.

配列変数visited[f]の初期化では、fが関数mainのときはtrue、それ以外の場合には、falseに設定される。
また、初期化処理において、CPU101は、関数mainから関数fに至る探索の経路を記憶するリスト型の変数PATHを空にし、さらに、再帰部が抽出できたか否かを表す変数flagをfalseに設定する。
In the initialization of the array variable visited [f], it is set to true when f is the function main, and is set to false otherwise.
In the initialization process, the CPU 101 empties the list-type variable PATH that stores the search path from the function main to the function f, and sets the variable flag indicating whether the recursive part has been extracted to false. To do.

続いて、CPU101は、引数の関数fに関数mainを設定して、サブルーチンAを実行し(ステップS42)、サブルーチンAの返却値(変数flag及び再帰部の関数群)を再帰検出結果として、たとえば、RAM102に出力する(ステップS43)。   Subsequently, the CPU 101 sets the function main in the argument function f, executes the subroutine A (step S42), and uses the return value of the subroutine A (the variable flag and the function group of the recursive unit) as the recursion detection result, for example, And output to the RAM 102 (step S43).

図16は、サブルーチンAの処理の一例を示すフローチャートである。
まず、CPU101は、引数として渡された関数fを、変数PATHの末尾の変数に追加する(ステップS50)。続いて、CPU101は、関数fが呼び出す全ての子関数fcについて、各々を引数として渡してサブルーチンBを実行する(ステップS51)。これにより再帰部が検出される。なお、子関数fcが存在しない場合には、ステップS51の処理では、なにも行われない。その後、CPU101は、変数PATHの末尾の変数に追加された関数fを削除し(ステップS52)、図14のフローチャートに戻る。
FIG. 16 is a flowchart illustrating an example of processing of the subroutine A.
First, the CPU 101 adds the function f passed as an argument to the variable at the end of the variable PATH (step S50). Subsequently, the CPU 101 executes the subroutine B by passing each child function fc called by the function f as an argument (step S51). Thereby, the recursive part is detected. If the child function fc does not exist, nothing is performed in the process of step S51. Thereafter, the CPU 101 deletes the function f added to the last variable of the variable PATH (step S52) and returns to the flowchart of FIG.

図17は、サブルーチンBの処理の一例を示すフローチャートである。
なお、図17中で、左辺の変数に対して右辺の値を代入(または設定)することを“:=”で記し、左辺の変数の値と右辺の値との比較を“==”で明示している。以降の図でも同様の意味とする。
FIG. 17 is a flowchart illustrating an example of the processing of the subroutine B.
In FIG. 17, “: =” indicates that the value on the right side is assigned (or set) to the variable on the left side, and the comparison between the value of the variable on the left side and the value on the right side is “==”. It is clearly stated. The same meaning applies to the following figures.

まず、CPU101は、再帰部が抽出できたか否かを表す変数flagの真偽を判定する(ステップS60)。変数flagがfalseの場合には、ステップS61の処理が行われ、変数flagがtrueの場合には、サブルーチンBの処理が終了する。   First, the CPU 101 determines whether or not a variable flag indicating whether or not a recursive part has been extracted (step S60). If the variable flag is false, the process of step S61 is performed. If the variable flag is true, the process of the subroutine B ends.

変数flagがfalseの場合、CPU101は、配列変数visited[fc]の真偽を判定する(ステップS61)。配列変数visited[fc]がfalseの場合、ステップS62の処理が行われ、trueの場合、ステップS65の処理が行われる。   When the variable flag is false, the CPU 101 determines whether the array variable visited [fc] is true or false (step S61). If the array variable visited [fc] is false, the process of step S62 is performed, and if true, the process of step S65 is performed.

配列変数visited[fc]がfalseの場合、CPU101は、配列変数visited[fc]をtrueに設定し(ステップS62)、引数として渡された子関数fcをサブルーチンAの引数の関数fとして設定し、図16に示したサブルーチンAを実行する(ステップS63)。   If the array variable visited [fc] is false, the CPU 101 sets the array variable visited [fc] to true (step S62), sets the child function fc passed as an argument as the function f of the subroutine A argument, The subroutine A shown in FIG. 16 is executed (step S63).

その後、CPU101は、引数として渡された子関数fcの配列変数visited[fc]をfalseに設定し(ステップS64)、図16に示したサブルーチンAに戻る。   Thereafter, the CPU 101 sets the array variable visited [fc] of the child function fc passed as an argument to false (step S64), and returns to the subroutine A shown in FIG.

一方、ステップS61の処理において、配列変数visited[fc]がtrueの場合、CPU101は分割作業用テーブルにおいて、変数PATHの子関数fc以降の関数の分割名が、再帰部を示すもの以外で全て同一か否かを判定する(ステップS65)。   On the other hand, if the array variable visited [fc] is true in the process of step S61, the CPU 101 indicates that the division names of the functions after the child function fc of the variable PATH are all the same except for the recursive part in the division work table. It is determined whether or not (step S65).

変数PATHの子関数fc以降の関数の分割名が、再帰部を示すもの以外で全て同一の場合、CPU101は、変数PATHの子関数fc以降の関数群を再帰部として抽出し(ステップS66)、変数flagをtrueに設定する(ステップS67)。   When the division names of the functions after the child function fc of the variable PATH are all the same except for those indicating the recursive part, the CPU 101 extracts the function group after the child function fc of the variable PATH as a recursive part (step S66). The variable flag is set to true (step S67).

ステップS67の処理の後、または、変数PATHの子関数fc以降の関数の分割名が、再帰部を示すもの以外で違うものがある場合にはステップS66に示すような抽出は行われず、サブルーチンAに戻る。   After the process of step S67, or when there is a difference in the division names of functions after the child function fc of the variable PATH other than those indicating the recursive part, the extraction as shown in step S66 is not performed, and the subroutine A Return to.

たとえば、以下に示すような静的コールグラフに対して、上記の再帰検出処理を適用した場合について説明する。
図18は、複数の再帰部を含む静的コールグラフの例を示す図である。
For example, a case where the above recursion detection process is applied to a static call graph as shown below will be described.
FIG. 18 is a diagram illustrating an example of a static call graph including a plurality of recursive units.

図18に示す静的コールグラフd10は、図10に示したものと同じであるが、関数の呼び出し関係を矢印で示してある。たとえば、関数mainは関数f1aを呼び出し、関数f1aは、関数f2aを呼び出していることが、矢印で示されている。ここで、関数f1a〜f9aの部分が閉路であり、再帰部110となっている。また関数f3b〜f6bの部分も閉路であり、再帰部111となっている。   The static call graph d10 shown in FIG. 18 is the same as that shown in FIG. 10, but the function calling relationship is indicated by arrows. For example, an arrow indicates that the function main calls the function f1a and the function f1a calls the function f2a. Here, the portions of the functions f1a to f9a are closed circuits, which are the recursive unit 110. The parts of the functions f3b to f6b are also closed and are recursive parts 111.

以下では、再帰部110を上記の再帰検出処理で検出する例を説明する。
図14に示されるステップS41の初期化処理が行われた後、関数mainを引数(関数f)として、図16に示されるサブルーチンAが実行される。このときサブルーチンAのステップS50の処理では、変数PATH=(main)となる。関数mainの子関数fcは関数f1a,f1bである。ステップS51の処理では、図10、図18に示した静的コールグラフd10登録順に処理するとした場合、まずは、関数f1aを引数としてサブルーチンBが実行される。
Below, the example which detects the recursion part 110 by said recursion detection process is demonstrated.
After the initialization process of step S41 shown in FIG. 14, the subroutine A shown in FIG. 16 is executed with the function main as an argument (function f). At this time, in the process of step S50 of the subroutine A, the variable PATH = (main). Child functions fc of the function main are functions f1a and f1b. In the processing of step S51, when processing is performed in the order of registration of the static call graph d10 shown in FIGS. 10 and 18, first, subroutine B is executed with function f1a as an argument.

図17に示されるサブルーチンBにおいて、ステップS60では、変数flagがfalseに設定されているので、ステップS61の処理が行われる。また、ステップS61の処理では、図15に示されているように配列変数visited[f1a]がfalseであるのでステップS62の処理が行われ、配列変数visited[f1a]はtrueに設定され、配列変数visited[f]が更新される。   In the subroutine B shown in FIG. 17, in step S60, the variable flag is set to false, so the process of step S61 is performed. In the process of step S61, as shown in FIG. 15, since the array variable visited [f1a] is false, the process of step S62 is performed, the array variable visited [f1a] is set to true, and the array variable is set to true. Visited [f] is updated.

図19は、更新された配列変数visited[f]の例を示す図である。
図15に示した初期状態の配列変数visited[f]では関数f1aに関する配列変数visited[f]の部分はfalseであったが、図19に示されている配列変数visited[f]ではtrueに変更されている。
FIG. 19 is a diagram illustrating an example of the updated array variable visited [f].
In the array variable visited [f] in the initial state shown in FIG. 15, the part of the array variable visited [f] related to the function f1a is false, but in the array variable visited [f] shown in FIG. 19, it is changed to true. Has been.

その後、CPU101は、引数(関数f)として関数f1aをサブルーチンAに渡して、サブルーチンAを実行する。
サブルーチンAのステップS50の処理では、変数PATHの末尾に関数f1aが追加され、変数PATH=(main,f1a)となる。その後、関数f1aの子関数fcは関数f2aであるので、関数f2aを引数としてサブルーチンBが実行される。
Thereafter, the CPU 101 passes the function f1a to the subroutine A as an argument (function f) and executes the subroutine A.
In the process of step S50 of the subroutine A, the function f1a is added to the end of the variable PATH so that the variable PATH = (main, f1a). Thereafter, since the child function fc of the function f1a is the function f2a, the subroutine B is executed with the function f2a as an argument.

サブルーチンBにおいて、ステップS60では、変数flagがfalseであるので、ステップS61の処理が行われる。また、ステップS61の処理では、図19に示されているようにvisited[f2a]がfalseであるのでステップS62の処理が行われ、visited[f2a]がtrueとなり、配列変数visited[f]が更新される。   In subroutine B, in step S60, since the variable flag is false, the process of step S61 is performed. Further, in the process of step S61, as shown in FIG. 19, since the verified [f2a] is false, the process of step S62 is performed, and the verified [f2a] becomes true, and the array variable visited [f] is updated. Is done.

その後、CPU101は、ステップS63の処理において、引数として関数f2aをサブルーチンAに渡して、サブルーチンAを実行する。
以下、同様の処理が繰り返される。関数f9aが引数としてサブルーチンBに渡され、ステップS62の処理により更新されたときの配列変数visited[f]は、以下のようになる。
Thereafter, the CPU 101 passes the function f2a as an argument to the subroutine A in the process of step S63, and executes the subroutine A.
Thereafter, the same processing is repeated. The array variable visited [f] when the function f9a is passed as an argument to the subroutine B and updated by the process of step S62 is as follows.

図20は、関数f9aについてまで更新された、配列変数visited[f]の例を示す図である。
図20に示されているように、関数main,f1a〜f9aについての配列変数visited[f]が、trueとなっている。
FIG. 20 is a diagram illustrating an example of the array variable visited [f] updated up to the function f9a.
As shown in FIG. 20, the array variable visited [f] for the functions main, f1a to f9a is true.

その後、CPU101は、ステップS63の処理において、引数として関数f9aをサブルーチンAに渡して、サブルーチンAを実行する。
サブルーチンAのステップS50の処理では、変数PATHの末尾に関数f9aが追加され、変数PATH=(main,f1a,f2a,f3a,f4a,f5a,f6a,f7a,f8a,f9a)となる。その後、関数f9aの子関数fcは関数f1aであるので、関数f1aを引数としてサブルーチンBが実行される。
Thereafter, the CPU 101 passes the function f9a as an argument to the subroutine A in the process of step S63, and executes the subroutine A.
In the process of step S50 of the subroutine A, the function f9a is added to the end of the variable PATH, and the variable PATH = (main, f1a, f2a, f3a, f4a, f5a, f6a, f7a, f8a, f9a). Thereafter, since the child function fc of the function f9a is the function f1a, the subroutine B is executed with the function f1a as an argument.

サブルーチンBにおいて、ステップS60では、変数flagがfalseであるので、ステップS61の処理が行われる。また、ステップS61の処理では、図20に示されているように配列変数visited[f1a]がtrueであるのでステップS65の処理が行われる。   In subroutine B, in step S60, since the variable flag is false, the process of step S61 is performed. Further, in the process of step S61, the array variable visited [f1a] is true as shown in FIG. 20, so the process of step S65 is performed.

ステップS65の処理において、引数(子関数fc)として渡された関数f1a以降、すなわち、関数f1a〜f9aの分割名は、図13に示した分割作業用テーブルを見ると、全てMAINである。つまり、関数f1a以降の関数群の分割名が初期値のMAINで、再帰部ではないことを示しており、しかも同一であるので、ステップS66の処理が行われる。   In the process of step S65, the division names of the function f1a and subsequent functions passed as arguments (child functions fc), that is, the division names of the functions f1a to f9a are all MAIN in the division work table shown in FIG. That is, the division name of the function group after the function f1a is the initial value MAIN, which indicates that it is not a recursive part, and since it is the same, the process of step S66 is performed.

ステップS66の処理では、再帰部として、変数PATHの子関数fc、つまり関数f1a以降の関数群(関数f1a,f2a,f3a,f4a,f5a,f6a,f7a,f8a,f9a)が再帰部として抽出される。その後、ステップS67の処理で変数flagがtrueに設定され、サブルーチンAの処理に戻り、ステップS52の処理が行われる。   In the process of step S66, a child function fc of the variable PATH, that is, a function group after the function f1a (functions f1a, f2a, f3a, f4a, f5a, f6a, f7a, f8a, f9a) is extracted as a recursive part. The Thereafter, the variable flag is set to true in the process of step S67, the process returns to the process of subroutine A, and the process of step S52 is performed.

ステップS52の処理では、変数PATHの末尾の関数f、すなわち関数f9aが削除され、変数PATH=(main,f1a,f2a,f3a,f4a,f5a,f6a,f7a,f8a)となる。その後、サブルーチンBの処理に復帰し、ステップS64の処理が行われる。ステップS64の処理では、子関数fcの関数f9aについての配列変数visited[f9a]がfalseに設定される。   In step S52, the function f at the end of the variable PATH, ie, the function f9a is deleted, and the variable PATH = (main, f1a, f2a, f3a, f4a, f5a, f6a, f7a, f8a). Thereafter, the process returns to the subroutine B, and the process of step S64 is performed. In the process of step S64, the array variable visited [f9a] for the function f9a of the child function fc is set to false.

図21は、関数f9aにおける配列変数visited[f]が変更された例を示す図である。
図20に示した配列変数visited[f]では関数f9aに関する配列変数visited[f]の部分はtrueであったが、図21に示されている配列変数visited[f]ではfalseに変更されている。
FIG. 21 is a diagram illustrating an example in which the array variable visited [f] in the function f9a is changed.
In the array variable visited [f] shown in FIG. 20, the portion of the array variable validated [f] related to the function f9a is true, but in the array variable visited [f] shown in FIG. 21, it is changed to false. .

その後、同様の処理が行われ、変数PATHが空になり、配列変数visited[f]が全ての関数についてfalseになると、サブルーチンAが終了し、図14に示した処理フローに復帰し、ステップS43の処理が行われる。すなわち、再帰部として検出された関数f1a〜f9aと、変数flag=trueが、再帰検出結果として出力される。   Thereafter, the same processing is performed, and when the variable PATH becomes empty and the array variable validated [f] becomes false for all functions, the subroutine A ends, and the process returns to the processing flow shown in FIG. Is performed. That is, the functions f1a to f9a detected as the recursion unit and the variable flag = true are output as the recursion detection result.

続いて、図12に示したステップS33の分割処理の詳細を説明する。
(分割処理)
以下では、i番目に検出された再帰部の関数群を示す再帰関数リストにしたがって分割処理を行う例について説明する。
Next, details of the division process in step S33 illustrated in FIG. 12 will be described.
(Division processing)
Below, the example which performs a division | segmentation process according to the recursive function list | wrist which shows the function group of the recursive part detected i-th is demonstrated.

図22は、分割処理の一例を示すフローチャートである。
分割処理が開始され、たとえば、RAM102に格納されている再帰部の関数群を示した再帰関数リストと、分割作業用テーブルがCPU101に入力されると(ステップS70)、カウンタ変数jを1に初期化する(ステップS71)。
FIG. 22 is a flowchart illustrating an example of the division process.
When the dividing process is started and, for example, a recursive function list indicating the function group of the recursive unit stored in the RAM 102 and a dividing work table are input to the CPU 101 (step S70), the counter variable j is initialized to 1. (Step S71).

続いて、CPU101は、入力された再帰関数リストのj番目に当たる関数f_i,jの分割名をRiとして設定する(ステップS72)。その後、CPU101は、カウンタ変数jが、i番目の再帰部の関数の数n(i)よりも小さいか否かを判定する(ステップS73)。   Subsequently, the CPU 101 sets the division name of the function f_i, j corresponding to the jth in the input recursive function list as Ri (step S72). Thereafter, the CPU 101 determines whether or not the counter variable j is smaller than the number n (i) of functions of the i-th recursive unit (step S73).

カウンタ変数jが、n(i)よりも小さい場合には、CPU101はカウンタ変数jをインクリメントし(ステップS74)、ステップS72からの処理を繰り返す。カウンタ変数jが、n(i)に達した場合、CPU101はカウンタ変数jを再度、1に初期化する(ステップS75)。   If the counter variable j is smaller than n (i), the CPU 101 increments the counter variable j (step S74) and repeats the processing from step S72. When the counter variable j reaches n (i), the CPU 101 initializes the counter variable j to 1 again (step S75).

前述した再帰部110の検出処理後の分割処理における、ステップS75の処理時点での分割作業用テーブルは、たとえば、以下のようになる。
図23は、分割作業用テーブルの更新例を示す図である。
The division work table at the time of the processing in step S75 in the division processing after the detection processing of the recursive unit 110 is as follows, for example.
FIG. 23 is a diagram illustrating an example of updating the division work table.

図23に示されているように、再帰部110の関数群である、関数f1a〜f9aの分割名が、MAINからR1に変更されている。
その後、CPU101は、再帰関数リストの関数f_i,jの子孫関数のうち、分割作業用テーブルの分割名が、RjでもRk(k<j)でもrk,l(lは自然数)でもないものについて、分割名ri,jを設定する(ステップS76)。これは、関数f_i,jの子孫関数のうち、再帰を構成している子関数(f_i,(j+1))以外のもので、以前に再帰部の関数として分割名が設定された関数及びそれの子孫関数を除いた関数について、分割名ri,jを与えるということを、意味している。
As shown in FIG. 23, the division name of the functions f1a to f9a, which is a function group of the recursive unit 110, is changed from MAIN to R1.
After that, the CPU 101 uses the descendant functions of the function f_i, j in the recursive function list for those whose partition names in the partitioning work table are not Rj, Rk (k <j), or rk, l (l is a natural number). A division name ri, j is set (step S76). This is a function other than the child function (f_i, (j + 1)) constituting the recursion among the descendant functions of the function f_i, j, and the function whose division name has been previously set as the function of the recursive part and its function This means that the division name ri, j is given to the function excluding descendant functions.

たとえば、図18に示した静的コールグラフd10から、再帰部110が検出された後、再帰部110に含まれる関数f2aの子孫関数である関数f3bについては、まだ再帰部111の関数としての分割名が設定されていないため、分割名r1,1が設定される。   For example, after the recursive unit 110 is detected from the static call graph d10 illustrated in FIG. 18, the function f3b that is a descendant function of the function f2a included in the recursive unit 110 is still divided as a function of the recursive unit 111. Since no name is set, split names r1, 1 are set.

その後、再び、CPU101は、カウンタ変数jが、i番目の再帰部の関数の数n(i)よりも小さいか否かを判定する(ステップS77)。
カウンタ変数jが、n(i)よりも小さい場合には、CPU101はカウンタ変数jをインクリメントし(ステップS78)、ステップS76からの処理を繰り返す。カウンタ変数jが、n(i)に達した場合、CPU101は、分割作業用テーブルを出力し(ステップS79)、たとえば、RAM102に格納して、ステップS33の分割処理を終える。
Thereafter, again, the CPU 101 determines whether or not the counter variable j is smaller than the number n (i) of functions of the i-th recursive unit (step S77).
If the counter variable j is smaller than n (i), the CPU 101 increments the counter variable j (step S78) and repeats the processing from step S76. When the counter variable j reaches n (i), the CPU 101 outputs a division work table (step S79), stores it in the RAM 102, for example, and finishes the division process in step S33.

カウンタ変数jが、n(i)に達した時点での、分割作業用テーブルは、たとえば、以下のようになる。
図24は、1つ目の再帰部の検出後に行われる分割処理後の分割作業用テーブルの例を示す図である。
The division work table when the counter variable j reaches n (i) is, for example, as follows.
FIG. 24 is a diagram illustrating an example of a division work table after division processing performed after detection of the first recursive part.

再帰部110に含まれる関数f2aの子孫関数である、関数f3b,f4b,f5b,f5d,f6b,f7bについては、分割名r1,1が設定されている。再帰部110に含まれる関数f4aの子孫関数である、関数f5c,f6c,f7c,f8cについては、分割名r1,2が設定されている。再帰部110に含まれる関数f7aの子孫関数である、関数f7dについては、分割名r1,3が設定されている。   For the functions f3b, f4b, f5b, f5d, f6b, and f7b, which are descendant functions of the function f2a included in the recursive unit 110, split names r1 and 1 are set. The division names r1 and 2 are set for the functions f5c, f6c, f7c, and f8c that are descendant functions of the function f4a included in the recursive unit 110. For the function f7d, which is a descendant function of the function f7a included in the recursive unit 110, split names r1 and 3 are set.

このような分割処理が行われると、再び、図12のステップS32の再帰検出処理が行われる。
以下では、図18に示した静的コールグラフd10の再帰部111を検出する例を説明する。
When such division processing is performed, the recursion detection processing in step S32 in FIG. 12 is performed again.
Below, the example which detects the recursive part 111 of the static call graph d10 shown in FIG. 18 is demonstrated.

再帰部110を検出する際と同様に、図14、図16、図17に示した処理が行われる。前述と同様に処理が進み、変数PATH=(main,f1a,f2a,f3a,f4a,f5a,f6a,f7a,f8a,f9a)となり、引数として渡された関数f1aに関するサブルーチンBが実行される。サブルーチンBのステップS61の判定では、配列変数visited[f1a]がtrueであるので、ステップS65の処理が実行される。   Similar to the detection of the recursion unit 110, the processes shown in FIGS. 14, 16, and 17 are performed. Processing proceeds in the same manner as described above, and variable PATH = (main, f1a, f2a, f3a, f4a, f5a, f6a, f7a, f8a, f9a), and subroutine B related to function f1a passed as an argument is executed. In the determination in step S61 of the subroutine B, since the array variable visited [f1a] is true, the process of step S65 is executed.

ステップS65の処理において、CPU101は、図24に示したような分割作業用テーブルを参照する。ここで、変数PATHの関数f1a以降の分割名は全て、R1となっている。分割名R1は、再帰部110を示すものであるため、サブルーチンBの処理が終了し、サブルーチンAに復帰し、ステップS52の処理が行われる。   In the processing of step S65, the CPU 101 refers to the division work table as shown in FIG. Here, all the division names after the function f1a of the variable PATH are R1. Since the division name R1 indicates the recursive unit 110, the process of the subroutine B ends, the process returns to the subroutine A, and the process of step S52 is performed.

ステップS52の処理では、変数PATHの末尾の関数f、すなわち関数f9aが削除され、変数PATH=(main,f1a,f2a,f3a,f4a,f5a,f6a,f7a,f8a)となる。その後、サブルーチンBの処理に復帰し、ステップS64の処理が行われる。ステップS64の処理では、子関数fcの関数f9aについての配列変数visited[f9a]がfalseに設定される。   In step S52, the function f at the end of the variable PATH, ie, the function f9a is deleted, and the variable PATH = (main, f1a, f2a, f3a, f4a, f5a, f6a, f7a, f8a). Thereafter, the process returns to the subroutine B, and the process of step S64 is performed. In the process of step S64, the array variable visited [f9a] for the function f9a of the child function fc is set to false.

その後、同様に、サブルーチンAのステップS52の処理が行われ、変数PATHの末尾の関数f8aが削除され、変数PATH=(main,f1a,f2a,f3a,f4a,f5a,f6a,f7a)となる。その後、サブルーチンBのステップS64の処理が行われる。ステップS64の処理では、子関数fcの関数f8aについての配列変数visited[f8a]がfalseに設定される。   Thereafter, similarly, the process of step S52 of the subroutine A is performed, the function f8a at the end of the variable PATH is deleted, and the variable PATH = (main, f1a, f2a, f3a, f4a, f5a, f6a, f7a). Thereafter, the process of step S64 of the subroutine B is performed. In the process of step S64, the array variable visited [f8a] for the function f8a of the child function fc is set to false.

続いて、サブルーチンAのステップS51において、関数f7aのもう1つの子関数fcである関数f7dが引数としてサブルーチンBに渡され、サブルーチンBが実行される。   Subsequently, in step S51 of the subroutine A, the function f7d, which is another child function fc of the function f7a, is passed as an argument to the subroutine B, and the subroutine B is executed.

サブルーチンBにおいて、ステップS60では、変数flagがfalseであるので、ステップS61の処理が行われる。また、ステップS61の処理では、関数f7dの探索はこれまで行われていなかったので、配列変数visited[f7d]はfalseである。これにより、ステップS62の処理が行われ、配列変数visited[f7d]はtrueに設定され、配列変数visited[f]が更新される。   In subroutine B, in step S60, since the variable flag is false, the process of step S61 is performed. In the process of step S61, since the search for the function f7d has not been performed so far, the array variable visited [f7d] is false. Thereby, the process of step S62 is performed, the array variable validated [f7d] is set to true, and the array variable validated [f] is updated.

図25は、更新された配列変数visited[f]の例を示す図である。
図25の配列変数visited[f]では、関数f7dに関する配列変数visited[f]の部分がtrueに変更されている。
FIG. 25 is a diagram illustrating an example of the updated array variable visited [f].
In the array variable validated [f] in FIG. 25, the portion of the array variable validated [f] related to the function f7d is changed to true.

その後、ステップS63の処理において、関数f7dを引数として、サブルーチンAが実行される。
サブルーチンAのステップS50の処理では、変数PATHの末尾に関数f7dが追加され、変数PATH=(main,f1a,f2a,f3a,f4a,f5a,f6a,f7a,7d)となる。その後、関数f7dの子関数fcは存在しないので、ステップS51のサブルーチンBは実行されず、ステップS52の処理が実行され、変数PATH=(main,f1a,f2a,f3a,f4a,f5a,f6a,f7a)となる。
Thereafter, in the process of step S63, the subroutine A is executed with the function f7d as an argument.
In the process of step S50 of the subroutine A, the function f7d is added to the end of the variable PATH, and the variable PATH = (main, f1a, f2a, f3a, f4a, f5a, f6a, f7a, 7d). Thereafter, since the child function fc of the function f7d does not exist, the subroutine B of step S51 is not executed, the processing of step S52 is executed, and the variable PATH = (main, f1a, f2a, f3a, f4a, f5a, f6a, f7a). )

続いて、サブルーチンBのステップS64の処理に戻り、関数f7dについての配列変数visited[f7d]がfalseに設定される。
その後、サブルーチンAのステップS52の処理に戻り、変数PATHの末尾の関数f7aが削除され、変数PATH=(main,f1a,f2a,f3a,f4a,f5a,f6a)となる。
Subsequently, returning to the process of step S64 of the subroutine B, the array variable validated [f7d] for the function f7d is set to false.
Thereafter, the process returns to step S52 of the subroutine A, the function f7a at the end of the variable PATH is deleted, and the variable PATH = (main, f1a, f2a, f3a, f4a, f5a, f6a).

以下、同様の処理が進むと、サブルーチンAのステップS51において、関数f2aの、もう1つの子関数である関数f3bを引数としたサブルーチンBが実行される。
サブルーチンBにおいて、ステップS60では、変数flagがfalseであるので、ステップS61の処理が行われる。また、ステップS61の処理では、関数f3bの探索はこれまで行われていなかったので、配列変数visited[f3b]はfalseである。これにより、ステップS62の処理が行われ、配列変数visited[f3b]はtrueに設定され、配列変数visited[f]が更新される。
Thereafter, when the same processing proceeds, in step S51 of the subroutine A, the subroutine B having the function f3b, which is another child function of the function f2a, as an argument is executed.
In subroutine B, in step S60, since the variable flag is false, the process of step S61 is performed. In the process of step S61, since the search for the function f3b has not been performed so far, the array variable visited [f3b] is false. As a result, the process of step S62 is performed, the array variable validated [f3b] is set to true, and the array variable validated [f] is updated.

その後、関数f3bを引数としたサブルーチンAが実行される。ステップS50の処理において、変数PATHの末尾に関数f3bが追加され、変数PATH=(main,f1a,f2a,f3b)となる。   Thereafter, the subroutine A with the function f3b as an argument is executed. In step S50, the function f3b is added to the end of the variable PATH, and the variable PATH = (main, f1a, f2a, f3b).

次に、関数f3bの子関数fcである関数f4b、関数f4bの子関数fcであり、静的コールグラフd10の上位に位置する関数f5b、関数f5bの子関数fcである関数f6bについても同様の処理が行われる。   Next, the same applies to the function f4b that is a child function fc of the function f3b, a function f5b that is a child function fc of the function f5b, and a function f6b that is a child function fc of the function f5b. Processing is performed.

関数f6bの子関数fcである関数f3bを引数としたサブルーチンBの実行時、配列変数visited[f3b]がtrueに設定されているので、サブルーチンBのステップS61の判定処理により、ステップS65の処理が行われることになる。   When the subroutine B is executed with the function f3b, which is the child function fc of the function f6b, as an argument, the array variable visited [f3b] is set to true. Therefore, the determination process of step S61 of the subroutine B causes the process of step S65 to Will be done.

ステップS65の処理の時点において、変数PATHは、変数PATH=(main,f1a,f2a,f3b,f4b,f5b,f6b)となっている。図24に示したような分割作業用テーブルでは、関数f3b以降の関数f4b,f5b,f6bの分割名が、同一の分割名r1,1となっており、再帰部110を示すものでもないため、ステップS66の処理が行われる。   At the time of the process of step S65, the variable PATH is variable PATH = (main, f1a, f2a, f3b, f4b, f5b, f6b). In the division work table as shown in FIG. 24, the division names of the functions f4b, f5b, and f6b after the function f3b are the same division names r1, 1, and do not indicate the recursive unit 110. The process of step S66 is performed.

すなわち、CPU101は、変数PATHの関数f3b以降を再帰部111として抽出する。そして、ステップS67の処理で、変数flagがtrueに設定される。その後は、前述の再帰部110の検出処理と同様に、配列変数visited[f]をfalseに設定する処理と変数PATHの末尾の関数を削除する処理とが繰り返された後、図14のステップS43の処理に戻り、再帰検出結果として、再帰部111となる関数群(関数f3b〜f6b)と変数flag=trueが、出力される。   In other words, the CPU 101 extracts the function f3b and subsequent functions of the variable PATH as the recursive unit 111. In step S67, the variable flag is set to true. After that, similarly to the detection process of the recursive unit 110 described above, after the process of setting the array variable visited [f] to false and the process of deleting the function at the end of the variable PATH are repeated, step S43 in FIG. 14 is performed. Returning to the process, the function group (functions f3b to f6b) and the variable flag = true that become the recursion unit 111 are output as the recursion detection result.

その後、再び、図22に示したような分割処理が行われる。
詳細な説明は省略するが、上記のように検出されたi=2番目に検出された再帰部111の関数群(関数f3b〜f6b)を示す再帰関数リストにしたがって、図22の処理が実行される。
Thereafter, division processing as shown in FIG. 22 is performed again.
Although detailed description is omitted, the process of FIG. 22 is executed according to the recursive function list indicating the function group (functions f3b to f6b) of the recursive unit 111 detected as i = 2nd detected as described above. The

2つの目の再帰部111の各関数については、ステップS72の処理により、分割名としてR2が与えられる。
図26は、ステップS79の処理で出力される分割作業用テーブルの例を示す図である。
For each function of the second recursive unit 111, R2 is given as a division name by the process of step S72.
FIG. 26 is a diagram illustrating an example of the division work table output in the process of step S79.

再帰部111に含まれる関数f3b〜f6bについて、分割名R2が与えられている。また、関数f3bの子孫関数のうち、再帰部111に含まれない関数f5dに分割名r2,1が付与され、関数f7bに分割名r2,2が付与される。   The division name R2 is given to the functions f3b to f6b included in the recursive unit 111. Of the descendant functions of the function f3b, the division name r2,1 is given to the function f5d not included in the recursive unit 111, and the division name r2,2 is given to the function f7b.

(分割情報出力処理)
図12に示したステップS34の処理では、CPU101は、たとえば、図11に示した関数サイズ情報と、図26のように更新された分割作業用テーブルをもとに、分割情報を生成して出力する。
(Division information output processing)
In the process of step S34 shown in FIG. 12, for example, the CPU 101 generates and outputs division information based on the function size information shown in FIG. 11 and the division work table updated as shown in FIG. To do.

図27は、分割情報の例を示す図である。
分割情報には、各分割名の関数のリストと、各分割名の関数の合計コードサイズと、後述する分割案と、採用分割案が含まれる。分割情報の初期値において、分割案と採用分割案はNULLとなっている。
FIG. 27 is a diagram illustrating an example of division information.
The division information includes a list of functions of each division name, a total code size of the functions of each division name, a division plan to be described later, and an adoption division plan. In the initial value of the division information, the division plan and the adoption division plan are NULL.

続いて、図8のステップS22の再帰部の分割案作成処理の詳細を説明する。
(再帰部の分割案作成処理)
図28は、再帰部の分割案作成処理の一例を示すフローチャートである。
Next, details of the division plan creation process of the recursive unit in step S22 of FIG. 8 will be described.
(Recursion part division plan creation process)
FIG. 28 is a flowchart illustrating an example of the division plan creation process of the recursive unit.

CPU101は、たとえば、図27に示したような、分割情報を入力する(ステップS80)。そして、CPU101は、再帰部の番号をカウンタ変数iとして、まず、カウンタ変数iの初期値に1を設定する(ステップS81)。また、CPU101は、再帰部の中で分割する関数の番号をカウンタ変数jとして、カウンタ変数jの初期値に1を設定する(ステップS82)。また、CPU101は、カウンタ変数kの初期値にカウンタ変数jの値を設定する(ステップS83)。   For example, the CPU 101 inputs division information as shown in FIG. 27 (step S80). Then, the CPU 101 sets 1 as the initial value of the counter variable i with the number of the recursive part as the counter variable i (step S81). Further, the CPU 101 sets 1 as the initial value of the counter variable j with the number of the function to be divided in the recursive unit as the counter variable j (step S82). Further, the CPU 101 sets the value of the counter variable j as the initial value of the counter variable k (step S83).

次に、CPU101は、分割名Riの再帰部に含まれる関数fjの手前と関数fkの手前で分割した時の、各関数群の合計コードサイズσ,τを含む分割案(j,k)=(σ,τ),分割案(k,j)=(τ,σ)を算出する(ステップS84)。   Next, the CPU 101 divides proposals (j, k) including the total code sizes σ and τ of each function group when divided before the function fj and before the function fk included in the recursive part of the division name Ri. (Σ, τ), division plan (k, j) = (τ, σ) is calculated (step S84).

たとえば、図18に示した再帰部110において、関数f1aの手前と関数f2aの手前で分割するとは、再帰部110を、関数f1aと、関数f2a〜関数f9aの2つの分割部に分割するということである。   For example, in the recursive unit 110 shown in FIG. 18, to divide before the function f1a and before the function f2a means to divide the recursive unit 110 into a function f1a and two division units of function f2a to function f9a. It is.

ここでは、図18に示した再帰部110において、関数f1a〜f9aを、j=1〜9の関数f1〜f9とする。たとえば、j=1、k=2の場合、関数f1の手前と、関数f2の手前で分割したときの分割案(1,2),(2,1)が求められ、σは関数f1のコードサイズ、τは関数f2〜f9の合計コードサイズとなる。   Here, in the recursive unit 110 shown in FIG. For example, when j = 1 and k = 2, division plans (1, 2) and (2, 1) are obtained when division is performed before the function f1 and before the function f2, and σ is a code of the function f1. The size τ is the total code size of the functions f2 to f9.

コードサイズσ,τは以下の式で表される。   The code sizes σ and τ are expressed by the following equations.

Figure 2012256263
Figure 2012256263

Figure 2012256263
Figure 2012256263

式(1)において、s(fi,t)は、i番目の再帰部のt番目の関数fi,tのコードサイズを示している。また、式(2)において、s(fi,u)は、i番目の再帰部のu番目の関数fi,uのコードサイズを示している。n(i)は、i番目の再帰部に含まれる関数の数を示している。 In equation (1), s (f i, t ) indicates the code size of the t-th function f i, t of the i-th recursive part. In the equation (2), s (f i, u ) indicates the code size of the u th function f i, u of the i th recursive part. n (i) indicates the number of functions included in the i-th recursive part.

次に、CPU101は、カウンタ変数kが、n(i)よりも小さいか否かを判定する(ステップS85)。
カウンタ変数kが、n(i)よりも小さい場合には、CPU101はカウンタ変数kをインクリメントし(ステップS86)、ステップS84からの処理を繰り返す。カウンタ変数kが、n(i)に達した場合、CPU101は、カウンタ変数jが、n(i)よりも小さいか否かを判定する(ステップS87)。
Next, the CPU 101 determines whether or not the counter variable k is smaller than n (i) (step S85).
When the counter variable k is smaller than n (i), the CPU 101 increments the counter variable k (step S86) and repeats the processing from step S84. When the counter variable k reaches n (i), the CPU 101 determines whether or not the counter variable j is smaller than n (i) (step S87).

カウンタ変数jが、n(i)よりも小さい場合には、CPU101はカウンタ変数jをインクリメントし(ステップS88)、ステップS83からの処理を繰り返す。カウンタ変数jが、n(i)に達した場合、CPU101は、カウンタ変数iが、再帰部の数を示すNよりも小さいか否かを判定する(ステップS89)。   If the counter variable j is smaller than n (i), the CPU 101 increments the counter variable j (step S88) and repeats the processing from step S83. When the counter variable j reaches n (i), the CPU 101 determines whether or not the counter variable i is smaller than N indicating the number of recursive parts (step S89).

カウンタ変数iが、Nよりも小さい場合には、CPU101はカウンタ変数iをインクリメントし(ステップS90)、ステップS82からの処理を繰り返す。カウンタ変数iが、Nに達している場合、CPU101は、上記の分割案入りの分割情報を出力し、たとえばRAM102などに格納する(ステップS91)。   If the counter variable i is smaller than N, the CPU 101 increments the counter variable i (step S90) and repeats the processing from step S82. When the counter variable i has reached N, the CPU 101 outputs the division information including the above division plan and stores it in, for example, the RAM 102 (step S91).

図29は、分割案入りの分割情報の例を示す図である。
図29に示される分割情報には、分割名R1の再帰部110の分割案としてテーブルtbl1が追加されている。また、分割名R2の再帰部111の分割案としてテーブルtbl2が追加されている。
FIG. 29 is a diagram illustrating an example of division information including a division plan.
In the division information shown in FIG. 29, a table tbl1 is added as a division plan of the recursive unit 110 with the division name R1. Further, a table tbl2 is added as a division plan of the recursion unit 111 of the division name R2.

図30は、テーブルtbl1の例を示す図である。
図30には、再帰部110の関数f1a〜f9aにおいて、分割する位置に応じた関数群のコードサイズ(前述のσとτ)が示されている。なお、図30では、関数f1a〜f9aのコードサイズは、それぞれ1KBとしている。
FIG. 30 is a diagram illustrating an example of the table tbl1.
FIG. 30 shows the code size (σ and τ described above) of the function group corresponding to the division position in the functions f1a to f9a of the recursive unit 110. In FIG. 30, the code sizes of the functions f1a to f9a are each 1 KB.

たとえば、関数f1aの手前と、関数f2aの手前で分割したとき(分割案(f1a,f2a))、σは関数f1aのコードサイズとなり1KB、τは関数f2a〜f9aの合計コードサイズとなり8KBとなる。そのため、図30に示されているように、(1,8)が得られる。なお、分割案(f1a,f1a),(f2a,f2a)などは、分割しないことを示している。   For example, when division is performed before the function f1a and before the function f2a (division plan (f1a, f2a)), σ is the code size of the function f1a, and τ is the total code size of the functions f2a to f9a, which is 8 KB. . Therefore, (1, 8) is obtained as shown in FIG. Note that the division proposals (f1a, f1a), (f2a, f2a), and the like indicate that they are not divided.

図31は、テーブルtbl2の例を示す図である。
図31には、再帰部111の関数f3b〜f6bにおいて、分割する位置に応じた関数群のコードサイズ(前述のσとτ)が示されている。なお、図31では、関数f3aのコードサイズは、0.5KB、関数f4bのコードサイズは、1.0KB、関数f5bのコードサイズは、1.5KB、関数f6bのコードサイズは、2.0KBとしている。
FIG. 31 is a diagram illustrating an example of the table tbl2.
FIG. 31 shows the code size (σ and τ described above) of the function group corresponding to the division position in the functions f3b to f6b of the recursive unit 111. In FIG. 31, the code size of the function f3a is 0.5 KB, the code size of the function f4b is 1.0 KB, the code size of the function f5b is 1.5 KB, and the code size of the function f6b is 2.0 KB. Yes.

たとえば、関数f6bの手前と関数f3bの手前で分割したとき(分割案(f6b,f3b))、τは関数f6bのコードサイズとなり2.0KB、σは関数f3b〜f5bの合計コードサイズとなり3.0KBとなる。そのため、図31に示されているように、(2.0,3.0)が得られる。   For example, when division is performed before the function f6b and before the function f3b (division plan (f6b, f3b)), τ is the code size of the function f6b and 2.0 KB, and σ is the total code size of the functions f3b to f5b. 0KB. Therefore, as shown in FIG. 31, (2.0, 3.0) is obtained.

以上のようなテーブルtbl1,tbl2が、図8に示した分割案d13として、分割情報d12とともに、ステップS23の処理で用いられる。
続いて、図8のステップS23の関数割り当て処理の詳細を説明する。
The tables tbl1 and tbl2 as described above are used in the process of step S23 together with the division information d12 as the division plan d13 shown in FIG.
Next, details of the function assignment process in step S23 of FIG. 8 will be described.

(関数割り当て処理)
図32は、関数割り当て処理の一例を示すフローチャートである。
CPU101は、たとえば、RAM102に保持されている、分割情報d12、分割案d13、メモリバンク構成情報d3、関数サイズ情報d11などの情報を入力する(ステップS100)。
(Function assignment processing)
FIG. 32 is a flowchart illustrating an example of a function assignment process.
For example, the CPU 101 inputs information such as the division information d12, the division plan d13, the memory bank configuration information d3, and the function size information d11 that are held in the RAM 102 (step S100).

その後、CPU101は各種変数の初期化を行う(ステップS101)。
図33は、初期化後の変数m_rest[M]の一例を示す図である。
変数m_rest[M]は、各メモリバンクの残り容量を示している。Mはメモリバンクの番号を示している。CPU101は、図9に示したようなメモリバンク構成情報d3をもとに、変数m_rest[M]に、各メモリバンクの容量を設定する。
Thereafter, the CPU 101 initializes various variables (step S101).
FIG. 33 is a diagram illustrating an example of the variable m_rest [M] after initialization.
A variable m_rest [M] indicates the remaining capacity of each memory bank. M indicates the number of the memory bank. The CPU 101 sets the capacity of each memory bank in the variable m_rest [M] based on the memory bank configuration information d3 as shown in FIG.

図34は、初期化後の分割情報の一例を示す図である。
CPU101は、分割情報に、その分割名の関数の割り当てが済んでいるか否かを示す情報を追加し、初期化時には、その情報を“未”としておく。
FIG. 34 is a diagram illustrating an example of the division information after initialization.
The CPU 101 adds information indicating whether or not the function of the division name has been assigned to the division information, and sets the information as “not yet” at the time of initialization.

また、ステップS101の処理では、以下のような割り当て情報が生成される。
図35は、初期化時の割り当て情報の一例を示す図である。
割り当て情報には、分割名とその分割名で示される関数と、その分割名の関数が割り当てられるメモリバンクの番号が含まれる。初期化時には、メモリバンクへの割り当ては行われていないので、メモリバンク番号の欄はブランクとなっている。
Further, in the process of step S101, the following allocation information is generated.
FIG. 35 is a diagram illustrating an example of allocation information at the time of initialization.
The allocation information includes a partition name, a function indicated by the partition name, and a memory bank number to which the function of the partition name is allocated. At the time of initialization, since the assignment to the memory bank is not performed, the column of the memory bank number is blank.

初期化が終わると、CPU101は、分割名がMAINの関数について、メモリバンクへの割り当てを行う(ステップS102)。CPU101は、関数mainを含む分割名MAINの関数群については、たとえば、電力制御状態を常時通常状態とするメモリバンクに割り当てる。常時通常状態とするメモリバンクを、M=0のメモリバンクとすると、図35に示した割り当て情報の分割名がMAINの欄のメモリバンク番号が、0に設定される。また、CPU101は、図34に示した分割情報において、割り当てが済んでいるか否かを示す情報を、“未”から“済”に更新する。また、CPU101は、図33に示したM=0のメモリバンクの変数m_restから、分割名がMAINの関数の合計コードサイズを差し引く。なお、電力制御状態を常時通常状態とするメモリバンクに、他の分割名の関数を配置させない場合には、M=0のメモリバンクの変数m_rest[0]を0.0KBとしてもよい。   When the initialization is completed, the CPU 101 assigns the function whose division name is MAIN to the memory bank (step S102). For example, the function group of the division name MAIN including the function main is assigned to the memory bank in which the power control state is always the normal state. If a memory bank that is always in the normal state is a memory bank with M = 0, the memory bank number in the column of the division name of the allocation information shown in FIG. Further, the CPU 101 updates the information indicating whether or not the allocation is completed in the division information shown in FIG. 34 from “not yet” to “completed”. Further, the CPU 101 subtracts the total code size of the function whose division name is MAIN from the variable m_rest of the memory bank of M = 0 shown in FIG. If no other division name function is placed in the memory bank in which the power control state is always the normal state, the variable m_rest [0] of the memory bank with M = 0 may be set to 0.0 KB.

続いて、CPU101は、残り容量が最大のメモリバンクM_Maxと、合計コードサイズが最大の分割部F_Maxを選択する(ステップS103)。M_Maxには、変数m_rest[M]が最大のメモリバンクが選択される。F_Maxには、合計コードサイズが最大の分割名の関数群が選択される。   Subsequently, the CPU 101 selects the memory bank M_Max having the largest remaining capacity and the dividing unit F_Max having the largest total code size (step S103). For M_Max, the memory bank with the largest variable m_rest [M] is selected. For F_Max, a function group having a division name having the maximum total code size is selected.

そして、CPU101は、選択されたF_Maxが再帰部であるか否かを判定する(ステップS104)。F_Maxが再帰部である場合には、ステップS105の処理が行われ、再帰部でない場合には、ステップS109の処理が行われる。   Then, the CPU 101 determines whether or not the selected F_Max is a recursion unit (step S104). If F_Max is a recursive part, the process of step S105 is performed. If F_Max is not a recursive part, the process of step S109 is performed.

たとえば、図34に示した分割情報では、分割名がR1の関数群の合計コードサイズが最大となり、分割案として、tbl1が設定されているので、再帰部として判定され、ステップS105の処理が行われる。分割案がNULLの場合には、再帰部ではないと判定される。なお、CPU101は、分割名からF_Maxが再帰部であるか否かを判定するようにしてもよい。たとえば、分割名R1,R2は、再帰部を示しているので、このような分割名をもつF_Maxの場合には、再帰部であると判定されるようにしてもよい。   For example, in the division information shown in FIG. 34, since the total code size of the function group with the division name R1 is the maximum and tbl1 is set as the division plan, it is determined as a recursive unit, and the process of step S105 is performed. Is called. When the division plan is NULL, it is determined that it is not a recursive part. Note that the CPU 101 may determine whether or not F_Max is a recursive part from the division name. For example, the split names R1 and R2 indicate the recursive part. Therefore, in the case of F_Max having such a split name, it may be determined that it is the recursive part.

F_Maxが再帰部である場合、CPU101は、図34に示したような分割情報を参照して、採用する分割案が設定済であるか否かを判定する(ステップS105)。設定済でない場合には、ステップS106の処理が行われ、設定済の場合にはステップS108の処理が行われる。   When F_Max is a recursive unit, the CPU 101 refers to the division information as illustrated in FIG. 34 and determines whether or not the division plan to be adopted has been set (step S105). If it has not been set, the process of step S106 is performed, and if it has been set, the process of step S108 is performed.

たとえば、分割情報において、図34のように、採用分割案がNULLのままである場合には、ステップS106の処理が行われる。
採用する分割案が設定済でない場合、CPU101は、採用分割案を選択して、M_Maxに割り当てる関数群Fを設定する(ステップS106)。
For example, in the division information, when the adopted division plan remains NULL as shown in FIG. 34, the process of step S106 is performed.
If the division plan to be adopted has not been set, the CPU 101 selects the adoption division plan and sets the function group F to be assigned to M_Max (step S106).

ステップS106の処理では、CPU101は、図30、図31のような分割案を示すテーブルtbl1,tbl2を参照する。たとえば、F_Maxとして選択された分割名R1の分割部では、分割案としてテーブルtbl1が設定されている。CPU101は、分割したときの2つの関数群のそれぞれのコードサイズのうち、第2要素が変数m_restを超えない範囲で最大となる分割案を選択する。   In the process of step S106, the CPU 101 refers to the tables tbl1 and tbl2 indicating the division plan as shown in FIGS. For example, the table tbl1 is set as the division plan in the division unit of the division name R1 selected as F_Max. The CPU 101 selects the division plan that maximizes the second element in a range not exceeding the variable m_rest among the code sizes of the two function groups when the division is performed.

最大のm_rest[M]が8KBの場合、図30に示される分割案のうち、たとえば、関数f1a,f2aのそれぞれ手前で分割することで得られる(f1a,f2a)=(1,8)が選択される。この分割案の第2要素のコードサイズ(8KB)となる関数群(f2a〜f9a)が、関数群Fとして設定される。   When the maximum m_rest [M] is 8 KB, for example, (f1a, f2a) = (1, 8) obtained by dividing before each of the functions f1a and f2a is selected from the division plans shown in FIG. Is done. A function group (f2a to f9a) having the code size (8 KB) of the second element of the division plan is set as the function group F.

その後、CPU101は、採用分割案を分割情報に設定する(ステップS107)。上記の例の場合、CPU101は、分割名R1の分割部の採用分割案の部分を、NULLから、(f1a,f2a)に変更する。その後、ステップS110の処理が行われる。   Thereafter, the CPU 101 sets the adoption division plan as division information (step S107). In the case of the above example, the CPU 101 changes the adoption division proposal part of the division unit of the division name R1 from NULL to (f1a, f2a). Thereafter, the process of step S110 is performed.

ステップS105の処理で、採用分割案が設定済みと判定した場合、CPU101は、採用分割案の2つの要素のうち未割り当て側を関数群Fとして設定する(ステップS108)。たとえば、分割案(f1a,f2a)が採用されている場合で、関数群(f2a〜f9a)のメモリバンクへの割り当てが済んでいる場合、残っている関数f1aが、関数群Fとして設定される。その後、ステップS110の処理が行われる。   If it is determined in step S105 that the adoption division plan has been set, the CPU 101 sets the unassigned side of the two elements of the adoption division plan as the function group F (step S108). For example, when the division plan (f1a, f2a) is adopted and the function group (f2a to f9a) has been assigned to the memory bank, the remaining function f1a is set as the function group F. . Thereafter, the process of step S110 is performed.

一方、ステップS104の処理で、F_Maxが再帰部ではないと判定された場合、関数群Fとして、F_Maxが設定される。
次に、CPU101は、関数群Fのコードサイズs(F)が、M_Maxの残り容量(m_rest[M_Max])以下であるか判定する(ステップS110)。s(F)がm_rest[M_Max]以下であれば割り当てが可能なので、CPU101は、関数群Fを、M_Maxに割り当てる(ステップS111)。また、CPU101は、s(F)を、m_rest[M_Max]から減じる。
On the other hand, if it is determined in step S104 that F_Max is not a recursive part, F_Max is set as the function group F.
Next, the CPU 101 determines whether or not the code size s (F) of the function group F is equal to or less than the remaining capacity (m_rest [M_Max]) of M_Max (step S110). Since assignment is possible if s (F) is equal to or less than m_rest [M_Max], the CPU 101 assigns the function group F to M_Max (step S111). In addition, the CPU 101 subtracts s (F) from m_rest [M_Max].

たとえば、分割名R1の分割部のうち、関数f2a〜f9aをM=1のメモリバンクに割り当てたとき、割り当て情報は以下のようになる。
図36は、割り当て情報の更新例を示す図である。
For example, when the functions f2a to f9a are allocated to the memory bank with M = 1 among the division units of the division name R1, the allocation information is as follows.
FIG. 36 is a diagram illustrating an example of updating allocation information.

分割名R1の分割部(再帰部)が、さらに2つに分割されているので、図36に示されているように、一方の分割名をR1_1、他方をR1_2としている。本実施の形態の例では、これらのうち、コードサイズの大きいものが最初にメモリバンクに割り当てられる。図36の例では、分割名R1_1の関数f2a〜f9aが、メモリバンク番号が1のメモリバンクに割り当てられ、残りの分割名R1_2の関数f1aは、未割り当て状態となっている。   Since the division part (recursion part) of the division name R1 is further divided into two, as shown in FIG. 36, one division name is R1_1 and the other is R1_2. In the example of the present embodiment, among these, the one with the larger code size is first assigned to the memory bank. In the example of FIG. 36, the functions f2a to f9a of the division name R1_1 are assigned to the memory bank with the memory bank number 1, and the remaining functions f1a of the division name R1_2 are in an unassigned state.

図37は、分割情報の更新例を示す図である。
分割名R1の分割部について、採用分割案として(f1a,f2a)が設定されている。割り当て情報の分割名R1_1の関数群についてはメモリバンクへの割り当てが済んでいる場合でも、分割名R1_2の関数群についての割り当てが済んでいない場合には、分割情報で管理されている割り当て済みか否かを示す情報は、“未”のままである。
FIG. 37 is a diagram illustrating an example of updating the division information.
For the division part of the division name R1, (f1a, f2a) is set as the adoption division plan. Whether the function group with the division name R1_1 of the allocation information has been assigned to the memory bank, but if the function group with the division name R1_2 has not been assigned yet, is the allocation managed by the division information completed? The information indicating whether or not remains “not yet”.

関数群FのM_Maxへの割り当て後、CPU101は、割り当て情報に含まれる全ての分割名の関数群の割り当てが済んでいるか判定する(ステップS112)。
全て割り当て済みの場合には、CPU101は、更新した割り当て情報を出力し(ステップS113)、たとえば、RAM102などに格納し、関数割り当て処理が終了する。割り当てていないものがある場合には、ステップS103からの処理が繰り返される。
After assigning the function group F to M_Max, the CPU 101 determines whether the function groups of all the division names included in the assignment information have been assigned (step S112).
If all assignments have been made, the CPU 101 outputs the updated assignment information (step S113) and stores it in the RAM 102, for example, and the function assignment process ends. If there is something that has not been assigned, the processing from step S103 is repeated.

たとえば、分割名R1の分割部のメモリバンクへの割り当ての際、分割名R1_2の関数群の割り当てが済んでいない場合、分割情報で管理されている分割名R1の分割部の割り当て済みか否かを示す情報は、図37に示したように、“未”のままである。そのため、ステップS103の処理では、再び分割名R1の分割部がF_Maxとして選択される。   For example, when the division name R1 is assigned to the memory bank and the function group of the division name R1_2 has not been assigned, whether or not the division part of the division name R1 managed by the division information has already been assigned. As shown in FIG. 37, the information indicating “No” remains “not yet”. Therefore, in the process of step S103, the division part with the division name R1 is selected again as F_Max.

その後、ステップS105の判定処理から、ステップS108の処理に進み、未割り当ての分割名R1_2の関数群が関数群Fとして設定され、ステップS111にてM_Maxに割り当てられることになる。   Thereafter, the process proceeds from the determination process of step S105 to the process of step S108, where a function group with an unassigned division name R1_2 is set as a function group F and is assigned to M_Max in step S111.

一方、ステップS110の処理において、s(F)が、m_rest[M_Max]を超える場合には、その関数群Fはどのメモリバンクにも割り当てられないので、エラーが出力される(ステップS114)。CPU101は、たとえば、グラフィック処理装置104を制御して、モニタ104aの画面上にエラーを表示させ、関数割り当て処理を終了する。   On the other hand, if s (F) exceeds m_rest [M_Max] in the process of step S110, the function group F is not assigned to any memory bank, and an error is output (step S114). For example, the CPU 101 controls the graphic processing device 104 to display an error on the screen of the monitor 104a, and ends the function assignment processing.

図38は、出力される割り当て情報の例を示す図である。
図38の例では、各分割名の関数が、メモリバンク番号が0〜4のメモリバンクに割り当てられている。
FIG. 38 is a diagram illustrating an example of allocation information to be output.
In the example of FIG. 38, the function of each division name is assigned to the memory banks with memory bank numbers 0 to 4.

以上のような関数割り当て処理が終了すると、図38に示したような割り当て情報を用いて、図8のステップS24のアドレス計算が行われる。
以下、アドレス計算処理の詳細を説明する。
When the function assignment process as described above is completed, the address calculation in step S24 in FIG. 8 is performed using the assignment information as shown in FIG.
Details of the address calculation process will be described below.

(アドレス計算処理)
図39は、アドレス計算処理の一例を示すフローチャートである。
CPU101は、たとえば、RAM102に保持されている、割り当て情報d14、メモリバンク構成情報d3、関数サイズ情報d11などの情報を入力する(ステップS120)。
(Address calculation processing)
FIG. 39 is a flowchart illustrating an example of the address calculation process.
For example, the CPU 101 inputs information such as allocation information d14, memory bank configuration information d3, and function size information d11 held in the RAM 102 (step S120).

その後、CPU101は変数の初期化を行う(ステップS121)。ここでは、CPU101は、メモリバンク構成情報d3をもとに、関数の開始アドレスを示す変数start_addr[M]を、メモリバンク番号がMのメモリバンクの開始アドレスに設定する。   Thereafter, the CPU 101 initializes variables (step S121). Here, the CPU 101 sets the variable start_addr [M] indicating the start address of the function as the start address of the memory bank whose memory bank number is M, based on the memory bank configuration information d3.

続いてCPU101は、割り当て情報d14から、同じ分割名のついた関数群を抽出する(ステップS122)。たとえば、図38に示したような割り当て情報から、まず、メモリバンク番号が0のメモリバンクに割り当てられる分割名MAINの関数main,f1b,f2b,f2cが抽出される。   Subsequently, the CPU 101 extracts a function group having the same division name from the allocation information d14 (step S122). For example, from the allocation information as shown in FIG. 38, first, the functions main, f1b, f2b, and f2c of the division name MAIN allocated to the memory bank with the memory bank number 0 are extracted.

そして、CPU101は、カウンタ変数iに1を設定し(ステップS123)、抽出した関数群のうち、i番目の関数fiの開始アドレスとして、変数start_addr[M]を割り当てる(ステップS124)。   Then, the CPU 101 sets 1 to the counter variable i (step S123), and assigns the variable start_addr [M] as the start address of the i-th function fi in the extracted function group (step S124).

その後、CPU101は、割り当てた関数fiのコードサイズをもとに、変数start_addr[M]を更新した後(ステップS125)、カウンタ変数iが抽出した関数の数nよりも小さいか否かを判定する(ステップS126)。i<nの場合には、CPU101は、カウンタ変数iをインクリメントし(ステップS127)、ステップS124からの処理を繰り返す。カウンタ変数iがnに達した場合、CPU101は、割り当て情報d14の全ての分割名の関数群について割り当てが完了したか判定する(ステップS128)。   Thereafter, the CPU 101 updates the variable start_addr [M] based on the code size of the assigned function fi (step S125), and then determines whether or not the counter variable i is smaller than the number n of the extracted functions. (Step S126). If i <n, the CPU 101 increments the counter variable i (step S127) and repeats the processing from step S124. When the counter variable i has reached n, the CPU 101 determines whether the assignment has been completed for all the division name function groups in the assignment information d14 (step S128).

全ての割り当てが完了した場合には、CPU101は、メモリマップを出力し(ステップS128)、たとえば、RAM102に格納し、アドレス計算処理を終える。全ての割り当てが完了していない場合には、CPU101は、ステップS122からの処理を繰り返す。   When all the assignments are completed, the CPU 101 outputs a memory map (step S128), stores it in the RAM 102, for example, and finishes the address calculation process. If all assignments have not been completed, the CPU 101 repeats the processing from step S122.

図40は、出力されるメモリマップの一例を示す図である。
メモリマップには、各メモリバンクに割り当てられた、各関数の開始アドレスが設定されている。
FIG. 40 is a diagram showing an example of an output memory map.
In the memory map, the start address of each function assigned to each memory bank is set.

以上のようなアドレス計算処理が終了し、メモリマップが作成されると、図7に示したように、ステップS12の電力制御コード挿入処理が行われる。以下、電力制御コード挿入処理の詳細を説明する。   When the address calculation process as described above is completed and a memory map is created, the power control code insertion process in step S12 is performed as shown in FIG. Details of the power control code insertion process will be described below.

(電力制御コード挿入処理)
図41は、電力制御コード挿入処理の一例を示すフローチャートである。
CPU101は、たとえば、RAM102に保持されている、プログラム(アセンブリ)d2、メモリマップd4などの情報を入力する(ステップS130)。次に、CPU101は、プログラムd2の先頭から命令を取り出していき(ステップS131)、その命令が関数呼び出し命令であるか否か判定する(ステップS132)。
(Power control code insertion process)
FIG. 41 is a flowchart illustrating an example of the power control code insertion process.
For example, the CPU 101 inputs information such as a program (assembly) d2 and a memory map d4 held in the RAM 102 (step S130). Next, the CPU 101 extracts an instruction from the head of the program d2 (step S131), and determines whether or not the instruction is a function call instruction (step S132).

命令が、関数呼び出し命令である場合には、ステップS133の処理が行われ、関数呼び出し命令ではない場合、ステップS135の処理が行われる。
命令が、関数呼び出し命令の場合、CPU101は、メモリマップd4を参照して、呼び出し元関数と呼び出し先関数のメモリバンクが同一か否かを判定する(ステップS133)。
If the instruction is a function call instruction, the process of step S133 is performed. If the instruction is not a function call instruction, the process of step S135 is performed.
If the instruction is a function call instruction, the CPU 101 refers to the memory map d4 to determine whether the memory bank of the caller function and the callee function are the same (step S133).

呼び出し元関数と呼び出し先関数のメモリバンクが同一でない場合には、ステップS134の処理が行われ、同一の場合には、ステップS135の処理が行われる。
呼び出し元関数と呼び出し先関数のメモリバンクが同一でない場合、CPU101は、電力制御コードを生成して、関数呼び出し命令の直前と直後に挿入する(ステップS134)。
If the memory banks of the caller function and the callee function are not the same, the process of step S134 is performed, and if they are the same, the process of step S135 is performed.
When the memory banks of the caller function and the callee function are not the same, the CPU 101 generates a power control code and inserts it immediately before and after the function call instruction (step S134).

関数呼び出し命令の直前に挿入される電力制御コードは、呼び出し元関数が配置されているメモリバンクの電力制御状態を省電力状態とし、呼び出し先関数が配置されているメモリバンクの電力制御状態を通常状態とするものである。   The power control code inserted immediately before the function call instruction sets the power control state of the memory bank in which the caller function is placed to the power saving state, and normally sets the power control state of the memory bank in which the callee function is placed. It is a state.

また、関数呼び出し命令の直後に挿入される電力制御コードは、呼び出し元関数が配置されているメモリバンクと、関数mainが配置されているメモリバンク以外のメモリバンクの電力制御状態を省電力状態とするものである。   In addition, the power control code inserted immediately after the function call instruction includes the power control state of the memory bank other than the memory bank in which the caller function is disposed and the memory bank in which the function main is disposed. To do.

その後、CPU101は、取り出した命令が、関数の末尾のものか否かを判定する(ステップS135)。CPU101が取り出した命令が、関数の末尾であれば、ステップS136の処理が行われ、関数の末尾でなければ、ステップS138の処理が行われる。   Thereafter, the CPU 101 determines whether or not the fetched instruction is at the end of the function (step S135). If the instruction fetched by the CPU 101 is the end of the function, the process of step S136 is performed. If the instruction is not the end of the function, the process of step S138 is performed.

取り出した命令が関数の末尾である場合、CPU101は、関数とその関数の全ての呼び出し元関数のメモリバンクが同一であるか否かを判定する(ステップS136)。
関数とその関数の全ての呼び出し元関数のメモリバンクが同一ではない場合、ステップS137の処理が行われ、同一の場合には、ステップS138の処理が行われる。
When the fetched instruction is the end of the function, the CPU 101 determines whether or not the memory bank of the function and all the caller functions of the function are the same (step S136).
If the memory bank of the function and all the caller functions of the function are not the same, the process of step S137 is performed. If the memory bank is the same, the process of step S138 is performed.

関数とその関数の全ての呼び出し元関数のメモリバンクが同一ではない場合、CPU101は、関数の末尾に、電力制御コードを挿入する(ステップS137)。
この電力制御コードは、その関数を呼び出している全ての関数が配置されているメモリバンクの電力制御状態を、通常状態とするものである。
When the memory bank of the function and all the caller functions of the function are not the same, the CPU 101 inserts a power control code at the end of the function (step S137).
This power control code sets the power control state of the memory bank in which all the functions calling the function are arranged to the normal state.

続いて、CPU101は、プログラム全体の末尾を検出する(ステップS138)。プログラム全体の末尾が検出された場合、CPU101は、電源制御コード入りのプログラム(アセンブリ)d5を出力し(ステップS139)、たとえば、RAM102などに記憶し、電力制御コード挿入処理を終える。   Subsequently, the CPU 101 detects the end of the entire program (step S138). When the end of the entire program is detected, the CPU 101 outputs the program (assembly) d5 containing the power supply control code (step S139), stores it in the RAM 102, for example, and finishes the power control code insertion process.

一方、ステップS138の処理で、プログラム全体の末尾が検出されていない場合には、ステップS131からの処理が繰り返される。
以上のようにして生成された電源制御コード入りのプログラム(アセンブリ)d5は、図7に示したように、アセンブルにより、電力制御コード入りプログラム(オブジェクト)d6となる。さらに、リンカにより、メモリマップd4など他のライブラリとリンクされ、電力制御コード入りプログラム(バイナリ)d7が生成され(ステップS14)、プログラム生成処理が終了する。
On the other hand, if the end of the entire program is not detected in the process of step S138, the process from step S131 is repeated.
The program (assembly) d5 containing the power control code generated as described above becomes a program (object) d6 containing the power control code by assembling as shown in FIG. Further, the linker is linked with another library such as the memory map d4 to generate a power control code-containing program (binary) d7 (step S14), and the program generation process ends.

以上のようにして生成された電力制御コード入りプログラムd7が、図2に示したような電子装置50に入力されると、たとえば、プロセッサ20は、メモリマップd4をもとに、関数を命令コード用メモリ12のメモリバンク11−0〜11−3…に割り当てる。   When the power control code-containing program d7 generated as described above is input to the electronic device 50 as shown in FIG. 2, for example, the processor 20 converts the function into an instruction code based on the memory map d4. Are allocated to memory banks 11-0 to 11-3.

そして、プロセッサ20は、メモリバンク11−0〜11−3…の電力制御コード入りプログラムd7を実行していくことで、再帰部分を含むような呼び出し関係の多いプログラムを実行する場合であっても、メモリ部10の消費電力を削減することができる。その結果、低消費電力の電子装置50が得られる。   Even when the processor 20 executes the program d7 including the power control code in the memory banks 11-0 to 11-3. The power consumption of the memory unit 10 can be reduced. As a result, the low power consumption electronic device 50 is obtained.

以下、消費電力削減例について説明する。
たとえば、電力制御対象の電子装置50の命令コード用メモリ12が、4つのメモリバンク11−0〜11−3を有し、メモリバンク11−0,11−1の通常状態での消費電力が2mW、省電力状態での消費電力が0.5mWとする。また、メモリバンク11−2,11−3の通常状態での消費電力が4mW、省電力状態での消費電力が1.0mWとする。
Hereinafter, an example of power consumption reduction will be described.
For example, the instruction code memory 12 of the electronic device 50 subject to power control has four memory banks 11-0 to 11-3, and the power consumption in the normal state of the memory banks 11-0 and 11-1 is 2 mW. The power consumption in the power saving state is 0.5 mW. The power consumption in the normal state of the memory banks 11-2 and 11-3 is 4 mW, and the power consumption in the power saving state is 1.0 mW.

そして、プログラムは、関数f1,f2,f3による再帰部と関数mainを有しているとする。また、関数mainはメモリバンク11−0に、関数f1はメモリバンク11−1に、関数f2はメモリバンク11−2に、関数f3はメモリバンク11−3に配置されるものとする。   It is assumed that the program has a recursive part with functions f1, f2, and f3 and a function main. Further, the function main is arranged in the memory bank 11-0, the function f1 is arranged in the memory bank 11-1, the function f2 is arranged in the memory bank 11-2, and the function f3 is arranged in the memory bank 11-3.

たとえば、ある入力に対して、プログラムが以下のように実行されたとする。
関数mainが15msec実行された後、関数f1が呼び出され、380msec実行された後、関数f2が呼び出され、3msec実行された後、関数f3が呼び出され、10msec実行された後、関数f2に復帰する。そして関数f2が7msec実行された後、関数f1に復帰し、関数f1が580msec実行された後、関数mainに戻り、関数mainが5msec実行される。
For example, assume that a program is executed as follows for a certain input.
After the function main is executed for 15 msec, the function f1 is called, after 380 msec is executed, the function f2 is called, after 3 msec is executed, the function f3 is called, and after 10 msec is executed, the function f2 is restored. . Then, after the function f2 is executed for 7 msec, the function f1 is returned to. After the function f1 is executed for 580 msec, the function main is returned to and the function main is executed for 5 msec.

以上のようなプログラム動作が行われる場合、本実施の形態の電力制御方法によれば、メモリバンク11−0〜11−3の合計消費エネルギーは、6mJである。一方、再帰部の処理の際、再帰部に含まれる関数f1〜f3が配置されるメモリバンク11−1〜11−3を常に通常状態としておく場合の合計消費エネルギーは、11.85mJであるから、大幅な電力削減が可能となる。   When the program operation as described above is performed, according to the power control method of the present embodiment, the total energy consumption of the memory banks 11-0 to 11-3 is 6 mJ. On the other hand, when processing the recursive unit, the total energy consumption when the memory banks 11-1 to 11-3 in which the functions f1 to f3 included in the recursive unit are arranged is always in the normal state is 11.85 mJ. A significant power reduction is possible.

なお、上記の説明では、たとえば、図6に示したようなコンピュータ100がプログラムを生成するとしたが、これに限定されない。たとえば、図2に示した電子装置50のプロセッサ20自体が、メモリ部10に格納されたプログラムを読み込んで、上記のような電力制御コードが含まれるプログラムを生成するようにしてもよい。   In the above description, for example, the computer 100 as shown in FIG. 6 generates the program, but the present invention is not limited to this. For example, the processor 20 itself of the electronic device 50 shown in FIG. 2 may read a program stored in the memory unit 10 and generate a program including the power control code as described above.

(第3の実施の形態)
上記の第2の実施の形態では、図32に示したような関数割り当て処理の際、メモリバンクの容量より大きな再帰部を分割し、一方の関数群をそのメモリバンクに割り当て、他方の関数群を、他の分割部よりも先に、他のメモリバンクに割り当てていた。
(Third embodiment)
In the second embodiment, in the function assignment process as shown in FIG. 32, the recursive part larger than the capacity of the memory bank is divided, one function group is assigned to the memory bank, and the other function group is assigned. Are assigned to other memory banks prior to the other division units.

しかし、以下のようにすれば、少ないメモリバンクにも効率よく迅速に関数を割り当てることができるようになる。
図42は、第3の実施の形態における関数割り当て処理の一例を示すフローチャートである。
However, the function can be efficiently and quickly assigned to a small number of memory banks as follows.
FIG. 42 is a flowchart illustrating an example of a function assignment process according to the third embodiment.

CPU101は、図32に示した例と同様に、各種情報の入力(ステップS140)と、各種変数の初期化(ステップS141)を行うが、以下に示すような項目を分割情報に追加する。   Similarly to the example shown in FIG. 32, the CPU 101 inputs various information (step S140) and initializes various variables (step S141), but adds the following items to the division information.

図43は、初期化後の分割情報の一例を示す図である。
図43に示される分割情報には、前述の図34に示したような、その分割名の関数の割り当てが済んでいるか否かを示す情報の代わりに、その分割名の分割部の“残りコードサイズ”という項目が追加されている。残りコードサイズは、その分割名で示される分割部に含まれる関数のうち、メモリバンクへの割り当てが行われていないものの合計コードサイズを示している。
FIG. 43 is a diagram illustrating an example of the division information after initialization.
In the division information shown in FIG. 43, instead of information indicating whether or not the function of the division name has been assigned as shown in FIG. The item “Size” has been added. The remaining code size indicates the total code size of the functions included in the division unit indicated by the division name but not assigned to the memory bank.

初期化が終わると、CPU101は、前述の図32のステップS102の処理と同様に、分割名がMAINの関数について、メモリバンクへの割り当てを行う(ステップS142)。   When the initialization is completed, the CPU 101 assigns the function whose division name is MAIN to the memory bank in the same manner as the processing in step S102 of FIG. 32 described above (step S142).

続いて、CPU101は、残り容量が最大のメモリバンクM_Maxと、残りコードサイズが最大の分割部F_Maxを選択する(ステップS143)。M_Maxには、変数m_rest[M]が最大のメモリバンクが選択される。F_Maxには、残りコードサイズが最大の分割名の関数群が選択される。   Subsequently, the CPU 101 selects the memory bank M_Max having the largest remaining capacity and the division unit F_Max having the largest remaining code size (step S143). For M_Max, the memory bank with the largest variable m_rest [M] is selected. For F_Max, a function group having a division name with the largest remaining code size is selected.

以下、ステップS144〜S154は、前述の図32のステップS104〜S114の処理とほぼ同様である。ただし、ステップS151の処理において、CPU101は、関数群FをM_Maxに割り当てた後、分割情報において、割り当てた関数群Fを含む分割部の残りコードサイズから、関数群Fのコードサイズを減じる。   Hereinafter, steps S144 to S154 are substantially the same as the processing of steps S104 to S114 of FIG. 32 described above. However, in the process of step S151, after assigning the function group F to M_Max, the CPU 101 subtracts the code size of the function group F from the remaining code size of the division unit including the assigned function group F in the division information.

図44は、分割情報の更新例を示す図である。
図44では、分割名R1の分割部のうち、関数f2a〜f9aのメモリバンクへの割り当て後の分割情報の更新例が示されている。
FIG. 44 is a diagram illustrating an example of updating the division information.
FIG. 44 shows an example of updating the division information after the functions f2a to f9a are allocated to the memory banks in the division unit of the division name R1.

上記の例において、各関数f2a〜f9aのコードサイズは1.0KBであるから、合計コードサイズは8.0KBである。CPU101は、これを分割名R1の分割部の合計コードサイズから減じて、残りコードサイズを1.0KBとする。   In the above example, the code size of each function f2a to f9a is 1.0 KB, so the total code size is 8.0 KB. The CPU 101 subtracts this from the total code size of the division part of the division name R1, and sets the remaining code size to 1.0 KB.

これにより、ステップS143の処理に戻った際、分割情報で管理される分割部の中から、残りコードサイズが最大の分割名R2の分割部の関数f3b〜f6bが関数群Fとして選択され、メモリバンクへの割り当てが行われる。   Thereby, when returning to the process of step S143, the functions f3b to f6b of the division unit having the largest remaining code size R2 are selected as the function group F from the division units managed by the division information, and the memory Assignment to the bank is performed.

図45は、割り当て情報の更新例を示す図である。
分割名R1_1の関数群が、メモリバンク番号が1のメモリバンクに割り当てられた後、分割名R1_2の関数群よりも先に、分割名R2の関数群が、メモリバンク(メモリバンク番号=2)に割り当てられている様子が示されている。
FIG. 45 is a diagram illustrating an example of updating allocation information.
After the function group with the division name R1_1 is assigned to the memory bank with the memory bank number 1, the function group with the division name R2 is assigned to the memory bank (memory bank number = 2) before the function group with the division name R1_2. The state assigned to is shown.

小さいコードサイズのものを先にメモリバンクに割り当てると、後で、メモリバンクの残り容量が足りなくて、大きな関数群を配置できなくなり、エラーとなる可能性がある。
しかし、以上のような関数割り当て処理によれば、残りコードサイズが大きい分割部から、メモリバンクに割り当てられるようにしたので、少ないメモリバンクにも効率よく迅速に関数を割り当てることができるようになる。
If a code having a small code size is assigned to a memory bank first, the remaining capacity of the memory bank is insufficient, and a large function group cannot be arranged, resulting in an error.
However, according to the function allocation process as described above, since the division unit having a large remaining code size is allocated to the memory bank, the function can be allocated efficiently and quickly to a small memory bank. .

(第4の実施の形態)
以下では、さらに、より迅速に関数をメモリバンクに割り当てることが可能な関数割り当て処理について説明する。
(Fourth embodiment)
In the following, a function assignment process that can assign functions to memory banks more quickly will be described.

図46は、第4の実施の形態における関数割り当て処理の一例を示すフローチャートである。
CPU101は、第3の実施の形態と同様に、各種情報の入力(ステップS160)と、各種変数の初期化(ステップS161)を行う。
FIG. 46 is a flowchart illustrating an example of a function assignment process according to the fourth embodiment.
Similar to the third embodiment, the CPU 101 inputs various information (step S160) and initializes various variables (step S161).

その後、CPU101は、以下に示すような早見表を作成する(ステップS162)。
図47は、早見表の一例を示す図である。
早見表には、個々の分割案のコードサイズがまとめられている。なお、各分割案のコードサイズは、分割案の第2要素の値となっている。たとえば、図30に示したような、テーブルtbl1では、分割案(f1a,f2a)で分割したときの各関数群のコードサイズは(1,8)となっているため、第2要素の値の8(KB)が、早見表におけるコードサイズとなる。
Thereafter, the CPU 101 creates a quick reference table as shown below (step S162).
FIG. 47 is a diagram showing an example of a quick reference table.
The quick reference table summarizes the code size of each division plan. The code size of each division plan is the value of the second element of the division plan. For example, in the table tbl1 as shown in FIG. 30, since the code size of each function group when it is divided by the division plan (f1a, f2a) is (1, 8), the value of the second element is 8 (KB) is the code size in the quick reference table.

分割名がr1,r2、MAINなどの、再帰部ではない分割部については、分割案はNULLとなっており、その分割部のコードサイズが示されている。
CPU101は、上記のような早見表の作成を終えると、前述の図32のステップS102の処理と同様に、分割名がMAINの関数について、メモリバンクへの割り当てを行う(ステップS163)。
For a division unit that is not a recursive part, such as division names r1, r2, and MAIN, the division plan is NULL, and the code size of the division unit is indicated.
When the creation of the quick reference table as described above is completed, the CPU 101 assigns the function whose division name is MAIN to the memory bank in the same manner as the processing in step S102 of FIG. 32 described above (step S163).

続いて、CPU101は、残り容量が最大のメモリバンクM_Maxと、早見表を参照して、コードサイズが最大の分割部F_Maxを選択する(ステップS164)。複数のメモリバンクにおいて、最大の残り容量が8KBの場合、図47の早見表の例では、8KBに収まる範囲では、分割案(f1a,f2a)のコードサイズが最大であるので、この分割案を有する分割名R1の分割部が分割部F_Maxとして選択される。   Subsequently, the CPU 101 refers to the memory bank M_Max with the largest remaining capacity and the quick reference table, and selects the division unit F_Max with the largest code size (step S164). When the maximum remaining capacity is 8 KB in a plurality of memory banks, in the example of the quick reference table in FIG. 47, the code size of the division plan (f1a, f2a) is the maximum within the range of 8 KB. The division part having the division name R1 is selected as the division part F_Max.

ステップS165〜S172は、図42に示したステップS144〜S151の処理とほぼ同様であるが、ステップS167の処理では、早見表の前述した最大のコードサイズの分割案が選択され、その分割案の第2要素の関数群を関数群Fとして設定する。   Steps S165 to S172 are substantially the same as the processing of steps S144 to S151 shown in FIG. 42, but in the processing of step S167, the above-mentioned division plan of the maximum code size in the quick reference table is selected, and A function group of the second element is set as a function group F.

たとえば、前述の分割案(f1a,f2a)が設定され、第2要素の関数群(関数f2a〜f9a)が関数群Fとして設定される。
関数群FのM_Maxへの割り当て後、CPU101は、早見表を更新する(ステップS173)。たとえば、分割案(f1a,f2a)の第2要素の関数群(関数f2a〜f9a)をメモリバンクに割り当てた後、早見表は以下のように更新される。
For example, the aforementioned division plan (f1a, f2a) is set, and the function group (functions f2a to f9a) of the second element is set as the function group F.
After assigning the function group F to M_Max, the CPU 101 updates the quick reference table (step S173). For example, after assigning the function group (functions f2a to f9a) of the second element of the division plan (f1a, f2a) to the memory bank, the quick reference table is updated as follows.

図48は、早見表の更新例を示す図である。
図48のように、メモリバンクに割り当てた分割名MAINと、分割名R1のデータ(以下エントリと呼ぶ)については、削除されている。ただし、分割名R1の分割部のうち、上記分割案(f1a,f2a)の第1要素である関数f1aについては未割り当てであるので、図45に示した割り当て情報で記した分割名R1_2のエントリが新たに早見表に追加される。
FIG. 48 is a diagram illustrating an example of updating the quick reference table.
As shown in FIG. 48, the division name MAIN assigned to the memory bank and the data of the division name R1 (hereinafter referred to as an entry) are deleted. However, since the function f1a which is the first element of the division plan (f1a, f2a) among the division units of the division name R1 is not assigned, the entry of the division name R1_2 described by the assignment information shown in FIG. Is newly added to the chart.

分割名R1_2のエントリは、コードサイズは、関数f1aのコードサイズであるから1.0KBであり、分割案についてはNULLとなっている。
図46のステップS174〜S176の処理については、図42のステップS152〜S154の処理と同じである。関数群FのM_Maxへの割り当てと、早見表の更新が繰り返され、最後に割り当て情報が出力される。
The entry of the division name R1_2 has a code size of 1.0 KB because it is the code size of the function f1a, and the division plan is NULL.
The processing in steps S174 to S176 in FIG. 46 is the same as the processing in steps S152 to S154 in FIG. Allocation of the function group F to M_Max and updating of the quick reference table are repeated, and finally allocation information is output.

図49は、早見表作成処理の例を示すフローチャートである。
CPU101は、たとえば、図43に示したような分割情報を入力し(ステップS180)、分割情報から1エントリ(図43のようなテーブルの一行のデータ)を取得する(ステップS181)。
FIG. 49 is a flowchart illustrating an example of a quick reference table creation process.
For example, the CPU 101 inputs division information as shown in FIG. 43 (step S180), and acquires one entry (data in one row of a table as shown in FIG. 43) from the division information (step S181).

そして、CPU101は、取得したエントリが再帰部であるか否かを判定する(ステップS182)。再帰部であるか否かは、たとえば、分割情報の分割名により判別できる。図43に示した分割情報の例では、分割名がR1またはR2の場合には、再帰部として判定され、ステップS184の処理が行われる。分割名がそれ以外の場合(たとえば、MAIN、r1,2など)には、再帰部ではないと判定され、ステップS188の処理が行われる。   Then, the CPU 101 determines whether or not the acquired entry is a recursive part (step S182). Whether or not it is a recursive part can be determined by, for example, the division name of the division information. In the example of the division information shown in FIG. 43, when the division name is R1 or R2, it is determined as a recursion unit, and the process of step S184 is performed. When the division name is other than that (for example, MAIN, r1, 2, etc.), it is determined not to be a recursive part, and the process of step S188 is performed.

CPU101は、エントリを再帰部と判定した場合、その再帰部に対する分割案を1エントリ取得する(ステップS184)。たとえば、分割名R1の分割部(再帰部)の分割案は、図30に示したテーブルtbl1のような組み合わせがあり、各組み合わせ(たとえば、(f1a,f1a)、(f1a,f2a)など)が1エントリとして取得される。   When the CPU 101 determines that the entry is a recursive part, the CPU 101 obtains one entry of a division plan for the recursive part (step S184). For example, the division plan of the division unit (recursion unit) of the division name R1 has combinations such as the table tbl1 shown in FIG. Obtained as one entry.

そして、CPU101は、早見表に、同一分割名で同一コードサイズのエントリが登録済みか否かを判定し(ステップS185)、登録済みでなければ、早見表にそのエントリを登録する(ステップS186)。   Then, the CPU 101 determines whether or not an entry with the same division name and the same code size has been registered in the quick reference table (step S185). If not, the entry is registered in the quick reference table (step S186). .

早見表に登録した後、または、取得したエントリと同一分割名で同一コードサイズのエントリが登録済みの場合、CPU101は、分割案の全エントリについてのステップS184〜S186の処理が完了したか否かを判定する(ステップS187)。分割案の全エントリについてのステップS184〜S186の処理が完了した場合には、ステップS189の処理が行われ、完了していないエントリが残っている場合には、そのエントリについて、ステップS184からの処理が繰り返される。   After registration in the chart, or when an entry with the same division name and code size as the acquired entry has already been registered, the CPU 101 determines whether or not the processing of steps S184 to S186 has been completed for all entries of the division plan Is determined (step S187). When the processes of steps S184 to S186 for all the entries of the division plan are completed, the process of step S189 is performed. When there are uncompleted entries, the process from step S184 is performed for the entry. Is repeated.

一方、CPU101は、ステップS182において、分割情報のエントリが再帰部ではないと判定した場合、そのエントリを早見表に登録して、ステップS189の処理に進む。   On the other hand, if the CPU 101 determines in step S182 that the entry of the division information is not a recursive part, the CPU 101 registers the entry in the quick reference table and proceeds to the process of step S189.

分割案の全エントリについてのステップS184〜S186の処理が完了した場合、または、ステップS188の処理の後、CPU101は、分割情報の全エントリについて、ステップS181〜S188の処理が完了したか否かを判定する(ステップS189)。   When the processing of steps S184 to S186 for all entries of the division plan is completed, or after the processing of step S188, the CPU 101 determines whether or not the processing of steps S181 to S188 has been completed for all entries of the division information. Determination is made (step S189).

分割情報の全エントリについて、ステップS181〜S188の処理が完了した場合には、CPU101は、早見表を出力し(ステップS190)、たとえば、RAM102などに格納し、早見表の作成処理を終了する。分割情報の全エントリについて、ステップS181〜S188の処理が完了していない場合には、ステップS181からの処理が繰り返される。   When the processing of steps S181 to S188 is completed for all entries of the division information, the CPU 101 outputs a quick reference table (step S190), stores it in the RAM 102, for example, and ends the quick reference table creation processing. If the processing of steps S181 to S188 has not been completed for all entries of the division information, the processing from step S181 is repeated.

以上のような処理により、図47に示したような早見表が作成される。
図50は、早見表の更新処理の例を示すフローチャートである。
CPU101は、早見表と分割情報とを入力し(ステップS200)、更新対象のエントリが分割案未決定の再帰部であるか否か判定する(ステップS201)。更新対象のエントリが分割案未決定の再帰部である場合には、ステップS202の処理が行われ、更新対象のエントリが分割案未決定の再帰部でない場合には、ステップS204の処理が行われる。
Through the processing as described above, a quick reference table as shown in FIG. 47 is created.
FIG. 50 is a flowchart illustrating an example of a quick reference table update process.
The CPU 101 inputs the quick reference table and the division information (step S200), and determines whether or not the entry to be updated is a recursive unit for which the division plan has not been determined (step S201). If the entry to be updated is a recursive part for which the division plan has not been determined, the process of step S202 is performed. If the entry to be updated is not a recursive part for which the division plan has not been determined, the process of step S204 is performed. .

たとえば、図47に示したような早見表において、コードサイズが8.0KB、分割名R1、分割案(f1a,f2a)のエントリを更新する場合、図43に示したような分割情報では分割名R1の分割案はNULLである。そのため、分割案未決定の再帰部と判定され、CPU101は、更新対象のエントリと同一の分割名のエントリを早見表から削除する(ステップS202)。   For example, in the quick reference table as shown in FIG. 47, when updating the entry having the code size of 8.0 KB, the division name R1, and the division plan (f1a, f2a), the division information shown in FIG. The division plan for R1 is NULL. Therefore, it is determined that the recursion unit has not yet been determined, and the CPU 101 deletes the entry having the same division name as the update target entry from the quick reference table (step S202).

その後、CPU101は、分割案決定後のエントリを早見表に登録する(ステップS203)。これにより、たとえば、図48に示したように、分割名R1のエントリが削除され、分割名R1_2のエントリが追加された早見表が得られる。   Thereafter, the CPU 101 registers the entry after the division plan decision in the quick reference table (step S203). As a result, for example, as shown in FIG. 48, an entry for the division name R1 is deleted, and a quick reference table to which an entry for the division name R1_2 is added is obtained.

一方、更新対象のエントリが分割案未決定の再帰部でない場合には、CPU101は、そのエントリを早見表から削除する(ステップS204)。
ステップS203またはS204の処理後、CPU101は早見表を出力し(ステップS205)、たとえば、RAM102などに格納し、早見表の更新処理を終了する。
On the other hand, if the entry to be updated is not a recursive part for which the division plan has not been determined, the CPU 101 deletes the entry from the quick reference table (step S204).
After the processing of step S203 or S204, the CPU 101 outputs the quick reference table (step S205), stores it in the RAM 102, for example, and ends the quick reference table update processing.

以上のように、早見表を用いてメモリバンクへの関数の割り当てを行うことにより、さらに迅速に関数をメモリバンクに割り当てることが可能となる。
なお、上記の電力制御方法や、電力制御コード入りのプログラムの生成処理は、たとえば、図6に示したようなハードウェア構成を有するコンピュータによって実現することができる。その場合、電子装置1,50やコンピュータ100が有すべき機能の処理内容を記述したプログラムが提供される。そのプログラムをコンピュータで実行することにより、上記処理機能がコンピュータ上で実現される。処理内容を記述したプログラムは、コンピュータで読み取り可能な記録媒体に記録しておくことができる。コンピュータで読み取り可能な記録媒体としては、磁気記憶装置、光ディスク、光磁気記録媒体、半導体メモリなどがある。磁気記憶装置には、HDD、フレキシブルディスク(FD)、磁気テープなどがある。光ディスクには、DVD、DVD−RAM、CD−ROM/RWなどがある。光磁気記録媒体には、MO(Magneto-Optical disk)などがある。
As described above, by assigning a function to a memory bank using a quick reference table, it becomes possible to assign a function to a memory bank more quickly.
Note that the above-described power control method and generation processing of a program including a power control code can be realized by, for example, a computer having a hardware configuration as shown in FIG. In that case, a program describing the processing contents of the functions that the electronic devices 1 and 50 and the computer 100 should have is provided. By executing the program on a computer, the above processing functions are realized on the computer. The program describing the processing contents can be recorded on a computer-readable recording medium. Examples of the computer-readable recording medium include a magnetic storage device, an optical disk, a magneto-optical recording medium, and a semiconductor memory. Magnetic storage devices include HDDs, flexible disks (FD), and magnetic tapes. Optical discs include DVD, DVD-RAM, CD-ROM / RW, and the like. Magneto-optical recording media include MO (Magneto-Optical disk).

プログラムを流通させる場合には、たとえば、そのプログラムが記録されたDVD、CD−ROMなどの可搬型記録媒体が販売される。また、プログラムをサーバコンピュータの記憶装置に格納しておき、ネットワークを介して、サーバコンピュータから他のコンピュータにそのプログラムを転送することもできる。   When distributing the program, for example, portable recording media such as a DVD and a CD-ROM in which the program is recorded are sold. It is also possible to store the program in a storage device of a server computer and transfer the program from the server computer to another computer via a network.

プログラムを実行するコンピュータは、たとえば、可搬型記録媒体に記録されたプログラムもしくはサーバコンピュータから転送されたプログラムを、自己の記憶装置に格納する。そして、コンピュータは、自己の記憶装置からプログラムを読み取り、プログラムに従った処理を実行する。なお、コンピュータは、可搬型記録媒体から直接プログラムを読み取り、そのプログラムにしたがった処理を実行することもできる。また、コンピュータは、ネットワークを介して接続されたサーバコンピュータからプログラムが転送されるごとに、逐次、受け取ったプログラムにしたがった処理を実行することもできる。   The computer that executes the program stores, for example, the program recorded on the portable recording medium or the program transferred from the server computer in its own storage device. Then, the computer reads the program from its own storage device and executes processing according to the program. The computer can also read the program directly from the portable recording medium and execute processing according to the program. In addition, each time a program is transferred from a server computer connected via a network, the computer can sequentially execute processing according to the received program.

また、上記の処理機能の少なくとも一部を、DSP、ASIC(Application Specific Integrated Circuit)、PLD(Programmable Logic Device)などの電子回路で実現することもできる。   In addition, at least a part of the above processing functions can be realized by an electronic circuit such as a DSP, an ASIC (Application Specific Integrated Circuit), or a PLD (Programmable Logic Device).

以上、実施の形態に基づき、本発明の電力制御方法、電子装置、プログラム及びプログラムの生成方法の一観点について説明してきたが、これらは一例にすぎず、上記の記載に限定されるものではない。   As described above, one aspect of the power control method, the electronic device, the program, and the program generation method of the present invention has been described based on the embodiments. However, these are merely examples, and are not limited to the above description. .

1,50 電子装置
2,20 プロセッサ
3a,3b メモリ領域
10 メモリ部
11−0〜11−n メモリバンク
12 命令コード用メモリ
13 データ用メモリ
21 プロセッサコア
22 メモリコントローラ
30 制御レジスタ部
40 電力制御部
40−0〜40−n 電力制御回路
41 バス
42 電源線
DESCRIPTION OF SYMBOLS 1,50 Electronic device 2,20 Processor 3a, 3b Memory area 10 Memory unit 11-0 to 11-n Memory bank 12 Memory for instruction code 13 Memory for data 21 Processor core 22 Memory controller 30 Control register unit 40 Power control unit 40 −0 to 40−n Power control circuit 41 Bus 42 Power supply line

Claims (11)

プロセッサで実行されるプログラム中の関数が割り当てられ、通常状態と省電力状態の電力制御状態をもつ複数のメモリ領域のうち、第1のメモリ領域に配置される第1の関数の実行時、第2のメモリ領域に配置される第2の関数が呼び出される直前に、前記第1のメモリ領域を前記省電力状態、前記第2のメモリ領域を前記通常状態とするように、
前記プロセッサが前記複数のメモリ領域の電力制御状態を制御することを特徴とする電力制御方法。
A function in a program executed by the processor is assigned, and when executing a first function arranged in the first memory area among a plurality of memory areas having a power control state of a normal state and a power saving state, Just before the second function arranged in the second memory area is called, the first memory area is set to the power saving state, and the second memory area is set to the normal state.
The power control method, wherein the processor controls a power control state of the plurality of memory areas.
前記第2の関数から前記第1の関数へ復帰する直前に、前記第1のメモリ領域を前記通常状態とし、
前記第2の関数から前記第1の関数へ復帰した直後に、前記第2のメモリ領域を前記省電力状態とするように、
前記プロセッサが前記複数のメモリ領域の電力制御状態を制御することを特徴とする請求項1に記載の電力制御方法。
Immediately before returning from the second function to the first function, the first memory area is set to the normal state.
Immediately after returning from the second function to the first function, the second memory area is set to the power saving state.
The power control method according to claim 1, wherein the processor controls a power control state of the plurality of memory areas.
前記第1の関数及び前記第1のメモリ領域が複数存在する場合に、
前記第2の関数から前記第1の関数へ復帰する直前に、全ての前記第1のメモリ領域を前記通常状態とし、
前記第2の関数から前記第1の関数へ復帰した直後に、複数の前記第1のメモリ領域のうち復帰先となるメモリ領域以外、及び前記第2のメモリ領域を前記省電力状態とするように、
前記プロセッサが前記複数のメモリ領域の電力制御状態を制御することを特徴とする請求項1または2に記載の電力制御方法。
When there are a plurality of the first function and the first memory area,
Immediately before returning from the second function to the first function, all the first memory areas are set to the normal state,
Immediately after returning from the second function to the first function, the second memory area other than the memory area that is the return destination among the plurality of first memory areas and the second memory area are set in the power saving state. In addition,
The power control method according to claim 1, wherein the processor controls a power control state of the plurality of memory areas.
前記第1の関数において、前記第2の関数の呼び出し命令の直前に、前記第1のメモリ領域を前記省電力状態、前記第2のメモリ領域を前記通常状態とする命令が記述されていることを特徴とする請求項1乃至3の何れか一項に記載の電力制御方法。   In the first function, an instruction for setting the first memory area to the power saving state and the second memory area to the normal state is described immediately before the instruction to call the second function. The power control method according to any one of claims 1 to 3. 前記第1の関数において、前記第2の関数の呼び出し命令の直後に、前記第2のメモリ領域を前記省電力状態とする命令が記述されていることを特徴とする請求項1乃至4の何れか一項に記載の電力制御方法。   5. The instruction according to claim 1, wherein an instruction for setting the second memory area in the power saving state is described immediately after the instruction for calling the second function in the first function. The power control method according to claim 1. プロセッサと、
前記プロセッサで実行されるプログラム中の関数が割り当てられ、通常状態と省電力状態の電力制御状態をもつ複数のメモリ領域と、を有し、
前記プロセッサは、前記複数のメモリ領域のうち、第1のメモリ領域に配置される第1の関数の実行時、第2のメモリ領域に配置される第2の関数が呼び出される直前に、前記第1のメモリ領域を前記省電力状態とすることを特徴とする電子装置。
A processor;
A function in a program executed by the processor is assigned, and has a plurality of memory areas having a power control state of a normal state and a power saving state;
The processor, when executing the first function arranged in the first memory area among the plurality of memory areas, immediately before calling the second function arranged in the second memory area. An electronic apparatus characterized in that one memory area is placed in the power saving state.
プロセッサで実行されるプログラム中の関数が割り当てられ、通常状態と省電力状態の電力制御状態をもつ複数のメモリ領域のうち、第1のメモリ領域に配置される第1の関数の実行時、第2のメモリ領域に配置される第2の関数が呼び出される直前に、前記第1のメモリ領域を前記省電力状態、前記第2のメモリ領域を前記通常状態とする、
処理をコンピュータに実行させるプログラム。
A function in a program executed by the processor is assigned, and when executing a first function arranged in the first memory area among a plurality of memory areas having a power control state of a normal state and a power saving state, Immediately before the second function arranged in the second memory area is called, the first memory area is set to the power saving state, and the second memory area is set to the normal state.
A program that causes a computer to execute processing.
通常状態と省電力状態の電力制御状態をもつ複数のメモリ領域の前記電力制御状態を制御するプログラムの生成方法において、
コンピュータが、
プログラム中の関数の前記複数のメモリ領域への割り当てを決定し、
前記複数のメモリ領域のうち、第1のメモリ領域に配置される第1の関数において、第2のメモリ領域に配置される第2の関数の呼び出し命令の直前に、前記第1のメモリ領域を前記省電力状態、前記第2のメモリ領域を前記通常状態とする命令を挿入する、
ことを特徴とするプログラムの生成方法。
In a method for generating a program for controlling the power control state of a plurality of memory areas having a power control state of a normal state and a power saving state,
Computer
Determining allocation of functions in the program to the plurality of memory areas;
Among the plurality of memory areas, in the first function arranged in the first memory area, the first memory area is set immediately before the call instruction of the second function arranged in the second memory area. Inserting an instruction to set the power saving state and the second memory area to the normal state;
A program generation method characterized by the above.
前記プログラムを1または複数の関数を含む複数の分割部に分割し、
前記複数の分割部のうち、再帰部となる関数群をさらに分割する複数の分割案を作成し、
前記複数の分割案から、前記複数のメモリ領域の残り容量に応じて採用する分割案を選択し、
選択した前記分割案をもとに分割した前記再帰部と、前記再帰部以外の分割部とを配置するメモリ領域を指定するメモリマップを作成することを特徴とする請求項8に記載のプログラムの生成方法。
Dividing the program into a plurality of division units including one or more functions;
Among the plurality of division units, create a plurality of division plans that further divide the function group to be a recursion unit,
From the plurality of division plans, select a division plan to be adopted according to the remaining capacity of the plurality of memory areas,
9. The program according to claim 8, wherein a memory map for designating a memory area in which the recursive unit divided based on the selected division plan and a divided unit other than the recursive unit are arranged is created. Generation method.
前記複数の分割部のうち、前記メモリ領域に割り当てていないコードサイズが大きい分割部から、前記割り当てを決定していくことを特徴とする請求項9に記載のプログラムの生成方法。   The program generation method according to claim 9, wherein the allocation is determined from a division unit having a large code size that is not allocated to the memory area among the plurality of division units. 前記複数の分割案のそれぞれに応じて前記再帰部を分割したときに得られる各関数群のコードサイズを含むテーブルを作成し、
前記テーブルを参照し、前記複数のメモリ領域のそれぞれの残り容量と、前記コードサイズに応じて、前記複数の分割案から、前記採用する分割案を選択することを特徴とする請求項9または10に記載のプログラムの生成方法。
Create a table including the code size of each function group obtained when dividing the recursive unit according to each of the plurality of division plans,
11. The division plan to be adopted is selected from the plurality of division plans according to the remaining capacity of each of the plurality of memory areas and the code size with reference to the table. A method for generating the program described in 1.
JP2011129767A 2011-06-10 2011-06-10 Power control method, electronic device, program, and program generation method Expired - Fee Related JP5776347B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2011129767A JP5776347B2 (en) 2011-06-10 2011-06-10 Power control method, electronic device, program, and program generation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2011129767A JP5776347B2 (en) 2011-06-10 2011-06-10 Power control method, electronic device, program, and program generation method

Publications (2)

Publication Number Publication Date
JP2012256263A true JP2012256263A (en) 2012-12-27
JP5776347B2 JP5776347B2 (en) 2015-09-09

Family

ID=47527761

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2011129767A Expired - Fee Related JP5776347B2 (en) 2011-06-10 2011-06-10 Power control method, electronic device, program, and program generation method

Country Status (1)

Country Link
JP (1) JP5776347B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014160362A (en) * 2013-02-20 2014-09-04 Nec Corp Calculation device suitable for intermittent operation and operation method thereof
JP2014203148A (en) * 2013-04-02 2014-10-27 ルネサスエレクトロニクス株式会社 Memory control circuit

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004272448A (en) * 2003-03-06 2004-09-30 Matsushita Electric Ind Co Ltd Memory control device and memory control method
JP2005196545A (en) * 2004-01-08 2005-07-21 Matsushita Electric Ind Co Ltd Power saving controller
JP2010146181A (en) * 2008-12-17 2010-07-01 Fujitsu Ltd Execution file creation device
JP2010257437A (en) * 2009-03-30 2010-11-11 Fujitsu Ltd Command arrangement program, command arrangement device, and command arrangement method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004272448A (en) * 2003-03-06 2004-09-30 Matsushita Electric Ind Co Ltd Memory control device and memory control method
JP2005196545A (en) * 2004-01-08 2005-07-21 Matsushita Electric Ind Co Ltd Power saving controller
JP2010146181A (en) * 2008-12-17 2010-07-01 Fujitsu Ltd Execution file creation device
JP2010257437A (en) * 2009-03-30 2010-11-11 Fujitsu Ltd Command arrangement program, command arrangement device, and command arrangement method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014160362A (en) * 2013-02-20 2014-09-04 Nec Corp Calculation device suitable for intermittent operation and operation method thereof
JP2014203148A (en) * 2013-04-02 2014-10-27 ルネサスエレクトロニクス株式会社 Memory control circuit

Also Published As

Publication number Publication date
JP5776347B2 (en) 2015-09-09

Similar Documents

Publication Publication Date Title
JP6267711B2 (en) Modernization of legacy software systems based on modeled dependencies
CN102929786B (en) The volatile memory of non-volatile memory device set represents
CN102103567B (en) multiple versions of the data of virtual memory shared among isomerous processors
CN102945212B (en) Collect zoning and expression
US9244883B2 (en) Reconfigurable processor and method of reconfiguring the same
JP5681473B2 (en) Program optimization apparatus, optimization method, and optimization program
US7305665B2 (en) Compiler register allocation and compilation
CN101310258A (en) Protecting shared variables in a software transactional memory system
CN103999036A (en) Method and system using exceptions for code specialization in a computer architecture that supports transactions
CN108196876A (en) PHP business collocation methods and central server based on file
JP6937759B2 (en) Database operation method and equipment
US8266416B2 (en) Dynamic reconfiguration supporting method, dynamic reconfiguration supporting apparatus, and dynamic reconfiguration system
JP5776347B2 (en) Power control method, electronic device, program, and program generation method
JP5108252B2 (en) Index updating method and system
US20220121498A1 (en) Combination of multiple data processing and machine learning frameworks for a target hardware
CN115586972B (en) Command generation method and device, AI chip, electronic device and storage medium
KR102657104B1 (en) Operation device of convolutional neural network, operation method of convolutional neural network and computer program stored in a recording medium to execute the method thereof
JP5014871B2 (en) Program start device, program start method, start processing program, and integrated circuit
US10310823B2 (en) Program development support system and program development support software
JP2022140995A (en) Information processing device, compile program, and compile method
JP2009020695A (en) Information processing apparatus and system
Pratt The competence/performance dichotomy in programming preliminary report
CN109923527B (en) Variable type builder
US20220229664A1 (en) Information processing device, compiling method, and non-transitory computer-readable recording medium
US11809849B1 (en) Global modulo allocation in neural network compilation

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20140304

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20141126

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20141202

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20150130

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20150609

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20150622

R150 Certificate of patent or registration of utility model

Ref document number: 5776347

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees