JP2005258607A - Processor capable of executing software short of synchronization instruction - Google Patents

Processor capable of executing software short of synchronization instruction Download PDF

Info

Publication number
JP2005258607A
JP2005258607A JP2004066544A JP2004066544A JP2005258607A JP 2005258607 A JP2005258607 A JP 2005258607A JP 2004066544 A JP2004066544 A JP 2004066544A JP 2004066544 A JP2004066544 A JP 2004066544A JP 2005258607 A JP2005258607 A JP 2005258607A
Authority
JP
Japan
Prior art keywords
instruction
processor
writing
synchronous
synchronization
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.)
Pending
Application number
JP2004066544A
Other languages
Japanese (ja)
Inventor
Yuji Chiba
雄司 千葉
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.)
Hitachi Ltd
Original Assignee
Hitachi 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 Hitachi Ltd filed Critical Hitachi Ltd
Priority to JP2004066544A priority Critical patent/JP2005258607A/en
Publication of JP2005258607A publication Critical patent/JP2005258607A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Multi Processors (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To acquire normal execution results acquirable unless synchronization instructions are missed, from software missing synchronization instructions. <P>SOLUTION: A processor 301 that provides synchronization instructions for both reading and writing makes the behavior of the writing synchronization instruction variable, and changes the behavior of the writing synchronization instruction to enable normal software execution (the same operation as with the synchronization instruction unmissed on the reading side) if only the writing side has the synchronization instruction even if the reading side misses the synchronization instruction. Specifically, the writing synchronization instruction has two operation modes. One (normal operation mode) enables normal software execution only if both reading and writing sides have the synchronization instructions, and the other (emergency operation mode) enables normal software execution if only the writing side has the synchronization instruction. <P>COPYRIGHT: (C)2005,JPO&NCIPI

Description

本発明は,電子回路の一種であるマイクロプロセッサに関する。   The present invention relates to a microprocessor which is a kind of electronic circuit.

キャッシュメモリを搭載するプロセッサを使って,マルチプロセッサ構成のコンピュータシステムを実現する場合に解決すべき問題に,キャッシュメモリの不整合がある。キャッシュメモリとは,プロセッサのメモリ参照を高速化するための記憶領域である。プロセッサがメモリ参照をおこなうにあたって,主記憶を参照すると,主記憶の記憶素子は大容量である代わりに動作が低速であることから,長い時間がかかる.そこで昨今のプロセッサは,メモリ参照を高速化するために,キャッシュメモリという高速小容量の記憶素子を搭載し,キャッシュメモリに主記憶の記憶内容の一部をコピーしておく。そして,メモリ参照にあたっては,まずキャッシュメモリに,参照したいアドレスに格納してある値のコピーがあるか調べ,あるならば高速なキャッシュメモリから値を読み取り,なければ低速な主記憶を参照する。主記憶を参照した際には,参照した値をキャッシュメモリに記憶し,次に同じアドレスを参照したときに,キャッシュメモリから参照できるようにする。参照した値をキャッシュメモリに記憶する際には,キャッシュメモリのどこかの領域を書き潰すことになる。書き潰した領域が主記憶のアドレスαに記憶してあった内容のコピーを保持していたとすると,書潰しの結果,プロセッサは次にアドレスαを参照するときには主記憶を参照することになる。キャッシュメモリに新しく値を書きこみ,古い値を書き潰すことを,キャッシュメモリの内容の入れ換えと呼ぶことにする。   A problem to be solved when implementing a multiprocessor computer system using a processor equipped with a cache memory is inconsistency in the cache memory. The cache memory is a storage area for speeding up the memory reference of the processor. When the processor performs memory reference, it takes a long time to refer to the main memory because the memory element of the main memory is slow in operation instead of having a large capacity. Therefore, recent processors have a high-speed and small-capacity storage element called a cache memory in order to speed up memory reference, and a part of the stored contents of the main memory is copied to the cache memory. When referring to the memory, first, the cache memory is checked for a copy of the value stored at the address to be referred to. If there is, the value is read from the high-speed cache memory, and if not, the low-speed main memory is referenced. When the main memory is referenced, the referenced value is stored in the cache memory so that it can be referenced from the cache memory the next time the same address is referenced. When the referenced value is stored in the cache memory, some area of the cache memory is overwritten. Assuming that the erasure area holds a copy of the contents stored at the address α in the main memory, as a result of the erasure, the processor will refer to the main memory the next time it refers to the address α. Writing a new value into the cache memory and crushing the old value is referred to as replacing the contents of the cache memory.

マルチプロセッサ構成のコンピュータで問題となるキャッシュメモリの不整合とは,個々のプロセッサが同じ主記憶のアドレスに記憶してある値として,それぞれのキャッシュメモリに,互いに異なる値を記憶した場合に発生する。この問題が発生する例を次に示す。まず,プロセッサAとプロセッサBからなるコンピュータシステムにおいて,プロセッサAが主記憶のアドレスαにある値をキャッシュメモリに記憶していたとする。ここでプロセッサBがアドレスαに値を書き込むと,次の条件が満たされた場合に,キャッシュメモリの不整合から問題が発生する。   Cache memory inconsistency, which is a problem in computers with multiple processors, occurs when different values are stored in each cache memory as values stored in the same main memory address by each processor. . The following is an example of this problem. First, in the computer system composed of the processor A and the processor B, it is assumed that the processor A stores the value at the address α in the main memory in the cache memory. Here, if the processor B writes a value at the address α, a problem occurs due to inconsistency of the cache memory when the following condition is satisfied.

条件とは,プロセッサBが値の書込みをキャッシュメモリに対してのみおこなうことである。昨今のプロセッサは,メモリへの書込みを高速化するために,メモリへの書込みを一旦,キャッシュメモリに対してのみおこない,キャッシュメモリの内容を入れ換える際に主記憶への書込みを実施する場合がある。こうすると,たとえば同じアドレスへの書込みが立て続けに発生した場合,主記憶への書込みは,最後に書き込んだ値のみで済むため,主記憶への書込みを減らし,メモリ参照を高速化できる。一方で主記憶への書込みを遅延すると,値を書き込んだことが他のプロセッサに伝わらないため,キャッシュメモリの不整合が発生する。キャッシュメモリの不整合は,解消しないとプログラムの実行結果がおかしくなりうるので,必ず解消する必要がある。   The condition is that the processor B only writes a value to the cache memory. In recent years, in order to speed up writing to the memory, the processor may write to the memory only once and then write to the main memory when replacing the contents of the cache memory. . In this way, for example, when writing to the same address occurs in succession, writing to the main memory requires only the last written value, so writing to the main memory can be reduced and memory reference can be speeded up. On the other hand, if the writing to the main memory is delayed, the fact that the value has been written is not transmitted to other processors, so that inconsistency of the cache memory occurs. If the cache memory inconsistency is not resolved, the execution result of the program may be wrong.

キャッシュメモリの不整合を解消するには,プロセッサBが値を主記憶に書きこめばよい。プロセッサに主記憶への書込みを強制するには,「書き側の同期命令」という命令を実行させればよい。書き側の同期命令はキャッシュのみに書き込んだ値を主記憶に書き出す役割を果たす。昨今のプロセッサは主記憶への参照を覗き見(スヌープ)する機能を備えているのが一般的であり,あるプロセッサが書き側の同期命令を実行し,主記憶への書出しを実施すると,他のプロセッサはスヌープ機能によって書出しを検知して,キャッシュメモリに書出し前の古い値を保持しているか調べ,保持していたら,古い値を棄てる。この結果,キャッシュメモリの不整合が解消される。   In order to eliminate the inconsistency of the cache memory, the processor B has only to write the value into the main memory. In order to force the processor to write to the main memory, an instruction “synchronous instruction on the writing side” may be executed. The synchronous instruction on the writing side plays a role of writing the value written only in the cache to the main memory. Modern processors generally have a function of peeping (snooping) references to main memory. When one processor executes a write-side synchronization instruction and writes to main memory, The processor detects the writing by the snoop function, checks whether the old value before writing is held in the cache memory, and discards the old value if held. As a result, the cache memory inconsistency is resolved.

なお,同期命令という語は,マルチプロセッサ構成のコンピュータシステムにおいて,プロセッサ間の相互干渉から発生する問題の解決を目的とする命令全般を指す。同期命令には様々な実装があり,キャッシュメモリの不整合を解消する「書き側の同期命令」の他に,「読み側の同期命令」を提供するプロセッサもある。   The term “synchronous instruction” refers to all instructions for the purpose of solving problems arising from mutual interference between processors in a multiprocessor computer system. There are various implementations of synchronous instructions, and there are processors that provide "synchronous instructions on the read side" in addition to "synchronous instructions on the write side" that resolve cache memory inconsistencies.

読み側の同期命令とは,命令のアウトオブオーダ実行から発生する問題の回避を目的としたものである。アウトオブオーダ実行とは,命令列に並ぶ命令を,並び順とは異なる順序で実行することを意味する。たとえば,命令列m1,m2をアウトオブオーダ実行すると,先にm2を実行して,あとからm1を実行することがある。アウトオブオーダ実行から発生する問題について,図1のプログラムを用いて説明する。図1のプログラムはプロセッサ間の通信を目的としたもので,変数dataに通信内容にあたるデータを書く側と,読む側に分かれている。データを書く側のプログラムでは,変数dataにデータを書き込んだら,書き側の同期命令syncを実行して,読む側のプロセッサに書き込んだデータを伝え,続いて変数flagをたて,データの読み込みを許可する。一方,読む側のプログラムは,変数flagを参照して,変数flagがたつまで待ち,たったら変数dataに書いてあるデータを読み取る。   The synchronous instruction on the reading side is intended to avoid problems that arise from out-of-order execution of instructions. Out-of-order execution means that instructions arranged in an instruction sequence are executed in an order different from the order of arrangement. For example, if instruction sequences m1 and m2 are executed out of order, m2 may be executed first and m1 may be executed later. Problems that arise from out-of-order execution will be described using the program of FIG. The program of FIG. 1 is intended for communication between processors, and is divided into a side for writing data corresponding to communication contents in a variable data and a side for reading. In the program that writes data, after writing data to the variable data, execute the synchronous instruction sync on the write side to transmit the written data to the processor on the reading side, and then set the variable flag to read the data. to approve. On the other hand, the reading program refers to the variable flag, waits until the variable flag is reached, and then reads the data written in the variable data.

図1のプログラムを,アウトオブオーダ実行をおこなう機能をもっているプロセッサで実行すると,書く側が書き込んだデータが,書き込んだ順番通りに読む側に伝わらないことがある。その原因は,アウトオブオーダ実行の結果,読む側において,変数flagを参照するより前に変数dataを参照しうることにある。具体的には,メモリの参照順序が図2の通りであるとき,読む側は,書く側がデータを書き込む前の変数dataの内容を参照してしまい,書く側が書き込んだデータは読む側に伝わらない。   When the program shown in FIG. 1 is executed by a processor having a function for executing out-of-order execution, data written by the writing side may not be transmitted to the reading side in the order of writing. The cause is that, as a result of out-of-order execution, the reader can refer to the variable data before referring to the variable flag. Specifically, when the memory reference order is as shown in FIG. 2, the reading side refers to the contents of the variable data before the data is written, and the data written by the writing side is not transmitted to the reading side. .

図1のプログラムにおいて,書く側が変数dataに書いた内容を確実に読む側に伝える方法はプロセッサによって異なる。読む側の同期命令を提供するプロセッサ(非特許文献1)向けの問題解決方法は,図1の読み側のプログラムについて,変数flagの読込みと変数dataの読込みの間に,読む側の同期命令を挿入することである。読む側の同期命令には命令のアウトオブオーダ実行を抑止する効果があり,変数flagの読込みと変数dataの読込みの間に挿入すれば,変数dataの読込みの実行が先になることを保証し,これにより書く側が変数dataに書いた内容を,読む側に確実に伝えることができる。   In the program shown in FIG. 1, the method in which the writing side reliably transmits the content written in the variable data to the reading side differs depending on the processor. The problem-solving method for the processor (Non-Patent Document 1) that provides the synchronization instruction on the reading side is that the synchronization instruction on the reading side is read between the reading of the variable flag and the reading of the variable data. Is to insert. The synchronous instruction on the reading side has the effect of suppressing the out-of-order execution of the instruction, and if it is inserted between the reading of the variable flag and the reading of the variable data, it guarantees that the reading of the variable data will be executed first. Thus, the content written in the variable data by the writer can be surely transmitted to the reader.

一方,読む側の同期命令を提供しないプロセッサ(非特許文献2)では,図1のプログラムに何の改変を加えなくても,書く側が変数dataに書いた内容は,読む側に確実に伝わる。これは読む側の同期命令を提供しないプロセッサでは,書く側の同期命令に,読む側のアウトオブオーダ実行をキャンセルする効果があるからである。   On the other hand, in a processor (Non-Patent Document 2) that does not provide a synchronous instruction on the reading side, the contents written in the variable data are surely transmitted to the reading side without any modification to the program of FIG. This is because in a processor that does not provide a reading-side synchronization instruction, the writing-side synchronization instruction has the effect of canceling the reading-side out-of-order execution.

プロセッサごとに同期命令の実現が異なることは,異なるプロセッサ向けにソフトウェアを移植する際に障害となる。具体的には,書く側の同期命令だけを提供するプロセッサ向けに開発したソフトウェアを,読む側と書く側(両側)の同期命令を提供するプロセッサ向けに移植する際に,読み側に同期命令を挿入し忘れることがある。たとえば,書く側の同期命令だけを提供するプロセッサ向けに開発した図1のプログラムを移植する際に,フラグの読込みとデータの読込みの間に読む側の同期命令を挿入し忘れる。この挿入し忘れの発生は、読む側の同期命令を挿入すべきプログラム中の位置を自動的に検出して挿入するといった自動処理が困難で、膨大な行数のプログラムに対して人手で挿入箇所を決めていることに起因する。同期命令を挿入し忘れても,ソフトウェアは一見正常に動作することが多い。なぜなら同期命令の挿入忘れから障害が発生するか否かは,タイミングによるところが大きいからである。たとえば図1のプログラムから問題が発生するためには,図2のタイミングでメモリ参照が起きる必要がある。   Different implementations of synchronous instructions for each processor is an obstacle to porting software to different processors. Specifically, when porting software developed for a processor that provides only a synchronous instruction on the writing side to a processor that provides a synchronous instruction on the reading side and the writing side (both sides), the synchronous instruction is sent to the reading side. You may forget to insert. For example, when porting the program of FIG. 1 developed for a processor that provides only the synchronization instruction on the writing side, forgetting to insert the synchronization instruction on the reading side between reading the flag and reading the data. This forgetting to insert is difficult to automatically detect and insert the position in the program where the reading-side synchronization instruction should be inserted. Due to the decision. Even if you forget to insert a synchronization command, the software often works normally. This is because whether or not a failure occurs due to forgetting to insert a synchronous instruction depends largely on the timing. For example, in order to cause a problem from the program of FIG. 1, it is necessary to refer to the memory at the timing of FIG.

同期命令を挿入し忘れたソフトウェアが,一見正常に動作した結果,ソフトウェアを移植した企業の品質検査をパスして販売され,該ソフトウェアを購入した企業が,該ソフトウェアを長期間運用して初めて問題が露見するケースがままある。運用を開始したソフトウェアに欠陥が見つかると,修正までの期間,運用を停止することから,膨大な経済的損失が発生しうる。このため,同期命令の挿入忘れのように,運用が始まるまで見つかりにくい問題については,問題が露見した場合に,迅速に対処するための対策が重要になる。   As a result of software that has forgotten to insert a synchronization instruction at first glance functioning normally, it is sold after passing the quality inspection of the company that transplanted the software. There are still some cases where the If a defect is found in the software that has started operation, the operation is stopped during the period until the correction, and a huge economic loss can occur. For this reason, for problems that are difficult to find until operation begins, such as forgetting to insert a synchronous instruction, it is important to take measures to quickly deal with the problem when it is revealed.

IBM Microelectronics, MOTOROLA: "PowerPC Microprocessor Family: The Programming Environments," 1996IBM Microelectronics, MOTOROLA: "PowerPC Microprocessor Family: The Programming Environments," 1996 Gerry Kane: "PA-RISC 2.0 ARCHITECTURE," Prentice-Hall, 1996Gerry Kane: "PA-RISC 2.0 ARCHITECTURE," Prentice-Hall, 1996

本発明の目的は読み側の同期命令を挿入し忘れたソフトウェアを正常に実行できるプロセッサを提供することにある。   An object of the present invention is to provide a processor that can normally execute software for which a synchronization instruction on the reading side is forgotten to be inserted.

両側の同期命令を提供するプロセッサにおいて,書き側の同期命令の挙動を可変にし,書き側の同期命令の挙動を変更することにより,書き側にだけ同期命令があれば,読み側の同期命令が欠落していても,ソフトウェアを正常に実行可能にする(読み側の同期命令が欠落していない場合と同様に動作するようにする)。具体的には,書き側の同期命令に2つの動作モードを設け,その一方(通常の動作モード)では読み書き双方に同期命令がある場合にのみソフトウェアを正常に実行でき,もう一方(緊急動作モード)では書き側にだけ同期命令があればソフトウェアを正常に実行できるようにする。ソフトウェアに,読み側の同期命令が欠落している欠陥が見つかった場合には,ユーザの指定によりプロセッサの動作モードを緊急動作モードに切り替える。書き側の同期命令の挙動を可変にするために,プロセッサ内部に書き側の同期命令の挙動を指定する記憶領域を設ける。プロセッサは書き側の同期命令を実行する際に,該記憶領域を参照し,記憶領域の値が緊急動作モードであった場合には,書き側の同期命令の実行を完了するまでの遅延を延長する。
ここで、書き側の同期命令の実行を完了するまでの遅延とは、書き側の同期命令に関して,その実行を開始してから,実行が完了するまでに経過する時間(何クロック経過するか)を指し、その長さが動作モードによって変わる。本発明では、「緊急動作モード」に設定されている場合の遅延は、「通常の動作モード」に設定されている場合の遅延よりも長く設定される。
In a processor that provides synchronous instructions on both sides, by changing the behavior of the synchronous instruction on the writing side and changing the behavior of the synchronous instruction on the writing side, if there is a synchronous instruction only on the writing side, the synchronous instruction on the reading side Make the software run correctly even if it is missing (make sure it works as if the synchronization instruction on the reading side is not missing). Specifically, there are two operation modes for the write side synchronous instruction, and one (normal operation mode) can execute the software normally only when there is a synchronous instruction for both reading and writing, and the other (emergency operation mode). ) If there is a synchronization instruction only on the writing side, the software can be executed normally. If a defect is found in the software that is missing the synchronization instruction on the reading side, the processor operation mode is switched to the emergency operation mode as specified by the user. In order to make the behavior of the synchronous instruction on the writing side variable, a storage area for specifying the behavior of the synchronous instruction on the writing side is provided in the processor. The processor refers to the storage area when executing the write side synchronous instruction, and if the value of the storage area is in the emergency operation mode, the delay until the execution of the write side synchronous instruction is extended. To do.
Here, the delay until the execution of the write side synchronous instruction is completed, the time elapsed from the start of execution of the write side synchronous instruction until the execution is completed (how many clocks are passed) And its length varies depending on the operation mode. In the present invention, the delay when the “emergency operation mode” is set is set longer than the delay when the “normal operation mode” is set.

遅延の延長により,キャッシュメモリがスヌープ機構を備えていれば,書き込んだ値が他プロセッサのキャッシュメモリに伝わるまでの時間を確保し,キャッシュメモリの整合性を保つことが可能になる。また,遅延の延長により,他のプロセッサがアウトオブオーダ実行している読込み命令の実行完了を待つことが可能になる。この結果,読み側の同期命令が欠落したソフトウェアを実行した際にも,読み側の同期命令がある場合と同じ実行結果を取得可能になる。   By extending the delay, if the cache memory has a snoop mechanism, it is possible to secure the time until the written value is transmitted to the cache memory of another processor and to maintain the consistency of the cache memory. Further, due to the extension of the delay, it becomes possible to wait for the completion of the execution of the read instruction being executed out of order by another processor. As a result, even when software that lacks the synchronization instruction on the reading side is executed, it is possible to obtain the same execution result as when there is a synchronization instruction on the reading side.

同期命令を挿入し忘れたソフトウェアを正常に実行可能になる。   Software that has forgotten to insert a synchronization instruction can be executed normally.

プロセッサにおいて、同期命令を挿入し忘れたソフトウェアを正常に実行可能にするため、書き側の同期命令の挙動を可変とする。   In the processor, the behavior of the synchronous instruction on the writing side is made variable so that the software that has forgotten to insert the synchronous instruction can be executed normally.

図3に本発明のプロセッサ301を含むコンピュータの例を示す。図3のコンピュータでは,バス302上にプロセッサ301と主記憶303,DVD−ROM読取装置304など外部記憶装置が接続されており,DVD−ROM305など外部記憶に記録してあるプログラムを,バス302を経由して主記憶303に読みこみ,プロセッサ301で実行する。   FIG. 3 shows an example of a computer including the processor 301 of the present invention. In the computer of FIG. 3, an external storage device such as a processor 301, a main memory 303, and a DVD-ROM reader 304 is connected on a bus 302, and a program recorded in an external storage such as a DVD-ROM 305 is loaded on the bus 302. Then, the data is read into the main memory 303 and executed by the processor 301.

プロセッサ301の中にはメモリインタフェース306や命令解釈部307,レジスタ群308,命令実行部309がある。プロセッサはこれらの要素を使い,次の手順でプログラムの実行を進める。まず,命令解釈部307は次に実行すべき命令のアドレスを保持するレジスタPC310が格納する値を,配線311を経由して取得し,取得したアドレスにある命令をメモリインタフェース306経由で取得する。そして取得した命令の内容を解釈し,その内容に応じて,命令実行部309にある論理回路に命令を実行するよう指示して,命令の実行完了報告を待つ。たとえば命令が,同期命令の動作を指定する記憶領域に,値を記録する命令であれば,命令実行部309の中にある,同期モード指定命令実行回路312に命令の実行を命じる。同期モード指定命令実行回路312は,レジスタに値を読み込む命令を実行する既存の論理回路と同様の論理回路で実現できる。同期モード指定命令実行回路312は,配線313経由で同期モード指定レジスタ314,つまり前述の記憶領域に値を設定する。本実施例では、書き側の同期命令に2つの動作モード(通常の動作モード、緊急動作モード)を設ける構成とするため、同期モード指定レジスタ314は、1ビット情報が格納できる記憶領域であればよい。   The processor 301 includes a memory interface 306, an instruction interpretation unit 307, a register group 308, and an instruction execution unit 309. The processor uses these elements and proceeds to execute the program in the following procedure. First, the instruction interpretation unit 307 acquires the value stored in the register PC 310 that holds the address of the next instruction to be executed via the wiring 311, and acquires the instruction at the acquired address via the memory interface 306. Then, the contents of the acquired instruction are interpreted, and according to the contents, the instruction execution unit 309 is instructed to execute the instruction and waits for an instruction execution completion report. For example, if the instruction is an instruction that records a value in a storage area that designates the operation of the synchronous instruction, the instruction execution unit 309 is instructed to execute the instruction. The synchronous mode designation instruction execution circuit 312 can be realized by a logic circuit similar to an existing logic circuit that executes an instruction for reading a value into a register. The synchronous mode designation command execution circuit 312 sets a value in the synchronous mode designation register 314, that is, the above-described storage area via the wiring 313. In this embodiment, since two operation modes (normal operation mode and emergency operation mode) are provided for the write-side synchronization instruction, the synchronization mode designation register 314 is a storage area that can store 1-bit information. Good.

命令解釈部307は,取得した命令が,書き側の同期命令syncであれば命令実行部309の中にある,書き側の同期命令実行回路315に命令の実行を命じる。書き側の同期命令実行回路315は,配線313経由で,本発明の同期モード指定レジスタ314の値を参照してその動作を変更する。   If the acquired instruction is a synchronous instruction sync on the writing side, the instruction interpretation unit 307 instructs the synchronous instruction executing circuit 315 on the writing side to execute the instruction in the instruction executing unit 309. The write side synchronous instruction execution circuit 315 changes its operation with reference to the value of the synchronous mode designation register 314 of the present invention via the wiring 313.

図4、図5を用いて、本実施例の書き側の同期命令実行回路315の実現方法を、それぞれ説明する。   A method for realizing the synchronous instruction execution circuit 315 on the writing side according to this embodiment will be described with reference to FIGS.

まず,書き側の同期命令実行回路315の動作内容(同期命令の実行を完了するまでの遅延を変更する機能の動作内容)を,図4に示す。図4において,書き側の同期命令実行回路315は,まず,同期モード指定レジスタ314の値に依存しない処理401を実行し,次に,同期モード指定レジスタ314の値に依存する,本発明の処理402を実行する。依存しない処理401の動作内容は,既存の両側の同期命令を提供するプロセッサにおける,書き側の同期命令を実行する際の処理内容と同一である。同期モード指定レジスタ314の値に依存する,本発明の処理402では,まず,判断403で同期モード指定レジスタ314の値を参照し,値が通常か否か判定し,通常であれば動作を終了し,通常でなければ遅延処理404を実行する。同期モード指定レジスタ314の値を設定するには,同期モード指定レジスタ314を含むプロセッサの内部状態を設定する命令を実行する。遅延処理404では,まず処理405で遅延カウンタcの値を遅延クロック数に初期化する。遅延クロック数はプロセッサに固有な値で,プロセッサがメモリへの書込み命令を実施してから,該書込みが他プロセッサに伝わり,他プロセッサが次に読込命令を実施する際に,書込み前の古い値を読み込まないと保証できるまでにかかる最悪クロック数として与えられる。次に判断406でカウンタcの値が0より大きいか調べ,大きければ処理407に進み,大きくなければ遅延処理404を終了する。処理407ではカウンタcの値を1減じ,続く処理408でクロック線316を参照して次のクロックを待ってから,判断406に戻る。なお,本発明の処理402は単純な順序回路で実現できる。   First, the operation content of the write side synchronous instruction execution circuit 315 (the operation content of the function for changing the delay until the execution of the synchronous instruction is completed) is shown in FIG. In FIG. 4, the synchronous instruction execution circuit 315 on the writing side first executes a process 401 that does not depend on the value of the synchronous mode designation register 314, and then the process of the present invention that depends on the value of the synchronous mode designation register 314. 402 is executed. The operation contents of the independent process 401 are the same as the process contents when executing the write-side synchronization instruction in the existing processor that provides the synchronization instructions on both sides. In the process 402 of the present invention, which depends on the value of the synchronization mode specification register 314, first, the value of the synchronization mode specification register 314 is referred to in a decision 403 to determine whether or not the value is normal. If it is not normal, a delay process 404 is executed. To set the value of the synchronization mode specification register 314, an instruction for setting the internal state of the processor including the synchronization mode specification register 314 is executed. In the delay process 404, first, in process 405, the value of the delay counter c is initialized to the number of delay clocks. The number of delay clocks is a value specific to the processor. When the processor executes a write instruction to the memory, the write is transmitted to the other processor, and when the other processor executes the read instruction next time, the old value before the write is performed. Is given as the worst number of clocks it takes to guarantee that Next, in decision 406, it is checked whether the value of the counter c is greater than 0. If it is larger, the process proceeds to process 407, and if not larger, the delay process 404 is terminated. In process 407, the value of the counter c is decremented by 1, and in the subsequent process 408, the clock line 316 is referred to wait for the next clock, and then the process returns to decision 406. Note that the process 402 of the present invention can be realized by a simple sequential circuit.

図4の動作をおこなう同期命令実行回路315を持つ本発明のプロセッサ101では,同期モード指定レジスタ314の値を緊急動作モードにした状態ならば,図1のプログラムにおいて,書く側が変数dataに書込んだデータを読む側に確実に伝えることができる。なぜなら,図1のプログラムにおいて,書く側が変数dataに書込んだデータが読む側に伝わらない条件は,図2の順番で読み書きが発生することだが,緊急動作モードでは図2の順番で読み書きが発生しないからである。図2では,まず読む側がアウトオブオーダ実行により,変数dataの中身を読み(処理201),次に書く側が2つの書込みを実施するが(処理202、処理203),2つの書込みの間には,書く側の同期命令syncがある。緊急動作モードであれば,syncの終了までに長い時間がかかるので,syncが終了する前に,必ず読む側が変数flagの読込みを完了する。この緊急動作モードの場合におけるメモリ参照の順序を図8に示す。まず読む側が、アウトオブオーダ実行により変数dataからデータを読み込み(処理801)、書く側が、変数dataに書込みを実行する(処理802)。その後、書く側の同期命令syncが実行されるが、この同期命令はプロセッサ毎に設定された遅延カウンタcだけ遅延され、この間に読む側の変数flagの読込みは必ず完了される(処理804)。このとき読む側が読み込んだ変数flagの値はfalseである。図1のプログラムから判るように,読み込んだ変数flagの値がfalseであるということは、読む側がまだ変数dataの値を読むことを許可されていないことを意味する。そこで読む側のプログラムは再び変数flagを参照しにゆく。さて、図8に戻り、書く側のプログラムは遅延カウンタcに基づく所定の時間経過後に、書く側は変数flagに真値を書き込む(処理803)。そのあとで読む側のプログラムがアウトオブオーダ実行されている場合は、読む側が変数dataの値を読み込み(処理805)、読む側は変数flagの値を読み込む(処理806)。読む側が変数flagの値を読み込むと(処理806)、その値が真値になっているが、このとき読む側が処理805で読み込んだ変数dataの値は、確かに書き側が処理802で書き込んだ値になっている。アウトオブオーダ実行により、処理805の命令が処理803の命令より前に実行された場合でも、読む側が処理805で読み込む変数dataの値は、書き側が処理802で書き込んだ値となり、正しく動作する。   In the processor 101 of the present invention having the synchronous instruction execution circuit 315 that performs the operation of FIG. 4, if the value of the synchronous mode designation register 314 is in the emergency operation mode, the writer writes in the variable data in the program of FIG. The data can be reliably communicated to the reader. This is because, in the program of FIG. 1, the condition in which the data written to the variable data is not transmitted to the reading side is that reading and writing occur in the order of FIG. 2, but in the emergency operation mode, reading and writing occur in the order of FIG. Because it does not. In FIG. 2, first, the reading side reads out the contents of the variable data by executing out-of-order execution (process 201), and the next writing side performs two writes (process 202 and process 203). , There is a synchronization instruction sync on the writing side. In the emergency operation mode, since it takes a long time to finish the sync, the reading side always completes the reading of the variable flag before the sync ends. FIG. 8 shows the order of memory reference in the emergency operation mode. First, the reading side reads data from the variable data by out-of-order execution (processing 801), and the writing side executes writing to the variable data (processing 802). Thereafter, the synchronous instruction sync on the writing side is executed. This synchronous instruction is delayed by a delay counter c set for each processor, and the reading of the variable flag on the reading side is surely completed during this time (process 804). At this time, the value of the variable flag read by the reading side is false. As can be seen from the program of FIG. 1, that the value of the read variable flag is “false” means that the reading side is not yet permitted to read the value of the variable “data”. Therefore, the program on the reading side goes to the variable flag again. Returning to FIG. 8, the writing program writes a true value in the variable flag after a predetermined time based on the delay counter c has elapsed (process 803). After that, when the program on the reading side is executed out of order, the reading side reads the value of the variable data (process 805), and the reading side reads the value of the variable flag (process 806). When the reading side reads the value of the variable flag (processing 806), the value becomes a true value. At this time, the reading side reads the value of the variable data read in the processing 805, but the writing side surely writes the value written in the processing 802. It has become. Even when the instruction of the process 805 is executed before the instruction of the process 803 due to out-of-order execution, the value of the variable data read by the process 805 on the reading side becomes the value written by the process 802 on the reading side and operates correctly.

この結果として,図2のタイミングで読み書きが発生することはなくなり,書く側が変数dataに書込んだデータを読む側に確実に伝わる。   As a result, reading / writing does not occur at the timing of FIG. 2, and the writing side is surely transmitted to the reading side of the data written in the variable data.

なお,図4の処理404では,定数(遅延クロック数)回のクロック分だけ遅延を発生するが,遅延の長さはプロセッサ間で調停して決めることもできる。たとえば,syncを実行するプロセッサが,バス302を経由して他のプロセッサに,アウトオブオーダ実行中の読込み命令が終了したら返信してくれるよう依頼し,返信を受けた段階でsyncの実行を完了することもできる。   In the process 404 of FIG. 4, a delay is generated by a constant (number of delay clocks) times, but the length of the delay can be determined by arbitrating between processors. For example, a processor that executes sync requests another processor via the bus 302 to return a read instruction during execution of out-of-order, and completes the execution of the sync when the reply is received. You can also

次に,書き側の同期命令実行回路315の動作内容(ハードウェアトラップを発生する機能の動作内容)を,図5に示す。   Next, FIG. 5 shows the operation content of the write side synchronous instruction execution circuit 315 (operation content of a function that generates a hardware trap).

図5は,図4の遅延処理404を,トラップ発生処理504に変えたものである。トラップ発生処理504の実現は,トラップを発生する命令の既存の実現に準じる。図5の動作をおこなう書き側の同期命令実行回路315は,同期モード指定レジスタ314の値が通常でなければトラップを発生する。トラップを発生した際に,オペレーティングシステムがトラップを捕捉し,遅延を発生させるなどしたあとで,トラップを発生したsyncの次の命令から実行を再開すれば,図5の動作による同期命令実行回路315の実現でも,読み側の同期命令の不足から問題が発生することはなくなる。   FIG. 5 is obtained by replacing the delay process 404 of FIG. 4 with a trap generation process 504. The realization of the trap generation process 504 is in accordance with the existing realization of the instruction that generates a trap. The write side synchronous instruction execution circuit 315 that performs the operation of FIG. 5 generates a trap if the value of the synchronous mode designation register 314 is not normal. When the trap is generated, if the operating system captures the trap and generates a delay, and then resumes execution from the instruction next to the sync that generated the trap, the synchronous instruction execution circuit 315 according to the operation of FIG. Even with the implementation of, there will be no problem due to the lack of synchronization instructions on the reading side.

次に、同期命令の動作を指定する記憶領域に,値を記録するソフトウェアの実施例を図6に示す。図6のソフトウェアは初期化処理601と残りの処理602からなり,初期化処理601の内部にコマンドラインオプション解析処理603がある。コマンドラインオプション解析処理603の内部にある同期モード指定処理604において,同期命令の動作を指定する記憶領域に動作モードを示す値を記録させる命令(同期モード指定命令)を実行する。同期モード指定処理604の実施例を図7に示す。図7の処理では,まず判断701で,ユーザがアプリケーションの起動時にコマンドラインオプション-Emergencyを指定したか検査し,指定していたら処理702に進んで同期モード指定命令を使って同期モード指定レジスタの値を「緊急」にセットし,指定していなかったら処理703に進んで,同期モード指定命令を使って同期モード指定レジスタの値を「通常」にセットする。図7の処理を実行した結果,ユーザがアプリケーションの起動時にコマンドラインオプション-Emergencyを指定していたならば,図6の処理602の内部に読み側の同期命令を挿入し忘れている箇所があったとしても,図6のソフトウェアは読み側の同期命令がきちんと挿入してある場合と同様の動作をおこなうことが可能になる。   Next, FIG. 6 shows an embodiment of software for recording a value in a storage area for designating the operation of the synchronous instruction. The software shown in FIG. 6 includes an initialization process 601 and the remaining process 602. The initialization process 601 includes a command line option analysis process 603. In a synchronous mode designation process 604 inside the command line option analysis process 603, a command (synchronous mode designation command) for recording a value indicating the operation mode in a storage area for designating the operation of the synchronous command is executed. FIG. 7 shows an embodiment of the synchronization mode designation processing 604. In the process of FIG. 7, first, in the determination 701, it is checked whether or not the user has specified the command line option -Emergency at the time of starting the application, and if so, the process proceeds to the process 702 and the synchronization mode specification register is used. If the value is set to “emergency” and not specified, the process proceeds to step 703, and the value of the synchronization mode specification register is set to “normal” using a synchronization mode specification command. As a result of executing the processing of FIG. 7, if the user has specified the command line option -Emergency at the time of starting the application, there is a portion forgetting to insert the reading-side synchronization instruction in the processing 602 of FIG. Even so, the software shown in FIG. 6 can perform the same operation as when the reading-side synchronization instruction is properly inserted.

サーバにおいて,本発明を利用することで,ソフトウエアの欠陥を修復可能になる。   By utilizing the present invention in the server, it becomes possible to repair software defects.

プロセッサ間の通信プログラムCommunication program between processors 問題が発生するメモリ参照順序Memory reference order in which the problem occurs 本発明を利用するコンピュータComputer utilizing the present invention 書込み側の同期命令の挙動Behavior of synchronous instruction on write side 書込み側の同期命令の挙動Behavior of synchronous instruction on write side 同期モードを指定する機能を有するアプリケーションソフトウェアApplication software with a function to specify the synchronization mode 同期モード指定処理Synchronization mode specification processing 遅延処理によるメモリ参照順序Memory reference order by delay processing

符号の説明Explanation of symbols

301 プロセッサ
302 バス
303 主記憶
304 DVD−ROM読取装置
305 DVD−ROM
306 メモリインタフェース
307 命令解釈部
308 レジスタ群
309 命令実行部
310 プログラムカウンタPC
311 配線
312 同期命令実行回路
313 配線
314 同期モード指定レジスタ
315 クロック信号線
301 Processor 302 Bus 303 Main Memory 304 DVD-ROM Reader 305 DVD-ROM
306 Memory interface 307 Instruction interpretation unit 308 Register group 309 Instruction execution unit 310 Program counter PC
311 Wiring 312 Synchronous instruction execution circuit 313 Wiring 314 Synchronization mode designation register 315 Clock signal line

Claims (7)

プロセッサ間の通信に用いられる同期命令の動作を指定する記憶領域を有するプロセッサ。 A processor having a storage area for specifying an operation of a synchronous instruction used for communication between processors. 請求項1記載のプロセッサにおいて、
前記同期命令の動作を指定する記憶領域に,値を記録する命令を提供し,該命令を実行する機能を有するプロセッサ。
The processor of claim 1, wherein
A processor having a function of providing an instruction for recording a value in a storage area for designating the operation of the synchronous instruction and executing the instruction.
プロセッサの有するプロセッサ間の通信に用いられる同期命令の動作を指定する記憶領域に値を記録する命令により、該記憶領域に,値を記録するプログラム。 A program for recording a value in a storage area in accordance with an instruction for recording a value in a storage area for designating an operation of a synchronous instruction used for communication between processors of the processor. 請求項1記載のプロセッサにおいて、
同期命令の実行にあたり,前記記憶領域を参照し,該記憶領域に記録してある値により,同期命令の実行を完了するまでの遅延を変更する機能を有するプロセッサ。
The processor of claim 1, wherein
A processor having a function of referring to the storage area when executing a synchronous instruction and changing a delay until the execution of the synchronous instruction is completed according to a value recorded in the storage area.
請求項1記載のプロセッサにおいて、
同期命令の実行にあたり,前記記憶領域を参照し,該記憶領域に記録してある値により,ハードウェアトラップを発生する機能を有するプロセッサ。
The processor of claim 1, wherein
A processor having a function of referring to the storage area and generating a hardware trap according to a value recorded in the storage area when executing a synchronous instruction.
請求項1記載のプロセッサにおいて、
前記同期命令の動作は複数モードあり、それぞれの動作モードにおける同期処理に必要なサイクル数が異なることを特徴とするプロセッサ。
The processor of claim 1, wherein
2. The processor according to claim 1, wherein the operation of the synchronization instruction has a plurality of modes, and the number of cycles required for the synchronization processing in each operation mode is different.
請求項1記載のプロセッサにおいて、
前記同期命令の動作は複数モードあり、そのうちの1つの動作モードでは、同期処理に要するサイクル数が可変であることを特徴とするプロセッサ。
The processor of claim 1, wherein
The operation of the synchronous command has a plurality of modes, and in one of the operation modes, the number of cycles required for the synchronous processing is variable.
JP2004066544A 2004-03-10 2004-03-10 Processor capable of executing software short of synchronization instruction Pending JP2005258607A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004066544A JP2005258607A (en) 2004-03-10 2004-03-10 Processor capable of executing software short of synchronization instruction

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2004066544A JP2005258607A (en) 2004-03-10 2004-03-10 Processor capable of executing software short of synchronization instruction

Publications (1)

Publication Number Publication Date
JP2005258607A true JP2005258607A (en) 2005-09-22

Family

ID=35084284

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004066544A Pending JP2005258607A (en) 2004-03-10 2004-03-10 Processor capable of executing software short of synchronization instruction

Country Status (1)

Country Link
JP (1) JP2005258607A (en)

Similar Documents

Publication Publication Date Title
US6223228B1 (en) Apparatus for synchronizing multiple processors in a data processing system
US20070101318A1 (en) Multi-core-model simulation method, multi-core model simulator, and computer product
WO2016106935A1 (en) Flash memory controller and control method for flash memory controller
JP6312550B2 (en) Semiconductor device
JP2007257441A (en) Processor and processor control method
JP5811245B1 (en) Information processing apparatus, memory order guarantee method, and program
JP2006113689A (en) Bus bridge device and data transfer method
JP2006079345A (en) Microcomputer
JP5578811B2 (en) Information processing apparatus, information processing apparatus control method, and program
US6249880B1 (en) Method and apparatus for exhaustively testing interactions among multiple processors
US6230263B1 (en) Data processing system processor delay instruction
JP4382833B2 (en) Processor
JP2005258607A (en) Processor capable of executing software short of synchronization instruction
JPH07182170A (en) Microprocessor
JP2017146703A (en) Shared memory control circuit and shared memory control method
JP4806577B2 (en) Trace data recording device
JP2005165825A (en) Trace information recorder
JP3067408B2 (en) Diagnosis method of memory access control device
JP5850732B2 (en) Semiconductor device and control method thereof
JP2007213131A (en) Microprocessor and memory access system
JP6645467B2 (en) Microcomputer
JP2008003786A (en) Logic simulation method and its device
JPH0784827A (en) Trace device
JP2024111758A (en) Information processing device and information processing program
JP5121134B2 (en) Simulation apparatus and simulation method

Legal Events

Date Code Title Description
RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20060424