JPH05143454A - Cache control system - Google Patents

Cache control system

Info

Publication number
JPH05143454A
JPH05143454A JP3318553A JP31855391A JPH05143454A JP H05143454 A JPH05143454 A JP H05143454A JP 3318553 A JP3318553 A JP 3318553A JP 31855391 A JP31855391 A JP 31855391A JP H05143454 A JPH05143454 A JP H05143454A
Authority
JP
Japan
Prior art keywords
memory
cache
shared
cache memory
access
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP3318553A
Other languages
Japanese (ja)
Other versions
JP3219810B2 (en
Inventor
Kiyoshi Sudo
清 須藤
Kiminari Ogura
仁成 小椋
Tatsuya Yamaguchi
達也 山口
Yasutomo Sakurai
康智 桜井
Koichi Odawara
孝一 小田原
Takumi Nonaka
巧 野中
Eiji Kanetani
英治 金谷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP31855391A priority Critical patent/JP3219810B2/en
Publication of JPH05143454A publication Critical patent/JPH05143454A/en
Application granted granted Critical
Publication of JP3219810B2 publication Critical patent/JP3219810B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Abstract

PURPOSE:To effectively utilize a cache memory even when accessing any specified area on a shared memory for the exclusive control of shared resources in a data processor provided with a cache memory. CONSTITUTION:When a processor 1a reads a specified area 4a on a shared memory 4 for the exclusive control of shared resources 4b by a specified operation, it is discriminated whether the copy of the specified area 4a is held in a cache memory 1b or not and when it is held, the copy of the specified area 4a is read from the cache memory 1b. When the copy of the specified area 4a is not held in the cache memory 1b, the specified area 4a on the shared memory 4 is read and updated at the same time, and data before the update are returned to the side of a data processor 3 as read data. These read data are inputted to the cache memory 1b and held.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は複数のデータ処理装置が
共通の資源をアクセスするデータ処理システムのキャッ
シュ制御方式に関し、特に、共通の資源の排他制御のた
めのメモリ上の特定領域をキャッシュに取り込むための
制御方式に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a cache control method for a data processing system in which a plurality of data processing devices access a common resource, and more particularly to a cache for a specific area on a memory for exclusive control of the common resource. Control method for capturing.

【0002】[0002]

【従来の技術】複数のデータ処理装置が共有の資源をア
クセスする場合の共有資源の排他制御は、一般に複数の
データ処理装置がアクセスするメモリ上の特定領域に対
し、1回のメモリアクセスによりテストと更新を行う特
定のオペレーションにより実現されている。
2. Description of the Related Art Exclusive control of a shared resource when a plurality of data processing devices access a shared resource is generally tested by a single memory access to a specific area on a memory accessed by the plurality of data processing devices. And it is realized by a specific operation that updates.

【0003】上記特定領域は通常「セマフォ領域」と呼
ばれる。また、このオペレーションには、上記セマフォ
領域上の特定の1ビットのリードとセットを1回のメモ
リアクセスにより行う「テスト・アンド・セット」と呼
ばれる方法や、セマフォ領域の値が特定値の場合のみ他
の値に置き換える操作を1回のメモリアクセスにより行
う「コンペア・アンド・スワップ」と呼ばれる方法があ
る。特に、「テスト・アンド・セット」における上記特
定ビットはセマフォビットと呼ばれる。
The specific area is usually called a "semaphore area". In addition, this operation is only available when the specified 1-bit read and set on the semaphore area is performed by a single memory access, or when the value of the semaphore area is a specific value. There is a method called "compare and swap" in which the operation of replacing with another value is performed by one memory access. In particular, the specific bit in "test and set" is called a semaphore bit.

【0004】ある装置がリードしたセマフォビットが0
なら、対応する共有資源は他装置に占有されていないこ
とを意味し、自装置にアクセス権が得られる。同時にア
クセス権を得た装置はセマフォビットに1を書き込むの
で、他装置はその共有資源に対して、アクセス権を得る
ことができない。上記自装置による共有資源に対するア
クセスが終了すると、その装置はセマフォビットをクリ
アする。以後の「テスト・アンド・セット」の操作にお
けるセマフォビットリードにおいては、0がリードされ
るため他装置はその共有資源に対してアクセス権を得る
ことができる。
The semaphore bit read by a device is 0
If so, it means that the corresponding shared resource is not occupied by another device, and the own device can obtain the access right. At the same time, the device that has acquired the access right writes 1 to the semaphore bit, so that another device cannot acquire the access right to the shared resource. When the access to the shared resource by the device itself ends, the device clears the semaphore bit. In the semaphore bit read in the subsequent “test and set” operation, 0 is read, so that the other device can obtain the access right to the shared resource.

【0005】上記の「テスト・アンド・セット」におい
ては、セマフォビットのリードとライトが1回のメモリ
アクセスにより行われるので、一方の装置がセマフォビ
ットをリードしたのち1をセットする前に他装置がセマ
フォビットをリードしてしまい、同時に複数の装置が共
有資源に対してアクセス権を得るということはない。
「コンペア・アンド・スワップ」においても一回のメモ
リアクセスにより、上記操作を行っているので、「テス
ト・アンド・セット」と同様の排他制御が実現できる。
In the above-mentioned "test and set", since the semaphore bit is read and written by one memory access, one device reads the semaphore bit and then the other device sets it. Does not read the semaphore bit, and multiple devices do not simultaneously gain access to the shared resource.
Even in the "compare and swap", the above operation is performed by one memory access, so that the exclusive control similar to the "test and set" can be realized.

【0006】ところで、従来においては、データ処理装
置にキャッシュメモリが設けられている場合であって
も、上記「テスト・アンド・セット」や「コンペア・ア
ンド・スワップ」を行う場合、キャッシュメモリを使わ
ず、共有メモリを直接アクセスすることにより実現して
いた。これは、上記「テスト・アンド・セット」や「コ
ンペア・アンド・スワップ」においては、1回の操作に
より、セマフォ領域のリードと更新を行っているため、
もし、ある装置が「テスト・アンド・セット」時、リー
ドしたセマフォビット0をキャッシュに書き込んだとす
ると、このセマフォビット0は更新前のものであり、上
記装置は0をリードすると同時に主記憶装置のセマフォ
ビットに1を書き込むから、キャッシュと主記憶装置の
セマフォビットの内容が一致しないという問題が生じる
ためである。
By the way, conventionally, even when the data processing device is provided with a cache memory, the cache memory is used when performing the above-mentioned "test and set" or "compare and swap". Instead, it was realized by directly accessing the shared memory. This is because the "test and set" and "compare and swap" described above read and update the semaphore area with a single operation.
If a device writes the read semaphore bit 0 to the cache during “test and set”, this semaphore bit 0 is the one before update, and the device reads 0 and at the same time the semaphore bit of the main memory device is read. This is because writing 1 to the bit causes a problem that the contents of the semaphore bits of the cache and the main memory do not match.

【0007】また、キャッシュは通常複数ワードのブロ
ック単位で構成されているため、通常のメモリアクセス
においては、ブロック単位のリードが有効であるが、セ
マフォビットのリード、ライトにおいては、1ビット単
位のデータのリード、ライトであり、余計なデータをも
含むブロック単位のリードを行うと、かえって遅くなり
性能の低下につながるという欠点があった。
Further, since the cache is usually constructed in units of blocks of a plurality of words, reading in units of blocks is effective in normal memory access. However, in reading and writing semaphore bits, it is in units of 1 bit. There is a drawback in that reading and writing of data, and reading in block units including extra data is rather slow and leads to deterioration in performance.

【0008】しかしながら、上記のように共有資源を複
数の装置が頻繁にアクセスする場合、「テスト・アンド
・セット」の操作も頻繁に行われることとなる。そし
て、一方の装置が共有資源のアクセス権を得ている間、
他の装置がその共有資源のアクセス権を得たい場合、一
方の装置がセマフォビットをクリアするまで、「テスト
・アンド・セット」の操作を繰り返すこととなる。この
「テスト・アンド・セット」の操作はキャッシュを使わ
ず、直接メモリにアクセスすることとなるから、メモリ
の使用率が著しく高まり、メモリビジイにより、他の装
置のメモリアクセスが待たされる確率が高くなり、シス
テム全体の効率が低下するという欠点があった。
However, when a plurality of devices frequently access the shared resource as described above, the "test and set" operation is also frequently performed. And while one device gains access to the shared resource,
If another device wants to gain access to the shared resource, it will repeat the "test and set" operation until one device clears the semaphore bit. This "test and set" operation directly accesses the memory without using the cache, which significantly increases the memory usage rate and increases the probability of waiting for the memory access of another device due to the memory busy. However, there is a drawback that the efficiency of the entire system is reduced.

【0009】[0009]

【発明が解決しようとする課題】本発明は上記従来技術
の欠点を改善するためになされたものであって、キャッ
シュメモリを持つデータ処理装置において、「テスト・
アンド・セット」などの特定のオペレーションにより、
共有資源を排他制御するため共有メモリ上の特定領域を
アクセスする場合にもキャッシュメモリを有効に活用で
きるようにすることにより、システムの効率を向上する
ことを目的にする。
SUMMARY OF THE INVENTION The present invention has been made in order to solve the above-mentioned drawbacks of the prior art. In a data processing device having a cache memory, the "test
Certain operations such as "and set"
An object of the present invention is to improve the efficiency of the system by enabling effective use of the cache memory even when accessing a specific area on the shared memory for exclusive control of the shared resource.

【0010】[0010]

【課題を解決するための手段】上記課題を解決するため
本発明の請求項1のものは、図1に示すように、キャッ
シュメモリ1bを備えたデータ処理装置1と、複数のデ
ータ処理装置1,3がアクセスする共有の資源4bと共
有メモリ4を持ち、共有メモリ4上に設けられた特定領
域4aを1回のメモリアクセスによりテストと更新を行
う特定のオペレーションにより共有資源4bの排他制御
を実現しているデータ処理装置1,3におけるキャッシ
ュ制御方式において、上記特定オペレーションにより、
共有メモリ4上の特定領域4aをリードする際、その特
定領域4aのコピーを保持するキャッシュメモリ1bを
アクセスし、そのキャッシュメモリ1bに特定領域4a
のコピーが存在しなかった場合は共有メモリ4上の特定
領域4aをリードしてデータ処理装置1内のプロセッサ
1aに送出するとともに、キャッシュメモリ1bにも書
き込み、キャッシュメモリ1bに特定領域4aのコピー
が存在する場合には、キャッシュメモリ1bのみにアク
セスして共有メモリ4にはアクセスせず、他のデータ処
理装置3が共有メモリ4の特定領域4aにライトを行っ
た場合には、キャッシュメモリ1bを無効化するキャッ
シュ制御手段1cを備えている。請求項2のものは請求
項1において、特定オペレーションにより、共有メモリ
4上の特定領域4aをリードする際、その特定領域4a
のコピーを保持するキャッシュメモリ1bをアクセス
し、そのキャッシュメモリ1bに特定領域4aのコピー
が存在しなかった場合は共有メモリ4上の特定領域4a
をリードしてデータ処理装置1のプロセッサ1aに送出
し、その特定領域4aが他のデータ処理装置3による共
有資源4bのアクセス中であることを示す特定値であっ
た場合にのみ特定値をキャッシュメモリ1bにライトす
る機能をキャッシュ制御手段1cに設けている。請求項
3のものは請求項1において、特定オペレーションによ
り、共有メモリ4上の特定領域4aをリードする際、そ
の特定領域4aのコピーを保持するキャッシュメモリ1
bをアクセスし、そのキャッシュメモリ1bに特定領域
4aのコピーが存在しなかった場合は共有メモリ4上の
特定領域4aをリードしてデータ処理装置1のプロセッ
サ1aに送出するとともに、キャッシュメモリ1bに他
のデータ処理装置3による共有資源4bのアクセス中で
あることを示す特定値に置き換えた値をライトする機能
をキャッシュ制御手段1cに設けている。請求項4のも
のは請求項1又は請求項2又は請求項3において、キャ
ッシュメモリ1bが通常のメモリアクセスにおけるキャ
ッシュメモリとしても用いられるように構成したもので
あり、請求項5のものは請求項4において、特定オペレ
ーションにおけるキャッシュヒット判定と通常のメモリ
アクセスに於けるキャッシュヒット判定とを切り分ける
手段を備えたものである。また、請求項6のものは請求
項4又は請求項5において、特定オペレーションにおけ
るキャッシュミスヒット時のキャッシュメモリ1bへの
データの書き込みと通常のメモリアクセスにおけるキャ
ッシュミスヒット時のキャッシュメモリ1bへのデータ
の書き込みとを切り分ける手段を備えたものである。
In order to solve the above problems, the first aspect of the present invention is, as shown in FIG. 1, a data processing device 1 having a cache memory 1b, and a plurality of data processing devices 1. , 3 have a shared resource 4b accessed by the shared memory 4 and a specific area 4a provided on the shared memory 4 is tested and updated by a single memory access to perform exclusive control of the shared resource 4b. In the cache control method in the realized data processing devices 1 and 3, by the above specific operation,
When the specific area 4a on the shared memory 4 is read, the cache memory 1b holding a copy of the specific area 4a is accessed and the specific area 4a is stored in the cache memory 1b.
When there is no copy of the specified area 4a, the specified area 4a on the shared memory 4 is read and sent to the processor 1a in the data processing device 1 and also written to the cache memory 1b, and the specified area 4a is copied to the cache memory 1b. Exists, the cache memory 1b is accessed only and the shared memory 4 is not accessed. If another data processing device 3 writes to the specific area 4a of the shared memory 4, the cache memory 1b is accessed. Cache control means 1c for invalidating According to a second aspect of the present invention, when the specific area 4a on the shared memory 4 is read by the specific operation according to the first aspect, the specific area 4a is read.
When the cache memory 1b holding a copy of the specified area is accessed and there is no copy of the specified area 4a in the cache memory 1b, the specified area 4a on the shared memory 4 is accessed.
Is sent to the processor 1a of the data processing device 1, and the specific value is cached only when the specific area 4a is a specific value indicating that the shared resource 4b is being accessed by another data processing device 3. The cache control means 1c has a function of writing to the memory 1b. A third aspect of the present invention is the cache memory 1 according to the first aspect, which holds a copy of the specific area 4a when the specific area 4a on the shared memory 4 is read by the specific operation.
b is accessed, and when there is no copy of the specific area 4a in the cache memory 1b, the specific area 4a in the shared memory 4 is read and sent to the processor 1a of the data processing device 1 and also to the cache memory 1b. The cache control means 1c is provided with a function of writing a value replaced with a specific value indicating that the shared resource 4b is being accessed by another data processing device 3. According to claim 4, claim 1 or claim 2 or claim 3 is configured such that the cache memory 1b is also used as a cache memory in a normal memory access, and claim 5 claims 4 is provided with a means for discriminating between a cache hit determination in a specific operation and a cache hit determination in a normal memory access. According to claim 6, in claim 4 or 5, data is written to the cache memory 1b at the time of a cache miss in a specific operation and data is written to the cache memory 1b at the time of a cache miss in a normal memory access. It is provided with a means for separating writing from.

【0011】[0011]

【作用】プロセッサ1aが特定オペレーションにより、
共有メモリ4の特定領域4aをリードする場合、特定領
域4aのコピーがキャッシュメモリ1bに保持されてい
るか否かを判別し、保持されている場合には、キャッシ
ュメモリ1bより、特定領域4aのコピーをリードす
る。また、キャッシュメモリ1bに特定領域4aのコピ
ーが保持されていない場合には、共有メモリ4上の特定
領域4aのリードとその更新を同時に行い、更新する前
のデータをリードデータとしてデータ処理装置側にかえ
す。このリードデータはキャッシュメモリ1bに入力さ
れ保持される。共有メモリ4上の特定領域4aのリード
とその更新を同時に行うため、共有メモリ4の特定領域
4aとキャッシュメモリ1bの特定領域4aのコピーは
異なったものとなるが、通常特定領域4aを再度アクセ
スするのは、共有資源4bの占有権の獲得に失敗した場
合であり、この場合には、共有メモリ4の特定領域4a
とキャッシュ12に保持される特定領域4aのコピーは
一致しているので問題はない。なお、請求項2のよう
に、共有メモリ4上の特定領域4aのリードとその更新
を同時に行う際、その特定領域4aが他のデータ処理装
置3による共有資源4bのアクセス中であることを示す
特定値であった場合にのみキャッシュメモリ1bにライ
トすることにより、共有メモリ4の特定領域4aとキャ
ッシュメモリ1bに保持される特定領域4aのコピーの
一致性を保つことができる。また、上記場合において、
請求項3のように、他のデータ処理装置3による共有資
源4bのアクセス中であることを示す特定値に置き換え
た値をキャッシュメモリ1bにライトすることにより、
共有メモリ4のデータが常にキャッシュに登録され、再
度のリードの場合でも高速にアクセスすることができ
る。
The processor 1a performs a specific operation,
When reading the specific area 4a of the shared memory 4, it is determined whether or not a copy of the specific area 4a is held in the cache memory 1b, and if it is held, a copy of the specific area 4a is made from the cache memory 1b. To lead. If the cache memory 1b does not hold a copy of the specific area 4a, the specific area 4a on the shared memory 4 is read and updated at the same time, and the data before the update is used as read data on the data processing device side. Change back. This read data is input and held in the cache memory 1b. Since the specific area 4a on the shared memory 4 is read and updated at the same time, the copies of the specific area 4a of the shared memory 4 and the specific area 4a of the cache memory 1b are different, but the normal specific area 4a is accessed again. When the acquisition of the exclusive right of the shared resource 4b fails, in this case, the specific area 4a of the shared memory 4 is
Since there is a match between the copy of the specific area 4a held in the cache 12 and the copy, there is no problem. It is to be noted that, when reading and updating the specific area 4a on the shared memory 4 at the same time as in claim 2, it is shown that the specific area 4a is accessing the shared resource 4b by another data processing device 3. By writing to the cache memory 1b only when it is the specific value, it is possible to maintain the consistency between the copy of the specific area 4a of the shared memory 4 and the copy of the specific area 4a held in the cache memory 1b. In the above case,
As described in claim 3, by writing to the cache memory 1b a value replaced with a specific value indicating that the shared resource 4b is being accessed by another data processing device 3,
The data in the shared memory 4 is always registered in the cache, and high-speed access is possible even when reading again.

【0012】[0012]

【実施例】図2は本発明の全体構成を示す図である。同
図において、11−1,11−2はデータ処理装置、1
2は共通バス、13はメモリ制御回路、14は共有メモ
リ、20はプロセッサ、21はキャッシュ制御回路、2
2はキャッシュメモリ、23はメモリインタフェース、
24−1はアドレスバス、24−2はアクセス情報バ
ス、25はデータバス、26はキャッシュ制御信号、2
7はキャッシュ無効化アドレスバス、28−1はメモリ
データバス、31はセマフォ制御回路、41はセマフォ
領域、42は排他制御すべき共有資源である。
FIG. 2 is a diagram showing the overall construction of the present invention. In the figure, 11-1, 11-2 are data processing devices, 1
2 is a common bus, 13 is a memory control circuit, 14 is a shared memory, 20 is a processor, 21 is a cache control circuit, 2
2 is a cache memory, 23 is a memory interface,
24-1 is an address bus, 24-2 is an access information bus, 25 is a data bus, 26 is a cache control signal, 2
7 is a cache invalidation address bus, 28-1 is a memory data bus, 31 is a semaphore control circuit, 41 is a semaphore area, and 42 is a shared resource to be exclusively controlled.

【0013】同図において、複数のデータ処理装置11
−1,11−2が共通バス12、メモリ制御回路13を
介して、共有メモリ14に接続される。共有メモリ14
上には複数のデータ処理装置11−1,11−2がアク
セスする共有資源42およびその排他制御を行うための
セマフォ領域41が設けられる。なお、この実施例にお
いては、共有資源42が共有メモリ14上に設けられて
いるが、共有資源は例えばI/Oなど他の資源でもよ
い。
In the figure, a plurality of data processing devices 11
-1, 11-2 are connected to the shared memory 14 via the common bus 12 and the memory control circuit 13. Shared memory 14
A shared resource 42 accessed by the plurality of data processing devices 11-1 and 11-2 and a semaphore area 41 for exclusive control of the shared resource 42 are provided above the shared resource 42. Although the shared resource 42 is provided on the shared memory 14 in this embodiment, the shared resource may be another resource such as I / O.

【0014】メモリ制御回路13はデータ処理装置11
−1,11−2のメモリ・アクセスを制御するめの手段
であり、メモリ制御回路13には共有資源に対する排他
制御を行うためのセマフォ制御回路31が設けられ、セ
マフォ制御回路31は共有メモリ14に対して、テスト
・アンド・セット・アクセスを行う。データ処理装置1
1−1,11−2内には、共有メモリ14上のブロック
データあるいはセマフォバイトを保持するためのキャッ
シュ制御回路21およびキャッシュメモリ22が設けら
れている。プロセッサ20は共有メモリ14にアクセス
する際、アクセスするアドレスのデータがキャッシュメ
モリ22上に保持されている場合には、キャッシュメモ
リ22からデータをリードする。
The memory control circuit 13 is a data processing device 11.
-1, 11-2 are means for controlling memory access, and the memory control circuit 13 is provided with a semaphore control circuit 31 for performing exclusive control on shared resources. For test and set access. Data processing device 1
A cache control circuit 21 and a cache memory 22 for holding block data or semaphore bytes on the shared memory 14 are provided in the 1-1 and 11-2. When accessing the shared memory 14, the processor 20 reads data from the cache memory 22 if the data of the address to be accessed is held in the cache memory 22.

【0015】メモリインタフェース23はデータ処理装
置11−1,11−2と共通バスの間のインターフェー
スをとる手段であり、アドレスバス24−1はプロセッ
サ20がメモリ・アクセスをする際アドレス信号を送出
するバス、アクセス情報バス24−2は通常のメモリ・
アクセスかテスト・セット・アクセスなのかの種類を示
す情報を出力するバス、データバス25はデータを出力
するバスである。
The memory interface 23 is means for interfacing between the data processors 11-1 and 11-2 and the common bus, and the address bus 24-1 sends out an address signal when the processor 20 makes a memory access. The bus and access information bus 24-2 is a normal memory
The data bus 25 is a bus for outputting information indicating the type of access or test set access, and the data bus 25 is a bus for outputting data.

【0016】キャッシュ制御信号26はキャッシュメモ
リ22を制御するための信号、キャッシュ無効化アドレ
スバス27は他のデータ処理装置がメモリをアクセスし
た際のアドレスを送出するバス、メモリデータバス28
−1は共有メモリ14からのリードデータが送出される
バスである。
A cache control signal 26 is a signal for controlling the cache memory 22, a cache invalidation address bus 27 is a bus for transmitting an address when another data processing device accesses the memory, and a memory data bus 28.
-1 is a bus to which the read data from the shared memory 14 is transmitted.

【0017】図5は共有メモリ14上のセマフォ領域の
フォーマットを示す図であり、セマフォ領域の先頭ビッ
トにセマフォビットが割り当てられる。図3は図2にお
けるキャッシュ制御回路21および、キャッシュメモリ
22の具体的な構成を示す図である。同図において、1
01はアドレスセーブレジスタ、102はタグ、103
はメモリアドレスレジスタ、104は比較器、105は
有効フラグレジスタ、106はタグモードフラグレジス
タ、107は比較器、108はキャッシュメモリ制御信
号生成回路、109はデータ選択回路、110はオア回
路、111は制御切り替え回路、112は選択情報生成
回路、113ないし116はバッファメモリである。
FIG. 5 is a diagram showing the format of the semaphore area on the shared memory 14, in which the semaphore bit is assigned to the first bit of the semaphore area. FIG. 3 is a diagram showing a specific configuration of the cache control circuit 21 and the cache memory 22 in FIG. In the figure, 1
01 is an address save register, 102 is a tag, 103
Is a memory address register, 104 is a comparator, 105 is a valid flag register, 106 is a tag mode flag register, 107 is a comparator, 108 is a cache memory control signal generation circuit, 109 is a data selection circuit, 110 is an OR circuit, and 111 is A control switching circuit, 112 is a selection information generating circuit, and 113 to 116 are buffer memories.

【0018】同図における、アドレスセーブレジスタ1
01はアドレスバス24−1から送出されたメモリアド
レスを保持するためのレジスタ、タグ102はキャッシ
ュメモリに登録されているデータに対応するアドレスを
保持するレジスタであり、また、メモリアドレスレジス
タ103はメモリインタフェース23から入力されるキ
ャッシュ無効化アドレスを保持するためのレジスタであ
る。アドレスセーブレジスタ101、タグ102および
メモリアドレスレジスタ103はそれぞれ32ビットで
構成されている。
Address save register 1 in FIG.
01 is a register for holding a memory address sent from the address bus 24-1, tag 102 is a register for holding an address corresponding to data registered in the cache memory, and memory address register 103 is a memory. This is a register for holding the cache invalidation address input from the interface 23. The address save register 101, the tag 102, and the memory address register 103 are each composed of 32 bits.

【0019】比較器104はアドレスセーブレジスタ1
01とタグ102の内容を比較する比較器であり、制御
切替え回路111の出力が通常のメモリ・アクセス・モ
ードを示す論理のとき上記レジスタ101の32ビット
とタグ102の32ビットの内の上位28ビットを比較
し、また、テスト・アンド・セット・モードのとき、全
32ビットを比較する。
The comparator 104 is the address save register 1
01 is a comparator for comparing the contents of the tag 102, and when the output of the control switching circuit 111 is a logic indicating a normal memory access mode, the upper 28 of the 32 bits of the register 101 and the 32 bits of the tag 102 are used. Compare bits, and when in test and set mode, compare all 32 bits.

【0020】有効フラグレジスタ105はタグに登録さ
れたアドレスが有効であることを示す有効フラグVを保
持するレジスタであり有効時に「1」となる。タグモー
ドフラグレジスタ106はキャッシュメモリに保持され
ているデータがセマフォバイトであることを示すタグモ
ードフラグMを保持するレジスタでありセマフォバイト
保持時に「1」となる。また、比較器107はメモリア
ドレスレジスタ103とタグ102の内容を比較する比
較器である。
The valid flag register 105 is a register for holding a valid flag V indicating that the address registered in the tag is valid, and becomes "1" when valid. The tag mode flag register 106 is a register that holds a tag mode flag M indicating that the data held in the cache memory is a semaphore byte, and becomes "1" when the semaphore byte is held. The comparator 107 is a comparator that compares the contents of the memory address register 103 and the tag 102.

【0021】キャッシュメモリ制御信号生成回路108
はキャッシュメモリ22を制御する信号を発生する回
路、データ選択回路109はバッファメモリ113ない
し116またはメモリインタフェース23からのデータ
の内必要なデータを選択して出力する回路であり、ま
た、制御切り替え回路111はメモリ・アクセスか、テ
スト・アンド・セット・アクセスかを判別してモード切
り換え信号1111を出力する回路であり、モード切替
え信号1111は通常のメモリ・アクセスの時、論理0
となり、テスト・アンド・セット・アクセスの時、論理
1となる。選択情報生成回路112はバッファメモリ1
13ないし116からの情報を選択するデータ選択回路
109への選択情報信号を生成する回路、バッファメモ
リ113ないし116はデータを保持する回路であり4
バイトで構成される。
Cache memory control signal generation circuit 108
Is a circuit for generating a signal for controlling the cache memory 22, a data selection circuit 109 is a circuit for selecting and outputting necessary data out of the data from the buffer memories 113 to 116 or the memory interface 23, and the control switching circuit. A circuit 111 outputs a mode switching signal 1111 by discriminating between a memory access and a test and set access. The mode switching signal 1111 is a logic 0 during a normal memory access.
And becomes a logic 1 at the time of test and set access. The selection information generation circuit 112 is the buffer memory 1
The circuits for generating selection information signals to the data selection circuit 109 for selecting information from 13 to 116, and the buffer memories 113 to 116 are circuits for holding data.
Composed of bytes.

【0022】次に図2,図3を用いて実施例の動作を説
明する。通常のメモリ・アクセス時、プロセッサ20は
アドレスバス24−1へアドレスを送出するとともに、
アクセス情報バス24−2にメモリ・アクセスであるこ
とを示すアクセス情報を出力する。アドレスおよびアク
セス情報はキャッシュ制御回路21に入力され、アドレ
スは図3のアドレスセーブレジスタ101に入力され、
また、アクセス情報は図3の制御切替え回路111に入
力されセットされる。
Next, the operation of the embodiment will be described with reference to FIGS. At the time of normal memory access, the processor 20 sends an address to the address bus 24-1 and
The access information indicating the memory access is output to the access information bus 24-2. The address and access information are input to the cache control circuit 21, the address is input to the address save register 101 of FIG.
Further, the access information is input to and set in the control switching circuit 111 of FIG.

【0023】制御切替え回路111はアクセス情報を解
読し、通常のメモリ・アクセスか、テスト・アンド・セ
ット・アクセスかを判別し、モード切替え信号1111
を送出する。モード切替え信号1111は前述したよう
に、通常のメモリ・アクセスのとき論理0となり、テス
ト・アンド・セット・アクセスのとき論理1となる。こ
の場合は通常のメモリ・アクセスなので、論理0が比較
器104に入力され、比較器104は前述したように、
アドレスセーブレジスタ101の上位28ビットとタグ
102の上位28ビットを比較し、キャッシュにヒット
するか否か、すなわち、所望のデータがキャッシュメモ
リ22に存在するか否かを判別する。
The control switching circuit 111 decodes the access information to determine whether it is a normal memory access or a test and set access, and a mode switching signal 1111.
Is sent. As described above, the mode switching signal 1111 becomes logical 0 in the normal memory access and becomes logical 1 in the test and set access. In this case, since it is a normal memory access, a logical 0 is input to the comparator 104, and the comparator 104, as described above,
The upper 28 bits of the address save register 101 and the upper 28 bits of the tag 102 are compared to determine whether or not the cache is hit, that is, whether or not desired data exists in the cache memory 22.

【0024】この実施例においては、バッファメモリ1
13ないし116が16バイトで構成されており、通常
のメモリリードにおいて1回で16バイトのブロックデ
ータがキャッシュメモリ22に読み込まれるので、上記
のようにアドレスの上位28ビットを比較することによ
り、キャッシュにヒットしたか否かを判別できる。
In this embodiment, the buffer memory 1
Since 13 to 116 are composed of 16 bytes, and 16 bytes of block data are read into the cache memory 22 at one time in a normal memory read, by comparing the upper 28 bits of the address as described above, the cache You can determine whether or not you hit.

【0025】上記の比較において、比較結果が一致する
と、所望のデータがキャッシュメモリ22に存在するこ
とがわかり、一致信号EQ1が選択情報生成回路112
に送出される。また、これと同時に、アドレスセーブレ
ジスタ101の下位4ビットが選択情報生成回路112
に入力される。選択情報生成回路112は上記下位4ビ
ットより選択情報を生成して、キャッシュメモリ22内
のセレクタ109に与える。セレクタ109は上記下位
4ビットに基づきキャッシュメモリ22内のバッファメ
モリ113ないし116のうちの必要なワード(16ビ
ット)またはバイト(8ビット)を選択してプロセッサ
20に送る。また、アドレスセーブレジスタ101の値
がタグ102にセットされるとともに、タグモードフラ
グレジスタ106のタグモードフラグMが0にセットさ
れキャッシュメモリ22に保持されているデータはブロ
ックデータであることを示す。
In the above comparison, if the comparison results match, it is found that the desired data exists in the cache memory 22, and the match signal EQ1 indicates the selection information generating circuit 112.
Sent to. At the same time, the lower 4 bits of the address save register 101 are set to the selection information generation circuit 112.
Entered in. The selection information generation circuit 112 generates selection information from the lower 4 bits and gives it to the selector 109 in the cache memory 22. The selector 109 selects a necessary word (16 bits) or byte (8 bits) of the buffer memories 113 to 116 in the cache memory 22 based on the lower 4 bits and sends it to the processor 20. The value of the address save register 101 is set in the tag 102, the tag mode flag M of the tag mode flag register 106 is set to 0, and the data held in the cache memory 22 is block data.

【0026】一方、比較結果が不一致、すなわちミスヒ
ットであると、アドレスバス24−1上のアドレスがメ
モリインタフェース23を介して共通バス12に出力さ
れ、メモリ制御回路13を介して、共有メモリ14がア
クセスされる。共有メモリ14から読み出されたデータ
はメモリ制御回路13、共通バス12、メモリインタフ
ェース23、メモリデータバス28−1を経由して、キ
ャッシュメモリ22に入力される。
On the other hand, if the comparison result is a mismatch, that is, a mishit, the address on the address bus 24-1 is output to the common bus 12 via the memory interface 23 and the shared memory 14 via the memory control circuit 13. Is accessed. The data read from the shared memory 14 is input to the cache memory 22 via the memory control circuit 13, the common bus 12, the memory interface 23, and the memory data bus 28-1.

【0027】キャッシュメモリ22に所望のデータが存
在しない場合、すなわち、キャッシュミスヒットの場
合、共有メモリ14へのアクセスはブロック単位、この
実施例においては16バイト単位でアクセスされ、1回
のアクセス単位が4バイトとすると、4回連続してリー
ドデータがキャッシュメモリ22に入力され、バッファ
メモリ113ないし116に書き込まれる。また、共有
メモリ14から読み出されたブロックデータのうち、所
望のデータがセレクタ109により選択されプロセッサ
20に送られる。
When the desired data does not exist in the cache memory 22, that is, in the case of a cache mishit, the shared memory 14 is accessed in block units, in this embodiment, in 16-byte units. Is 4 bytes, read data is input to the cache memory 22 four times in a row and written to the buffer memories 113 to 116. Further, of the block data read from the shared memory 14, desired data is selected by the selector 109 and sent to the processor 20.

【0028】テスト・アンド・セット命令の場合はプロ
セッサ20はアドレスバス24−1へアドレスを送出す
るとともに、アクセス情報バス24−2にテスト・アン
ド・セット・アクセスであることを示すアクセス情報を
出力する。アドレスおよびアクセス情報はキャッシュ制
御回路21に入力され、アドレスは図3のアドレスセー
ブレジスタ101にセットされ、また、アクセス情報は
図3の制御切替え回路111にセットされる。
In the case of the test and set instruction, the processor 20 sends out the address to the address bus 24-1 and outputs the access information indicating the test and set access to the access information bus 24-2. To do. The address and access information are input to the cache control circuit 21, the address is set in the address save register 101 of FIG. 3, and the access information is set in the control switching circuit 111 of FIG.

【0029】制御切替え回路111はアクセス情報を解
読し、通常のメモリ・アクセスか、テスト・アンド・セ
ット・アクセスかを判別し、モード切替え信号1111
を送出する。この場合はテスト・アンド・セットアクセ
スなので、論理1が比較器104に入力され、比較器1
04の比較対象ビットを28ビットから32ビットに変
更する。すなわち、アドレスセーブレジスタ101の3
2ビットとタグ102の32ビットの全ビットを比較
し、キャッシュにヒットするか否か、すなわち、セマフ
ォバイトがキャッシュメモリ22に保持されているか否
かを判別する。
The control switching circuit 111 decodes the access information and determines whether it is a normal memory access or a test and set access, and a mode switching signal 1111.
Is sent. In this case, since it is the test and set access, the logic 1 is input to the comparator 104 and the comparator 1
The comparison target bit of 04 is changed from 28 bits to 32 bits. That is, 3 of the address save register 101
Two bits are compared with all 32 bits of the tag 102 to determine whether or not the cache is hit, that is, whether or not the semaphore byte is held in the cache memory 22.

【0030】比較結果が一致すると、すなわち、ヒット
すると、一致信号EQ1が選択情報生成回路112に送
出される。また、これと同時に、制御切替え回路111
の出力である切替え信号1111が選択情報生成回路1
12に入力され、その出力はバッファメモリ116の最
下位バイトを選択する信号をセレクタ109に与える。
セレクタ109はバッファメモリ116の最下位バイト
に保持されているセマフォバイトを選択しプロセッサ2
0に与える。
When the comparison results match, that is, when there is a hit, the match signal EQ1 is sent to the selection information generating circuit 112. At the same time, the control switching circuit 111
The switching signal 1111 which is the output of the selection information generation circuit 1
12 and its output gives the selector 109 a signal for selecting the least significant byte of the buffer memory 116.
The selector 109 selects the semaphore byte held in the least significant byte of the buffer memory 116, and the processor 2
Give to 0.

【0031】また、比較結果が不一致であると、すなわ
ち、ミスヒットであると、アドレスバス24−1上のア
ドレスがメモリインタフェース23を介して共通バス1
2に出力され、メモリ制御回路13を介して、共有メモ
リ14がアクセスされる。共有メモリ14から読み出さ
れたデータはメモリ制御回路13、共通バス12、メモ
リインタフェース23、メモリデータバス28−1を経
由して、キャッシュメモリ22に入力される。また、メ
モリ制御回路13へもテスト・アンド・セット・アクセ
スであることを示す情報が、メモリインタフェース2
3、共通バス12を介して伝えられ、メモリ制御回路1
3のセマフォ制御回路31は共有メモリ14に対して、
テスト・アンド・セット・アクセスを行う。すなわち、
セマフォバイトのリードとその最上位ビット位置に対す
る1のセットを同時に行い、1にセットする前のデータ
をリードデータとしてデータ処理装置側にかえす。この
リードデータはメモリ制御回路13、共通バス12、メ
モリインタフェース23を介して、キャッシュメモリ2
2に入力される。
Further, if the comparison result does not match, that is, if it is a mishit, the address on the address bus 24-1 is passed through the memory interface 23 to the common bus 1.
2 and the shared memory 14 is accessed via the memory control circuit 13. The data read from the shared memory 14 is input to the cache memory 22 via the memory control circuit 13, the common bus 12, the memory interface 23, and the memory data bus 28-1. Further, information indicating that the memory control circuit 13 is also a test and set access is stored in the memory interface 2.
3, transmitted via the common bus 12 and the memory control circuit 1
The semaphore control circuit 31 for the shared memory 14
Provides test and set access. That is,
The semaphore byte is read and 1 is set to the most significant bit position at the same time, and the data before being set to 1 is returned to the data processor as read data. This read data is transferred to the cache memory 2 via the memory control circuit 13, the common bus 12 and the memory interface 23.
Entered in 2.

【0032】この場合は、通常のメモリ・アクセスのよ
うにブロック単位のアクセスではなく、必要なバイトの
みのリードデータがセレクタ109を介してプロセッサ
20に転送される。また、キャッシュメモリ制御信号生
成回路108はライトイネーブル信号26−2を発生し
て、バッファメモリ116の最下位バイトに上記リード
データをセットする。また、アドレスセーブレジスタ1
01の値が新にタグ102にセットされるとともに、タ
グモードフラグレジスタ106のタグモードフラグMに
1がセットされキャッシュメモリ22に保持されている
データがセマフォバイトであることを示す。
In this case, read data of only necessary bytes is transferred to the processor 20 via the selector 109, instead of access in block units as in normal memory access. The cache memory control signal generation circuit 108 also generates a write enable signal 26-2 and sets the read data in the least significant byte of the buffer memory 116. Also, address save register 1
The value 01 is newly set in the tag 102, and the tag mode flag M of the tag mode flag register 106 is set to 1 to indicate that the data held in the cache memory 22 is a semaphore byte.

【0033】次に、他のデータ処理装置などが共有メモ
リ14にライトすると、そのアドレスはメモリ制御回路
13、共通バス12、メモリインタフェース23、キャ
ッシュ無効アドレスバス27を介してキャッシュ無効化
アドレスレジスタ103に与えられセットされる。その
際、タグモードフラグMが0の場合、すなわち、キャッ
シュメモリ22に保持されているデータがブロックデー
タの場合は、比較器107における、他装置が共有メモ
リにアクセスしたアドレスとタグにセットされているア
ドレスとの比較対象アドレスは上位28ビットとなる。
キャッシュ無効アドレスレジスタ103とタグ102の
上位28ビットを比較した結果、これらが一致すると有
効フラグレジスタの有効フラグVをリセットして、キャ
ッシュメモリ22のデータを無効化する。
Next, when another data processing device or the like writes to the shared memory 14, the address thereof is passed through the memory control circuit 13, the common bus 12, the memory interface 23, and the cache invalidation address bus 27 to the cache invalidation address register 103. Given to and set. At this time, when the tag mode flag M is 0, that is, when the data held in the cache memory 22 is block data, the comparator 107 sets the tag and the address at which another device has accessed the shared memory. The address to be compared with the existing address is the upper 28 bits.
As a result of comparing the cache invalid address register 103 and the upper 28 bits of the tag 102, if they match, the valid flag V of the valid flag register is reset and the data in the cache memory 22 is invalidated.

【0034】また、他のデータ処理装置などが共有メモ
リ14にライトした際、タグモードフラグMが1の場
合、すなわち、キャッシュメモリ22に保持されている
データがセマフォバイトの場合は、比較器107におけ
る、他装置が共有メモリにアクセスしたアドレスとタグ
にセットされているアドレスとの比較対象アドレスは全
32ビットとなる。その比較の結果、これらが一致する
と上記したのと同様、有効フラグレジスタ105の有効
フラグVをリセットして、キャッシュメモリ22のデー
タを無効化する。(なおこの場合、セマフォバイトへの
ライトは、1バイトライトに限るということが前提とな
る)
When the tag mode flag M is 1 when another data processing device or the like writes to the shared memory 14, that is, when the data held in the cache memory 22 is a semaphore byte, the comparator 107 In, the comparison target address of the address accessed by the other device to the shared memory and the address set in the tag is all 32 bits. If they match as a result of the comparison, the valid flag V of the valid flag register 105 is reset and the data in the cache memory 22 is invalidated, as described above. (In this case, it is premised that writing to the semaphore byte is limited to 1-byte writing.)

【0035】上記実施例において、リードしたセマフォ
ビットが0であった場合、メモリ制御回路13のセマフ
ォ制御回路31はテスト・アンド・セット命令により共
有メモリ14のセマフォ領域41のセマフォビットを1
に書き換える。一方、キャッシュメモリ22に保持され
るセマフォバイトはテスト・アンド・セット命令により
共有メモリ14からリードした更新前の0であり、共有
メモリ14とキャッシュメモリ22のセマフォバイトは
異なったものとなる。
In the above embodiment, when the read semaphore bit is 0, the semaphore control circuit 31 of the memory control circuit 13 sets the semaphore bit 41 of the shared memory 14 to 1 by the test and set instruction.
Rewrite On the other hand, the semaphore byte held in the cache memory 22 is 0 before update read from the shared memory 14 by the test and set instruction, and the semaphore bytes of the shared memory 14 and the cache memory 22 are different.

【0036】しかしながら、通常、セマフォバイトを再
度アクセスするのは、リードデータのセマフォビットが
1であった場合、すなわち、共有資源42の占有権の獲
得に失敗した場合である。この場合には、共有メモリ1
4のセマフォバイトをアクセスしたときセマフォバイト
を書き換えることはなく、共有メモリ14のセマフォバ
イトとキャッシュメモリ22のセマフォバイトは一致し
ている。
However, normally, the semaphore byte is accessed again when the semaphore bit of the read data is 1, that is, when the acquisition of the exclusive right of the shared resource 42 fails. In this case, the shared memory 1
When the semaphore byte 4 is accessed, the semaphore byte is not rewritten, and the semaphore byte of the shared memory 14 and the semaphore byte of the cache memory 22 match.

【0037】そして、他の装置が共有資源42のアクセ
スを終了し、共有メモリ14のセマフォビットを0に書
き換えると、上記したようにキャッシュメモリ22のデ
ータは無効化され、プロセッサ20によるセマフォバイ
トリード時、共有メモリ14のセマフォバイトがリード
され、キャッシュメモリ22のデータは0に書き換えら
れる。上記のように、共有メモリ14のセマフォバイト
とキャッシュメモリ22のセマフォバイトが不一致とな
るのは、自プロセッサ20が共有資源42の専有権の獲
得に成功した場合のみであり、通常、共有資源42の専
有権を獲得した後にセマフォバイトを読むことはないの
で、上記のような不一致は問題にならない。
When another device finishes accessing the shared resource 42 and rewrites the semaphore bit of the shared memory 14 to 0, the data in the cache memory 22 is invalidated as described above, and the semaphore byte read by the processor 20 is performed. At this time, the semaphore byte of the shared memory 14 is read and the data of the cache memory 22 is rewritten to 0. As described above, the semaphore byte of the shared memory 14 and the semaphore byte of the cache memory 22 do not match only when the own processor 20 succeeds in acquiring the exclusive right of the shared resource 42. Since we don't read the semaphore bytes after we get the exclusive right, the above inconsistency is not a problem.

【0038】以上のように、本発明の第1の実施例によ
り、キャッシュメモリ22にセマフォバイトを取り込ん
でも矛盾のない効率的なアクセスを実現すること可能と
なるが、プログラムによっては、共有資源の占有権獲得
に成功した後も、セマフォバイトを読む場合もあり得な
いことではない。この場合共有メモリ14とキャッシュ
メモリ22の不一致の部分はセマフォバイトのセマフォ
ビットのみなので、プログラムを作成する際意識するこ
とが出来る範囲内の問題であるが、次に、プログラム作
成上の意識をすることなく、共有メモリ14とキャッシ
ュメモリ22の一致性を保つことができる実施例を説明
する。
As described above, according to the first embodiment of the present invention, even if the semaphore bytes are fetched into the cache memory 22, it is possible to realize efficient access without any contradiction. It is not impossible to read the semaphore bytes even after the acquisition of the exclusive right. In this case, since the mismatch between the shared memory 14 and the cache memory 22 is only the semaphore bit of the semaphore byte, this is a problem within the range that can be considered when creating a program. Next, consider the program creation. An embodiment will be described in which the shared memory 14 and the cache memory 22 can be kept consistent with each other.

【0039】図4は上記したように共有メモリ14とキ
ャッシュメモリ22の一致性を保つことができる本発明
の他の実施例を示す図であり、本実施例においては、図
4に示すように、メモリインタフェース23からメモリ
データバス上のデータの内セマフォビットに対応する部
分を、ライン28−2を介してキャッシュ制御回路21
に入力する。
FIG. 4 is a diagram showing another embodiment of the present invention in which the consistency between the shared memory 14 and the cache memory 22 can be maintained as described above. In this embodiment, as shown in FIG. , The portion corresponding to the semaphore bit of the data on the memory data bus from the memory interface 23 is transferred via the line 28-2 to the cache control circuit 21.
To enter.

【0040】キャッシュ制御回路21に入力されたセマ
フォビットは図3に示すキャッシュメモリ制御信号生成
回路108に入力される。キャッシュメモリ制御信号生
成回路108は共有メモリ14からリードされたセマフ
ォビットが1の場合のみキャッシュメモリ22に書き込
み、セマフォビットが0の場合はキャッシュメモリ22
には書き込まない。また、この場合には、アドレスセー
ブレジスタ101のアドレスをタグ102にも書き込ま
ず、有効フラグVもセットしない。すなわち、セマフォ
ビットが0の場合には、以前登録されたままの状態を保
つ。
The semaphore bits input to the cache control circuit 21 are input to the cache memory control signal generation circuit 108 shown in FIG. The cache memory control signal generation circuit 108 writes to the cache memory 22 only when the semaphore bit read from the shared memory 14 is 1, and when the semaphore bit is 0, the cache memory 22.
Not write to. In this case, the address of the address save register 101 is not written in the tag 102, and the valid flag V is not set. That is, when the semaphore bit is 0, the previously registered state is maintained.

【0041】これにより、第1の実施例のような、共有
メモリ14とキャッシュメモリ22の不一致が生ずるこ
とはなく、その一致性は完全に保たれる。なお、上記し
た実施例のものは、セマフォビットが0であった場合に
は、キャッシュメモリ22に登録されないわけであるか
ら、プログラムが再びセマフォバイトをリードしようと
した場合にはミスヒットとなり、共有メモリ14をアク
セスすることとなり、アクセス時間が遅くなる欠点があ
る。
As a result, the mismatch between the shared memory 14 and the cache memory 22 as in the first embodiment does not occur, and the matching is completely maintained. In the embodiment described above, if the semaphore bit is 0, it will not be registered in the cache memory 22, so if the program tries to read the semaphore byte again, a mishit occurs and the shared Since the memory 14 is accessed, there is a drawback that the access time is delayed.

【0042】本発明の第3の実施例は上記欠点を改善す
るものであり、図4に示すように、テスト・アンド・セ
ットによるミス・ヒット時、キャッシュメモリ22にセ
マフォビットを強制的セットする信号26−3を送出す
る。すなわち、図4において、テスト・アンド・セット
におけるミスヒット時、キャッシュ制御回路21のキャ
ッシュメモリ制御信号生成回路108はバッファメモリ
116にライト・イネーブル信号26−2を送出する
際、セマフォビット強制セット信号26−3を送出す
る。この信号はオア回路110を経由して、バッファメ
モリ116に送られ、バッファメモリ116の最下位バ
イトの最上位ビット、すなわち、セマフォビットに対応
するビットを強制的に1にする。
The third embodiment of the present invention is to improve the above-mentioned drawbacks. As shown in FIG. 4, the semaphore bit is forcibly set in the cache memory 22 at the time of a miss hit by the test and set. The signal 26-3 is transmitted. That is, in FIG. 4, at the time of a mishit in the test and set, when the cache memory control signal generation circuit 108 of the cache control circuit 21 sends the write enable signal 26-2 to the buffer memory 116, the semaphore bit forced set signal is output. 26-3 is transmitted. This signal is sent to the buffer memory 116 via the OR circuit 110 and forcibly sets the most significant bit of the least significant byte of the buffer memory 116, that is, the bit corresponding to the semaphore bit to 1.

【0043】すなわち、テスト・アンド・セットによる
メモリ・アクセスでは、共有メモリ14のセマフォビッ
トは常に1に更新されるから、キャッシュメモリ22に
おいても、テスト・アンド・セットによるメモリ・アク
セスであることがアクセス情報により伝えられれば、共
有メモリ14と全く同一の更新を行うことができる。こ
の実施例によれば、共有メモリ14とキャッシュメモリ
22のデータは完全に一致し、しかも、共有メモリ14
のデータが常にキャッシュメモリ22に登録されるの
で、再度のリードの場合でも高速にアクセスすることが
できる。
That is, in the memory access by the test and set, the semaphore bit of the shared memory 14 is always updated to 1, so that the cache memory 22 may also be the memory access by the test and set. If transmitted by the access information, the same update as the shared memory 14 can be performed. According to this embodiment, the data in the shared memory 14 and the cache memory 22 completely match each other, and the shared memory 14
Since the data of 1 is always registered in the cache memory 22, it is possible to access at high speed even when the data is read again.

【0044】[0044]

【発明の効果】以上説明したことから明らかなように、
本発明によれば、テスト・アンド・セット命令などによ
るセマフォ領域アクセス時も、キャッシュメモリを有効
に活用できるため、システムの性能を大幅に向上するこ
とができる。
As is clear from the above description,
According to the present invention, even when a semaphore area is accessed by a test and set instruction or the like, the cache memory can be effectively used, so that the system performance can be greatly improved.

【図面の簡単な説明】[Brief description of drawings]

【図1】本発明の原理ブロック図である。FIG. 1 is a principle block diagram of the present invention.

【図2】本発明の全体構成を示す図である。FIG. 2 is a diagram showing an overall configuration of the present invention.

【図3】本発明の実施例を示す図である。FIG. 3 is a diagram showing an embodiment of the present invention.

【図4】本発明の他の実施例を示す図である。FIG. 4 is a diagram showing another embodiment of the present invention.

【符号の説明】[Explanation of symbols]

1,3,11−1,11−2 データ処理装置 2,12 共通バス 13 メモリ制御回路 4,14 共有メモリ 1a,20 プロセッサ 1c,21 キャッシュ制御回路 1b,22 キャッシュメモリ 23 メモリインタフェース 24−1 アドレスバス 24−2 アクセス情報バス 25 データバス 26 キャッシュ制御信号 27 キャッシュ無効化アドレスバス 28−1 メモリデータバス 31 セマフォ制御回路 41 セマフォ領域 4b,42 共有資源 101 アドレスセーブレジスタ 102 タグ 103 メモリアドレスレジスタ 104,107 比較器 105 有効フラグレジスタ 106 タグモードフラグレジスタ 108 キャッシュメモリ制御信号生成回
路 109 データ選択回路 110 オア回路 111 制御切り替え回路 112 選択情報生成回路 113,114,115,116 バッファメモリ
1, 3, 11-1, 11-2 Data processing device 2, 12 Common bus 13 Memory control circuit 4, 14 Shared memory 1a, 20 Processor 1c, 21 Cache control circuit 1b, 22 Cache memory 23 Memory interface 24-1 Address Bus 24-2 Access information bus 25 Data bus 26 Cache control signal 27 Cache invalidation address bus 28-1 Memory data bus 31 Semaphore control circuit 41 Semaphore area 4b, 42 Shared resource 101 Address save register 102 Tag 103 Memory address register 104, 107 Comparator 105 Effective Flag Register 106 Tag Mode Flag Register 108 Cache Memory Control Signal Generation Circuit 109 Data Selection Circuit 110 OR Circuit 111 Control Switching Circuit 112 Selection Information Generation Synthesis circuit 113, 114, 115, 116 Buffer memory

─────────────────────────────────────────────────────
─────────────────────────────────────────────────── ───

【手続補正書】[Procedure amendment]

【提出日】平成5年1月14日[Submission date] January 14, 1993

【手続補正1】[Procedure Amendment 1]

【補正対象書類名】明細書[Document name to be amended] Statement

【補正対象項目名】図5[Name of item to be corrected] Figure 5

【補正方法】追加[Correction method] Added

【補正内容】[Correction content]

【図5】 セマフォ領域のフォーマットを示す図であ
る。
FIG. 5 is a diagram showing a format of a semaphore area.

───────────────────────────────────────────────────── フロントページの続き (72)発明者 桜井 康智 神奈川県川崎市中原区上小田中1015番地 富士通株式会社内 (72)発明者 小田原 孝一 神奈川県川崎市中原区上小田中1015番地 富士通株式会社内 (72)発明者 野中 巧 神奈川県川崎市中原区上小田中1015番地 富士通株式会社内 (72)発明者 金谷 英治 神奈川県川崎市中原区上小田中1015番地 富士通株式会社内 ─────────────────────────────────────────────────── ─── Continuation of the front page (72) Inventor Yasutoshi Sakurai 1015 Kamiodanaka, Nakahara-ku, Kawasaki, Kanagawa Prefecture, Fujitsu Limited (72) Inventor, Koichi Odawara, 1015, Kamikodanaka, Nakahara-ku, Kawasaki, Kanagawa Prefecture, Fujitsu Limited ( 72) Inventor Takumi Nonaka 1015 Kamiodanaka, Nakahara-ku, Kawasaki City, Kanagawa Prefecture, Fujitsu Limited (72) Inventor Eiji Kanaya, 1015, Kamikodanaka, Nakahara-ku, Kawasaki, Kanagawa Prefecture

Claims (6)

【特許請求の範囲】[Claims] 【請求項1】キャッシュメモリ(1b)を備えたデータ処理
装置(1) と、 複数のデータ処理装置(1,3) がアクセスする共有の資源
(4b)と共有メモリ(4)を持ち、 共有メモリ(4) 上に設けられた特定領域(4a)を1回のメ
モリアクセスによりテストと更新を行う特定のオペレー
ションにより共有資源(4b)の排他制御を実現しているデ
ータ処理装置(1) におけるキャッシュ制御方式におい
て、 上記特定オペレーションにより共有メモリ(4) 上の特定
領域(4a)をリードする際、特定領域(4a)のコピーを保持
するキャッシュメモリ(1b)をアクセスし、 そのキャッシュメモリ(1b)に特定領域(4a)のコピーが存
在しなかった場合は共有メモリ(4) 上の特定領域(4a)を
リードしてデータ処理装置(1) 内のプロセッサ(1a)に送
出するとともに、キャッシュメモリ(1b)にも書き込み、 キャッシュメモリ(1b)に特定領域(4a)のコピーが存在す
る場合にはキャッシュメモリ(1b)のみにアクセスして共
有メモリ(4) にはアクセスせず、 他のデータ処理装置(3) が共有メモリ(4) の特定領域(4
a)にライトを行った場合にはキャッシュメモリ(1b)を無
効化するキャッシュ制御手段(1c)を備えたことを特徴と
するキャッシュ制御方式。
1. A data processing device (1) having a cache memory (1b) and a shared resource accessed by a plurality of data processing devices (1, 3).
(4b) and shared memory (4), the specific area (4a) provided on the shared memory (4) is tested and updated by a single memory access. Exclusive operation of the shared resource (4b) by a specific operation. In the cache control method in the data processing device (1) that realizes control, a cache that holds a copy of the specific area (4a) when the specific area (4a) on the shared memory (4) is read by the specific operation described above. When the memory (1b) is accessed and there is no copy of the specified area (4a) in the cache memory (1b), the specified area (4a) on the shared memory (4) is read and the data processing device (1 ) In the processor (1a), write to the cache memory (1b), and if there is a copy of the specific area (4a) in the cache memory (1b), access only the cache memory (1b). Access shared memory (4) Without a specific region (4 other data processing device (3) is a shared memory (4)
A cache control method comprising a cache control means (1c) for invalidating the cache memory (1b) when a write is performed to a).
【請求項2】特定オペレーションにより、共有メモリ
(4) 上の特定領域(4a)をリードする際その特定領域(4a)
のコピーを保持するキャッシュメモリ(1b)をアクセス
し、 そのキャッシュメモリ(1b)に特定領域(4a)のコピーが存
在しなかった場合は共有メモリ(4) 上の特定領域(4a)を
リードしてデータ処理装置(1) のプロセッサ(1a)に送出
し、 その特定領域(4a)が他のデータ処理装置(3)による共有
資源(4b)のアクセス中であることを示す特定値であった
場合にのみ特定値をキャッシュメモリ(1b)にライトする
ことを特徴とする請求項1のキャッシュ制御方式。
2. A shared memory according to a specific operation.
(4) When reading the specific area (4a) above, the specific area (4a)
Access the cache memory (1b) that holds a copy of the specified area, and if there is no copy of the specified area (4a) in the cache memory (1b), read the specified area (4a) on the shared memory (4). Is sent to the processor (1a) of the data processing device (1) and the specific area (4a) is a specific value indicating that the shared resource (4b) is being accessed by another data processing device (3). 2. The cache control method according to claim 1, wherein the specific value is written to the cache memory (1b) only in the case.
【請求項3】特定オペレーションにより、共有メモリ
(4) 上の特定領域(4a)をリードする際、その特定領域(4
a)のコピーを保持するキャッシュメモリ(1b)をアクセス
し、 そのキャッシュメモリ(1b)に特定領域(4a)のコピーが存
在しなかった場合は共有メモリ(4) 上の特定領域(4a)を
リードしてデータ処理装置(1) のプロセッサ(1a)に送出
するとともに、キャッシュメモリ(1b)には他のデータ処
理装置(3)による共有資源(4b)のアクセス中であること
を示す特定値に置き換えた値をライトすることを特徴と
する請求項1のキャッシュ制御方式。
3. A shared memory according to a specific operation.
(4) When reading the specific area (4a) above,
If the cache memory (1b) holding the copy of a) is accessed and there is no copy of the specified area (4a) in the cache memory (1b), the specified area (4a) on the shared memory (4) is A specific value that indicates that the data is read and sent to the processor (1a) of the data processing device (1) and that the shared memory (4b) is being accessed by the other data processing device (3) in the cache memory (1b). 2. The cache control method according to claim 1, wherein the value replaced with is written.
【請求項4】キャッシュメモリ(1b)が通常のメモリアク
セスにおけるキャッシュメモリとしても用いられること
を特徴とする請求項1又は請求項2又は請求項3のキャ
ッシュ制御方式。
4. A cache control system according to claim 1, wherein the cache memory (1b) is also used as a cache memory in a normal memory access.
【請求項5】特定オペレーションにおけるキャッシュヒ
ット判定と通常のメモリアクセスに於けるキャッシュヒ
ット判定とを切り分ける手段を備えたことを特徴とする
請求項4のキャッシュ制御方式。
5. The cache control method according to claim 4, further comprising means for separating a cache hit determination in a specific operation from a cache hit determination in a normal memory access.
【請求項6】特定オペレーションにおけるキャッシュミ
スヒット時のキャッシュメモリ(1b)へのデータの書き込
みと通常のメモリアクセスにおけるキャッシュミスヒッ
ト時のキャッシュメモリ(1b)へのデータの書き込みとを
切り分ける手段を備えたことを特徴とする請求項4又は
請求項5のキャッシュ制御方式。
6. A means for separating writing of data into the cache memory (1b) at the time of a cache miss in a specific operation and writing of data into the cache memory (1b) at the time of a cache miss in a normal memory access. The cache control method according to claim 4 or 5, characterized in that.
JP31855391A 1991-11-07 1991-11-07 Data processing device Expired - Fee Related JP3219810B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP31855391A JP3219810B2 (en) 1991-11-07 1991-11-07 Data processing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP31855391A JP3219810B2 (en) 1991-11-07 1991-11-07 Data processing device

Publications (2)

Publication Number Publication Date
JPH05143454A true JPH05143454A (en) 1993-06-11
JP3219810B2 JP3219810B2 (en) 2001-10-15

Family

ID=18100420

Family Applications (1)

Application Number Title Priority Date Filing Date
JP31855391A Expired - Fee Related JP3219810B2 (en) 1991-11-07 1991-11-07 Data processing device

Country Status (1)

Country Link
JP (1) JP3219810B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009122694A1 (en) * 2008-03-31 2009-10-08 パナソニック株式会社 Cache memory device, cache memory system, and processor system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009122694A1 (en) * 2008-03-31 2009-10-08 パナソニック株式会社 Cache memory device, cache memory system, and processor system
US20110004731A1 (en) * 2008-03-31 2011-01-06 Panasonic Corporation Cache memory device, cache memory system and processor system
JP4767361B2 (en) * 2008-03-31 2011-09-07 パナソニック株式会社 Cache memory device, cache memory system, processor system

Also Published As

Publication number Publication date
JP3219810B2 (en) 2001-10-15

Similar Documents

Publication Publication Date Title
US7613884B2 (en) Multiprocessor system and method ensuring coherency between a main memory and a cache memory
JP3016575B2 (en) Multiple cache memory access methods
EP0514024B1 (en) Method and apparatus for an improved memory architecture
US7082499B2 (en) External memory control device regularly reading ahead data from external memory for storage in cache memory, and data driven type information processing apparatus including the same
JP2007048296A (en) Method, apparatus and system for invalidating multiple address cache entries
EP0533427B1 (en) Computer memory control system
JPH03225542A (en) Memory of data and processing circuit for bit encode data
US5206945A (en) Single-chip pipeline processor for fetching/flushing instruction/data caches in response to first/second hit/mishit signal respectively detected in corresponding to their logical addresses
JP2004199677A (en) System for and method of operating cache
US5010475A (en) Consistency ensuring system for the contents of a cache memory
JPH10500235A (en) Data storage device
KR100380674B1 (en) Method and system for maintaining cache coherency for write-through store operations in a multiprocessor system
US5012410A (en) Data processor with instruction cache memory
JPH05143454A (en) Cache control system
JPH06103477B2 (en) Parallel cache memory
US5349672A (en) Data processor having logical address memories and purge capabilities
JPH07234819A (en) Cache memory
KR960015583B1 (en) Cache memory filtering apparatus of multi-processor
JP3260566B2 (en) Storage control method and storage control device in information processing system
JP3074897B2 (en) Memory circuit
JP2001202286A (en) Flash control circuit for cache memory and its control method
JP2588547B2 (en) Multi CPU system
JPS617960A (en) Buffer nullification control system
JPH05189313A (en) Cache memory control system
JPH0512109A (en) Cache memory system

Legal Events

Date Code Title Description
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20010731

LAPS Cancellation because of no payment of annual fees