Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP4941103B2 - Multiprocessor system, exclusive control method, vehicle electronic control unit - Google Patents
[go: Go Back, main page]

JP4941103B2 - Multiprocessor system, exclusive control method, vehicle electronic control unit - Google Patents

Multiprocessor system, exclusive control method, vehicle electronic control unit Download PDF

Info

Publication number
JP4941103B2
JP4941103B2 JP2007139555A JP2007139555A JP4941103B2 JP 4941103 B2 JP4941103 B2 JP 4941103B2 JP 2007139555 A JP2007139555 A JP 2007139555A JP 2007139555 A JP2007139555 A JP 2007139555A JP 4941103 B2 JP4941103 B2 JP 4941103B2
Authority
JP
Japan
Prior art keywords
data
register
cpu core
rmw
stored
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.)
Expired - Fee Related
Application number
JP2007139555A
Other languages
Japanese (ja)
Other versions
JP2008293368A (en
Inventor
竜路 岡村
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.)
Toyota Motor Corp
Original Assignee
Toyota Motor Corp
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 Toyota Motor Corp filed Critical Toyota Motor Corp
Priority to JP2007139555A priority Critical patent/JP4941103B2/en
Publication of JP2008293368A publication Critical patent/JP2008293368A/en
Application granted granted Critical
Publication of JP4941103B2 publication Critical patent/JP4941103B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、マルチプロセッサシステム等に関し、特に、複数のCPUが共有メモリにアクセスする場合に排他制御するマルチプロセッサシステム、排他制御方法及び車両用電子制御ユニットに関する。   The present invention relates to a multiprocessor system and the like, and more particularly to a multiprocessor system, an exclusive control method, and a vehicle electronic control unit that perform exclusive control when a plurality of CPUs access a shared memory.

CPUコアなどの演算部を複数備えたマルチチプロセッサシステム(以下、MPSという)では、RAMなどの共有メモリに各演算部がアクセスする場合があるため、共有メモリへの排他処理が必要となる。   In a multi-processor system (hereinafter referred to as MPS) including a plurality of arithmetic units such as a CPU core, each arithmetic unit may access a shared memory such as a RAM, and thus exclusive processing to the shared memory is required.

排他処理としてRMW(リード・モディファイ・ライト)命令が知られている。図7(a)はRMW命令による処理の概念図を示す。図7(a)のRMW命令では、a)所定アドレスのデータ204を読み出す、b)該データ204を加工する、c)加工後のデータ204を元のアドレスに書き込む、の一連の処理が実行される。   An RMW (Read Modify Write) instruction is known as an exclusive process. FIG. 7A shows a conceptual diagram of processing by the RMW instruction. In the RMW instruction of FIG. 7A, a series of processes are executed: a) reading data 204 at a predetermined address, b) processing the data 204, and c) writing the processed data 204 to the original address. The

図7(a)では読み込んだデータ204の所定ビット(例えばフラグ)を書き換えてRAM200の元のアドレスに書き込んでいる。CPUコア100aがb)の処理を実行している間に、CPUコア100bが同じデータ204を書き換えても、その後CPUコア100aがc)の処理によりデータ204を上書きしてしまうので、CPUコア100bが書き込んだはずのデータ204が消失してしまう。このため、RMW命令は割り込み禁止機能を備え、a)〜c)の一連の処理の間、CPUコア100bのRAM200へのアクセルを禁止する。   In FIG. 7A, a predetermined bit (for example, flag) of the read data 204 is rewritten and written to the original address of the RAM 200. Even if the CPU core 100b rewrites the same data 204 while the CPU core 100a is executing the process b), the CPU core 100a subsequently overwrites the data 204 by the process c). The data 204 that should have been written will be lost. For this reason, the RMW instruction has an interrupt prohibiting function, and prohibits the accelerator of the CPU core 100b to the RAM 200 during the series of processes a) to c).

しかしながら、RMW命令がソースコードに記述されていればコンパイラが自動的に認識し上述の排他処理が実行できるが、RMW命令を用いない広義の(いくつかのステップを経る)RMW処理はコンパイラが認識できない。このため、プログラマがRMW処理の開始から終了まで排他処理を記述する必要がある。   However, if the RMW instruction is described in the source code, the compiler automatically recognizes it and can execute the above exclusion process. However, the compiler recognizes the RMW process that does not use the RMW instruction (through several steps). Can not. For this reason, it is necessary for the programmer to describe the exclusive process from the start to the end of the RMW process.

例えばエンジン等の制御ソフトにおいて、エンジンの状態を表すデータを入力値として演算する場合、最初の処理で入力値のデータを取得し、途中の処理でRMW処理に付随する他のデータを演算して、最後の処理で入力値のデータを更新するといった、RMW命令を用いないRMW処理が多いが、このような広義のRMW処理の全てに排他処理を記述する必要がある。   For example, in control software such as an engine, when calculating data representing the state of the engine as an input value, the input value data is acquired in the first process, and other data associated with the RMW process is calculated in the intermediate process. There are many RMW processes that do not use the RMW instruction, such as updating the data of the input value in the last process, but it is necessary to describe the exclusive process in all such broad RMW processes.

また、RMW処理の間、排他処理のためCPUコア100aがRAM200を1リソースとしてアクセスを禁止すると、その間CPUコア100bはRAM200にアクセスできないためオーバーヘッドが大きくなってしまうという問題がある。   In addition, during the RMW process, if the CPU core 100a prohibits access by using the RAM 200 as one resource for the exclusive process, the CPU core 100b cannot access the RAM 200 during that time, resulting in an increase in overhead.

この点について、自CPUが処理対象としたアドレスに対してのみ他CPUのアクセスを禁止する技術が提案されている(例えば、特許文献1参照。)。特許文献1には、自CPUがRMW処理を実行する場合、そのメモリアドレスを保持しておき、システムバスに出力されているアドレスとメモリアドレスが一致するか否かを検出するMPSが記載されており、一致を検出した場合は、他CPUにアクセス中断信号を送出することで、処理対象としたアドレスに対してのみ他CPUのアクセスを禁止している。
特開平7−93259号公報
With regard to this point, a technique has been proposed that prohibits the access of other CPUs only to addresses that are processed by the CPU (see, for example, Patent Document 1). Patent Document 1 describes an MPS that holds its memory address when its own CPU executes RMW processing and detects whether the address output to the system bus matches the memory address. When a match is detected, an access interruption signal is sent to the other CPU, thereby prohibiting the other CPU from accessing only the address to be processed.
JP-A-7-93259

しかしながら、特許文献1記載の技術では、メモリアドレスの一致に基づきアクセスを禁止するため、読み取りと書き込みのいずれのアクセスの場合も他CPUは共有メモリにアクセスできず、なお、オーバーヘッドが大きいという問題がある。また、自CPUがRMW処理を実行中、別のメモリアドレスにアクセスした場合には、他CPUがRMW処理の対象変数(上記の入力値のデータ)にアクセス可能となるため、入力値のデータを書き換えてしまうおそれがある。   However, in the technique described in Patent Document 1, since access is prohibited based on the coincidence of memory addresses, other CPUs cannot access the shared memory in both read and write accesses, and there is a problem that overhead is large. is there. In addition, when the own CPU accesses another memory address while executing the RMW process, the other CPU can access the target variable (the above input value data) of the RMW process. There is a risk of rewriting.

ところで、MPSの排他処理として、RMW(リード・モディファイ・ライト)処理の他に、同時性を確保するための処理が挙げられる。   By the way, as an MPS exclusion process, in addition to the RMW (read-modify-write) process, a process for ensuring simultaneity can be mentioned.

図7(b)は、2つのCPUコア100a、100bがRAM200を共有する従来のMPSの概念図を示す。同時性の確保は、例えば関連する複数のデータが他の処理に優先して同時に(一連の処理で)更新されることが要求されることをいう。例えばエンジンを制御する制御ソフトではエンジンの状態を複数のデータで表すが、元となるエンジンの状態が変われば複数のデータも同時に更新されなければならない。例えば、データ201〜203が関連するデータであってCPUコア100aがデータ201〜203を更新する場合、CPUコア100bがエンジンの別の制御に関連してデータ203にアクセスする可能性があるため、同時性を確保するためにはプログラム上でデータ201〜203の更新の間はRAM200へのアクセスを禁止する命令を記述する必要がある。しかしながら、制御ソフトには同時性の確保が必要な複数のデータが多く存在するため、RAM200にアクセスする処理全てに禁止命令を記述すると工数が増大してしまうし、プログラマ等の負担が増大するという問題がある。   FIG. 7B shows a conceptual diagram of a conventional MPS in which two CPU cores 100 a and 100 b share the RAM 200. Ensuring simultaneity means that, for example, a plurality of related data is required to be updated simultaneously (in a series of processes) in preference to other processes. For example, in the control software for controlling the engine, the engine state is represented by a plurality of data. However, if the original engine state changes, the plurality of data must be updated simultaneously. For example, when the data 201 to 203 is related data and the CPU core 100a updates the data 201 to 203, the CPU core 100b may access the data 203 in connection with another control of the engine. In order to ensure simultaneity, it is necessary to describe an instruction for prohibiting access to the RAM 200 during the update of the data 201 to 203 on the program. However, since there are many pieces of data that need to ensure simultaneity in the control software, if a forbidden instruction is described in all the processes that access the RAM 200, man-hours will increase and the burden on the programmer will increase. There's a problem.

本発明は、上記課題に鑑み、マルチプロセッサシステムの排他処理において、RMW処理のオーバーヘッドを低減し、プログラムの工数増大を抑制して同時性確保の処理を実現するマルチプロセッサシステム、排他制御方法及び車両用電子制御ユニットを提供することを目的とする。   SUMMARY OF THE INVENTION In view of the above problems, the present invention provides a multiprocessor system, an exclusive control method, and a vehicle that realizes a process for ensuring simultaneity by reducing overhead of RMW processing and suppressing an increase in the number of man-hours in exclusive processing of a multiprocessor system. An object of the present invention is to provide an electronic control unit.

上記課題を解決するため、本発明は、複数のCPUコアが並行してプログラムを実行するマルチプロセッサシステムにおいて、第1CPUコア(例えば、CPUコア11a)がアクセスするデータの第1データIDを格納する第1データIDレジスタ(例えば、使用IDレジスタ11a)と、第2CPUコア(例えば、CPUコア11b)がアクセスするデータの第2データIDを格納する第2データIDレジスタ(例えば、使用IDレジスタ11b)と、予め関連する複数のデータに、少なくとも一部が一致するデータIDを対応づけたデータテーブルを記憶する、複数のCPUコアが共有するデータテーブル記憶手段(例えば、RAM10)と、第1データIDレジスタに格納された第1データIDと第2データIDレジスタに格納された第2データIDを比較するデータID比較手段(例えば、比較回路16)と、データID比較手段による比較結果が一致を示す場合、第1CPUコアと第2CPUコアのいずれか一方はデータテーブルへのアクセスを保留する、ことを特徴とする。   In order to solve the above problems, the present invention stores a first data ID of data accessed by a first CPU core (for example, the CPU core 11a) in a multiprocessor system in which a plurality of CPU cores execute a program in parallel. A first data ID register (for example, usage ID register 11a) and a second data ID register (for example, usage ID register 11b) for storing a second data ID of data accessed by the second CPU core (for example, CPU core 11b) And a data table storage means (for example, RAM 10) shared by a plurality of CPU cores, which stores a data table in which at least a part of the data ID is matched with a plurality of related data, and a first data ID Stored in the first data ID and second data ID registers stored in the register When the comparison result by the data ID comparison means (for example, the comparison circuit 16) for comparing the second data ID and the data ID comparison means indicates coincidence, either the first CPU core or the second CPU core accesses the data table. Is suspended.

マルチプロセッサシステムの排他処理において、RMW処理のオーバーヘッドを低減し、プログラムの工数増大を抑制して同時性確保の処理を実現するマルチプロセッサシステム、排他制御方法及び車両用電子制御ユニットを提供することができる。   To provide a multiprocessor system, an exclusive control method, and a vehicular electronic control unit that realizes a process for ensuring simultaneity by reducing overhead of RMW processing and suppressing an increase in the number of man-hours in exclusive processing of a multiprocessor system. it can.

以下、本発明を実施するための最良の形態について図面を参照しながら説明する。
図1は、本実施形態のマルチプロセッサシステム(以下、MPSという)100の概略構成図を示す。本実施形態のMPS100は、関連する複数のデータを関連づけるようプログラム21に記述し、コンパイラによって関連する複数のデータに少なくとも一部が一致するデータIDが付与されるようにコンパイルする。CPUコア11a、11bがデータにアクセスする時には該データのデータIDを使用IDレジスタ12a、12bに格納しておき、いずれかのCPUコア11a、11bがデータにアクセスする場合、使用IDレジスタ12aのデータIDと使用IDレジスタ12bのデータIDを比較して一致する場合には、CPUコア11a又は11bはアクセスを保留する。CPUコア11a、11bのいずれか一方が同じデータIDのデータを処理している間は、他方が同じデータIDのデータにアクセスできないので、関連する複数のデータの同時性を確保することができる。
The best mode for carrying out the present invention will be described below with reference to the drawings.
FIG. 1 is a schematic configuration diagram of a multiprocessor system (hereinafter referred to as MPS) 100 according to the present embodiment. The MPS 100 of this embodiment is described in the program 21 so as to associate a plurality of related data, and is compiled so that a data ID at least partially matching the plurality of related data is given by the compiler. When the CPU cores 11a and 11b access data, the data ID of the data is stored in the use ID registers 12a and 12b. When any of the CPU cores 11a and 11b accesses data, the data in the use ID register 12a is stored. If the ID matches the data ID of the use ID register 12b, the CPU core 11a or 11b suspends access. While one of the CPU cores 11a and 11b is processing data with the same data ID, the other cannot access data with the same data ID, so that the simultaneity of a plurality of related data can be ensured.

また、RMW処理の処理対象のデータIDを格納する使用RMWIDレジスタ13a、13bを備え、いずれかのCPUコア11a(11b)がデータに書き込みのアクセスをする場合、使用IDレジスタ12a(12b)のデータIDと使用RMWIDレジスタ13b(13a)のデータIDを比較し、一致する場合には書き込みを保留することで、RMW処理中の排他処理を実現する。   In addition, use RMWID registers 13a and 13b that store data IDs to be processed in the RMW process are provided, and when any of the CPU cores 11a (11b) has write access to data, the data in the use ID register 12a (12b) The exclusive process during the RMW process is realized by comparing the ID and the data ID of the used RMWID register 13b (13a), and if the IDs match, the writing is suspended.

MPS100は、例えばエンジンECU(電子制御ユニット)、ブレーキECUなど制御系のECU、又は、ボディECU、エアコンECUなどボディ系のECUに組み込まれているコンピュータの一形態である。MPS100はCAN(Controller Area Network)やLIN(Local Interconnect Network)等の車内LANを介して他のECUと接続されており、車載装置の協調制御を実現している。   The MPS 100 is one form of a computer incorporated in a control system ECU such as an engine ECU (electronic control unit) and a brake ECU, or a body system ECU such as a body ECU and an air conditioner ECU. The MPS 100 is connected to another ECU via an in-vehicle LAN such as a CAN (Controller Area Network) or a LIN (Local Interconnect Network), and realizes cooperative control of the in-vehicle device.

MPS100は、ROM15、CPUコア11a、11b(区別しない場合、単にCPUコア11という)、RAM10、使用IDレジスタ12a、12b(区別しない場合、単に使用IDレジスタ12という)及び使用RMWIDレジスタ13a、13b(区別しない場合、単に使用RMWIDレジスタ13という)が内部バスに接続して構成されている。なお、車内LANに接続する入出力インターフェースや他のECUとの通信装置を備えていてもよい。CPUコア11a、11bは同一のCPUコアでもよいし、異なる構成のCPUコアであってもよい。   The MPS 100 includes a ROM 15, CPU cores 11a and 11b (if not distinguished, simply referred to as CPU core 11), RAM 10, use ID registers 12a and 12b (if not distinguished, simply referred to as use ID register 12), and use RMWID registers 13a and 13b ( If they are not distinguished, the used RMWID register 13 is simply connected to the internal bus. In addition, you may provide the input / output interface connected to in-vehicle LAN, and a communication apparatus with other ECU. The CPU cores 11a and 11b may be the same CPU core, or may be CPU cores having different configurations.

ROM15にはコンパイルにより実行形式に変換されたプログラム(オブジェクトコード)21、制御マップ、設定情報などのファイルが格納されている。プログラム21をCPUコア11a、11bが実行することで、例えばエンジンのスロットル開度、燃料噴射量等が制御される。   The ROM 15 stores files such as a program (object code) 21 converted into an execution format by compilation, a control map, and setting information. By executing the program 21 by the CPU cores 11a and 11b, for example, the throttle opening of the engine, the fuel injection amount, and the like are controlled.

CPUコア11a、11bはプログラム21の各スレッドを、予め定められた手順又はイベントの発生を受けて実行する。処理分配回路14は、例えばコンパイル時に対応づけられたスレッドをそのCPUコア11a、11bに分配するか、CPUコア11a、11bの負荷を監視しながら負荷の軽い方にスレッドを分配する。   The CPU cores 11a and 11b execute each thread of the program 21 upon occurrence of a predetermined procedure or event. For example, the processing distribution circuit 14 distributes the threads associated at the time of compilation to the CPU cores 11a and 11b, or distributes the threads to lighter loads while monitoring the loads on the CPU cores 11a and 11b.

CPUコア11a、11bはプログラム21の実行時にはプログラム21の一部又は全体をRAM10に展開し、RAM10を作業領域にしてプログラム21を実行する。CPUコア11a、11bは、RAM10の命令やデータをワード単位毎に読み出すフェッチ(読み出し)、命令を解読するデコード、命令に応じた演算、演算結果のRAM10への格納(書き込み)というステップを繰り返す。   When executing the program 21, the CPU cores 11a and 11b develop a part or the whole of the program 21 in the RAM 10, and execute the program 21 using the RAM 10 as a work area. The CPU cores 11a and 11b repeat the steps of fetching (reading) reading instructions and data in the RAM 10 for each word unit, decoding to decode the instructions, calculation according to the instructions, and storing (writing) the calculation results in the RAM 10.

本実施形態のMPS100は、CPUコア11aに接続された使用IDレジスタ12a及び使用RMWIDレジスタ13a、CPUコア11bに接続された使用IDレジスタ12b及び使用RMWIDレジスタ13bに、データを識別するデータIDを格納する。これらレジスタは好ましくは専用レジスタであり、後述する手順でデータIDを格納する。   The MPS 100 of this embodiment stores a data ID for identifying data in the use ID register 12a and the use RMWID register 13a connected to the CPU core 11a, and the use ID register 12b and the use RMWID register 13b connected to the CPU core 11b. To do. These registers are preferably dedicated registers, and store the data ID in the procedure described later.

また、MPS100は、使用IDレジスタ12aと使用IDレジスタ12bにそれぞれ格納されたデータIDを比較する比較手段16、使用IDレジスタ12aと使用RMWIDレジスタ13bにそれぞれ格納されたデータIDを比較する比較手段17、使用IDレジスタ12bと使用RMWIDレジスタ13aにそれぞれ格納されたデータIDを比較する比較手段18、使用IDレジスタ12aと使用RMWIDレジスタ13aにそれぞれ格納されたデータIDを比較する比較手段19、使用IDレジスタ12bと使用RMWIDレジスタ13bにそれぞれ格納されたデータIDを比較する比較手段20、を備え、CPUコア11a、11bがそれらの比較結果を検出できるようになっている。   Further, the MPS 100 compares the data IDs stored in the usage ID register 12a and the usage ID register 12b, and the comparison unit 17 compares the data IDs stored in the usage ID register 12a and the usage RMWID register 13b. The comparison means 18 for comparing the data IDs stored in the use ID register 12b and the use RMWID register 13a, the comparison means 19 for comparing the data IDs stored in the use ID register 12a and the use RMWID register 13a, and the use ID register Comparing means 20 for comparing the data IDs stored in 12b and the used RMWID register 13b is provided so that the CPU cores 11a and 11b can detect the comparison results.

〔データID〕
まず、データIDについて説明する。図2は、RAM10に記憶されたデータテーブル22の一例を示す。データテーブル22は、プログラム21に含まれておりプログラム21をRAM10に展開する際に同時に展開される。なお、データそのものでなくデータのアドレスを記憶していてもよい。
[Data ID]
First, the data ID will be described. FIG. 2 shows an example of the data table 22 stored in the RAM 10. The data table 22 is included in the program 21 and is expanded simultaneously when the program 21 is expanded in the RAM 10. Note that the address of the data may be stored instead of the data itself.

データテーブル22には、構造体st_A、st_B、配列array、変数data_X、data_YにデータIDが対応づけられている。構造体st_A、st_Bはそれぞれ変数a、bを関連付けて扱うための変数の一形態であり、例えばC言語では次のように記述される。
struct {
float a;
float b;
}st_A , st_B;
float a、float bは、C言語では構造体のメンバと呼ばれ、変数st_A.aとst_A.b、st_B.aとst_B.bをそれぞれ関連付けて扱うことを可能にする。
In the data table 22, data IDs are associated with the structures st_A and st_B, the array array, and the variables data_X and data_Y. The structures st_A and st_B are forms of variables for handling the variables a and b in association with each other, and are described as follows in the C language, for example.
struct {
float a;
float b;
} st_A, st_B;
Float a and float b are called structure members in the C language, and allow variables st_A.a and st_A.b and st_B.a and st_B.b to be handled in association with each other.

また、配列arrayは、配列で確保される複数の領域に格納される変数を関連付けて扱うための変数の一形態であり、C言語では次のように記述される。
float ary[2]
配列arreyの宣言により、array[0]に格納される変数とarray[1]に格納される変数を関連付けて扱うことが可能となる、
また、構造体や配列に他の変数を関連付けることができる。例えば、構造体st_A、st_B に変数data_Xを関連付ける場合、次のように記述する。
struct {
float a;
float b;
float c;
}st_A ;
float data_X;
int main() {
st_A.c = data_X;
かかる書式を予め定めておき当該書式に対し同じデータID又は一部が一致するデータIDを付与するようにコンパイルルールが設定されたコンパイラを用いてコンパイルすることで、所定の書式で記述された変数に対しては、同じデータID又は一部が一致するデータIDを付与するようにコンパイルすることができる。図2では、変数st_A.aとst_A.b、はいずれもデータIDが等しく(図では10)、st_B.aとst_B.bはいずれもデータIDが等しく(図では20)、array[0]に格納される変数とarray[1]に格納される変数はいずれもデータIDが等しい(図では22)。また、構造体st_Aに関連付けられた変数data_XのデータID「11」はst_AのデータID「10」と一部が一致している。
The array array is one form of variables for handling variables stored in a plurality of areas secured by the array in association with each other, and is described as follows in the C language.
float ary [2]
By declaring the array arrey, it becomes possible to associate and handle the variables stored in array [0] and the variables stored in array [1].
You can also associate other variables with structures and arrays. For example, when the variable data_X is associated with the structures st_A and st_B, the structure is described as follows.
struct {
float a;
float b;
float c;
} st_A;
float data_X;
int main () {
st_A.c = data_X;
Variables described in a predetermined format by compiling using a compiler in which a compile rule is set so that the format is determined in advance and the same data ID or a partially matching data ID is assigned to the format. Can be compiled to give the same data ID or a partially matching data ID. In FIG. 2, the variables st_A.a and st_A.b have the same data ID (10 in the figure), st_B.a and st_B.b have the same data ID (20 in the figure), and array [0] The variable ID stored in array [1] and the variable stored in array [1] both have the same data ID (22 in the figure). The data ID “11” of the variable data_X associated with the structure st_A partially matches the data ID “10” of st_A.

比較回路16、17、18、19、20は、例えば、ビット毎に一致するか否かを比較するEXNOR回路を有し、全ビットが一致する場合、及び、所定数以上のビットが一致する場合に一致するとの比較結果を出力する。これにより、完全にはデータIDが一致しない複数のデータを一致するとして扱うことができる。   The comparison circuits 16, 17, 18, 19, 20 have, for example, an EXNOR circuit that compares whether each bit matches, and when all the bits match, and when a predetermined number of bits or more match Outputs the comparison result that matches. Thereby, a plurality of data whose data IDs do not completely match can be handled as matching.

関連する複数のデータとは、例えばMPS100がエンジンを制御する場合、エンジンの状態を表す複数のデータである。ソースコードに複数のデータを関連付けておくことで、コンパイルにより自動的に一致したデータIDを付与することができる。また、データIDはコンパイラが付与するので、プログラム21のソースコードが修正された場合もプログラマが意識してデータIDを修正する必要がない。   For example, when the MPS 100 controls the engine, the plurality of related data is a plurality of data representing the state of the engine. By associating a plurality of data with the source code, it is possible to automatically give a matching data ID by compilation. Since the data ID is assigned by the compiler, it is not necessary for the programmer to correct the data ID even when the source code of the program 21 is corrected.

〔同時性の確保〕
使用IDレジスタ12a、12bを用いた、関連した複数データの同時性の確保について説明する。図3は、同時性を確保する処理において各レジスタに格納されるデータIDの遷移図を示す。
[Ensuring simultaneity]
The securing of the simultaneity of a plurality of related data using the use ID registers 12a and 12b will be described. FIG. 3 shows a transition diagram of the data ID stored in each register in the process of ensuring simultaneity.

使用IDレジスタ12aはCPUコア11aの、使用IDレジスタ12bはCPUコア11bの、アクセス要求に基づきデータIDを格納し、比較回路16はデータIDの格納の度に使用IDレジスタ12aと使用IDレジスタ12bのデータIDを比較し、CPUコア11は比較結果が一致を示す場合に、データテーブル22へのアクセスを保留する。   The use ID register 12a stores the data ID based on the access request of the CPU core 11a and the use ID register 12b stores the data ID based on the access request. The comparison circuit 16 uses the use ID register 12a and the use ID register 12b each time the data ID is stored. The CPU core 11 suspends access to the data table 22 when the comparison result indicates a match.

i)CPUコア11aが先に所定のデータIDのデータ(例えば、st_A.a)にアクセスした場合、使用IDレジスタ12aは当該データのデータID(例えば、「10」)を格納する。   i) When the CPU core 11a first accesses data (eg, st_A.a) having a predetermined data ID, the use ID register 12a stores the data ID (eg, “10”) of the data.

ii)ついで、CPUコア11bが所定のデータIDのデータ(例えば、st_A.b)にアクセスした場合、使用IDレジスタ12bは当該データのデータID(例えば、「10」)を格納する。   ii) Next, when the CPU core 11b accesses data of a predetermined data ID (for example, st_A.b), the use ID register 12b stores the data ID of the data (for example, “10”).

この間、CPUコア11aは例えば関連するデータであるst_A.a、st_A.bの更新処理を実行している。   During this time, the CPU core 11a performs, for example, update processing of st_A.a and st_A.b that are related data.

iii)比較回路16は、使用IDレジスタ12aと使用IDレジスタ12bのデータIDと比較した比較結果を出力するので、CPUコア11bは比較結果が一致を示す場合、RAM10へのアクセスを保留する。一致を示さない場合、CPUコア11bはRAM10へのアクセスを中断しないので、CPUコア11bは実行中のスレッドを処理できる。   iii) Since the comparison circuit 16 outputs the comparison result compared with the data ID of the usage ID register 12a and the usage ID register 12b, the CPU core 11b suspends access to the RAM 10 when the comparison result indicates a match. If the match is not indicated, the CPU core 11b does not interrupt the access to the RAM 10, so that the CPU core 11b can process the thread being executed.

iv)CPUコア11aがデータテーブル22にアクセスする度に、使用IDレジスタ12aはアクセスするデータのデータIDを格納(上書き)するので、CPUコア11aが関連しないデータにアクセスすると使用IDレジスタ12aも書き変わる。   iv) Each time the CPU core 11a accesses the data table 22, the use ID register 12a stores (overwrites) the data ID of the data to be accessed. Therefore, when the CPU core 11a accesses unrelated data, the use ID register 12a is also written. change.

v)比較回路16は所定のサイクル時間毎にデータIDの比較を繰り返し、CPUコア11bは比較結果が一致を示さなくなるとRAM10にアクセスする。   v) The comparison circuit 16 repeats the comparison of the data ID every predetermined cycle time, and the CPU core 11b accesses the RAM 10 when the comparison result does not indicate coincidence.

したがって、同時に更新することが必要な関連する複数のデータについて、CPUコア11aが更新処理等している間は、他のCPUコア11bは関連する複数のデータにアクセスできないので、関連する複数のデータの同時性を確保することができる。例えば、CPUコア11bは関連する複数のデータが更新された後に当該データにアクセスできるようになる。   Therefore, while the CPU core 11a is performing update processing or the like for a plurality of related data that needs to be updated at the same time, the other CPU cores 11b cannot access the related data. Simultaneity can be ensured. For example, the CPU core 11b can access the data after a plurality of related data is updated.

関連する複数データの記述を除きプログラム21に同時性を確保するための記述も必要ないため、プログラム21の工数の増大を抑制できる。また、CPUコア11のアクセスの禁止/許可を使用IDレジスタ12が制御するので、高速に処理でき、同時性確保の処理にかかるオーバーヘッドを最小限に抑制できる。   Since there is no need for a description for ensuring simultaneity in the program 21 except for the description of a plurality of related data, an increase in the man-hour of the program 21 can be suppressed. In addition, since the use ID register 12 controls the prohibition / permission of the access to the CPU core 11, processing can be performed at a high speed, and the overhead required for ensuring the simultaneity can be minimized.

また、関連するデータであるが構造体や配列にひとまとめにできないデータについては、構造体や配列の宣言に加え文法に従った記述を加えることで、構造体や配列に関連するデータとして扱われ同時性を確保できるので、関連するデータを柔軟に設定することができる。   In addition, related data that cannot be grouped into a structure or array is handled as data related to a structure or array by adding a description according to the grammar in addition to the declaration of the structure or array. Therefore, related data can be set flexibly.

〔RMW処理〕
使用IDレジスタ12a、12b、及び、使用RMWIDレジスタ13a、13bを用いたRMW処理時の排他処理について説明する。
[RMW processing]
Exclusion processing during RMW processing using the use ID registers 12a and 12b and the use RMWID registers 13a and 13b will be described.

コンパイラが認識できないRMW処理については、一連の処理がRMW処理であることをMPS100に検出させるため、プログラム21のソースコードにRMW処理であることを示す記述を加える。例えば、RMW処理の直前にRMW処理の開始を意味するRMW_start命令、直後にRMW処理の終了を意味するRMW_end命令、を記述する。
RMW_start
RMW処理(対象変数)
RMW_end
また、CPUコア11a、11bはRMW_start、RMW_end、を検出するRMW検出手段23a、23bをそれぞれ備える。CPUコア11a、11bは、RMW_startを検出すると、RMW処理の対象変数のデータIDを使用IDレジスタ12a、12b、使用RMWIDレジスタ13a、13bに格納する。なお、各RMW処理と対象変数はコンパイル時に対応づけられている。
For RMW processing that cannot be recognized by the compiler, a description indicating RMW processing is added to the source code of the program 21 in order to cause the MPS 100 to detect that the series of processing is RMW processing. For example, an RMW_start instruction that indicates the start of the RMW process is described immediately before the RMW process, and an RMW_end instruction that indicates the end of the RMW process is described immediately after.
RMW_start
RMW processing (target variable)
RMW_end
Further, the CPU cores 11a and 11b include RMW detection means 23a and 23b for detecting RMW_start and RMW_end, respectively. When detecting the RMW_start, the CPU cores 11a and 11b store the data ID of the target variable of the RMW process in the use ID registers 12a and 12b and the use RMWID registers 13a and 13b. Each RMW process and the target variable are associated at the time of compilation.

CPUコア11bがRMW処理を実行する場合では、使用IDレジスタ12bのデータIDはRMW処理の間、RMW処理に付随する処理のため次々と上書きされるが、使用RMWIDレジスタ13のデータIDはRMW_end命令が検出されるまで削除されない。   When the CPU core 11b executes the RMW process, the data ID of the use ID register 12b is overwritten one after another because of the process accompanying the RMW process during the RMW process, but the data ID of the use RMWID register 13 is RMW_end Will not be deleted until is detected.

したがって、RMW処理をしていない例えばCPUコア11aは、CPUコア11bがRMW処理をしている間、使用IDレジスタ12aと12bのデータIDが一致しない限り、データテーブル22へのアクセスできる。   Therefore, for example, the CPU core 11a not performing the RMW process can access the data table 22 while the CPU core 11b performs the RMW process as long as the data IDs of the use ID registers 12a and 12b do not match.

しかし、CPUコア11bがRMW処理を実行している間、他方のCPUコア11aがRMW処理の対象変数に書き込みしてしまうと不整合が生じるので、CPUコア11aは書き込み命令を実行する場合のみ、比較回路17に、使用IDレジスタ12aと使用RMWIDレジスタ13bのデータIDの比較を要求し、CPUコア11aは比較結果が一致を示す場合には書き込みを保留する。この構成により、RMW処理の間、他方のCPUコア11aは書き込み命令以外ではデータテーブル22にアクセスすることができる。なお、比較回路17,18はデータへのアクセスの度に比較結果を出力してもよい。   However, while the CPU core 11b is executing the RMW process, inconsistency occurs when the other CPU core 11a writes to the target variable of the RMW process, so the CPU core 11a only executes the write command. The comparison circuit 17 is requested to compare the data IDs of the use ID register 12a and the use RMWID register 13b, and the CPU core 11a suspends the writing when the comparison result indicates coincidence. With this configuration, during the RMW process, the other CPU core 11a can access the data table 22 except for a write command. The comparison circuits 17 and 18 may output a comparison result every time data is accessed.

図4の各レジスタに格納されるデータIDの遷移図を用いて、CPUコア11aがRMW処理する場合に、使用IDレジスタ12a、使用RMWIDレジスタ13aにデータIDが格納される手順を説明する。   A procedure for storing the data ID in the use ID register 12a and the use RMWID register 13a when the CPU core 11a performs the RMW process will be described with reference to the transition diagram of the data ID stored in each register of FIG.

i)RMW検出回路23aがRMW_startを検出すると、CPUコア11aは、RMW処理の対象変数(例えば、array[0])のデータID(例えば「22」)を使用IDレジスタ12a、使用RMWIDレジスタ13aのそれぞれに格納する。予めコンパイラは、例えばRMW_startの記述箇所にデータIDの格納命令を生成しておく。   i) When the RMW detection circuit 23a detects RMW_start, the CPU core 11a uses the data ID (eg, “22”) of the RMW processing target variable (eg, array [0]) in the use ID register 12a and the use RMWID register 13a. Store in each. For example, the compiler generates a data ID storage instruction in advance in, for example, a description location of RMW_start.

ii)ついで、CPUコア11aは、RMW処理に従い処理するその他のデータのデータIDを使用IDレジスタ12aに次々と格納する。このため、RMW処理の間は使用IDレジスタ12aに格納されるデータIDは変動することが多い。   ii) Next, the CPU core 11a successively stores data IDs of other data to be processed in accordance with the RMW process in the use ID register 12a. For this reason, the data ID stored in the use ID register 12a often fluctuates during RMW processing.

iii)ついで、CPUコア11bが所定のデータ(例えば、array[1])にアクセスした場合、CPUコア11bは使用IDレジスタ12bに当該データのデータID(例えば、「22」)を格納する。   iii) Next, when the CPU core 11b accesses predetermined data (for example, array [1]), the CPU core 11b stores the data ID (for example, “22”) of the data in the use ID register 12b.

iv)RMW処理の間は、使用IDレジスタ12aと12bに格納されたデータIDが一致しないことが多いため、使用IDレジスタ12aと12bに格納されるデータIDとが一致せず、CPUコア11bが当該データにアクセスできる。   iv) During the RMW process, the data IDs stored in the usage ID registers 12a and 12b often do not match, so the data IDs stored in the usage ID registers 12a and 12b do not match, and the CPU core 11b You can access the data.

ただし、CPUコア11bが書き込み命令を実行する場合のみ、CPUコア11bは検出回路18に使用IDレジスタ12bと使用RMWIDレジスタ13aのデータIDの比較を要求する。比較結果が一致を示す場合、CPUコア11bはデータテーブル22へのアクセスを保留する。一致しない場合、CPUコア11bはデータテーブル22へ書き込みでき、CPUコア11bは実行中のスレッドを処理できる。   However, only when the CPU core 11b executes a write command, the CPU core 11b requests the detection circuit 18 to compare the data IDs of the use ID register 12b and the use RMWID register 13a. If the comparison result indicates a match, the CPU core 11b suspends access to the data table 22. If they do not match, the CPU core 11b can write to the data table 22, and the CPU core 11b can process the thread being executed.

v)CPUコア11aは、RMW_endの前に必ずRMW処理の対象変数の加工結果をデータテーブル22に格納するため、使用IDレジスタ12aには対象変数のデータIDが格納されることになる。   v) Since the CPU core 11a always stores the processing result of the target variable of the RMW process in the data table 22 before RMW_end, the data ID of the target variable is stored in the use ID register 12a.

この結果、CPUコア11bがアクセスを保留していた場合、使用IDレジスタ12aと使用IDレジスタ12bには同じデータIDが格納されることになり、今度はCPUコア11aがデータテーブル22へのアクセスを禁止されてしまう。しかし、RMW処理の結果の格納を優先するため、書き込み命令実行時、CPUコア11aは比較回路19に使用IDレジスタ12aと使用RMWIDレジスタ13aのデータIDの比較を要求し、比較結果が一致を示す場合、CPUコア11aはデータテーブル22の対象変数へアクセスする。   As a result, when the CPU core 11b holds the access, the same data ID is stored in the use ID register 12a and the use ID register 12b, and this time the CPU core 11a accesses the data table 22. It will be prohibited. However, in order to give priority to storing the result of the RMW process, when executing the write command, the CPU core 11a requests the comparison circuit 19 to compare the data IDs of the use ID register 12a and the use RMWID register 13a, and the comparison result indicates coincidence. In this case, the CPU core 11a accesses the target variable of the data table 22.

vi)ついで、CPUコア11aがRMW_endを検出すると、CPUコア11aは使用IDレジスタ12a及び使用RMWIDレジスタ13aに格納した対象変数のデータIDを削除する。   vi) Next, when the CPU core 11a detects RMW_end, the CPU core 11a deletes the data ID of the target variable stored in the use ID register 12a and the use RMWID register 13a.

これにより、使用IDレジスタ12aと12bに格納されたデータIDが一致しないことになり、CPUコア11bは対象変数に書き込むことができるようになる。   As a result, the data IDs stored in the use ID registers 12a and 12b do not match, and the CPU core 11b can write to the target variable.

以上の手順により、コンパイラ等で認識できないRMW処理について排他処理を実現することができる。RMW処理の対象変数へのアクセスが発生しても、書き込み命令以外のアクセスは許可されるので、オーバーヘッドを最小限に抑制できるようになっている。また、書き込み命令時でも、RMW処理の対象変数へのアクセスに関してのみ排他処理を実行するため、RAM10全体をアクセス禁止することがなく、オーバーヘッドも低減できる。   With the above procedure, exclusive processing can be realized for RMW processing that cannot be recognized by a compiler or the like. Even if access to the target variable of RMW processing occurs, access other than the write command is permitted, so that overhead can be suppressed to a minimum. Further, even when a write command is issued, the exclusive process is executed only for access to the target variable of the RMW process, so that access to the entire RAM 10 is not prohibited and overhead can be reduced.

ところで、CPUコア11a及び11bが時間的に一部重複して同じRMW処理(すなわち対象変数も同じ)を実行する場合がある。   By the way, the CPU cores 11a and 11b may partially overlap in time and execute the same RMW processing (that is, the same target variable).

CPUコア11a CPUコア11b
RMW_start
RMW処理(対象変数) RMW_start
RMW_end RMW処理(対象変数)
RMW_end
この場合、CPUコア11aが先に対象変数を読み込むと共に書き込むが、その後にCPUコア11bが同じ対象変数を読み込みまた最後に書き込むため、対象変数の整合性の確保が困難となる。このため、例えば次のようにアクセスを制限する。
CPU core 11a CPU core 11b
RMW_start
RMW processing (target variable) RMW_start
RMW_end RMW processing (target variable)
RMW_end
In this case, the CPU core 11a reads and writes the target variable first. However, since the CPU core 11b reads and writes the same target variable after that, it is difficult to ensure the consistency of the target variable. For this reason, for example, access is restricted as follows.

使用RMWIDレジスタ13a又は13bのどちらかに先に対象変数のデータIDが格納されるので、RMW処理をこれから実行するCPUコア11は対象変数のデータIDと他方の使用RMWIDレジスタ13のデータIDを比較し、一致する場合には後からRMW処理するCPUコア11がアクセス(読み込み)を保留すればよい。   Since the data ID of the target variable is stored first in either the used RMWID register 13a or 13b, the CPU core 11 that will execute the RMW process will compare the data ID of the target variable with the data ID of the other used RMWID register 13. However, if they match, the CPU core 11 that performs RMW processing later may suspend access (reading).

以上のRMW処理におけるアクセスルールをまとめると次のように記載できる。ここでは、CPUコア11aがRMW処理を実行する状態を想定している。
A.使用IDレジスタ12aと使用IDレジスタ12bのデータIDが一致する場合は、CPUコア11a、11bのRAM10へのアクセスを禁止する。
B.但し、以下の場合はアクセスを許可する。
The access rules in the above RMW processing can be summarized as follows. Here, it is assumed that the CPU core 11a executes the RMW process.
A. When the data IDs of the usage ID register 12a and the usage ID register 12b match, the CPU cores 11a and 11b are prohibited from accessing the RAM 10.
B. However, access is permitted in the following cases.

b1:CPUコア11aが書き込み命令を実行する場合を想定すると、使用IDレジスタ12aと使用RMWIDレジスタ13aのデータIDが一致する場合。これにより、CPUコア11aはRMW処理の加工結果をデータテーブル22に書き込むことができる。   b1: When the case where the CPU core 11a executes a write command is assumed, the use ID register 12a and the use RMWID register 13a have the same data ID. Thereby, the CPU core 11a can write the processing result of the RMW process in the data table 22.

b2:CPUコア11bが書き込み命令を実行する場合を想定すると、使用IDレジスタ12bに値がないか、使用IDレジスタ12bと使用RMWIDレジスタ13aのデータIDが一致しない場合。これにより、CPUコア11bは、RMW処理の対象変数以外のデータを書き込むことができる。なお、使用IDレジスタ12bに値がないとは、例えばデータID(排他処理の必要ない)のないデータにアクセスする場合である。   b2: When the case where the CPU core 11b executes a write command is assumed, there is no value in the use ID register 12b, or the data IDs of the use ID register 12b and the use RMWID register 13a do not match. Thereby, the CPU core 11b can write data other than the target variable of the RMW process. The use ID register 12b has no value when, for example, accessing data without a data ID (exclusion processing is not required).

b3:CPUコア11aが読み込み命令を実行する場合を想定すると、使用IDレジスタ12aと使用RMDIDレジスタ13aのデータIDが一致し、かつ、使用IDレジスタ12aと使用IDレジスタ12b、使用IDレジスタ12aと使用RMWIDレジスタ13bのデータIDが一致しない場合。これにより、CPUコア11aはCPUコア11bが同じRMW処理を実行していない場合に対象変数を読み出すことができる。   b3: Assuming that the CPU core 11a executes a read instruction, the data IDs of the use ID register 12a and the use RMDID register 13a match, and the use ID register 12a, the use ID register 12b, and the use ID register 12a The data IDs in the RMWID register 13b do not match. Thereby, the CPU core 11a can read the target variable when the CPU core 11b is not executing the same RMW process.

b4:CPUコア11aが読み込み命令を実行する場合を想定すると、使用RMWIDレジスタ13aに値がない場合。使用RMWIDレジスタ13aに値がなければ、新たにRMW処理を実行できる。   b4: Assuming that the CPU core 11a executes a read instruction, the use RMWID register 13a has no value. If there is no value in the used RMWID register 13a, a new RMW process can be executed.

〔MPS100の処理手順〕
図5、6は、MPS100が同時性を確保し、また、RMW処理時に排他処理する手順を示すフローチャート図を示す。図5の処理は、例えばイグニッションオン等によりMPS100が起動するとスタートする。
[Processing procedure of MPS 100]
5 and 6 are flowcharts showing a procedure in which the MPS 100 ensures simultaneity and performs exclusive processing during RMW processing. The process shown in FIG. 5 starts when the MPS 100 is activated by, for example, ignition on.

CPUコア11a又は11bは、データテーブル22へのアクセス、又は、RMW_startが検出されたか否かを判定する(S1-1)。いずれも検出されなければ、ステップS1−1の判定を繰り返し、RMW_startが検出された場合、図6のステップS2−1に進む。   The CPU core 11a or 11b determines whether access to the data table 22 or RMW_start is detected (S1-1). If neither is detected, the determination in step S1-1 is repeated, and if RMW_start is detected, the process proceeds to step S2-1 in FIG.

CPUコア11aがデータテーブル22へのアクセスを検出したものとすると、CPUコア11aはアクセスするデータのデータIDを使用IDレジスタ12aに格納する(S1-2)。   If the CPU core 11a detects access to the data table 22, the CPU core 11a stores the data ID of the data to be accessed in the use ID register 12a (S1-2).

ついで、CPUコア11aは、使用IDレジスタ12aと使用RMWIDレジスタ13aのデータIDが一致するか否かを判定する(S1-3)。この判定はRMW処理の加工結果の書き込みを可能とするための判定である。   Next, the CPU core 11a determines whether or not the data IDs of the use ID register 12a and the use RMWID register 13a match (S1-3). This determination is a determination for enabling writing of the processing result of the RMW process.

すなわち、一致する場合(S1-3のYes)、CPUコア11aはプログラム21の指示するアクセスが書き込み命令か否かを判定し(S1-10)、書き込み命令である場合(S1-10のYes)は、RMW処理の加工結果を書き込むため、CPUコア11aはデータへアクセス(書き込み)する(S1-7)。なお、書き込み命令でない場合(S1-10のNo)、使用RMWIDレジスタ13aと使用IDレジスタ12aのデータIDが一致しない場合と同様に扱えるのでステップS1−4に進む。   That is, if they match (Yes in S1-3), the CPU core 11a determines whether the access instructed by the program 21 is a write command (S1-10), and if it is a write command (Yes in S1-10). The CPU core 11a accesses (writes) the data in order to write the processing result of the RMW process (S1-7). If it is not a write command (No in S1-10), it can be handled in the same manner as the case where the data IDs of the used RMWID register 13a and the used ID register 12a do not match, so the process proceeds to step S1-4.

一致しない場合(S1-3のNo)、CPUコア11aは、使用レジスタID12aと使用IDレジスタ12bのデータIDが一致するか否かを判定する(S1-4)。一致する場合(S1-4のYes)、CPUコア11aはデータへのアクセスを保留にして、ステップS1−4の判定を繰り返す(S1-5)。これにより、関連する複数データの同時性を確保できる。   If they do not match (No in S1-3), the CPU core 11a determines whether or not the data IDs in the use register ID 12a and the use ID register 12b match (S1-4). If they match (Yes in S1-4), the CPU core 11a suspends access to the data and repeats the determination in step S1-4 (S1-5). Thereby, the simultaneity of a plurality of related data can be secured.

使用レジスタID12aと使用IDレジスタ12bのデータIDが一致しない場合(S1-4のNo)、CPUコア11aはプログラム21の指示するアクセスが書き込み命令か否かを判定する(S1-6)。   If the data IDs of the use register ID 12a and the use ID register 12b do not match (No in S1-4), the CPU core 11a determines whether the access instructed by the program 21 is a write command (S1-6).

書き込み命令でない場合(S1-6のNo)、CPUコア11aはデータテーブル22のデータへのアクセスを実行する(S1-7)。   If it is not a write command (No in S1-6), the CPU core 11a accesses the data in the data table 22 (S1-7).

書き込み命令の場合(S1-6のYes)、CPUコア11aは使用IDレジスタ12aと使用RMWIDレジスタ13bのデータIDが一致するか否かを判定する(S1-8)。この判定により、CPUコア11bがRMW処理を実行中である場合CPUコア11bは対象変数の排他処理を実現できる。   In the case of a write command (Yes in S1-6), the CPU core 11a determines whether or not the data IDs in the use ID register 12a and the use RMWID register 13b match (S1-8). By this determination, when the CPU core 11b is executing the RMW process, the CPU core 11b can realize the exclusive process of the target variable.

したがって、一致する場合(S1-8のYes)、CPUコア11aはデータへのアクセスを保留にして、ステップS1−8の判定を繰り返す(S1-9)。   Therefore, if they match (Yes in S1-8), the CPU core 11a suspends access to the data and repeats the determination in step S1-8 (S1-9).

一致しない場合(S1-8のNo)、CPUコア11bはRMW処理をしていないか又はしていても対象変数とCPUコア11aがアクセスするデータが異なることになるので、CPUコア11aはデータへアクセスする(S1-7)。   If they do not match (No in S1-8), even if the CPU core 11b is not performing RMW processing or not, the target variable and the data accessed by the CPU core 11a are different. Access (S1-7).

図6のステップS2−1に進み、RMW_startが検出された場合、CPUコア11aは、RMW処理の対象変数のデータIDと使用RMWIDレジスタ13bのデータIDが一致するか否かを判定する(S2-1)。一致する場合(S2-1のYes)、CPUコア11aとCPUコア11bが同じ対象変数に対しRMW処理を実行しようとしていることになるので、CPUコア11aは、CPUコア11bのRMW処理が終了するまで(使用RMWIDレジスタ13bのデータIDが削除されるまで)、CPUコア11aはデータへのアクセスを保留にする(S2-8)。   Proceeding to step S2-1 in FIG. 6, when RMW_start is detected, the CPU core 11a determines whether or not the data ID of the target variable of the RMW process matches the data ID of the used RMWID register 13b (S2- 1). If they match (Yes in S2-1), the CPU core 11a and the CPU core 11b are about to execute the RMW process on the same target variable, so the CPU core 11a finishes the RMW process of the CPU core 11b. (Until the data ID of the used RMWID register 13b is deleted), the CPU core 11a suspends access to the data (S2-8).

一致しない場合(S2-1のYes)、CPUコア11aは、RMW処理の対象変数のデータIDを使用IDレジスタ12aに格納し(S2-2)、また、使用RMWIDレジスタ13aに格納する(S2-3)。   If they do not match (Yes in S2-1), the CPU core 11a stores the data ID of the target variable for RMW processing in the usage ID register 12a (S2-2) and also stores it in the usage RMWID register 13a (S2- 3).

ついで、CPUコア11aは、RMW処理の対象変数を読み出し(S2-4)、RMW処理に応じた演算処理を対象変数に施す(S2-5)。   Next, the CPU core 11a reads the target variable of the RMW process (S2-4), and performs arithmetic processing according to the RMW process on the target variable (S2-5).

演算処理が終了すると、CPUコア11aは対象変数をデータテーブル22に書き込む(S2-6)。ここでは、使用IDレジスタ12aと使用IDレジスタ12bのデータIDを比較しないので、これらが一致してもCPUコア11aはRMW処理の対象変数を優先的に書き込むことができる。   When the arithmetic processing is completed, the CPU core 11a writes the target variable to the data table 22 (S2-6). Here, since the data IDs of the usage ID register 12a and the usage ID register 12b are not compared, the CPU core 11a can preferentially write the target variable of the RMW process even if they match.

ついで、CPUコア11aは使用RMWIDレジスタ13aのデータIDを消去する(S2-7)。なお、使用IDレジスタ12aは上書きされるので消去してもしなくてもよい。   Next, the CPU core 11a deletes the data ID in the used RMWID register 13a (S2-7). Note that the use ID register 12a is overwritten and may or may not be erased.

以上説明したように、本実施形態のMPS100は、関連する複数のデータに同じデータIDが付与されるようにプログラム21を記述し、使用IDレジスタ12aと12bのデータIDが一致する場合には後から処理するCPUコア11のアクセスを禁止するので、関連する複数のデータの同時性を確保することができる。また、完全にデータIDが一致しなくてもデータIDが一部共通すれば、CPUコア11のアクセスを禁止するので、関連するデータを柔軟に設計することができる。   As described above, the MPS 100 of the present embodiment describes the program 21 so that the same data ID is assigned to a plurality of related data, and when the data IDs of the usage ID registers 12a and 12b match, Since the access of the CPU core 11 to be processed is prohibited, the simultaneity of a plurality of related data can be ensured. Further, even if the data IDs do not completely match, if the data IDs are partially in common, access to the CPU core 11 is prohibited, so that related data can be designed flexibly.

データの宣言とレジスタにより実現するので、プログラム21にアクセス制御の記述も不要で、かつ、高速に実行することができる。   Since it is realized by data declaration and register, the program 21 does not need to describe access control and can be executed at high speed.

また、RMW処理については、他方のCPUコア11が書き込む場合にのみ排他処理しRAM10全体へのアクセスは許可されているので、排他処理のオーバーヘッドを低減できる。コンパイラでは認識できないRMW処理についてもRMW処理の開始と終了を記述するだけで排他処理を実現できる。   Also, the RMW process is exclusive only when the other CPU core 11 writes, and access to the entire RAM 10 is permitted, so the overhead of the exclusive process can be reduced. For RMW processing that cannot be recognized by the compiler, exclusive processing can be realized simply by describing the start and end of the RMW processing.

なお、本実施形態ではCPUコア11を2つとしたが、3以上のCPUコア11を備えている場合はそれぞれのCPUコア11に使用IDレジスタ12、使用RMWIDレジスタ13を設け、他のCPUコア11のレジスタと比較できるように接続することで、本実施形態のMPS100を好適に実現できる。   In this embodiment, the number of CPU cores 11 is two. However, when three or more CPU cores 11 are provided, each CPU core 11 is provided with a use ID register 12 and a use RMWID register 13, and other CPU cores 11. The MPS 100 of this embodiment can be suitably realized by connecting so that it can be compared with this register.

マルチプロセッサシステムの概略構成図である。It is a schematic block diagram of a multiprocessor system. RAMに記憶されたデータテーブルの一例を示す図である。It is a figure which shows an example of the data table memorize | stored in RAM. 同時性を確保する処理において各レジスタに格納されるデータIDの遷移図である。It is a transition diagram of data ID stored in each register in the process of ensuring simultaneity. RMW処理において各レジスタに格納されるデータIDの遷移図である。It is a transition diagram of data ID stored in each register in RMW processing. マルチプロセッサシステムが同時性を確保し、また、RMW処理時に排他処理する手順を示すフローチャート図である。FIG. 11 is a flowchart showing a procedure for ensuring simultaneity by the multiprocessor system and performing exclusive processing during RMW processing. マルチプロセッサシステムが同時性を確保し、また、RMW処理時に排他処理する手順を示すフローチャート図である。FIG. 11 is a flowchart showing a procedure for ensuring simultaneity by the multiprocessor system and performing exclusive processing during RMW processing. 従来のRMW命令による処理の概念図、処理の同時性の概念図の一例である。It is an example of the conceptual diagram of the process by the conventional RMW instruction, and the conceptual diagram of the concurrency of a process.

符号の説明Explanation of symbols

10 RAM
11a、11b CPUコア
12a、12b 使用IDレジスタ
13a、13b 使用RMWIDレジスタ
14 処理分配回路
15 ROM
16、17、18、19、20 比較回路
21 プログラム
22 データテーブル
23a、23b RMW検出手段
100 マルチプロセッサシステム

10 RAM
11a, 11b CPU core 12a, 12b Use ID register 13a, 13b Use RMWID register 14 Processing distribution circuit 15 ROM
16, 17, 18, 19, 20 Comparison circuit 21 Program
22 Data table 23a, 23b RMW detection means 100 Multiprocessor system

Claims (6)

複数のCPUコアが並行してプログラムを実行するマルチプロセッサシステムにおいて、
第1CPUコアがアクセスするデータの第1データIDを格納する第1データIDレジスタと、第2CPUコアがアクセスする前記データの第2データIDを格納する第2データIDレジスタと、
予め関連する複数の前記データに、少なくとも一部が一致するデータIDを対応づけたデータテーブルを記憶する、複数の前記CPUコアが共有するデータテーブル記憶手段と、
第1データIDレジスタに格納された第1データIDと第2データIDレジスタに格納された第2データIDを比較するデータID比較手段と、
前記データID比較手段による比較結果が一致を示す場合、第1CPUコアと第2CPUコアのいずれか一方は前記データテーブルへのアクセスを保留する、
ことを特徴とするマルチプロセッサシステム。
In a multiprocessor system in which a plurality of CPU cores execute a program in parallel,
A first data ID register that stores a first data ID of data accessed by the first CPU core; a second data ID register that stores a second data ID of the data accessed by the second CPU core;
A data table storage means shared by a plurality of the CPU cores, which stores a data table in which a data ID at least a part of which corresponds to a plurality of the related data in advance is stored;
Data ID comparing means for comparing the first data ID stored in the first data ID register and the second data ID stored in the second data ID register;
If the comparison result by the data ID comparison means indicates a match, either the first CPU core or the second CPU core suspends access to the data table.
A multiprocessor system characterized by that.
前記データID比較手段は、第1データIDと第2データIDの一部が一致する場合、第1データIDと第2データIDが一致するとの比較結果を出力する、
ことを特徴とする請求項1記載のマルチプロセッサシステム。
The data ID comparing means outputs a comparison result that the first data ID and the second data ID match when a part of the first data ID and the second data ID match.
The multiprocessor system according to claim 1, wherein:
前記データIDは、前記データが記述されたソースコードをコンパイルするコンパイラにより付与される、
ことを特徴とする請求項2記載のマルチプロセッサシステム。
The data ID is given by a compiler that compiles a source code in which the data is described.
The multiprocessor system according to claim 2, wherein:
CPUコア毎に設けられた、所定処理の開始を検出する検出手段と、
第1CPUコアの前記検出手段が前記所定処理の開始を検出した場合、第1CPUコアが前記所定処理にてアクセスする対象変数の第1対象データIDを格納する第1所定処理データIDレジスタと、
第2CPUコアの前記検出手段が前記所定処理の開始を検出した場合、第2CPUコアが前記所定処理にてアクセスする対象変数の第2対象データIDを格納する第2所定処理データIDレジスタと、
第1データIDレジスタに格納された第1データIDと、第2所定処理データIDレジスタに格納された第2対象データIDとを比較する比較手段Aと、
第2データIDレジスタに格納された第2データIDと、第1所定処理データIDレジスタに格納された第1対象データIDが一致するか否かを判定する比較手段Bと、を有し、
第1CPUコアは、第1CPUコアが書き込み命令を実行する場合であって、かつ、比較手段Aによる比較結果が一致を示す場合、前記書き込み命令の実行を保留し、
第2CPUコアは、第2CPUコアが書き込み命令を実行する場合であって、かつ、判定手段Bによる比較結果が一致を示す場合、前記書き込み命令の実行を保留する、
ことを特徴とする請求項1記載のマルチプロセッサシステム。
Detection means provided for each CPU core for detecting the start of predetermined processing;
A first predetermined processing data ID register for storing a first target data ID of a target variable accessed by the first CPU core when the detection means of the first CPU core detects the start of the predetermined processing;
A second predetermined processing data ID register for storing a second target data ID of a target variable accessed by the second CPU core when the detection means of the second CPU core detects the start of the predetermined processing;
A comparison means A for comparing the first data ID stored in the first data ID register with the second target data ID stored in the second predetermined processing data ID register;
Comparing means B for determining whether or not the second data ID stored in the second data ID register matches the first target data ID stored in the first predetermined processing data ID register,
The first CPU core suspends execution of the write instruction when the first CPU core executes the write instruction and the comparison result by the comparison unit A indicates a match,
The second CPU core suspends execution of the write command when the second CPU core executes the write command and the comparison result by the determination unit B indicates a match.
The multiprocessor system according to claim 1, wherein:
第1CPUコアがアクセスするデータの第1データIDを格納する第1データIDレジスタと、
第2CPUコアがアクセスする前記データの第2データIDを格納する第2データIDレジスタと、
予め関連する複数の前記データに、少なくとも一部が一致するデータIDを対応づけたデータテーブルを記憶するた、複数の前記CPUコアが共有するデータテーブル記憶手段と、を有する、マルチプロセッサシステムの排他制御方法であって、
データID比較手段が、第1データIDレジスタに格納された第1データIDと第2データIDレジスタに格納された第2データIDを比較するステップと、
前記ステップの比較結果が一致を示す場合、第1CPUコアと第2CPUコアのいずれか一方は、前記データテーブルへのアクセスを保留するステップと、
を有することを特徴とするマルチプロセッサシステムの排他制御方法。
A first data ID register for storing a first data ID of data accessed by the first CPU core;
A second data ID register for storing a second data ID of the data accessed by the second CPU core;
Data table storage means for storing a data table in which a plurality of data related in advance are associated with data IDs that at least partially match, and a data table storage means shared by the plurality of CPU cores. A control method,
A step of comparing the first data ID stored in the first data ID register with the second data ID stored in the second data ID register;
If the comparison result of the step indicates a match, one of the first CPU core and the second CPU core suspends access to the data table;
An exclusive control method for a multiprocessor system, comprising:
請求項1〜4いずれか記載のマルチプロセッサシステムを搭載した車両用電子制御ユニット。
An electronic control unit for a vehicle on which the multiprocessor system according to claim 1 is mounted.
JP2007139555A 2007-05-25 2007-05-25 Multiprocessor system, exclusive control method, vehicle electronic control unit Expired - Fee Related JP4941103B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2007139555A JP4941103B2 (en) 2007-05-25 2007-05-25 Multiprocessor system, exclusive control method, vehicle electronic control unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2007139555A JP4941103B2 (en) 2007-05-25 2007-05-25 Multiprocessor system, exclusive control method, vehicle electronic control unit

Publications (2)

Publication Number Publication Date
JP2008293368A JP2008293368A (en) 2008-12-04
JP4941103B2 true JP4941103B2 (en) 2012-05-30

Family

ID=40168012

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007139555A Expired - Fee Related JP4941103B2 (en) 2007-05-25 2007-05-25 Multiprocessor system, exclusive control method, vehicle electronic control unit

Country Status (1)

Country Link
JP (1) JP4941103B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6293612B2 (en) * 2014-08-07 2018-03-14 本田技研工業株式会社 Vehicle control device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5835906A (en) * 1996-07-01 1998-11-10 Sun Microsystems, Inc. Methods and apparatus for sharing stored data objects in a computer system
US5893157A (en) * 1997-05-28 1999-04-06 International Business Machines Corporation Blocking symbol control in a computer system to serialize accessing a data resource by simultaneous processor requests
JP3965784B2 (en) * 1998-06-15 2007-08-29 株式会社日立製作所 Shared memory exclusive access control method
JP2003296128A (en) * 2002-03-29 2003-10-17 Fujitsu Ltd Thread execution unit
JP2004054906A (en) * 2003-05-21 2004-02-19 Hitachi Ltd Memory access method and computer system implementing the same

Also Published As

Publication number Publication date
JP2008293368A (en) 2008-12-04

Similar Documents

Publication Publication Date Title
JP4888272B2 (en) Software simulation method, software simulation program, and software simulation apparatus
US7434032B1 (en) Tracking register usage during multithreaded processing using a scoreboard having separate memory regions and storing sequential register size indicators
US8234476B2 (en) Information processing apparatus and method of updating stack pointer
JP2015518605A (en) Functional architecture patterns for safety applications
WO2012070137A1 (en) Processor, electronic control device, creation program
US7269820B2 (en) Program code generator and program
JPH08272686A (en) Method and system for collation of consistency of execution sequence of instruction
JP4941103B2 (en) Multiprocessor system, exclusive control method, vehicle electronic control unit
US20100088471A1 (en) Field device
US7191359B2 (en) Fail-safe controller
JP3965784B2 (en) Shared memory exclusive access control method
JP2001520415A (en) Method and apparatus for optimizing instruction execution
JP3458796B2 (en) Interruption instruction check device and recording medium
CN112364600A (en) Processor micro-architecture design verification method
JP2013200873A (en) Apparatus and method for processing invalid operation in prologue or epilogue of loop
JP2009238176A (en) Information processing apparatus and program verifying method
JP7579480B2 (en) Electronic control device and authentication method
US20260111555A1 (en) Method and device for secure booting of electronic control unit through mutual authentication
JP2023009818A (en) Electronic control device for vehicle and control method by electronic control device for vehicle
JP2014035741A (en) Electronic control device
JPS62168229A (en) Automatic recognizing system for system constitution
JP3381080B2 (en) Exclusive control method that can interrupt processing
JP2019159931A (en) Parallelization method, parallelization tool, and multicore microcomputer
US20210357285A1 (en) Program Generation Apparatus and Parallel Arithmetic Device
CN120872637A (en) Memory management method, device, embedded system, vehicle, medium and product

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20090723

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20120125

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: 20120131

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20120213

R151 Written notification of patent or utility model registration

Ref document number: 4941103

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20150309

Year of fee payment: 3

LAPS Cancellation because of no payment of annual fees