JPH09292995A - Instruction prefetching circuit - Google Patents

Instruction prefetching circuit

Info

Publication number
JPH09292995A
JPH09292995A JP10260896A JP10260896A JPH09292995A JP H09292995 A JPH09292995 A JP H09292995A JP 10260896 A JP10260896 A JP 10260896A JP 10260896 A JP10260896 A JP 10260896A JP H09292995 A JPH09292995 A JP H09292995A
Authority
JP
Japan
Prior art keywords
instruction
address
subroutine
return
signal
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
JP10260896A
Other languages
Japanese (ja)
Inventor
Takakazu Mishima
位和 三嶋
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.)
NEC Ibaraki Ltd
Original Assignee
NEC Ibaraki 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 NEC Ibaraki Ltd filed Critical NEC Ibaraki Ltd
Priority to JP10260896A priority Critical patent/JPH09292995A/en
Publication of JPH09292995A publication Critical patent/JPH09292995A/en
Pending legal-status Critical Current

Links

Landscapes

  • Advance Control (AREA)
  • Executing Machine-Instructions (AREA)

Abstract

PROBLEM TO BE SOLVED: To improve performance by abolishing unnecessary instruction prefetch so as to realize an effective instruction prefetch at the time of returning to a main routine from a subroutine. SOLUTION: An address generating part 7 generates the address of an instruction next to an instruction under execution. At the time of detecting a subroutine call instruction, a call instruction detection part 6 allows an address holding part 8 to hold an address generated the the generation part 7. The address held at this time is that of an instruction next to the subroutine call instruction, namely the instruction just after returning from the subroutine. When a return instruction detecting part 5 detects a return instruction in the middle of executing subroutine processing, an address selection part 9 selects the address held by the holding part 8 to use this address as an address for prefetch.

Description

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

【0001】[0001]

【発明の属する技術分野】本発明は命令先取り装置に関
し、特に、サブルーチン命令に好適な命令先取り装置に
関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an instruction prefetching device, and more particularly to an instruction prefetching device suitable for a subroutine instruction.

【0002】[0002]

【従来の技術】従来のこの種の命令先取り装置は、サブ
ルーチン処理中であるか否かを考慮せずに、命令の先取
りを行うものが多かった。これに対し、特開昭61−1
96332には、先取りした複数の命令を格納するレジ
スタを複数個有し、サブルーチン処理の終了までメイン
ルーチンにおけるサブルーチンへの分岐後の命令を保存
しておく方法が記載されている。
2. Description of the Related Art Many conventional instruction prefetching devices of this type prefetch an instruction without considering whether or not a subroutine is being processed. On the other hand, JP-A-61-1
96332 describes a method in which a plurality of registers for storing a plurality of prefetched instructions are provided and the instructions after branching to the subroutine in the main routine are stored until the end of the subroutine processing.

【0003】[0003]

【発明が解決しようとする課題】上述した従来の多くの
命令先取り装置では、サブルーチンからのリターン命令
を実行した時点で、サブルーチン処理中に先取りしてい
た命令が不必要となり、改めてメインルーチンの命令を
取り直す必要が生じるため、サブルーチンからメインル
ーチンへ戻る際に、無駄な命令先取りが発生し、性能向
上の妨げとなっている。
In many of the conventional instruction prefetching apparatus described above, the instruction prefetched during the processing of the subroutine becomes unnecessary when the return instruction from the subroutine is executed, and the instruction of the main routine is newly provided. Since it is necessary to retake the above, unnecessary instruction prefetch occurs when returning from the subroutine to the main routine, which hinders performance improvement.

【0004】また、特開昭61−196332に記載さ
れている方法では、先取りした複数の命令を格納するレ
ジスタを用意する必要があり、ハードウェア量の増大を
招くという問題点がある。
Further, the method disclosed in Japanese Patent Laid-Open No. 61-196332 has a problem that it is necessary to prepare a register for storing a plurality of prefetched instructions, which causes an increase in the amount of hardware.

【0005】本発明の目的は、サブルーチンからメイン
ルーチンへ戻る際に、不要な命令先取りを廃し、有効な
命令先取りを実現し、性能向上を図る命令先取り装置を
提供することである。
An object of the present invention is to provide an instruction prefetching device which eliminates unnecessary instruction prefetching, realizes effective instruction prefetching, and improves performance when returning from a subroutine to a main routine.

【0006】[0006]

【課題を解決するための手段】本発明の命令先取り装置
は、メインルーチンからサブルーチンへ移る際の戻り先
のアドレスを保持しておき、サブルーチン処理中の命令
先取り時に、リターン命令を検出すると、次の命令先取
り用のアドレスとして、前記保持しておいた戻り先アド
レスを使用することを特徴とする。
The instruction prefetching apparatus of the present invention holds a return address when a main routine is moved to a subroutine, and when a return instruction is detected during instruction prefetching during subroutine processing, The return address held as described above is used as the address for prefetching the instruction.

【0007】[0007]

【発明の実施の形態】次に、本発明の実施例について図
面を参照して詳細に説明する。
Embodiments of the present invention will now be described in detail with reference to the drawings.

【0008】図1は、本発明の一実施例のブロック図で
あり、処理装置1と記憶装置2とから成る。処理装置1
は、命令実行部3,命令バッファ4リターン命令検出部
5,コール命令検出部6,アドレス生成部7,アドレス
保持部8,アドレス選択部9,先取りアドレス生成部1
0およびカウンタ11から構成される。
FIG. 1 is a block diagram of an embodiment of the present invention, which comprises a processing device 1 and a storage device 2. Processing device 1
Is an instruction execution unit 3, an instruction buffer 4, a return instruction detection unit 5, a call instruction detection unit 6, an address generation unit 7, an address holding unit 8, an address selection unit 9, a prefetch address generation unit 1.
It consists of 0 and a counter 11.

【0009】記憶装置2は、アドレス選択部9が送出す
るアドレス信号ADによって指定されるアドレスからデ
ータ信号DTを送出する機能を持ち、アドレス信号AD
とデータ信号DTは命令バッファ4に蓄えられる。命令
実行部3は、命令バッファ4から逐次に命令を取り出し
て実行していく。また、先取りアドレス生成部10は、
アドレス信号ADと、そのときに記憶装置2から読み出
すバイト数とから、先取りアドレスを生成しアドレス信
号PADとしてアドレス選択部9に送出する。
The memory device 2 has a function of transmitting the data signal DT from an address designated by the address signal AD transmitted by the address selecting section 9, and the address signal AD
And the data signal DT are stored in the instruction buffer 4. The instruction execution unit 3 sequentially fetches instructions from the instruction buffer 4 and executes them. Further, the prefetch address generation unit 10
A prefetch address is generated from the address signal AD and the number of bytes read from the storage device 2 at that time, and is output to the address selection unit 9 as the address signal PAD.

【0010】一方、リターン命令検出部5は、データ信
号DTをデコードしてリターン命令を検出するとリター
ン信号RTNをアドレス選択部9とカウンタ11に送出
する。コール命令検出部6は、命令バッファ4から取り
出される実行命令信号CMDをデコードして、コール命
令を検出するとコール命令信号CALをアドレス保持部
8とカウンタ11に送出する。また、アドレス生成部7
は、命令バッファ4から取り出される実行命令信号CM
Dと実行アドレス信号BADとから、実行中のコマンド
のアドレスの次のアドレスを生成し、生成アドレス信号
GADとしてアドレス保持部8に送出する。
On the other hand, the return instruction detecting section 5 decodes the data signal DT to detect a return instruction, and then sends a return signal RTN to the address selecting section 9 and the counter 11. The call instruction detecting unit 6 decodes the execution instruction signal CMD fetched from the instruction buffer 4, and when detecting the call instruction, sends the call instruction signal CAL to the address holding unit 8 and the counter 11. Also, the address generator 7
Is an execution instruction signal CM fetched from the instruction buffer 4.
An address next to the address of the command being executed is generated from D and the execution address signal BAD, and the generated address signal GAD is sent to the address holding unit 8.

【0011】カウンタ11は、アドレス保持部8をワー
ド数分の大きさを持ち、コール命令信号CALを受信す
るとカウントアップし、リターン信号RTNを受信する
とカウントダウンする。また、カウンタ11が示す値を
ライト信号Wとして送出し、カウンタ値マイナス1の値
をリード信号Rとして送出する。
The counter 11 has a size corresponding to the number of words in the address holding unit 8 and counts up when the call command signal CAL is received and counts down when the return signal RTN is received. Further, the value indicated by the counter 11 is sent as the write signal W, and the value minus the counter value is sent as the read signal R.

【0012】アドレス保持部8は上述したように、コー
ル命令信号CALを受信するとライト信号Wが示すワー
ドに生成アドレス信号GADを書き込む。また、リード
信号Rが示すワードの値を保持アドレス信号SADとし
て送出する。このようにして、カウンタ11とアドレス
保持部8は、先入れ後出し式のバッファを形成してお
り、サブルーチンから更にサブルーチンを呼ぶ、いわゆ
る入れ子状態の場合にも、シークエンスを狂わすことな
く、対応が可能である。
As described above, the address holding unit 8 writes the generated address signal GAD in the word indicated by the write signal W when receiving the call command signal CAL. Further, the value of the word indicated by the read signal R is transmitted as the holding address signal SAD. In this way, the counter 11 and the address holding unit 8 form a first-in / first-out buffer, and even in the case of a so-called nested state in which a subroutine is further called, the sequence can be dealt with without disturbing the sequence. It is possible.

【0013】アドレス選択部9は、リターン信号RTN
が非アクティブならアドレス信号PAD、リターン信号
RTNがアクティブなら保持アドレス信号SADを選択
して、アドレス信号ADとする。
The address selection unit 9 uses the return signal RTN.
Is inactive, the address signal PAD is selected, and if the return signal RTN is active, the holding address signal SAD is selected and used as the address signal AD.

【0014】いま、一つの命令を先取りした後に、次に
命令を先取りする動作について説明する。
Now, the operation of prefetching one instruction and then prefetching the next instruction will be described.

【0015】先取りした命令のアドレスと、その命令の
バイト数とを基に、先取りアドレス生成部10にて、次
に先取りする命令のアドレス信号PADを生成する。ア
ドレス信号PADは、アドレス選択部9にて、リターン
信号RTNが非アクティブである条件にて選択され、ア
ドレス信号ADとして記憶装置2に送出される。記憶装
置2は、アドレス信号ADに従い、命令をデータ信号D
Tとして、処理装置1に送出する。このようにして、先
取りした命令の直後の命令を先取りすることができる。
Based on the address of the prefetched instruction and the number of bytes of the instruction, the prefetch address generator 10 generates the address signal PAD of the next prefetched instruction. The address signal PAD is selected by the address selection unit 9 under the condition that the return signal RTN is inactive, and is sent to the storage device 2 as the address signal AD. The memory device 2 sends an instruction to the data signal D according to the address signal AD.
It is sent to the processing device 1 as T. In this way, the instruction immediately following the prefetched instruction can be prefetched.

【0016】次に、命令実行部3にて実行した命令がサ
ブルーチンコールであった場合の動作について説明す
る。
Next, the operation when the instruction executed by the instruction executing section 3 is a subroutine call will be described.

【0017】命令実行部3、コール命令検出部6、およ
びアドレス生成部7対して、命令バッファ4から実行命
令信号CMDが送出される。また、これと同時にアドレ
ス生成部7には、命令バッファ4から、実行アドレス信
号BADも入力される。実行命令信号CMDと実行アド
レス信号BADは、命令実行部3にて実行されるコマン
ドと、そのアドレスである。アドレス生成部7は、これ
らを基に、実行中コマンドのアドレスの次のアドレスを
生成し、生成アドレス信号GADとしてアドレス保持部
8に送出する。
An execution command signal CMD is sent from the command buffer 4 to the command execution unit 3, the call command detection unit 6, and the address generation unit 7. At the same time, the address generator 7 also receives the execution address signal BAD from the instruction buffer 4. The execution command signal CMD and the execution address signal BAD are a command executed by the command execution unit 3 and its address. Based on these, the address generation unit 7 generates an address next to the address of the command being executed, and sends it to the address holding unit 8 as a generated address signal GAD.

【0018】一方、コール命令検出部6は、実行命令信
号CMDをデコードし、サブルーチンコール命令を検出
した場合に、コール命令信号CALをアクティブとす
る。アドレス保持部8は、コール命令信号CALがアク
ティブである条件にて、カウンタ11のライト信号Wが
示すワードに生成アドレス信号GADを書き込む。この
時に書き込まれるのは、サブルーチンコール命令の次の
命令、すなわちサブルーチンから戻った直後の命令のア
ドレスである。
On the other hand, the call instruction detection unit 6 decodes the execution instruction signal CMD and activates the call instruction signal CAL when detecting a subroutine call instruction. The address holding unit 8 writes the generated address signal GAD in the word indicated by the write signal W of the counter 11 under the condition that the call command signal CAL is active. What is written at this time is the address of the instruction following the subroutine call instruction, that is, the address of the instruction immediately after returning from the subroutine.

【0019】アドレス保持部8は、コール命令信号CA
Lが非アクティブとなった後も、コール命令信号CAL
が再度アクティブとなるまで、書き込んだデータを保持
する。また、カウンタ1のリード信号Rが示すワードの
データを、保持アドレス信号SADおしてアドレス選択
部9に送出する。
The address holding unit 8 has a call command signal CA.
Call command signal CAL even after L becomes inactive
Holds the written data until is activated again. Further, the data of the word indicated by the read signal R of the counter 1 is sent to the address selection unit 9 by the holding address signal SAD.

【0020】次に、サブルーチンの処理が終了し、メイ
ンルーチンへのリターン命令が検出された場合の処理を
説明する。
Next, the processing when the processing of the subroutine is completed and a return instruction to the main routine is detected will be described.

【0021】リターン命令検出部5は、先取りしてきた
直後のデータ信号DTを入力し、これをデコードしてリ
ターン命令を検出すると、リターン信号RTNをアクテ
ィブとする。アドレス選択部9はリターン信号RTNが
アクティブである条件にて、記憶装置2へ送出するアド
レス信号ADとして、信号SADを選択する。記憶装置
2は、アドレス信号ADに従い、命令をデータ信号DT
として、処理装置1に送出する。このようにして、保持
しておいたアドレスを、サブルーチンからメインルーチ
ンへの戻り時に使用することができ、サブルーチンコー
ルの次の命令を先取りすることができる。
The return command detecting section 5 inputs the data signal DT immediately after the prefetching, decodes the data signal DT and detects the return command, and activates the return signal RTN. The address selector 9 selects the signal SAD as the address signal AD to be sent to the storage device 2 under the condition that the return signal RTN is active. The memory device 2 sends an instruction to the data signal DT according to the address signal AD.
Is sent to the processing device 1. In this way, the retained address can be used when returning from the subroutine to the main routine, and the next instruction of the subroutine call can be prefetched.

【0022】[0022]

【発明の効果】本発明によれば、メインルーチンからサ
ブルーチンへ移る際の戻り先のアドレスを保持してお
き、サブルーチン処理中の命令先取り時に、リターン命
令を検出すると、次の命令先取り用のアドレスとして、
保持しておいた戻り先アドレスを使用する構成としたた
め、サブルーチンからメインルーチンへ戻る際に、不要
な命令先取りを廃し、有効な命令先取りを実現し、性能
を向上させることができる。
According to the present invention, the address of the return destination at the time of shifting from the main routine to the subroutine is held, and when the return instruction is detected during the instruction prefetch during the subroutine processing, the address for the next instruction prefetch is obtained. As
Since the stored return destination address is used, unnecessary instruction prefetching can be eliminated when returning from the subroutine to the main routine, effective instruction prefetching can be realized, and performance can be improved.

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

【図1】本発明の一実施例のブロック図である。FIG. 1 is a block diagram of one embodiment of the present invention.

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

1 処理装置 2 記憶装置 3 命令実行部 4 命令バッファ 5 リターン命令検出部 6 コール命令検出部 7 アドレス生成部 8 アドレス保持部 9 アドレス選択部 10 先取りアドレス生成部 11 カウンタ。 DESCRIPTION OF SYMBOLS 1 processing device 2 storage device 3 instruction execution unit 4 instruction buffer 5 return instruction detection unit 6 call instruction detection unit 7 address generation unit 8 address holding unit 9 address selection unit 10 prefetch address generation unit 11 counter.

Claims (3)

【特許請求の範囲】[Claims] 【請求項1】 メインルーチンからサブルーチンへ移る
際の戻り先のアドレスを保持しておき、サブルーチン処
理中の命令先取り時に、リターン命令を検出すると、次
の命令先取り用のアドレスとして、前記保持しておいた
戻り先アドレスを使用することを特徴とする命令先取り
装置。
1. When a return instruction is detected during a prefetch of an instruction during processing of a subroutine, the return address when the main routine is transferred to the sub routine is retained, and the address is retained as the address for the next prefetch of the instruction. An instruction prefetching device characterized by using a return address that has been set.
【請求項2】 実行中命令をデコードしてサブルーチン
コール命令を検出するコール命令検出部と、 前記実行中命令のアドレスとバイト数とを基に、実行中
命令の次の命令のアドレスを生成するアドレス生成部
と、 サブルーチンコール命令検出時に前記生成したアドレス
を保持するアドレス保持部と、 先取りした命令をデコードしてサブルーチンからのリタ
ーン命令を検出するリターン命令検出部と、 前記のリターン命令が検出された場合には、前記アドレ
ス保持部が保持するアドレスを、次の命令の先取り用ア
ドレスとして選択するアドレス選択部とを有することを
特徴とする請求項1記載の命令先取り装置。
2. A call instruction detection unit that decodes an executing instruction to detect a subroutine call instruction, and generates an address of an instruction next to the executing instruction based on the address and the number of bytes of the executing instruction. An address generation unit, an address holding unit that holds the generated address when a subroutine call instruction is detected, a return instruction detection unit that decodes a prefetched instruction to detect a return instruction from a subroutine, and the return instruction is detected. 2. The instruction prefetching apparatus according to claim 1, further comprising: an address selecting unit that selects an address held by the address holding unit as a prefetching address for the next instruction.
【請求項3】 前記アドレス保持部のワード数分の大き
さを有し、前記サブルーチンコール命令検出時にカウン
トアップし、前記リターン命令検出時にカウントダウン
し、カウント値をライト信号、カウント値マイナス1の
値をリード信号として前記アドレス保持部に供給するカ
ウンタを設けたことを特徴とする請求項2記載の命令先
取り装置。
3. The address holding unit has a size corresponding to the number of words, counts up when the subroutine call instruction is detected, counts down when the return instruction is detected, and a count value is a write signal or a count value minus one. 3. The instruction prefetching device according to claim 2, further comprising a counter for supplying a read signal to the address holding unit.
JP10260896A 1996-04-24 1996-04-24 Instruction prefetching circuit Pending JPH09292995A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP10260896A JPH09292995A (en) 1996-04-24 1996-04-24 Instruction prefetching circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP10260896A JPH09292995A (en) 1996-04-24 1996-04-24 Instruction prefetching circuit

Publications (1)

Publication Number Publication Date
JPH09292995A true JPH09292995A (en) 1997-11-11

Family

ID=14331963

Family Applications (1)

Application Number Title Priority Date Filing Date
JP10260896A Pending JPH09292995A (en) 1996-04-24 1996-04-24 Instruction prefetching circuit

Country Status (1)

Country Link
JP (1) JPH09292995A (en)

Similar Documents

Publication Publication Date Title
JP3290280B2 (en) Information processing device
US6542982B2 (en) Data processer and data processing system
US6654871B1 (en) Device and a method for performing stack operations in a processing system
JP3729545B2 (en) Access to cache memory
US6507899B1 (en) Interface for a memory unit
JPH01310441A (en) Data processor
US5572667A (en) Interrupt processing device for controlling the timing of an interrupt signal initiated by a debugging break point in an instruction code
JP4812058B2 (en) FIFO management method and pipeline processor system
JPH07121437A (en) Computer system
KR100532417B1 (en) The low power consumption cache memory device of a digital signal processor and the control method of the cache memory device
US5386521A (en) Instruction prefetching circuit with a next physical address precalculating circuit
JPH09292995A (en) Instruction prefetching circuit
US5500830A (en) Memory access device
JP2000148584A (en) Prefetch method and apparatus
US20050102574A1 (en) Apparatus and method for performing boundary scans using fixed and variable signal groups
JP4111645B2 (en) Memory bus access control method after cache miss
US20050097518A1 (en) Apparatus and method for transferring multiple scan length signal groups for JTAG boundary scans
JP2762798B2 (en) Information processing apparatus of pipeline configuration having instruction cache
US20050262403A1 (en) Apparatus and method for single operation read-modify-write in a bit-accessible memory unit memory
JP2666737B2 (en) Microprocessor with built-in trace memory and trace method
JPS63314644A (en) Data processor
JP2762797B2 (en) Information processing apparatus of pipeline configuration having instruction cache
KR20000003930A (en) Instruction patch apparatus for decreasing loss when being instruction cache miss
JPH1055303A (en) Memory system
JPH04255995A (en) Instruction cache

Legal Events

Date Code Title Description
A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 19990323