JPH0216654A - Method for controlling cache memory - Google Patents

Method for controlling cache memory

Info

Publication number
JPH0216654A
JPH0216654A JP63165861A JP16586188A JPH0216654A JP H0216654 A JPH0216654 A JP H0216654A JP 63165861 A JP63165861 A JP 63165861A JP 16586188 A JP16586188 A JP 16586188A JP H0216654 A JPH0216654 A JP H0216654A
Authority
JP
Japan
Prior art keywords
address
cache memory
memory
main memory
boundary
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
JP63165861A
Other languages
Japanese (ja)
Inventor
Masashi Suenaga
雅士 末永
Soichi Takatani
高谷 壮一
Takayuki Morioka
隆行 森岡
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 JP63165861A priority Critical patent/JPH0216654A/en
Publication of JPH0216654A publication Critical patent/JPH0216654A/en
Pending legal-status Critical Current

Links

Landscapes

  • Memory System Of A Hierarchy Structure (AREA)

Abstract

PURPOSE:To cause system rising to be processed only when assignment of a cache memory is performed and to prevent an increase in the overhead required for process switching by using the cache memory after dividing the memory into plural blocks. CONSTITUTION:When a CPU 1 outputs an access address 100, a comparator 5 compares the address 100 with a boundary address set by a boundary register 4 and an address producing circuit 6 decides the block of a cache memory 3 to which the address 100 corresponds based on the output 103 of the comparator 5 and outputs a block address 102. The memory 3 indexes the address 102 and an address 101 which is a part of the address 100 and an index section 7 compares the indexed address with an address read out from the tag section 31 of the memory 3. When the addresses coincide with each other, a coincidence signal 310 and an access response signal 300 to the CPU 1 are turned on and the CPU 1 reads data read out from the data section 32 of the memory 3. When the address do not coincide with each other, reading out from and rewriting of a main memory are executed as usual.

Description

【発明の詳細な説明】 〔発明の利用分野〕 本発明は、電子計算機のキャッシュメモリ制御方法に係
り、特に複数のプログラムの多重処理を行う計算機に好
適なキャッシュメモリ制御方法に関する。
DETAILED DESCRIPTION OF THE INVENTION [Field of Application of the Invention] The present invention relates to a cache memory control method for an electronic computer, and particularly to a cache memory control method suitable for a computer that performs multiple processing of a plurality of programs.

〔従来の技術〕[Conventional technology]

従来のキャッシュメモリを付加した電子計算機の構成を
第4図に示す、キャッシュメモリ3は、データ部32と
格納されたデータが主メモリ2のどのアドレスに対応す
るかを示すディレクトリ部3rから成る。
FIG. 4 shows the configuration of a conventional computer equipped with a cache memory. The cache memory 3 includes a data section 32 and a directory section 3r indicating which address in the main memory 2 the stored data corresponds to.

単位データあたりのディレクトリ部31の構成と役割を
第7図に示す、ディレクトリ部31は、キャッシュメモ
リ3の当該アドレスのデータが有効であるか否かを示す
有効フラグ(V) 311と、アドレス100のキャッ
シュメモリ索引に使用する部分101(以下では第1部
分アドレスとよぶ)を除いた部分(以下ではこれを第2
部分アドレスとよぶ)を格納するタグ部312とから成
る。即ちタグ部312に格納された第2部分アドレスと
、キャッシュメモリを索引するのに使用する第1部分ア
ドレス101を合わせたものが当該キャッシュメモリが
保存しているデータの、主メモリ上のアドレスになる。
FIG. 7 shows the structure and role of the directory section 31 per unit data. (hereinafter referred to as the second part address) excluding the part 101 used for the cache memory index (hereinafter referred to as the first part address).
and a tag section 312 that stores a partial address (referred to as a partial address). That is, the combination of the second partial address stored in the tag section 312 and the first partial address 101 used to index the cache memory is the address on the main memory of the data stored in the cache memory. Become.

例として、256語の主メモリと16語のキャッシュメ
モリを備えた処理装置の場合につき説明する。
As an example, the case of a processing device having a 256-word main memory and a 16-word cache memory will be described.

主メモリのアドレスは8ビツトであり、その範囲は(0
)+s〜(FF)taとなる。ただし、(・)16は、
16進数を示し、以下では簡単のため添え字を省いて(
・)で示す、一方キャッシュメモリのアドレスは4ビツ
トであり、範囲は(0)〜(F)となる。従ってキャッ
シュのダグ部には主メモリのアドレス8ビツトからキャ
ッシュメモリのアドレス4ビツトを引いた残りの4ビツ
トが格納される。ここでアドレスの下位4ビツトでキャ
ッシュメモリを索引するとして、キャッシュメモリのア
ドレス(8)番地のタグ部に(4)が格納されていて有
効フラグがオンのとき、タグの内容はアドレスの上位4
ビツトに対応するので、キャッシュメモリの(8)番地
は主メモリの(48)番地のデータを保持していること
を示している。
The main memory address is 8 bits, and its range is (0
)+s~(FF)ta. However, (・)16 is
The hexadecimal numbers are shown below, and subscripts are omitted for simplicity (
.), on the other hand, the address of the cache memory is 4 bits, and the range is (0) to (F). Therefore, the remaining 4 bits obtained by subtracting the 4 bits of the cache memory address from the 8 bits of the main memory address are stored in the tag section of the cache. Assuming that the cache memory is indexed using the lower 4 bits of the address, if (4) is stored in the tag field at address (8) in the cache memory and the valid flag is on, the content of the tag will be the upper 4 bits of the address.
This indicates that address (8) in the cache memory holds data at address (48) in the main memory.

以上のような構成にて、CPUIが主メモリ2ヘアクセ
ス(読みだしとする)する場合のキャッシュメモリ3の
動作は以下のようになる。CPU1が出力したアドレス
100の一部である第1部分アドレス101にてキャッ
シュメモリ3が索引される。この索引によって読み出さ
れた有効ビット311がオンしていれば、タグ部312
がら読みだした第2部分アドレス400と、入力された
アクセスアドレス100の内の第2部分アドレスとを比
較器7゜で比較する。これが一致して出力信号310の
オンのときアクセスデータがキャッシュメモリ3内に存
在することを示している。そしてそのデータは第1部分
アドレス101によりデータ部32から取り出されたデ
ータであるから、CPUIは、信号310オンによりア
クセス応答信号300がオンとなったことを検出してデ
ータ部32からのデータをデータバス200を介して読
み込む。
With the above configuration, the operation of the cache memory 3 when the CPUI accesses (reads) the main memory 2 is as follows. The cache memory 3 is indexed using a first partial address 101 that is a part of the address 100 output by the CPU 1. If the valid bit 311 read by this index is on, the tag part 312
The second partial address 400 that has been read out is compared with the second partial address of the input access address 100 by a comparator 7°. This coincides with the output signal 310 indicating that the access data exists in the cache memory 3 when the output signal 310 is on. Since the data is the data retrieved from the data section 32 by the first partial address 101, the CPU detects that the access response signal 300 is turned on by turning on the signal 310, and retrieves the data from the data section 32. Read via data bus 200.

一方、読み出した有効グラフ31がオフ、または比較器
7の出力信号の310がオフ、つまりタグ部312から
読みだした第2部分アドレスと入力アドレスのそれが不
一致のときは、所望のデータがキャッシュメモリ3内に
存在しないことを示しているから、信号300オフを見
でCPUIは主メモリ2からデータを読み込み、同時に
キャッシュメモリ3のデータ部32の、該当部分を主メ
モリから読みだしたデータ書き換え、さらにタグ部31
2の該当部分をそのときの入力アドレスの第2部分アド
レスに書き換え、有効フラグ311をオンとする。
On the other hand, if the read valid graph 31 is off, or the output signal 310 of the comparator 7 is off, that is, the second partial address read from the tag section 312 and that of the input address do not match, the desired data is cached. Since it indicates that it does not exist in the memory 3, the CPU reads the data from the main memory 2 when the signal 300 is turned off, and at the same time rewrites the corresponding part of the data section 32 of the cache memory 3 with the data read from the main memory. , further tag section 31
2 is rewritten to the second partial address of the input address at that time, and the valid flag 311 is turned on.

このような書き換えの発生が少ないほど、キャッシュメ
モリのアクセスだけでメモリアクセスが終わり、キャッ
シュメモリの動作は主メモリよりも高速なので、CPU
Iの処理を高速化できる。
The fewer such rewrites occur, the more the memory access will be completed just by accessing the cache memory, and since the cache memory operates faster than the main memory, the CPU
I processing can be sped up.

一方、複数のプログラムを多重処理(マツルチプロセッ
シング)するシステムでは、複数のプログラムは主メモ
リ上の異なった領域に格納される。
On the other hand, in a system that multi-processes multiple programs (multi-processing), the multiple programs are stored in different areas on the main memory.

このシステムでキャッシュメモリを用いると、実行プロ
グラムの切り替えが行われるごとに、第1部分アドレス
が一致する部分の書き換え(キャッシュのミスヒツト)
が発生し、CPU1の処理速度が大幅に低下する。各プ
ログラムごとに個別のキャッシュメモリを設ければ、こ
の問題は避けられるが、キャッシュメモリが多く必要で
、実装上。
If a cache memory is used in this system, each time the execution program is switched, the part where the first part address matches will be rewritten (cache miss).
occurs, and the processing speed of the CPU 1 is significantly reduced. This problem can be avoided if a separate cache memory is provided for each program, but this requires a large amount of cache memory and is difficult to implement.

あるいはコストの関係から、とくに小型のワークステー
ション等の場合には好ましくない。
Alternatively, due to cost considerations, this is not preferable, especially in the case of small workstations.

この問題点を解決するための従来技術としては、特開昭
62−144257に開示されたキャッシュメモリがあ
る。第5図はこのキャッシュメモリの構成を示したもの
で、キャッシュメモリ3は、第6図に例示したように複
数のブロックに分割され、各ブロックは主メモリ上の各
プログラムに割り当てられる。このプログラムとキャッ
シュメモリ3のブロックとの対応付けは、CPUIから
の指令104により行われる。このようにして、カーネ
ル等の実行頻度の高いプログラムにキャッシュメモリ3
のブロックを専用に割り当てることにより、そのプログ
ラム実行時にキャッシュメモリの書き換えが少なくなる
ため、処理速度が向上する。
As a conventional technique for solving this problem, there is a cache memory disclosed in Japanese Patent Laid-Open No. 62-144257. FIG. 5 shows the configuration of this cache memory. The cache memory 3 is divided into a plurality of blocks as illustrated in FIG. 6, and each block is assigned to each program on the main memory. The correspondence between this program and the blocks of the cache memory 3 is performed by a command 104 from the CPUI. In this way, cache memory 3 is used for frequently executed programs such as the kernel.
By allocating a block for exclusive use, the cache memory is less rewritten when the program is executed, improving processing speed.

〔発明が解決しようとする課題〕[Problem to be solved by the invention]

キャッシュメモリをブロックに分割した従来技術では、
多重処理を行うシステムの場合、実行プログラムの切り
替え時にはブロックの対応付けの変更が必要となり、こ
のためにCPUはどう対応付けるかの指令104を実行
プログラム切り替えごとに出さねばならない、従ってこ
の切り替えのためのCPUのオーバヘッドが増加すると
いう問題があり、更にシステムソフトウェアを他機種か
ら移植しようとすると、このキャッシュメモリの割り当
てを考慮する必要があり、ソフトウェア互換性が低下す
る。またあるプログラムに専用にキャッシュメモリのブ
ロックを割り当てた場合にも。
With conventional technology that divides cache memory into blocks,
In the case of a system that performs multiple processing, it is necessary to change the correspondence between blocks when switching execution programs, and for this purpose the CPU must issue a command 104 indicating how to make the correspondence every time the execution program is switched. There is a problem that CPU overhead increases, and furthermore, when attempting to port system software from another model, it is necessary to consider allocation of this cache memory, which reduces software compatibility. Also, when a block of cache memory is allocated exclusively to a certain program.

プログラム実行時に通常交互にアクセスされる命令とデ
ータ(通常はスタック内に割り当てられる)のアドレス
に関して、キャッシュメモリ索引に使用される第1部分
アドレスが一致すると書き換えが頻発し、処理速度向上
が妨げられる。
Regarding the addresses of instructions and data (usually allocated in the stack) that are normally accessed alternately during program execution, if the first partial address used for cache memory indexing matches, rewriting will occur frequently and processing speed improvement will be hindered. .

この最後の問題点を、前記した第7図の例、即ち256
語の主メモリと16語のキャッシュメモリを持ち、アド
レス8ビツト中下位4ビットでキャッシュメモリを索引
する処理装置を例に説明する。
This last problem can be solved in the example of FIG.
An example of a processing device will be explained, which has a main memory of 1 word and a cache memory of 16 words, and indexes the cache memory using the lower 4 bits of 8 bits of an address.

今、第8図(a)のように、主メモリ上でプログラムA
は(10)番地から(14)番地の5語のアドレスに、
データのスタックは(20)番地から(24)番地の5
11のアドレスに、そしてプログラムの実行を制御する
システムプログラムは(0)番地から(4)番地の5語
のアドレスにそれぞれ割り当てられているとする。この
とき、プログラムAとスタックとシステムプログラムは
、いずれも下位4ビツトが(0)〜(4)で一致してい
る。このようなメモリ配置にてプログラムAを実行し、
命・令フェッチとオペランドフェッチとが交互に発生す
ると、プログラムAとスタックでは第1部分アドレスで
ある下位4ビツトが同じで第2部分アドレス(上位4ビ
ツト)が異なるため、ミスヒツトが頻発する。このため
、第8図(b)のように、キャッシュメモリの(0)〜
(4)番地は、命令フェッチからオペランドフェッチへ
、またはその変り目ごとに5語の内容が主メモリをアク
セスして更新される。実際のシステムでは1回に更新さ
れるキャッシュメモリの領域はもっと大きいので、この
更新に要する時間は大きく、この間CPUはプログラム
の処理を行えない。第8図のスタックをプログラムBと
し、これとプログラムAとが頻繁に入れ替わり実行され
るときも、キャッシュメモリの(0)〜(4)番地はプ
ログラムA、システムプログラム、プログラムB、シス
テムプログラム、プログラムA・・・と更新され、やは
り処理速度の低下を招く。
Now, as shown in Figure 8(a), the program A is stored in the main memory.
is the 5-word address from address (10) to address (14),
The data stack is 5 from address (20) to address (24)
It is assumed that the system program that controls the execution of the program is assigned to five word addresses from address (0) to address (4). At this time, the lower 4 bits of program A, the stack, and the system program all match as (0) to (4). Execute program A with this memory arrangement,
When instructions/instruction fetches and operand fetches occur alternately, misses occur frequently because program A and the stack have the same first partial address (lower 4 bits) and different second partial addresses (higher 4 bits). Therefore, as shown in FIG. 8(b), (0) to
(4) The address is updated by accessing the main memory with the contents of five words every time an instruction fetch is performed or an operand fetch is performed or at each transition. In an actual system, the area of the cache memory that is updated at one time is larger, so the time required for this update is long, and the CPU cannot process the program during this time. The stack in Figure 8 is called program B, and even when this and program A are frequently exchanged and executed, addresses (0) to (4) of the cache memory are program A, system program, program B, system program, program A..., which again causes a decrease in processing speed.

本発明の目的は、実行プログラムの切り替えオーバヘッ
ドを短縮でき、システムソフトウェア移植時のプログラ
ム変更量が少なく、さらに同一プログラムにおける命令
とデータの引き続くアクセス時にキャッシュメモリ書き
換えが頻発しないキャッシュメモリ制御方法を提供する
にある。
An object of the present invention is to provide a cache memory control method that can shorten execution program switching overhead, reduce the amount of program changes during system software porting, and prevent cache memory rewriting from occurring frequently when instructions and data in the same program are successively accessed. It is in.

〔課題を解決するための手段〕[Means to solve the problem]

上記の目的は、キャッシュメモリを複数のブロックに分
割し、主メモリをこのブロック対応の複数の領域に区分
するための書き換え可能な境界レジスタと、この境界レ
ジスタの内容とアクセスアドレスとからアクセスアドレ
スがどの領域にあるかを決定する領域決定手段とを付加
し、この手段の出力によりキャッシュメモリのブロック
を選択することによって、主メモリの領域にキャッシュ
メモリのブロックを割り当てることにより達成される。
The purpose of the above is to create a rewritable boundary register to divide the cache memory into multiple blocks and divide the main memory into multiple areas corresponding to the blocks, and to determine the access address from the contents of this boundary register and the access address. This is achieved by allocating a cache memory block to a main memory area by adding an area determining means for determining in which area the cache memory block is located and selecting the cache memory block based on the output of this means.

〔作用〕[Effect]

キャッシュメモリの分割された各ブロックは主メモリの
分割された領域に割り当てられ、主メモリの領域の区分
は書き換え可能な境界レジスタへの設定値により行われ
る。境界レジスタへの書込みはシステム立上げ処理に於
て、システムソフトウェアが用途別に分割して使用する
主メモリの境界アドレスを設定するだけでよく一プロセ
ス切り換え時に特別な処理を必要としないから、CPU
の負荷にはならない、またシステムソフトウェア移植時
は、元来ハードウェア依存性が高いシステム立上げ処理
のみの変更で済む、さらに、データの大部分か格納され
るスタックに使用される主メモリの領域に、キャッシュ
メモリの1ブロツクを割当てれば、命令とデータの交互
アクセスによるキャッシュメモリの書き換えを回避でき
る。
Each divided block of the cache memory is assigned to a divided area of the main memory, and division of the main memory area is performed by setting values in rewritable boundary registers. To write to the boundary register, during system startup processing, the system software only needs to set the boundary address of the main memory that is divided and used for each purpose, and no special processing is required when switching one process.
In addition, when porting system software, only the system startup process, which is originally highly dependent on hardware, needs to be changed.Furthermore, the main memory area used for the stack where most of the data is stored By allocating one block of cache memory to each block, rewriting of the cache memory due to alternate access of instructions and data can be avoided.

〔実施例〕〔Example〕

以下、本発明を実施例により説明する。第1図は本発明
の方法を適用した電子計算機の一実施例を示すブロック
図で、CPU1.主メモリ2、キャッシュメモリ3、境
界レジスタ4、比較器5゜アドレス生成回路6、比較器
7により構成される。
The present invention will be explained below using examples. FIG. 1 is a block diagram showing an embodiment of an electronic computer to which the method of the present invention is applied. It is composed of a main memory 2, a cache memory 3, a boundary register 4, a comparator 5, an address generation circuit 6, and a comparator 7.

境界レジスタ4は主メモリ2を複数の領域に分割した場
合の領域間の境界アドレスを格納するものであり、任意
に書き換え可能である。比較器5は境界レジスタ4に格
納された境界アドレスとCPU1が出力する主メモリ2
のアドレス(アクセスアドレス)100との大小関係を
比較する回路であり、アドレス生成回路6は比較器5の
出力103よリアクセスアドレス100が主メモリ2の
複数に分割された領域のいずれに属するかを判定し、キ
ャッシュメモリ3のブロック選択用のアドレス102を
生成する回路である。
The boundary register 4 stores boundary addresses between areas when the main memory 2 is divided into a plurality of areas, and can be arbitrarily rewritten. The comparator 5 compares the boundary address stored in the boundary register 4 with the main memory 2 output by the CPU 1.
The address generating circuit 6 determines which of the divided areas of the main memory 2 the re-access address 100 belongs to based on the output 103 of the comparator 5. This circuit determines the block selection address 102 of the cache memory 3.

第2図(a)はアドレス生成回路6の回路構成を示すも
のである0本実施例では、境界レジスタ4および比較器
5は3個ずつ設けものとしており。
FIG. 2(a) shows the circuit configuration of the address generation circuit 6. In this embodiment, three boundary registers 4 and three comparators 5 are provided.

従って主メモリ2は3つの境界アドレスにより4つの領
域に分割される。キャッシュメモリ3もこれと同じく4
ブロツク構成である。そこで、各境界レジスタ4の3つ
の境界アドレスをXi、X2゜X3とし、これらとの比
較を行う各比較器5の出力103をYl、Y2.Y3、
アクセスアドレスを又とする。そして各比較器5は J=1. 2. 3・・・・・・ なる動作を行うとする。このとき、第2図(a)の論理
により出力されるブロックアドレス102(D。
Therefore, main memory 2 is divided into four areas by three boundary addresses. Cache memory 3 is also 4
It has a block configuration. Therefore, the three boundary addresses of each boundary register 4 are set as Xi, X2°X3, and the output 103 of each comparator 5 for comparison with these is set as Yl, Y2, . Y3,
This is the access address. And each comparator 5 has J=1. 2. 3... Suppose we perform the following actions. At this time, block address 102 (D) is output based on the logic shown in FIG. 2(a).

E)は同図(b)で与えられ、この値にキャッシュメモ
リ3の各ブロックが対応付けられる。
E) is given in FIG. 4B, and each block of the cache memory 3 is associated with this value.

以上の実施例において、CPUIが主メモリ2のデータ
を読みだす場合を例に動作を説明する。
In the above embodiment, the operation will be described using an example in which the CPUI reads data from the main memory 2.

まず、CPUIがアクセスアドレスlOOを出力すると
、これは比較器5によって境界レジスタ4に設定された
境界アドレスと比較される。アドレス生成回路6は、比
較器5の出力103から、第2図で説明したようにして
、アクセスアドレス100がキャッシュメモリのどのブ
ロックと対応するかを判定し、ブロックのアドレス10
2を出力する。キャッシュメモリ3は、このブロックア
ドレス102とアクセスアドレス100の一部であって
キャッシュメモリ3のブロック内の位置を示すアドレス
lotとにより索引される。この索引によりキャッシュ
メモリ3のタグ部312から読みだされたアドレス(第
2部分アドレス)はアクセスアドレス100の該当部と
比較器7にて比較され、両者が一致した場合は一致信号
310がオンとされる(キャツシュヒツト)、このとき
はCPUIへのアクセス応答信号300がオンとなり、
CPU1は上記索引によりキャッシュメモリ3のデータ
部32から読みだされたデータを読み込む。比較器7で
の比較結果が不一致なら(ミスヒツト)、従来の場合と
同様に、主メモリからの読みだしとキャッシュメモリの
書き換えが行われる。
First, when the CPUI outputs the access address lOO, this is compared with the boundary address set in the boundary register 4 by the comparator 5. The address generation circuit 6 determines which block of the cache memory the access address 100 corresponds to from the output 103 of the comparator 5 as explained in FIG.
Outputs 2. The cache memory 3 is indexed by this block address 102 and an address lot, which is part of the access address 100 and indicates a position within the block of the cache memory 3. The address (second partial address) read from the tag section 312 of the cache memory 3 using this index is compared with the corresponding section of the access address 100 in the comparator 7, and if the two match, the match signal 310 is turned on. At this time, the access response signal 300 to the CPUI is turned on.
The CPU 1 reads the data read from the data section 32 of the cache memory 3 using the above index. If the comparison result in the comparator 7 does not match (mishit), reading from the main memory and rewriting of the cache memory are performed as in the conventional case.

第3図はキャッシュメモリの各ブロックの使用例を示し
たもので、システムソフトウェアが主メモリ2をこのよ
うな領域に分割して使用する。カーネル領域21はシス
テムソフトウェアの本体であり、プロセス管理、メモリ
管理、ファイル管理。
FIG. 3 shows an example of how each block of the cache memory is used, and the system software divides the main memory 2 into such areas for use. The kernel area 21 is the main body of the system software, and is responsible for process management, memory management, and file management.

入出力2割込処理等のプログラムとそのためのデータが
格納される。ユーザプログラム領域23はシステムソフ
トウェアの環境化で動くプログラムを格納する領域であ
り、多重処理を行う電子計算機では複数のプログラムが
格納される。共通サブルーチン領域22はシステムプロ
グラムとユーザプログラム、あるいはユーザプログラム
同志で、共同して使用する共通サブルーチンを格納する
領域である。スタック領域24はプログラムで使用する
データ、サブルーチン呼出し時の引数及びサブルーチン
からの戻りアドレスを格納する領域である。
Programs such as input/output 2 interrupt processing and related data are stored. The user program area 23 is an area for storing programs that run according to the system software environment, and a plurality of programs are stored in an electronic computer that performs multiple processing. The common subroutine area 22 is an area for storing common subroutines used jointly by the system program and user programs, or by user programs. The stack area 24 is an area for storing data used in a program, arguments when calling a subroutine, and a return address from the subroutine.

これら領域の境界はシステムの利用状況によって変化す
るため一定ではないが、ある範囲内に収まるという特徴
がある。従って若干の誤差が発生するが主メモリを前記
の複数の領域に分割した場合の領域間の境界アドレスを
近似的に定めることができる。第3図では、第2図の例
によって、キャッシュメモリ3を4つのブロックに分割
した例を示している。この場合、システム立ち上げ処理
において、主メモリ2の各領域の境界アドレスの近似値
x1〜x3を境界レジスタに設定することによって、主
メモリ2の各領域にキャッシュメモリ3のブロックを割
り当てることができる0本実施例では、ユーザプログラ
ムのプロセス切り替え時に、プロセス管理を行うカーネ
ル領域21に専用のキャッシュメモリのブロックが割り
当てられており、この部分は他のプログラムによって置
き換わらないので、高速にプロセス切り替え処理が行え
るという効果がある。また複数のプログラムにより呼び
出される共通サブルーチン領域22も専用のキャッシュ
メモリのブロックが割り当てられているので、高速に処
理できるという効果がある。さらにプログラムで使用さ
れるデータを格納するスタック領域24にも専用のキャ
ッシュメモリのブロックが割り当てられるので、プログ
ラム実行時に命令とデータが交互にアクセスされてもキ
ャッシュメモリの置き換えが発生しないという効果があ
る。なお、第3図ではユーザプログラム領域を一つの領
域としており、これに対してキャッシュメモリも1ブロ
ツクだけ割り当てた例を示しているが、第1図の境界レ
ジスタ4と比較器5を増設して、キャッシュメモリ3と
主メモリ2のユーザプログラム領域23を細分化し、そ
れぞれにキャッシュメモリのブロック割り当てを行えば
、ユーザプログラム相互間のプロセス切り替え時のキャ
ッシュメモリの置き換えを減らすことができる。
The boundaries of these areas vary depending on the usage status of the system, so they are not fixed, but they are characterized by falling within a certain range. Therefore, although some errors may occur, it is possible to approximately determine the boundary addresses between the areas when the main memory is divided into the plurality of areas. FIG. 3 shows an example in which the cache memory 3 is divided into four blocks based on the example shown in FIG. In this case, in the system startup process, blocks of the cache memory 3 can be allocated to each area of the main memory 2 by setting approximate values x1 to x3 of the boundary addresses of each area of the main memory 2 in the boundary register. 0 In this embodiment, when a user program process is switched, a block of dedicated cache memory is allocated to the kernel area 21 that performs process management, and this part is not replaced by other programs, so the process switching process can be performed at high speed. This has the effect of allowing you to do this. Further, since a dedicated cache memory block is allocated to the common subroutine area 22 called by a plurality of programs, there is an effect that processing can be performed at high speed. Furthermore, since a dedicated cache memory block is allocated to the stack area 24 that stores data used in the program, there is an effect that cache memory will not be replaced even if instructions and data are accessed alternately during program execution. . Note that although FIG. 3 shows an example in which the user program area is one area and only one block of cache memory is allocated to it, it is possible to add the boundary register 4 and comparator 5 shown in FIG. By subdividing the cache memory 3 and the user program area 23 of the main memory 2 and allocating blocks of cache memory to each, it is possible to reduce the number of cache memory replacements when switching processes between user programs.

〔発明の効果〕〔Effect of the invention〕

本発明によれば、キャッシュメモリを複数のブロックに
分割して使用するために、システム立ち上げ処理時にキ
ャッシュメモリの割り当てを行うだけでよいため、プロ
セス切り替え時のオーバヘッドが増加せず、またシステ
ムソフトウェアの移植時にシステム立ち上げ処理の変更
を行うだけでよいのでソフトウェア互換性が高くなると
いう効果があり、またスタック領域とユーザプログラム
格納領域を別のブロックとすることで命令とデータの交
互アクセス時のキャッシュメモリの書き換えの頻発をな
くせるという効果がある。
According to the present invention, since the cache memory is divided into multiple blocks and used, it is only necessary to allocate the cache memory at the time of system startup processing, so there is no increase in overhead when switching processes, and the system software This has the effect of increasing software compatibility since only the system startup process needs to be changed when porting the system.Also, by making the stack area and user program storage area separate blocks, it is easier to use when accessing instructions and data alternately. This has the effect of eliminating frequent rewriting of the cache memory.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図は本発明の一実施例を示すブロック図。 第2図は第1図のアドレス生成回路の一例を示した図、
第3図は第1図の実施例における主メモリとキャッシュ
メモリの対応づけの例を示した図、第4図および第5図
は従来技術の例を示すブロック図、第6図は第5図の従
来例における主メモリとキャッシュメモリの対応付けの
例を示した図。 第7図はディレクトリ部の説明図、第8図は従来装置で
命令とオペランドのフェッチが交互に発生したときの動
作説明図である。 1・・・CPU、2・・・主メモリ、3・・・キャッシ
ュメモリ、4・・・境界レジスタ、5・・・比較器、d
・・・アドレス生成回路、102・・・ブロックアドレ
ス、103・・・大小判定信号。 代理人弁理士  秋  本  正  実第 図 集 図 (b) 輩 苓 図 栴 図 纂 図 葛 図
FIG. 1 is a block diagram showing one embodiment of the present invention. FIG. 2 is a diagram showing an example of the address generation circuit of FIG. 1,
FIG. 3 is a diagram showing an example of the correspondence between the main memory and cache memory in the embodiment of FIG. 1, FIGS. 4 and 5 are block diagrams showing examples of the prior art, and FIG. The figure which showed the example of the correspondence of the main memory and cache memory in the conventional example. FIG. 7 is an explanatory diagram of the directory section, and FIG. 8 is an explanatory diagram of the operation when instruction and operand fetches occur alternately in a conventional device. 1... CPU, 2... Main memory, 3... Cache memory, 4... Boundary register, 5... Comparator, d
. . . Address generation circuit, 102 . . . Block address, 103 . . . Size determination signal. Representative Patent Attorney Tadashi Akimoto Jitsu Illustrated Collection (b)

Claims (1)

【特許請求の範囲】 1、主メモリを複数個の領域に分割したときの境界アド
レスを格納するための書き換え可能な境界レジスタと、
処理装置から主メモリへのアクセスアドレスと上記境界
レジスタに格納された境界アドレスとを比較して、上記
アクセスアドレスが上記分割された主メモリ上の領域の
どれに属するかを示す領域指定信号を出力する判定回路
とを設け、かつ上記主メモリ上の領域に対応して1つず
つのブロックが存在するようにキャッシュメモリを複数
のブロックに分割するとともに、処理装置から主メモリ
へのアクセス時には、上記判定回路からの領域指定信号
の指定する領域に対するキャッシュメモリ上のブロック
内のみを索引対象として当該アクセスアドレスによる索
引を行うことを特徴とするキャッシュメモリ制御方法。 2、前記境界レジスタの境界アドレスは、システム立ち
上げ時にシステムプログラムにより設定されることを特
徴とする請求項1記載のキャッシュメモリ制御方法。 3、前記判定回路は、前記境界アドレスの各々とアクセ
スアドレスとを比較し、その比較結果に応じてその各々
がオンまたはオフ信号を出力する比較手段と、該手段の
各々の出力をデコードして上記アクセスアドレスが前記
主メモリの領域の何番目のものであるかを示す信号を生
成し、これを前記領域指定信号として出力する回路とか
ら構成されたことを特徴とする請求項1記載のキャッシ
ュメモリ制御方法。
[Claims] 1. A rewritable boundary register for storing boundary addresses when main memory is divided into a plurality of areas;
Compares the access address from the processing unit to the main memory with the boundary address stored in the boundary register, and outputs an area designation signal indicating which of the divided main memory areas the access address belongs to. The cache memory is divided into a plurality of blocks so that there is one block for each area on the main memory, and when the main memory is accessed from the processing device, 1. A cache memory control method, characterized in that indexing is performed using the access address, with only the inside of a block on a cache memory corresponding to an area designated by an area designation signal from a determination circuit being indexed. 2. The cache memory control method according to claim 1, wherein the boundary address of the boundary register is set by a system program at system startup. 3. The determination circuit includes comparison means for comparing each of the boundary addresses and the access address, each of which outputs an on or off signal according to the comparison result, and decoding the output of each of the means. 2. The cache according to claim 1, further comprising a circuit that generates a signal indicating which area of the main memory the access address is in, and outputs this as the area designation signal. Memory control method.
JP63165861A 1988-07-05 1988-07-05 Method for controlling cache memory Pending JPH0216654A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP63165861A JPH0216654A (en) 1988-07-05 1988-07-05 Method for controlling cache memory

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP63165861A JPH0216654A (en) 1988-07-05 1988-07-05 Method for controlling cache memory

Publications (1)

Publication Number Publication Date
JPH0216654A true JPH0216654A (en) 1990-01-19

Family

ID=15820384

Family Applications (1)

Application Number Title Priority Date Filing Date
JP63165861A Pending JPH0216654A (en) 1988-07-05 1988-07-05 Method for controlling cache memory

Country Status (1)

Country Link
JP (1) JPH0216654A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103999062A (en) * 2011-10-26 2014-08-20 惠普发展公司,有限责任合伙企业 Segmented caches

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103999062A (en) * 2011-10-26 2014-08-20 惠普发展公司,有限责任合伙企业 Segmented caches
JP2014534520A (en) * 2011-10-26 2014-12-18 ヒューレット−パッカード デベロップメント カンパニー エル.ピー.Hewlett‐Packard Development Company, L.P. Segmented cache
US9697115B2 (en) 2011-10-26 2017-07-04 Hewlett-Packard Development Company, L.P. Segmented caches

Similar Documents

Publication Publication Date Title
US8799621B2 (en) Translation table control
US5826057A (en) Method for managing virtual address space at improved space utilization efficiency
US4903234A (en) Memory system
US5555395A (en) System for memory table cache reloads in a reduced number of cycles using a memory controller to set status bits in the main memory table
JP2000057054A (en) High speed address translation system
JPS61141055A (en) Information processor
US4654779A (en) Multiprocessor system including firmware
US4654782A (en) Variable segment size plural cache system with cache memory unit selection based on relative priorities of accessed encached programs
US6564283B1 (en) Data processing system for expanded addresses
US5802598A (en) Data memory access control and method using fixed size memory sections that are sub-divided into a fixed number of variable size sub-sections
US8266379B2 (en) Multithreaded processor with multiple caches
Silberschatz et al. Operating systems
US5761740A (en) Method of and apparatus for rapidly loading addressing registers
US4984150A (en) Virtual memory control management system
US6766435B1 (en) Processor with a general register set that includes address translation registers
US5283878A (en) Method and apparatus for encoding data types for object identification
JPH0216654A (en) Method for controlling cache memory
KR930009092B1 (en) Apparatus and method for a page frame replacement in a data processing system having virtual memory addressing
US5450587A (en) Expanded memory addressing scheme
US4628450A (en) Data processing system having a local memory which does not use a directory device with distributed resident programs and a method therefor
JPH0540694A (en) Cache memory device
US20050268021A1 (en) Method and system for operating a cache memory
US5933856A (en) System and method for processing of memory data and communication system comprising such system
JP3105822B2 (en) Micro program controller
KR200204909Y1 (en) A microcontroller including an divided internal code memory