JPH05143330A - Stack cache and control system thereof - Google Patents

Stack cache and control system thereof

Info

Publication number
JPH05143330A
JPH05143330A JP3210120A JP21012091A JPH05143330A JP H05143330 A JPH05143330 A JP H05143330A JP 3210120 A JP3210120 A JP 3210120A JP 21012091 A JP21012091 A JP 21012091A JP H05143330 A JPH05143330 A JP H05143330A
Authority
JP
Japan
Prior art keywords
data
cache
stack
microcomputer
main memory
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
JP3210120A
Other languages
Japanese (ja)
Inventor
Toshio Doi
俊雄 土居
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP3210120A priority Critical patent/JPH05143330A/en
Publication of JPH05143330A publication Critical patent/JPH05143330A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To shorten time necessary for a PUSH/POP instruction and to prevent a cache from storing invalid data for popped software. CONSTITUTION:In order to hold the combinations of addresses and data at the time of pushing a microcomputer 3, automatically push unpushed held data to a main memory 4 during the idle time of a bus cycle, output the data concerned to the microcomputer 3 at the time of popping the microcomputer 3, and substitute valid data for unnecessary data by automatic popping from the main memory 4 during the idle time of the bus cycle, a stack cache 20 is provided with a cache 10 having a means indicating whether respective data have been written in the main memory 4 or not, an active controller having a vertex pointer for an intra-cache stack, a bottom pointer for the intra-cache stack and a vertex pointer for cache outside stack and a bus control part 11 for arbitrating the external accesses of the microcomputer 3 and the active controller.

Description

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

【0001】[0001]

【産業上の利用分野】この発明は、データ処理を行なう
マイクロコンピュータシステムに関し、特に主メモリ上
のデータ構造として、最後に入力したデータが最初に出
力されるスタック構造をサポートするマイクロコンピュ
ータシステムにおけるスタックキャッシュに関するもの
である。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a microcomputer system for processing data, and more particularly to a stack in a microcomputer system that supports a stack structure in which the last input data is first output as a data structure on the main memory. It's about cache.

【0002】[0002]

【従来の技術】図3はキャッシュを持たない従来のマイ
クロコンピュータシステム(以下マイコンシステムと略
す)の構成を示すブロック図であり、図中1はスタック
ポインタ(以下SPと略す)、2は8ビットインクリメ
ンタ/デクリメンタ(以下ID8Bと略す)、3はSP
1及びID8B2を含むマイクロコンピュータ(以下マ
イコンと略す)、4は主メモリである。図4はキャッシ
ュを持たない上記従来のマイコンシステムの動作を示す
メモリマップである。図5はキャッシュを持つ従来のマ
イコンシステムの構成を示すブロック図であり、図5中
1〜4は図3と同様であり、5はセレクタ、6はデータ
部、7はタグ部、8はデータが有効であることを示すV
ビット、9は比較器である。また、10はセレクタ5、
データ部6、タグ部7、Vビット8、及び比較器9より
構成されるキャッシュ、11はバス制御部である。図6
はキャッシュを持つ上記従来のマイコンシステムの動作
を示すメモリマップである。なお、図3及び図5におけ
る各構成要素の内容については以下の動作説明で述べ
る。
2. Description of the Related Art FIG. 3 is a block diagram showing the configuration of a conventional microcomputer system (hereinafter referred to as a microcomputer system) having no cache, in which 1 is a stack pointer (hereinafter abbreviated as SP) and 2 is 8 bits. Incrementer / decrementer (hereinafter abbreviated as ID8B), 3 is SP
1 and a microcomputer including the ID8B2 (hereinafter abbreviated as a microcomputer), 4 is a main memory. FIG. 4 is a memory map showing the operation of the conventional microcomputer system having no cache. FIG. 5 is a block diagram showing a configuration of a conventional microcomputer system having a cache. In FIG. 5, 1-4 are the same as those in FIG. 3, 5 is a selector, 6 is a data section, 7 is a tag section, and 8 is data. V is valid
Bit 9 is a comparator. Also, 10 is the selector 5,
A cache composed of a data unit 6, a tag unit 7, a V bit 8, and a comparator 9, and 11 is a bus control unit. Figure 6
Is a memory map showing the operation of the conventional microcomputer system having a cache. The contents of each component in FIGS. 3 and 5 will be described in the following operation description.

【0003】図4を用いてキャッシュを持たない図3の
従来のマイコンシステムの動作を説明する。このマイコ
ン3は主メモリ4上のデータ構造として、最後に入力し
たデータが最初に出力されるスタック構造をサポート
し、スタックへのデータ入力をPUSH(プッシュ)、
スタックからのデータ出力をPOP(ポップ)として、
他のデータ書込み/読出しと区別する。図4(a)では
マイコン3は主メモリ4のスタック領域にPUSHす
る。図4(b)ではマイコン3は主メモリ4のスタック
領域からPOPする。ここでマイコン3にPOPされた
主メモリ4上のデータは、値としてはそのまま残ってい
るがソフトウエア的にはその値を再び読出して利用する
ことはない。他方、PUSHされたスタック内のデータ
は、POPされる前は、「スタックのPOP動作」以外
の読出し/書込みの対象としてマイコン3から利用され
る。
The operation of the conventional microcomputer system of FIG. 3 having no cache will be described with reference to FIG. As a data structure on the main memory 4, the microcomputer 3 supports a stack structure in which the last input data is output first, and the data input to the stack is PUSH (push),
Data output from the stack as POP (pop)
Differentiate from other data writing / reading. In FIG. 4A, the microcomputer 3 pushes to the stack area of the main memory 4. In FIG. 4B, the microcomputer 3 pops from the stack area of the main memory 4. Here, the data on the main memory 4 POPed to the microcomputer 3 remains as a value, but the value is not read out again and used in terms of software. On the other hand, the PUSHed data in the stack is used by the microcomputer 3 as a read / write target other than the "stack POP operation" before being POPped.

【0004】図3において説明すると、データをPUS
Hするとき、マイコン3は現在のスタックの頂点を示す
SP1の値をID8B2でデクリメント(−1)し、そ
の値をアドレスとして主メモリ4に対して書込みを行な
う。その結果、データは主メモリ4上のスタックの新し
い頂点に書込まれる。データをPOPするとき、マイコ
ン3は現在のスタックの頂点を示すSP1の値をアドレ
スとして主メモリ4から読込みを行ない、SP1をID
8B2でインクリメント(+1)する。その結果、デー
タは主メモリ4上のスタックの頂点から取られ、SP1
は新しい、1段低いスタックの頂点のアドレスを示す。
Referring to FIG. 3, data is PUS
At the time of H, the microcomputer 3 decrements (-1) the value of SP1 indicating the top of the current stack with ID8B2, and writes it to the main memory 4 using that value as an address. As a result, the data is written to the new top of the stack on main memory 4. When popping the data, the microcomputer 3 reads from the main memory 4 using the value of SP1 indicating the top of the current stack as an address and sets SP1 as an ID.
Increment (+1) at 8B2. As a result, the data is taken from the top of the stack in main memory 4 and SP1
Indicates the address of the new one lower stack vertex.

【0005】次に図6を用いてキャッシュを持つ図5の
従来のマイコンシステムの動作を説明する。図6(a)
ではマイコン3は主メモリ4のスタック領域にデータを
PUSHする。この時キャッシュ10にも同時にデータ
と該当するアドレスの組が登録される。図6(b)では
マイコン3はキャッシュ10内のスタックからデータを
POPする。該当データはキャッシュ10に登録されて
いるのでデータはキャッシュ10から読出される。先に
述べたようにPOPされたスタック上の(キャッシュ1
0内にある)データは、値としてはそのまま残っている
が、ソフトウエア的にはその値を再び読出して利用する
ことはない。しかし、この従来例におけるキャッシュ1
0内ではそのデータは有効データとして扱われる。図6
(c)ではPUSHされたデータがキャッシュ10に登
録された後に大量の他のデータがキャッシュ10に登録
されるとキャッシュ10内のPUSHされたデータは他
のデータで上書きされる。この時は該当データはキャッ
シュ10に登録されていないのでPOPするデータは主
メモリ4から読み出される。主メモリ4から読みだされ
たデータは同時にキャッシュ10に登録される。先に述
べたようにPOPされたスタック上の(キャッシュ10
に新たに登録し直された)データは、値としてはそのま
ま残っているが、ソフトウエア的にはその値を再び読出
して利用することはない。しかし、キャッシュ10内で
はそのデータは有効データとして扱われる。
Next, the operation of the conventional microcomputer system of FIG. 5 having a cache will be described with reference to FIG. Figure 6 (a)
Then, the microcomputer 3 pushes the data to the stack area of the main memory 4. At this time, a set of data and a corresponding address is also registered in the cache 10 at the same time. In FIG. 6B, the microcomputer 3 pops the data from the stack in the cache 10. Since the relevant data is registered in the cache 10, the data is read from the cache 10. As mentioned above, (cache 1
The data (in 0) remains as a value, but the value is not read and used again in terms of software. However, cache 1 in this conventional example
Within 0, the data is treated as valid data. Figure 6
In (c), if a large amount of other data is registered in the cache 10 after the PUSHed data is registered in the cache 10, the PUSHed data in the cache 10 is overwritten with the other data. At this time, since the corresponding data is not registered in the cache 10, the POP data is read from the main memory 4. The data read from the main memory 4 is simultaneously registered in the cache 10. As mentioned above, (cache 10
The data (which has been newly re-registered in) remains as a value, but the value is not read again and used by software. However, in the cache 10, the data is treated as valid data.

【0006】図5において説明すると、データをPUS
Hするとき、マイコン3は現在のスタックの頂点を示す
SP1の値をID8B2でデクリメント(−1)し、そ
の値をアドレスとして書込みを行なう。実際にはこのと
きバス制御部11がデータを主メモリ4上のスタックの
新しい頂点と、キャッシュ10に書込む。例えばアドレ
スが8ビットの2進数「01010101」で、データ
が8ビットの2進数「11101110」である場合の
キャッシュ10内の動作を説明する。キャッシュ10が
図5に示すような8エントリの構成の場合アドレスの下
位3ビット「101」がセレクタ5に与えられ、セレク
タ5はタグ部7とVビット8とデータ部6の「101」
に対応する部分を選択する。タグ部7の「101」対応
部分はアドレスの上位5ビット「01010」を記録
し、Vビット8の「101」対応部分は「1」を記録
し、データ部6の「101」対応部分はデータ「111
01110」を記録する。
Referring to FIG. 5, data is PUS
At the time of H, the microcomputer 3 decrements (-1) the value of SP1 indicating the top of the current stack with ID8B2, and writes the value as an address. Actually, at this time, the bus control unit 11 writes the data to the cache 10 and the new vertex of the stack on the main memory 4. For example, the operation in the cache 10 when the address is an 8-bit binary number "01010101" and the data is an 8-bit binary number "11101110" will be described. When the cache 10 has a structure of 8 entries as shown in FIG. 5, the lower 3 bits “101” of the address are given to the selector 5, and the selector 5 has the tag portion 7, V bit 8 and “101” of the data portion 6.
Select the part corresponding to. The “101” corresponding part of the tag part 7 records the upper 5 bits “01010” of the address, the “101” corresponding part of the V bit 8 records “1”, and the “101” corresponding part of the data part 6 records the data. "111
"01110" is recorded.

【0007】データをPOPするとき、マイコン3は現
在のスタックの頂点を示すSP1の値をアドレスとして
読込みを行ない、SP1をID8B2でインクリメント
(+1)する。ここで、図6(b)のように該当データ
がキャッシュ10に登録されている場合をまず説明す
る。マイコン3から読出しアドレスとして8ビットの2
進数「01010101」が出力されると、バス制御部
11はまずキャッシュ10に対してそのアドレスを通知
する。キャッシュ10内部でアドレスの下位3ビット
「101」がセレクタ5に与えられ、セレクタ5はタグ
部7とVビット8とデータ部6の「101」に対応する
部分を選択する。タグ部7の「101」対応部分は記録
されていたアドレスの上位5ビット「01010」を比
較器9に出力し、比較器9は入力アドレスの上位5ビッ
ト「01010」と、記録されていたアドレスの上位5
ビット「01010」とを比較し一致していることを通
知する。Vビット8の「101」対応部分は「1」を出
力し、キャッシュ10内の該当データが有効であること
を示す。アドレスの一致と該当データの有効が示された
ので、データ部6の「101」対応部分はデータ「11
101110」をマイコン3に出力する。
When POP data, the microcomputer 3 reads the value of SP1 indicating the top of the current stack as an address, and increments (+1) SP1 by ID8B2. Here, the case where the corresponding data is registered in the cache 10 as shown in FIG. 6B will be described first. 8-bit 2 as a read address from the microcomputer 3
When the decimal number "01010101" is output, the bus control unit 11 first notifies the cache 10 of the address. The lower 3 bits "101" of the address are given to the selector 5 inside the cache 10, and the selector 5 selects the portion corresponding to "101" in the tag portion 7, the V bit 8 and the data portion 6. The portion corresponding to "101" of the tag portion 7 outputs the upper 5 bits "01010" of the recorded address to the comparator 9, and the comparator 9 outputs the upper 5 bits "01010" of the input address and the recorded address. Top 5 of
The bit “01010” is compared to notify that they match. The portion corresponding to "101" of the V bit 8 outputs "1", indicating that the corresponding data in the cache 10 is valid. Since the coincidence of the address and the validity of the corresponding data are shown, the portion corresponding to "101" of the data portion 6 is the data "11".
"101110" is output to the microcomputer 3.

【0008】次に図6(c)のように先にPUSHされ
たデータが他のデータで上書きされていた場合を説明す
る。マイコン3から読出しアドレスとして8ビットの2
進数「01010101」が出力されると、キャッシュ
10内部でアドレスの下位3ビット「101」がセレク
タ5に与えられ、セレクタ5はタグ部7とVビット8と
データ部6の「101」に対応する部分を選択する。タ
グ部7の「101」対応部分は上書きされた他のデータ
のアドレスの上位5ビット「XXXXX」を比較器9に
出力し、比較器9は入力アドレスの上位5ビット「01
010」と、記録されていたアドレスの上位5ビット
「XXXXX」とを比較し不一致であることを通知す
る。Vビット8の「101」対応部分は「1」を出力
し、キャッシュ10内の該当データが有効であることを
示す。アドレスの不一致が示されたのでデータ部6の
「101」対応部分はデータを出力しない。バス制御部
11はキャッシュ10からアドレスの不一致を示される
と、主メモリ4から該当アドレスのデータを読出し、マ
イコン3とキャッシュ10に与える。マイコン3は読出
しを完了し、キャッシュ10では先に述べたのと同様の
アドレスとデータの組の登録動作が行なわれる。
Next, the case where the previously PUSHed data is overwritten by another data as shown in FIG. 6C will be described. 8-bit 2 as a read address from the microcomputer 3
When the decimal number "01010101" is output, the lower 3 bits "101" of the address are given to the selector 5 inside the cache 10, and the selector 5 corresponds to "101" of the tag section 7, V bit 8 and data section 6. Select a part. The portion corresponding to “101” of the tag unit 7 outputs the upper 5 bits “XXXXXXX” of the address of the other overwritten data to the comparator 9, and the comparator 9 outputs the upper 5 bits “01” of the input address.
010 ”is compared with the upper 5 bits“ XXXXXXX ”of the recorded address to notify that they do not match. The portion corresponding to "101" of the V bit 8 outputs "1", indicating that the corresponding data in the cache 10 is valid. Since the address mismatch is indicated, the data corresponding to "101" in the data portion 6 does not output the data. When the cache controller 10 indicates that the addresses do not match, the bus controller 11 reads out the data at the corresponding address from the main memory 4 and supplies it to the microcomputer 3 and the cache 10. The microcomputer 3 completes the reading, and the cache 10 performs the same registering operation of the address and data as described above.

【0009】またマイコン3以外の図示しない手段によ
って主メモリ4のデータが書き換えられた場合などは、
主メモリ4のデータとキャッシュ10のデータの整合が
取れなくなるため、書き換えられた該当アドレスのVビ
ット8、又はすべてのVビット8が図示しない手段で
「0」にされる。またマイコンシステムの起動直後もす
べてのVビット8が「0」となっている。Vビット8が
「0」であれば読出し時にアドレスの不一致時と同様の
動作をする。
When the data in the main memory 4 is rewritten by means (not shown) other than the microcomputer 3,
Since the data in the main memory 4 and the data in the cache 10 cannot be matched with each other, the V bit 8 of the rewritten corresponding address, or all the V bits 8 are set to "0" by means not shown. Immediately after starting the microcomputer system, all V bits 8 are "0". If the V bit 8 is "0", the same operation as when the addresses do not match at the time of reading is performed.

【0010】[0010]

【発明が解決しようとする課題】スタックを操作するP
USHやPOP命令はサブルーチンや割込処理ルーチン
など処理の流れが代わったときにデータの退避などに使
われ、スタック上のデータは新旧ルーチン間でのデータ
の受渡などにも利用される。しかし、キャッシュを持た
ない従来のマイコンシステムではPUSHやPOPの命
令がマイコンに与えられる毎にマイコン自身が主メモリ
にアクセスする必要がありアクセス終了まで次の命令実
行が待たされるという問題点があった。また、キャッシ
ュを持つ従来のマイコンシステムではPOP命令実行時
にキャッシュに該当データが保持されていれば主メモリ
にアクセスする必要はない。しかしPUSH命令実行時
とPOP命令時にキャッシュに該当データが保持されて
いないときは主メモリにアクセスする必要がありアクセ
ス終了まで次の命令実行が待たされるという問題点があ
った。また、キャッシュを持つ従来のマイコンシステム
ではPOP命令実行後もソフトウエア上は無効となった
データを有効データとして保持しているため、実質上の
キャッシュの効率が悪いという問題点があった。
P for manipulating a stack
The USH and POP instructions are used for saving data when the flow of processing such as a subroutine or interrupt processing routine is changed, and the data on the stack is also used for passing data between old and new routines. However, in the conventional microcomputer system having no cache, the microcomputer itself needs to access the main memory every time a PUSH or POP instruction is given to the microcomputer, and the next instruction execution is delayed until the access is completed. .. Further, in the conventional microcomputer system having a cache, it is not necessary to access the main memory if the corresponding data is held in the cache when the POP instruction is executed. However, when the PUSH instruction is executed and when the corresponding data is not held in the cache at the time of the POP instruction, there is a problem that the main memory needs to be accessed and execution of the next instruction is waited until the access is completed. Further, in the conventional microcomputer system having the cache, since the data invalidated by the software is held as the valid data even after the POP instruction is executed, there is a problem that the efficiency of the cache is substantially ineffective.

【0011】この発明は、上記のような問題点を解決す
るためになされたもので、スタックを操作するPUSH
やPOP命令に必要な時間を減少させ、キャッシュ内に
効率良くスタックデータを保持することができるスタッ
クキャッシュの制御方式及びスタックキャッシュを提供
することを目的とする。
The present invention has been made to solve the above problems, and PUSH for operating a stack is provided.
It is an object of the present invention to provide a stack cache control method and a stack cache that can efficiently hold stack data in the cache by reducing the time required for a POP instruction.

【0012】[0012]

【課題を解決するための手段】この発明に係る請求項1
のスタックキャッシュの制御方式は、マイコン3がPU
SHするとき主メモリ4に代わって該当アドレスとデー
タの組を保持し、主メモリ4にPUSHされていない保
持データをマイコン3が外部にアクセスしていないとき
に主メモリ4にPUSHし、マイコン3がPOPすると
き該当データを保持していれば主メモリ4に代わって該
当データをマイコン3に出力し、マイコン3のPOPで
不要になったデータを後にPOPされる可能性のあるス
タック底部のデータに置き換えるため、マイコン3が外
部にアクセスしていないときに主メモリ4からPOPす
るものである。
[Means for Solving the Problems] Claim 1 according to the present invention
The control method of the stack cache of
When SH is performed, a set of the corresponding address and data is held in place of the main memory 4, and the held data that is not PUSHed to the main memory 4 is PUSHed to the main memory 4 when the microcomputer 3 is not accessing outside, and the microcomputer 3 If the corresponding data is held when the POP is performed, the corresponding data is output to the microcomputer 3 instead of the main memory 4, and the data unnecessary at the POP of the microcomputer 3 may be POPed later at the bottom of the stack. In order to replace with, the POP is made from the main memory 4 when the microcomputer 3 is not accessing the outside.

【0013】また、この発明に係る請求項2のスタック
キャッシュは、上記の方式を実現するために、書込み時
にアドレスとデータの組を記憶し、読出し時に入力アド
レスに対応するデータを出力し、各アドレスとデータの
組が有効か否かを示す有効判定手段(Vビット8),及
び各データを主メモリ4の該当アドレスに書込んだか否
かを示す書込み判定手段(Wビット12)を持ち上記各
手段に従って書込みあるいは読出し動作をされるキャッ
シュ10と、キャッシュ10内部のスタックの頂点を示
すポインタ(ITSP13),キャッシュ10内部のス
タックの底を示すポインタ(IBSP14),及びキャ
ッシュ10外部のスタックの頂点を示すポインタ(ET
SP15)で構成され上記各ポインタに従ってキャッシ
ュ10等を制御する能動制御器19と、マイコン3と能
動制御器19の外部アクセスを調停するバス制御部11
とを備えたものである。
In order to realize the above method, the stack cache according to claim 2 of the present invention stores a set of address and data at the time of writing, outputs data corresponding to the input address at the time of reading, and It has a validity determining means (V bit 8) for indicating whether the set of address and data is valid and a write determining means (W bit 12) for indicating whether or not each data is written in the corresponding address of the main memory 4. The cache 10 that is written or read according to each means, a pointer (ITSP13) indicating the top of the stack inside the cache 10, a pointer (IBSP14) indicating the bottom of the stack inside the cache 10, and the top of the stack outside the cache 10. Pointer (ET
SP15), an active controller 19 for controlling the cache 10 and the like in accordance with the above pointers, and a bus controller 11 for arbitrating external access between the microcomputer 3 and the active controller 19.
It is equipped with and.

【0014】[0014]

【作用】請求項1のスタックキャッシュの制御方式にお
いて、スタックキャッシュ20は、マイコン3がPUS
Hするとき主メモリ4に代わって該当アドレスとデータ
の組を保持し、主メモリ4にPUSHされていない保持
データをマイコン3が外部にアクセスしていないときに
自動的に主メモリ4にPUSHし、マイコン3がPOP
するとき該当データを保持していれば主メモリ4に代わ
って該当データをマイコン3に出力し、マイコン3のP
OPで不要になったデータを後にPOPされる可能性の
あるスタック底部のデータに置き換えるため、マイコン
3が外部にアクセスしていないときに主メモリ4から自
動的にPOPする方式をとるため、スタックを操作する
PUSHやPOP命令に必要な時間が減少し、バスの使
用が平均化し、キャッシュ10内に効率良くスタックデ
ータが保持される。
In the stack cache control system according to the first aspect, the stack cache 20 is the microcomputer 3 which is the PUS.
When H, the set of the corresponding address and data is held in place of the main memory 4, and the held data that is not PUSHed to the main memory 4 is automatically PUSHed to the main memory 4 when the microcomputer 3 is not accessing the outside. , The microcomputer 3 is a POP
When the corresponding data is held, the corresponding data is output to the microcomputer 3 instead of the main memory 4, and the P
In order to replace unnecessary data in OP with the data at the bottom of the stack that may be POP later, the POP is automatically performed from the main memory 4 when the microcomputer 3 is not accessing the outside. The time required for the PUSH and POP instructions for operating the is reduced, the bus use is averaged, and the stack data is efficiently held in the cache 10.

【0015】また、請求項2のスタックキャッシュにお
いて、キャッシュ10は、書込み時にアドレスとデータ
の組を記憶し、読出し時に入力アドレスに対応するデー
タを出力し、各アドレスとデータの組が有効か否かを示
す有効判定手段(Vビット8)、及び各データを主メモ
リ4の該当アドレスに書込んだか否かを示す書込み判定
手段(Wビット12)を持ち、上記各手段に従って書込
みあるいは読出し動作をされる。能動制御器19は、キ
ャッシュ10内部のスタックの頂点を示すポインタ(I
TSP13)、キャッシュ10内部のスタックの底を示
すポインタ(IBSP14)、及びキャッシュ10外部
のスタックの頂点を示すポインタ(ETSP15)に従
ってキャッシュ10等を制御する。バス制御部11はマ
イコン3と能動制御器19の外部アクセスを調停する。
このような構成要素を有するスタックキャッシュ20
は、比較的小規模のハードウェアで実現され、請求項1
の動作を可能にする。
Further, in the stack cache according to the present invention, the cache 10 stores the set of address and data at the time of writing, outputs the data corresponding to the input address at the time of reading, and determines whether each set of address and data is valid. There is a validity determining means (V bit 8) indicating whether or not, and a write determining means (W bit 12) indicating whether or not each data is written in the corresponding address of the main memory 4, and the write or read operation is performed according to each of the above means. To be done. The active controller 19 uses a pointer (I
The cache 10 and the like are controlled according to the TSP 13), a pointer (IBSP 14) indicating the bottom of the stack inside the cache 10, and a pointer (ETSP 15) indicating the top of the stack outside the cache 10. The bus control unit 11 arbitrates external access between the microcomputer 3 and the active controller 19.
Stack cache 20 having such components
Is realized with relatively small-scale hardware, and
Enable the operation of.

【0016】[0016]

【実施例】図1はこの発明の一実施例に係るスタックキ
ャッシュを持つマイコンシステムの構成を示すブロック
図である。図1において、図5に示す構成要素に対応す
るものには同一の符号を付し、その説明を省略する。図
1において、8は各アドレスとデータの組が有効か否か
を示すVビット(有効判定手段)、12は各データを主
メモリの該当アドレスに書込んだか否かを示すWビット
(書込み判定手段)、10はセレクタ5、、データ部
6、タグ部7、Vビット8、Wビット12、及び比較器
9より構成されるキャッシュ、13はキャッシュ10内
部のスタックの頂点を示すポインタ(以下ITSPと略
す)、14はキャッシュ10内部のスタックの底を示す
ポインタ(以下IBSPと略す)、15はキャッシュ1
0外部のスタックの頂点を示すポインタ(以下ETSP
と略す)、16はキャッシュ10外部のスタックの底を
示すポインタ(以下EBSPと略す)、17は3ビット
インクリメンタ/デクリメンタ(以下ID3Bと略
す)、18は8ビットインクリメンタ(以下I8Bと略
す)、19はITSP13、IBSP14、ETSP1
5、EBSP16、ID3B17、及びI8B18で構
成された能動制御器、11は従来の機能にマイコン3と
キャッシュ10のバス使用権を調停する機能の加わった
バス制御部、20はキャッシュ10、能動制御部19、
及びバス制御部11から構成されるスタックキャッシュ
である。図2はこの発明の一実施例に係るスタックキャ
ッシュを持つマイコンシステムの動作を示すメモリマッ
プである。
1 is a block diagram showing the configuration of a microcomputer system having a stack cache according to an embodiment of the present invention. In FIG. 1, components corresponding to those shown in FIG. 5 are designated by the same reference numerals, and their description will be omitted. In FIG. 1, 8 is a V bit (validity determination means) indicating whether each address and data pair is valid, and 12 is a W bit indicating whether each data is written to a corresponding address in the main memory (write determination). 10) is a cache composed of a selector 5, a data unit 6, a tag unit 7, a V bit 8, a W bit 12, and a comparator 9, and 13 is a pointer (hereinafter referred to as ITSP) indicating the top of the stack inside the cache 10. Abbreviated), 14 is a pointer (hereinafter abbreviated as IBSP) indicating the bottom of the stack inside the cache 10, and 15 is a cache 1
A pointer indicating the top of the stack outside 0 (hereinafter ETSP
16 is a pointer (hereinafter abbreviated as EBSP) indicating the bottom of the stack outside the cache 10, 17 is a 3-bit incrementer / decrementer (hereinafter abbreviated as ID3B), and 18 is an 8-bit incrementer (hereinafter abbreviated as I8B). , 19 are ITSP13, IBSP14, ETSP1
5, an active controller composed of EBSP16, ID3B17, and I8B18, 11 is a bus control unit in which a function of arbitrating the bus use right of the microcomputer 3 and the cache 10 is added to a conventional function, and 20 is a cache 10 and an active control unit. 19,
And a bus control unit 11 is a stack cache. FIG. 2 is a memory map showing the operation of the microcomputer system having the stack cache according to the embodiment of the present invention.

【0017】図2を用いて図1のスタックキャッシュを
持つマイコンシステムの動作を説明する。図2(a)で
はマイコン3はスタックキャッシュ20のキャッシュ1
0にデータをPUSHする。図2(b)では主メモリ4
にPUSHされていない保持データをマイコン3が外部
にアクセスしていないときに自動的に主メモリ4の該当
アドレスにPUSHする。このように、適宜スタックキ
ャッシュ20内のデータは主メモリ4に書込まれ、スタ
ックキャッシュ20の容量を越えてPUSHしたデータ
はすでに主メモリ4にPUSHされているデータに上書
きされる。しかしスタックキャッシュ20から主メモリ
4への書き込みが間に合わずキャッシュ10内のデータ
が全く主メモリ4に書き込まれていないときは、マイコ
ン3からスタックキャッシュ20へのPUSHに先立っ
てスタックキャッシュ20から主メモリ4への書込みを
行なってから上書きを行なう。
The operation of the microcomputer system having the stack cache shown in FIG. 1 will be described with reference to FIG. In FIG. 2A, the microcomputer 3 uses the cache 1 of the stack cache 20.
PUSH the data to 0. In FIG. 2B, the main memory 4
The held data that has not been PUSHed is automatically PUSHed to the corresponding address of the main memory 4 when the microcomputer 3 is not accessing the outside. In this way, the data in the stack cache 20 is appropriately written in the main memory 4, and the data PUSHed beyond the capacity of the stack cache 20 is overwritten on the data already PUSHed in the main memory 4. However, when the writing from the stack cache 20 to the main memory 4 is not in time and the data in the cache 10 is not written to the main memory 4 at all, prior to the PUSH from the microcomputer 3 to the stack cache 20, After writing to 4, the data is overwritten.

【0018】図2(c)ではマイコン3はスタックキャ
ッシュ20からデータをPOPする。該当データはスタ
ックキャッシュ20に登録されているのでスタックキャ
ッシュ20から読み出される。先に述べたようにPOP
されたスタック上の(キャッシュ10内にある)データ
は、値としてはそのまま残っているが、ソフトウエア的
にはその値を再び読出して利用することはない。そのた
めバス制御部11はキャッシュ10のPOPされたデー
タを無効化する。従って、スタックキャッシュ20内の
有効データの頂点が常にスタックの頂点となる。図2
(d)ではマイコン3が外部にアクセスしないときマイ
コン3からの読み込みによって不要になったアドレスと
データの組に代わって、上書きによって消去されていた
データのうち一番最近に消去されていたデータから順
に、主メモリ4に書込まれていたデータを読み込む。こ
のように、適宜上書きによって消去されていたデータが
主メモリ4からPOPされ、スタックキャッシュ20の
容量を越えてPOPしても常にスタックキャッシュ20
内にマイコン3がPOPすべきデータが存在するが、主
メモリ4からの読み込みが間に合わずキャッシュ10内
に有効データが全くないときは、マイコン3はキャッシ
ュ10からのPOPを行なわず、主メモリ4から直接P
OPのみを行なう。これはPOPされてソフトウエア的
に無効になったデータをキャッシュ10に取り込まない
ためである。
In FIG. 2C, the microcomputer 3 pops the data from the stack cache 20. Since the relevant data is registered in the stack cache 20, it is read from the stack cache 20. As mentioned earlier, POP
The data on the created stack (in the cache 10) remains as a value, but the software does not read and use the value again. Therefore, the bus control unit 11 invalidates the POP data in the cache 10. Therefore, the valid data vertex in the stack cache 20 is always the stack vertex. Figure 2
In (d), when the microcomputer 3 does not access the outside, the most recently erased data among the data erased by overwriting is used instead of the address and data set which becomes unnecessary by the reading from the microcomputer 3. The data written in the main memory 4 are read in order. In this way, even if the data that has been erased by overwriting is popped from the main memory 4 and exceeds the capacity of the stack cache 20, the stack cache 20 is always popped.
If there is data to be popped by the microcomputer 3, but there is no valid data in the cache 10 because the data from the main memory 4 cannot be read in time, the microcomputer 3 does not perform the POP from the cache 10 and the main memory 4 Directly from P
Perform only OP. This is because data that has been POP'd and has become invalid due to software is not taken into the cache 10.

【0019】次に図1を用いてこの実施例のスタックキ
ャッシュを持つマイコンシステムの動作を詳細に説明す
る。あらかじめETSP15とEBSP16にSP1の
初期値をマイコン3から書き込んでおく。データをPU
SHするとき、マイコン3は現在のスタックの頂点を示
すSP1の値をID8B2でデクリメント(−1)し、
その値をアドレスとして書込みを行なう。実際にはこの
ときバス制御部11がデータをキャッシュ10に書込
む。アドレスが8ビットの2進数「0101010
1」、データが8ビットの2進数「11101110」
である場合のキャッシュ10内の動作を説明する。キャ
ッシュ10が図1に示すような8エントリの構成の場
合、アドレスの下位3ビット「101」がITSP13
とIBSP14の下位3ビットとセレクタ5に与えら
れ、セレクタ5はタグ部7とWビット12とVビット8
とデータ部6の「101」に対応する部分を選択する。
タグ部7の「101」対応部分は記録していたアドレス
の上位5ビット「XXXXX」をIBSP14の上位5
ビットに与える。Wビット12の「101」対応部分は
記録している値を出力し、Wビット12が「1」の場合
はキャッシュ10の該当データはすでに主メモリ4に書
込まれているので、バス制御部11が上書き動作を行な
い、「0」の場合は後で述べる主メモリ4への書込みを
行なってから上書き動作を行なう。上書き動作として、
タグ部7の「101」対応部分はアドレスの上位5ビッ
ト「01010」を記録し、Wビット12の「101」
対応部分は「0」を記録し、Vビット8の「101」対
応部分は「1」を記録し、データ部6の「101」対応
部分はデータ「11101110」を記録する。
Next, the operation of the microcomputer system having the stack cache of this embodiment will be described in detail with reference to FIG. The initial value of SP1 is written in advance from the microcomputer 3 into ETSP15 and EBSP16. PU data
When SH is performed, the microcomputer 3 decrements (-1) the value of SP1 indicating the top of the current stack with ID8B2,
Writing is performed using the value as an address. Actually, at this time, the bus control unit 11 writes the data in the cache 10. The address is an 8-bit binary number "0101010
1 ”, the data is an 8-bit binary number“ 11101110 ”
The operation in the cache 10 in the case of When the cache 10 has a structure of 8 entries as shown in FIG. 1, the lower 3 bits “101” of the address are the ITSP 13
And the lower 3 bits of the IBSP 14 and the selector 5, and the selector 5 includes the tag unit 7, the W bit 12, and the V bit 8
And a portion corresponding to “101” of the data portion 6 is selected.
In the portion corresponding to “101” of the tag portion 7, the upper 5 bits “XXXXXXX” of the recorded address are set to the upper 5 of the IBSP 14.
Give to a bit. The portion corresponding to "101" of the W bit 12 outputs the recorded value. When the W bit 12 is "1", the corresponding data in the cache 10 has already been written in the main memory 4, so the bus control unit 11 performs the overwrite operation, and when it is "0", the overwrite operation is performed after writing to the main memory 4 described later. As an overwrite operation,
In the portion corresponding to “101” of the tag portion 7, the upper 5 bits “01010” of the address are recorded, and the W bit 12 “101”.
The corresponding portion records “0”, the V bit 8 “101” corresponding portion records “1”, and the data portion 6 “101” corresponding portion records data “11101110”.

【0020】データをPOPするとき、マイコン3は現
在のスタックの頂点を示すSP1の値をアドレスとして
読込みを行ない、SP1をID8B2でインクリメント
(+1)する。マイコン3から読出しアドレスとして8
ビットの2進数「01010101」が出力されると、
バス制御部11はまずキャッシュ10に対してそのアド
レスを通知する。キャッシュ10内部でアドレスの下位
3ビット「101」がセレクタ5に与えられ、セレクタ
5はタグ部7とWビット12とVビット8とデータ部6
の「101」に対応する部分を選択する。Vビット8の
「101」対応部分は記録していた値を出力し、Vビッ
ト8が「1」の場合はキャッシュ10内の該当データが
有効であるのでバス制御部11はキャッシュ10からP
OP動作を行ない、「0」の場合は主メモリ4からの直
接POPを行なう。キャッシュ10からのPOP動作と
して、タグ部7の「101」対応部分は記録されていた
アドレスの上位5ビット「01010」を比較器9に出
力し、比較器9は入力アドレスの上位5ビット「010
10」と、記録されていたアドレスの上位5ビット「0
1010」とを比較し、一致していることを通知する。
アドレスの一致と該当データの有効が示されたのでデー
タ部6の「101」対応部分はデータ「1110111
0」をマイコン3に出力する。Wビット12の「10
1」対応部分に「1」を記録し、Vビット8の「10
1」対応部分に「0」を記録する。能動制御器19で
は、ETSP15の内容とITSP13の内容が等しけ
れば、ETSP15とITSP13の両方の内容をID
3B17でインクリメント(+1)し、等しくなければ
ITSP13のみをインクリメント(+1)する。
When POP data, the microcomputer 3 reads the value of SP1 indicating the top of the current stack as an address, and increments (+1) SP1 by ID8B2. 8 as read address from microcomputer 3
When the binary number "01010101" is output,
The bus control unit 11 first notifies the cache 10 of the address. The lower 3 bits “101” of the address are given to the selector 5 inside the cache 10, and the selector 5 has the tag section 7, the W bit 12, the V bit 8 and the data section 6.
The portion corresponding to “101” of is selected. The portion corresponding to "101" of V bit 8 outputs the recorded value. When V bit 8 is "1", the corresponding data in cache 10 is valid, so bus control unit 11 causes cache 10 to cache P
The OP operation is performed, and when it is "0", the POP is directly performed from the main memory 4. As a POP operation from the cache 10, the portion corresponding to "101" of the tag unit 7 outputs the upper 5 bits "01010" of the recorded address to the comparator 9, and the comparator 9 outputs the upper 5 bits "010" of the input address.
10 "and the upper 5 bits of the recorded address" 0 "
1010 "is compared to notify that they match.
Since it is shown that the addresses match and the corresponding data is valid, the portion corresponding to “101” in the data portion 6 is the data “1110111”.
0 ”is output to the microcomputer 3. W bit 12 “10
"1" is recorded in the portion corresponding to "1", and "10" of V bit 8 is recorded.
"0" is recorded in the portion corresponding to "1". In the active controller 19, if the contents of ETSP15 and the contents of ITSP13 are equal, the contents of both ETSP15 and ITSP13 are ID.
3B17 increments (+1), and if not equal, ITSP13 only increments (+1).

【0021】バス制御部11がマイコン3とキャッシュ
10の外部にアクセスを調停し、マイコン3の外部アク
セスがないときに、スタックキャッシュ20は自動的に
PUSH又はPOPを行なう。IBSP14の下位3ビ
ットとITSP13のビットが等しくなければ、スタッ
クキャッシュ20は自動的にPOPを行なう。即ち能動
制御器19がマイコン3からの読み込みによって不要に
なったアドレスとデータの組に代わって、上書きによっ
て消去されていたデータのうち一番最近に消去されてい
たデータから順に、主メモリ4に書込まれていたデータ
をキャッシュ10に読み込む。この時まず、能動制御器
19はIBSP14とEBSP16を内容比較して、等
しければすでに主メモリ4上のスタックの底までキャッ
シュ10がデータを読み込んでいることになるため、な
にも行なわない。そうでなければ、主メモリ4に対し
て、IBSP14の値をアドレスとして出力してデータ
を読出す。また能動制御器19はIBSP14の下位3
ビットをセレクタ5に与え、セレクタ5はタグ部7とW
ビット12とVビット8とデータ部6の対応する部分を
選択する。読出したデータはデータ部6の対応部分に記
録し、タグ部7の対応部分はIBSP14の上位5ビッ
トを記録し、Vビット8の対応部分は「1」を記録し、
Wビット12の対応部分は「1」を記録し、IBSP1
4をI8B18でインクリメント(+1)してスタック
キャッシュ20の自動的なPOPが完了する。
The bus control unit 11 arbitrates access to the outside of the microcomputer 3 and the cache 10, and when there is no external access of the microcomputer 3, the stack cache 20 automatically performs PUSH or POP. If the lower 3 bits of the IBSP 14 and the bits of the ITSP 13 are not equal, the stack cache 20 automatically performs the POP. That is, the active controller 19 replaces the set of addresses and data that is no longer needed by the reading from the microcomputer 3 with the main memory 4 in order from the most recently erased data that has been erased by overwriting. The written data is read into the cache 10. At this time, the active controller 19 first compares the contents of the IBSP 14 and the EBSP 16, and if they are equal, it means that the cache 10 has already read the data to the bottom of the stack in the main memory 4, and therefore does nothing. If not, the value of the IBSP 14 is output to the main memory 4 as an address to read the data. Further, the active controller 19 is the lower 3 of the IBSP 14.
The bits are given to the selector 5, and the selector 5 and the tag unit 7 and W
Corresponding parts of bit 12 and V bit 8 and data part 6 are selected. The read data is recorded in the corresponding part of the data part 6, the corresponding part of the tag part 7 records the upper 5 bits of the IBSP 14, and the corresponding part of the V bit 8 records "1",
“1” is recorded in the corresponding portion of the W bit 12, and IBSP1
4 is incremented (+1) by I8B18 to complete the automatic POP of the stack cache 20.

【0022】IBSP14の下位3ビットとITSP1
3のビットが等しくてETSP15とITSP13のビ
ットが等しくないとき、スタックキャッシュ20は自動
的にPUSHを行なう。即ち、バス制御部11は、キャ
ッシュ10のデータのうち主メモリ4に書込んでいない
データを古いものから主メモリ4の該当アドレスに書込
む。能動制御器19はETSP15をID3B17でデ
クリメント(−1)し、ETSP15の値をセレクタ5
に与え、セレクタ5はタグ部7とWビット12とVビッ
ト8とデータ部6の対応する部分を選択する。まず、バ
ス制御部11は、Vビット8の対応部分から記録してい
た値を読みだし、「1」であれば、該当データは有効で
あるので書込みを行ない、「0」であれば、他のデバイ
スが該当アドレスを書き換えたことを示すので、書込み
は行なわない。書込み動作として、バス制御部11はタ
グ部7の対応部分から記録していたアドレスの上位5ビ
ットを読出し、ETSP15の3ビットと合わせて書込
みデータのアドレスとして主メモリ4に出力する。そし
て、データ部6の対応部分から記録していたデータを読
出して主メモリ4に書込む。Wビット12の対応部分は
「1」を記録してスタックキャッシュ20の自動的なP
USHが完了する。IBSP14の下位3ビットとIT
SP13のビットが等しくてETSP15とITSP1
3のビットが等しいときはスタックキャッシュ20はバ
ス制御部11にアクセス要求を行なわない。
Lower 3 bits of IBSP14 and ITSP1
When the 3 bits are equal and the ETSP 15 and ITSP 13 bits are not equal, the stack cache 20 automatically performs PUSH. That is, the bus control unit 11 writes the data, which has not been written in the main memory 4 among the data in the cache 10, to the corresponding address in the main memory 4 from the oldest one. The active controller 19 decrements (-1) the ETSP15 with the ID3B17, and the value of the ETSP15 is selected by the selector 5
The selector 5 selects the corresponding portion of the tag portion 7, the W bit 12, the V bit 8 and the data portion 6. First, the bus control unit 11 reads the recorded value from the corresponding portion of the V bit 8, and if it is "1", the corresponding data is valid and therefore is written. If it is "0", other data is written. No writing is performed because it indicates that the device has rewritten the corresponding address. As a write operation, the bus control unit 11 reads out the upper 5 bits of the recorded address from the corresponding portion of the tag unit 7, and outputs it to the main memory 4 as an address of write data together with 3 bits of the ETSP 15. Then, the recorded data is read from the corresponding portion of the data portion 6 and written in the main memory 4. The corresponding portion of the W bit 12 records “1” and the stack cache 20 automatically sets P
USH is complete. Lower 3 bits of IBSP14 and IT
Bits of SP13 are equal and ETSP15 and ITSP1
When the 3 bits are equal, the stack cache 20 does not make an access request to the bus control unit 11.

【0023】尚、この実施例ではキャッシュ10の構成
を図1のような単純な構成にしているが、アドレスとデ
ータとVビットとWビットを一組にして登録できるもの
であればキャッシュの形式や容量を問わない。キャッシ
ュの容量とデータ幅(ビット数)とは、組み合わせるマ
イコンのレジスタ数とバス幅(ビット数)とに依存す
る。例えば32ビットマイコンであればキャッシュのデ
ータ幅を32ビット又は32×Nビットとし、キャッシ
ュ容量はレジスタ数以上、実際的にはレジスタ数の3〜
4倍以上の容量があれば効率的な使用が可能である。
In this embodiment, the cache 10 has a simple structure as shown in FIG. 1. However, if the address, data, V bit and W bit can be registered as a set, the cache format will be used. And capacity. The capacity of the cache and the data width (the number of bits) depend on the number of registers and the bus width (the number of bits) of the microcomputer to be combined. For example, in the case of a 32-bit microcomputer, the data width of the cache is set to 32 bits or 32 × N bits, and the cache capacity is equal to or larger than the number of registers.
Efficient use is possible if the capacity is four times or more.

【0024】[0024]

【発明の効果】以上のように請求項1の発明によれば、
マイクロコンピュータがプッシュするとき主メモリに代
わって該当アドレスとデータの組を保持し、上記主メモ
リにプッシュされていない保持データを上記マイクロコ
ンピュータが外部にアクセスしていないときに上記主メ
モリにプッシュし、上記マイクロコンピュータがポップ
するとき該当データを保持していれば上記主メモリに代
わって該当データを上記マイクロコンピュータに出力
し、上記マイクロコンピュータのポップで不要になった
データを後にポップされる可能性のあるスタック底部の
データに置き換えるため、上記マイクロコンピュータが
外部にアクセスしていないときに上記主メモリからポッ
プするように制御するので、バスの使用が平均化し、ス
タックを操作するPUSHやPOP命令に必要な時間を
減少させることができ、また、キャッシュ内にPOP後
のソフトウエア上無効なデータが保持されるようなこと
がなくなり、したがってキャッシュ内に効率良くスタッ
クデータを保持できるという効果が得られる。
As described above, according to the invention of claim 1,
When the microcomputer pushes, it holds the corresponding address and data set in place of the main memory, and pushes the held data not pushed to the main memory to the main memory when the microcomputer does not access the outside. , If the microcomputer holds the corresponding data when popping, the corresponding data is output to the microcomputer instead of the main memory, and there is a possibility that the data no longer needed by the popping of the microcomputer will be popped later. In order to replace it with the data at the bottom of the stack, the microcomputer is controlled so that it pops from the main memory when it is not accessing the outside, so the use of the bus is averaged, and PUSH and POP instructions for operating the stack are executed. Can reduce the time needed In addition, there is no such thing as software on invalid data after POP is maintained in the cache, thus the effect is obtained that can be efficiently hold the stack data in the cache.

【0025】また、請求項2の発明によれば、書込み時
にアドレスとデータの組を記憶し、読出し時に入力アド
レスに対応するデータを出力し、各アドレスとデータの
組が有効か否かを示す有効判定手段,及び各データを主
メモリの該当アドレスに書込んだか否かを示す書込み判
定手段を持ち上記各手段に従って書込みあるいは読出し
動作をされるキャッシュと、このキャッシュ内部のスタ
ックの頂点を示すポインタ,上記キャッシュ内部のスタ
ックの底を示すポインタ,及び上記キャッシュ外部のス
タックの頂点を示すポインタで構成され上記各ポインタ
に従って上記キャッシュ等を制御する能動制御器と、マ
イクロコンピュータと上記能動制御器の外部アクセスを
調停するバス制御部とを備えて構成したので、上記請求
項1の発明の動作を比較的小規模のハードウェアの追加
で実現できるという効果が得られる。
According to the second aspect of the invention, the set of address and data is stored at the time of writing, and the data corresponding to the input address is output at the time of reading to indicate whether each set of address and data is valid. A cache which has a validity judging means and a write judging means which indicates whether or not each data is written to the corresponding address of the main memory, and which is written or read according to the above means, and a pointer which indicates the top of the stack inside the cache. An active controller configured by a pointer indicating the bottom of the stack inside the cache and a pointer indicating the apex of the stack outside the cache for controlling the cache and the like according to each of the pointers, and the outside of the microcomputer and the active controller. Since the bus control unit for arbitrating access is provided, the operation of the invention of claim 1 The effect is obtained that can be achieved with a relatively small scale of hardware additional.

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

【図1】この発明の一実施例に係るマイクロコンピュー
タシステムの構成を示すブロック図である。
FIG. 1 is a block diagram showing a configuration of a microcomputer system according to an embodiment of the present invention.

【図2】この実施例の動作を示すメモリマップである。FIG. 2 is a memory map showing the operation of this embodiment.

【図3】キャッシュを持たない従来のマイクロコンピュ
ータシステムの構成を示すブロック図である。
FIG. 3 is a block diagram showing a configuration of a conventional microcomputer system having no cache.

【図4】図3の従来例の動作を示すメモリマップであ
る。
FIG. 4 is a memory map showing the operation of the conventional example of FIG.

【図5】キャッシュを持つ従来のマイクロコンピュータ
システムの構成を示すブロック図である。
FIG. 5 is a block diagram showing a configuration of a conventional microcomputer system having a cache.

【図6】図5の従来例の動作を示すメモリマップであ
る。
FIG. 6 is a memory map showing the operation of the conventional example of FIG.

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

3 マイクロコンピュータ 4 主メモリ 8 Vビット(有効判定手段) 10 キャッシュ 11 バス制御部 12 Wビット(書込み判定手段) 13 ITSP(キャッシュ内部のスタックの頂点を示
すポインタ) 14 IBSP(キャッシュ内部のスタックの底を示す
ポインタ) 15 ETSP(キャッシュ外部のスタックの頂点を示
すポインタ) 19 能動制御器 20 スタックキャッシュ
3 Microcomputer 4 Main memory 8 V bit (validity determination means) 10 Cache 11 Bus control unit 12 W bit (write determination means) 13 ITSP (pointer indicating the top of the stack inside the cache) 14 IBSP (bottom of the stack inside the cache) 15 pointer ETSP (pointer indicating the top of the stack outside the cache) 19 active controller 20 stack cache

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】 主メモリ上のデータ構造として最後に入
力したデータが最初に出力されるスタック構造をサポー
トし、スタックへのデータ入力をプッシュ、上記スタッ
クからのデータ出力をポップとして、他のデータ書込み
/読出しと区別してデータ処理を行なうマイクロコンピ
ュータを備えたマイクロコンピュータシステムにおい
て、上記マイクロコンピュータがプッシュするとき上記
主メモリに代わって該当アドレスとデータの組を保持
し、上記主メモリにプッシュされていない保持データを
上記マイクロコンピュータが外部にアクセスしていない
ときに上記主メモリにプッシュし、上記マイクロコンピ
ュータがポップするとき該当データを保持していれば上
記主メモリに代わって該当データを上記マイクロコンピ
ュータに出力し、上記マイクロコンピュータのポップで
不要になったデータを後にポップされる可能性のあるス
タック底部のデータに置き換えるため、上記マイクロコ
ンピュータが外部にアクセスしていないときに上記主メ
モリからポップすることを特徴とするスタックキャッシ
ュの制御方式。
1. A stack structure in which the last input data is output first as a data structure on the main memory is supported, the data input to the stack is pushed, the data output from the stack is pop, and another data is output. In a microcomputer system including a microcomputer that performs data processing separately from writing / reading, when the microcomputer pushes, it holds a corresponding address and data set in place of the main memory and pushes it to the main memory. If the held data is pushed to the main memory when the microcomputer is not accessing the outside and the corresponding data is held when the microcomputer pops, the corresponding data is replaced with the main memory instead of the main memory. Output to the above Characterized by popping from the main memory when the microcomputer is not accessing outside in order to replace unnecessary data by popping the microcomputer with data at the bottom of the stack that may be popped later. Stack cache control method.
【請求項2】 書込み時にアドレスとデータの組を記憶
し、読出し時に入力アドレスに対応するデータを出力
し、各アドレスとデータの組が有効か否かを示す有効判
定手段,及び各データを主メモリの該当アドレスに書込
んだか否かを示す書込み判定手段を持ち上記各手段に従
って書込みあるいは読出し動作をされるキャッシュと、
このキャッシュ内部のスタックの頂点を示すポインタ,
上記キャッシュ内部のスタックの底を示すポインタ,及
び上記キャッシュ外部のスタックの頂点を示すポインタ
で構成され上記各ポインタに従って上記キャッシュ等を
制御する能動制御器と、マイクロコンピュータと上記能
動制御器の外部アクセスを調停するバス制御部とを備え
たことを特徴とするスタックキャッシュ。
2. A validity determining means for storing a set of an address and data at the time of writing, outputting data corresponding to an input address at the time of reading, and indicating validity of each set of the address and data, and each data. A cache which has a write determination means for indicating whether or not the data has been written to the corresponding address of the memory, and which is written or read in accordance with each of the above means;
A pointer to the top of the stack inside this cache,
An active controller configured by a pointer indicating the bottom of the stack inside the cache and a pointer indicating the apex of the stack outside the cache for controlling the cache and the like according to each pointer, and external access to the microcomputer and the active controller. And a bus control unit that arbitrates the stack cache.
JP3210120A 1991-07-26 1991-07-26 Stack cache and control system thereof Pending JPH05143330A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3210120A JPH05143330A (en) 1991-07-26 1991-07-26 Stack cache and control system thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3210120A JPH05143330A (en) 1991-07-26 1991-07-26 Stack cache and control system thereof

Publications (1)

Publication Number Publication Date
JPH05143330A true JPH05143330A (en) 1993-06-11

Family

ID=16584129

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3210120A Pending JPH05143330A (en) 1991-07-26 1991-07-26 Stack cache and control system thereof

Country Status (1)

Country Link
JP (1) JPH05143330A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6341334B1 (en) 1998-03-24 2002-01-22 Mitsubishi Denki Kabushiki Kaisha Bridge method, bus bridge, and multiprocessor system
JP2004303232A (en) * 2003-03-20 2004-10-28 Matsushita Electric Ind Co Ltd Data memory cache device and data memory cache system
US7203798B2 (en) 2003-03-20 2007-04-10 Matsushita Electric Industrial Co., Ltd. Data memory cache unit and data memory cache system
JP2009540438A (en) * 2006-06-06 2009-11-19 クゥアルコム・インコーポレイテッド Processor core stack expansion
JP2011022746A (en) * 2009-07-15 2011-02-03 Renesas Electronics Corp Data replacement method for cache memory

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6341334B1 (en) 1998-03-24 2002-01-22 Mitsubishi Denki Kabushiki Kaisha Bridge method, bus bridge, and multiprocessor system
JP2004303232A (en) * 2003-03-20 2004-10-28 Matsushita Electric Ind Co Ltd Data memory cache device and data memory cache system
US7203798B2 (en) 2003-03-20 2007-04-10 Matsushita Electric Industrial Co., Ltd. Data memory cache unit and data memory cache system
CN100382050C (en) * 2003-03-20 2008-04-16 松下电器产业株式会社 Data sotrage cache memory and data storage cache system
EP1467284A3 (en) * 2003-03-20 2008-09-10 Matsushita Electric Industrial Co., Ltd. Data memory cache unit and data memory cache system
JP2009540438A (en) * 2006-06-06 2009-11-19 クゥアルコム・インコーポレイテッド Processor core stack expansion
JP2011022746A (en) * 2009-07-15 2011-02-03 Renesas Electronics Corp Data replacement method for cache memory

Similar Documents

Publication Publication Date Title
US4937738A (en) Data processing system which selectively bypasses a cache memory in fetching information based upon bit information of an instruction
JP3204323B2 (en) Microprocessor with built-in cache memory
JPH03206523A (en) Method of pushing data on stack inside memory in digital computor and circuit executing stack operation in digital computor havingcommand and memory to be pipe-lined
JPH05150981A (en) Data processor
JPH04242848A (en) System for controlling cache memory by running mode
JPH0748190B2 (en) Microprocessor with cache memory
JPH0527971A (en) Information processor
US7334109B1 (en) Method and apparatus for improving segmented memory addressing
JPH05143330A (en) Stack cache and control system thereof
US5581720A (en) Apparatus and method for updating information in a microcode instruction
US5765190A (en) Cache memory in a data processing system
US5012410A (en) Data processor with instruction cache memory
US5724548A (en) System including processor and cache memory and method of controlling the cache memory
US6192449B1 (en) Apparatus and method for optimizing performance of a cache memory in a data processing system
US5613081A (en) Method of operating a data processor with rapid address comparison for data forwarding
US4853889A (en) Arrangement and method for speeding the operation of branch instructions
JPH09505428A (en) Microcontroller with page address mode
JP2540959B2 (en) Information processing device
JP3217348B2 (en) Information processing system
JP2927160B2 (en) Register device
JPH0385636A (en) Instruction advance control device
JPH07152654A (en) Method for processing of memory access error and for renewal of address-conversion cache
JPH05257807A (en) Cache memory controller
JP2694076B2 (en) Storage unit control device
JP3476376B2 (en) Virtual storage address space access control method and apparatus therefor