JPH11327904A - Microprocessor - Google Patents

Microprocessor

Info

Publication number
JPH11327904A
JPH11327904A JP25051998A JP25051998A JPH11327904A JP H11327904 A JPH11327904 A JP H11327904A JP 25051998 A JP25051998 A JP 25051998A JP 25051998 A JP25051998 A JP 25051998A JP H11327904 A JPH11327904 A JP H11327904A
Authority
JP
Japan
Prior art keywords
address
stack
instruction
return address
branch instruction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
JP25051998A
Other languages
Japanese (ja)
Other versions
JP3678330B2 (en
Inventor
Yutaka Fujimaki
裕 藤巻
Osamu Nakajima
修 中島
Yasuo Yamada
泰生 山田
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.)
JFE Steel Corp
Original Assignee
Kawasaki Steel 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 Kawasaki Steel Corp filed Critical Kawasaki Steel Corp
Priority to JP25051998A priority Critical patent/JP3678330B2/en
Publication of JPH11327904A publication Critical patent/JPH11327904A/en
Application granted granted Critical
Publication of JP3678330B2 publication Critical patent/JP3678330B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Executing Machine-Instructions (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a microprocessor capable of normally advancing a program even in the case that an old branching instruction is executed at a position unpredictable by a programmer on the program. SOLUTION: This microprocessor is provided with an old branching instruction execution circuit 15 for executing the old branching instruction, stacking the return addresses of a relatively short word length in a stack area 32 and preserving the return addresses of a relatively long word length and a stack constructing instruction execution circuit 17 for executing a stack constructing instruction and changing the return addresses of the relatively short word length stacked in the stack area 32 to the return addresses of the relatively long word length.

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【発明の属する技術分野】本発明は、命令を取り込んで
実行するマイクロプロセッサに関する。
The present invention relates to a microprocessor that fetches and executes an instruction.

【0002】[0002]

【従来の技術】近年のLSI技術の発達によって、メモ
リの大容量化が進んでおり、それに伴って、広いアドレ
ス空間を取り扱うことができる新型マイクロプロセッサ
が開発されている。このような新型マイクロプロセッサ
は、狭いアドレス空間のみを取り扱うことができる旧型
マイクロプロセッサ用に開発された、過去の資産である
ソフトウェアを利用することができるように、いわゆる
互換性が確保されていることが望まれている。また、当
然ながら、広いアドレス空間を自由に利用することがで
きるように、いわゆる拡張性を持つことも望まれてい
る。
2. Description of the Related Art With the development of LSI technology in recent years, the capacity of memories has been increased, and accordingly, a new type of microprocessor capable of handling a wide address space has been developed. These new microprocessors are so-called compatible so that they can use software that is a legacy asset developed for older microprocessors that can handle only a small address space. Is desired. Naturally, it is also desired to have so-called expandability so that a wide address space can be used freely.

【0003】このような要請の下、従来の新型マイクロ
プロセッサには、旧型マイクロプロセッサ用のソフトウ
ェアで使用されている、狭いアドレス空間を前提とする
旧命令と、新たに、旧命令と対応するように定義され
た、広いアドレス空間を前提とする新命令が用意されて
おり、コール命令やリスタート命令といった、スタック
に戻りアドレスを積むとともに分岐先アドレスに分岐す
る分岐命令については、スタックに、狭いアドレス空間
に対応する、語長が短い戻りアドレスが積まれる旧分岐
命令と、スタックに、広いアドレス空間に対応する、語
長が長い戻りアドレスが積まれる新分岐命令が用意され
ている。
[0003] Under such a demand, the conventional new microprocessor is designed to correspond to an old instruction which is used in software for the old microprocessor and assumes a narrow address space, and newly corresponds to the old instruction. There is a new instruction that assumes a wide address space, as defined in, and branch instructions such as call instructions and restart instructions that return addresses to the stack and branch to the branch destination address are stored in the narrower stack. An old branch instruction corresponding to an address space and having a short word-length return address stacked thereon, and a new branch instruction corresponding to a wide address space and having a long word-length return address stacked thereon are prepared.

【0004】このような旧分岐命令による分岐が行われ
た場合には、その分岐後に分岐先から分岐元へ戻る際に
は、語長が短い戻りアドレスに基づいて分岐元へ戻らな
ければならない。このため、旧分岐命令の実行後、正常
にプログラムが進行するためには、分岐先と分岐元との
位置関係が、所定の限定条件を満たしている必要があ
り、通常は、プログラマによって、この限定条件を満た
す位置で旧分岐命令が実行されるようにプログラムが設
計される。
When a branch is performed by such an old branch instruction, when returning from the branch destination to the branch source after the branch, it is necessary to return to the branch source based on a return address having a short word length. For this reason, in order for the program to proceed normally after the execution of the old branch instruction, the positional relationship between the branch destination and the branch source must satisfy a predetermined restriction condition. The program is designed so that the old branch instruction is executed at a position satisfying the restriction condition.

【0005】[0005]

【発明が解決しようとする課題】しかし、旧分岐命令
は、プログラム上の、プログラマによって予定された位
置で実行されるだけでなく、旧分岐命令を前提として設
計された周辺回路により、プログラム上の、プログラマ
が予測不可能な位置で実行される場合もある。
However, the old branch instruction is not only executed at a position on the program that is planned by the programmer, but also by a peripheral circuit designed on the basis of the old branch instruction. In some cases, the program is executed at a location that cannot be predicted by the programmer.

【0006】例えば、割り込み回路によって旧分岐命令
が割り込まれて優先的に実行される場合や、デバッグ装
置によって、プログラム上の命令が旧分岐命令に書き換
えられる場合等には、割り込みが発生する位置や、命令
が書き換えられる位置は、プログラマには予測ができな
い。このため、プログラムの正常な進行が保証されない
という問題がある。
For example, when an old branch instruction is interrupted by an interrupt circuit and executed preferentially, or when an instruction on a program is rewritten to an old branch instruction by a debugging device, the position at which an interrupt is generated is determined. The position where the instruction is rewritten cannot be predicted by the programmer. Therefore, there is a problem that normal progress of the program is not guaranteed.

【0007】しかも、このような、旧分岐命令を前提と
して設計された周辺回路を、新分岐命令を前提として設
計変更することは、困難である場合や不可能である場合
がある。
Moreover, it may be difficult or impossible to redesign such a peripheral circuit designed on the assumption of the old branch instruction on the basis of the new branch instruction.

【0008】本発明は、上記事情に鑑み、プログラム上
の、プログラマが予測不可能な位置で旧分岐命令が実行
される場合であっても、プログラムを正常に進行するこ
とができるマイクロプロセッサを提供することを目的と
する。
The present invention has been made in view of the above circumstances, and provides a microprocessor capable of normally executing a program even when an old branch instruction is executed at a position on a program which cannot be predicted by a programmer. The purpose is to do.

【0009】[0009]

【課題を解決するための手段】上記目的を達成する本発
明の第1のマイクロプロセッサは、データが積まれるス
タック領域と、複数の命令が格納されたプログラム領域
とを有するメモリに接続され、命令を順次取り込んで実
行するマイクロプロセッサにおいて、スタック領域に戻
りアドレスを積んで、プログラム領域上の分岐先アドレ
スに分岐する分岐命令を実行する分岐命令実行回路と、
分岐先アドレスに格納された命令が所定のスタック構築
命令であるか否かを判定する判定回路とを備え、分岐命
令実行回路が、判定回路により、分岐先アドレスに格納
された命令が所定のスタック構築命令であると判定され
たか否かに応じて、スタック領域に、それぞれ、相対的
に語長が長い戻りアドレスもしくは相対的に語長が短い
戻りアドレスを積むものであることを特徴とする。
According to a first aspect of the present invention, there is provided a first microprocessor connected to a memory having a stack area in which data is stacked and a program area in which a plurality of instructions are stored. A branch instruction execution circuit for executing a branch instruction that stacks a return address on a stack area and branches to a branch destination address on a program area,
A determination circuit for determining whether or not the instruction stored at the branch destination address is a predetermined stack construction instruction, wherein the branch instruction execution circuit determines whether the instruction stored at the branch destination address is a predetermined stack According to a feature of the present invention, a return address having a relatively long word length or a return address having a relatively short word length is loaded in the stack area in accordance with whether or not it is determined that the instruction is a construction instruction.

【0010】本発明の第1のマイクロプロセッサは、上
記メモリが、それぞれに上記プログラム領域および上記
スタック領域の両方が設けられてなる2つのアドレス空
間部分からなるアドレス空間を有するものであり、上記
分岐命令実行回路が、上記判定回路により、上記分岐先
アドレスに格納された命令が所定のスタック構築命令で
あると判定されたか否かに応じて、それぞれ、相対的に
語長が長い戻りアドレスを、スタック構築命令が存在す
るアドレス空間部分に設けられたスタック領域に積み、
あるいは相対的に語長が短い戻りアドレスを、上記分岐
命令が存在するアドレス空間部分に設けられたスタック
領域に積むものであることが好適である。
In a first microprocessor of the present invention, the memory has an address space including two address space portions each provided with both the program area and the stack area. The instruction execution circuit, depending on whether or not the instruction stored at the branch destination address is a predetermined stack construction instruction by the determination circuit, respectively, returns a relatively long word-length return address, Stack on the stack area provided in the address space where the stack construction instruction exists,
Alternatively, it is preferable that a return address having a relatively short word length be loaded on a stack area provided in the address space where the branch instruction exists.

【0011】上記目的を達成する本発明の第2のマイク
ロプロセッサは、データが積まれるスタック領域と、複
数の命令が格納されたプログラム領域とを有するメモリ
に接続され、命令を順次取り込んで実行するマイクロプ
ロセッサにおいて、スタック領域に戻りアドレスを積ん
で分岐先アドレスに分岐する分岐命令を実行する分岐命
令実行回路と、分岐命令実行回路によりスタック領域に
積まれた戻りアドレスを再構築するスタック構築命令を
実行するスタック構築命令実行回路とを備え、分岐命令
実行回路が、相対的に語長が短い戻りアドレスを前記ス
タック領域に積むとともに、相対的に語長が長い戻りア
ドレスを保存しておくものであって、スタック構築命令
実行回路が、スタック領域に積まれた相対的に語長が短
い戻りアドレスを、分岐命令実行回路によって保存され
た相対的に語長が長い戻りアドレスに変更するものであ
ることを特徴とする。
A second microprocessor according to the present invention for achieving the above object is connected to a memory having a stack area for storing data and a program area in which a plurality of instructions are stored, and sequentially fetches and executes the instructions. In a microprocessor, a branch instruction execution circuit for executing a branch instruction for stacking a return address in a stack area and branching to a branch destination address, and a stack construction instruction for reconstructing the return address stacked in the stack area by the branch instruction execution circuit. A stack construction instruction execution circuit to be executed, wherein the branch instruction execution circuit stores a return address having a relatively short word length in the stack area and stores a return address having a relatively long word length. The stack construction instruction execution circuit uses a relatively short word-length return address stacked in the stack area. Wherein the relatively word length stored by branch instruction execution circuit is to change the long return address.

【0012】ここで、「相対的に語長が長い戻りアドレ
スを保存しておく」とは、保存する場所を限定するもの
ではなく、分岐命令実行回路内部に保存しても良く、マ
イクロプロセッサ内にレジスタ等を設けて、このレジス
タ等に保存しても良く、スタック領域に保存しても良
い。また、相対的に語長が長い戻りアドレス全体を保存
しても良く、相対的に語長が短い戻りアドレスを越える
部分のみを保存しても良い。
Here, "storing a return address having a relatively long word length" does not limit the place where the return address is saved, and may be saved inside the branch instruction execution circuit. A register or the like may be provided and stored in the register or the like, or may be stored in a stack area. Alternatively, the entire return address having a relatively long word length may be stored, or only the portion exceeding the return address having a relatively short word length may be stored.

【0013】本発明の第2のマイクロプロセッサは、上
記メモリが、それぞれに上記プログラム領域および上記
スタック領域の両方が設けられてなる2つのアドレス空
間部分からなるアドレス空間を有するものであり、上記
分岐命令実行回路が、相対的に語長が短い戻りアドレス
を上記分岐命令が存在するアドレス空間部分に設けられ
たスタック領域に積み上記分岐命令が存在するアドレス
空間部分を2つのアドレス空間部分の中から特定する空
間部分情報を保存するとともに、相対的に語長が長い戻
りアドレスを保存しておくものであり、上記スタック構
築命令実行回路が、分岐命令実行回路によって保存され
た空間部分情報により特定されるアドレス空間部分に設
けられたスタック領域に積まれた相対的に語長が短い戻
りアドレスを読み出して、上記スタック構築命令が存在
するアドレス空間部分に設けられたスタック領域に、分
岐命令実行回路によって保存された相対的に語長が長い
戻りアドレスを積むものであることが好適である。
According to a second microprocessor of the present invention, the memory has an address space composed of two address space portions each provided with both the program area and the stack area. The instruction execution circuit stores a return address having a relatively short word length in a stack area provided in the address space where the branch instruction exists, and stores the address space where the branch instruction exists in the two address space portions. In addition to storing the specified space portion information, the return address having a relatively long word length is stored. The stack construction instruction execution circuit is specified by the space portion information stored by the branch instruction execution circuit. Reads a return address with a relatively short word length stacked on the stack area provided in the To, the stack area provided in the address space portion where the stack building instruction is present, it is preferred that relatively word length stored by the branch instruction execution circuit is intended to gain long return address.

【0014】本発明の第1および第2のマイクロプロセ
ッサは、上記分岐命令を受け付け、受け付けた分岐命令
を上記分岐命令実行回路に優先的に実行させる割り込み
受付回路を備えたものであることが望ましい。
It is preferable that the first and second microprocessors of the present invention include an interrupt receiving circuit that receives the branch instruction and causes the branch instruction execution circuit to execute the received branch instruction preferentially. .

【0015】この割り込み受付回路は、戻りアドレスが
適切にスタック領域に積まれるまで分岐命令の受け付け
を禁止する回路が付された回路であっても良い。
The interrupt accepting circuit may be a circuit provided with a circuit for inhibiting acceptance of a branch instruction until a return address is appropriately stacked on the stack area.

【0016】[0016]

【発明の実施の形態】以下、本発明の実施形態について
説明する。
Embodiments of the present invention will be described below.

【0017】図1は、本発明のマイクロプロセッサの第
1実施形態を示す図である。
FIG. 1 is a diagram showing a first embodiment of a microprocessor according to the present invention.

【0018】このマイクロプロセッサ10は、24ビッ
トのアドレス空間を取り扱うことができ、16ビットの
アドレス空間を前提とした旧型マイクロプロセッサとの
互換性を有する。また、このマイクロプロセッサ10
は、割り込み回路20およびメモリ30に、バス40を
介して接続されており、メモリ30は、24ビットのア
ドレス空間を有し、このアドレス空間上に、プログラム
が格納されるプログラム領域31と、データが積まれる
スタック領域32を有する。
The microprocessor 10 can handle a 24-bit address space, and is compatible with an old microprocessor which assumes a 16-bit address space. The microprocessor 10
Is connected to an interrupt circuit 20 and a memory 30 via a bus 40. The memory 30 has a 24-bit address space, in which a program area 31 in which a program is stored, Are stacked.

【0019】このマイクロプロセッサ10には、スタッ
ク領域32に、16ビットの戻りアドレスを積んで分岐
アドレスに分岐する旧分岐命令と、スタック領域32に
積まれた16ビットの戻りアドレスを、24ビットの戻
りアドレスに変更するスタック構築命令が用意されてお
り、割り込み回路20は、必要に応じて、マイクロプロ
セッサ10に対して論理「1」の割り込み要求信号を出
力すると共に、マイクロプロセッサ10にバス40を介
して旧分岐命令を出力する。
In the microprocessor 10, an old branch instruction for stacking a 16-bit return address in the stack area 32 and branching to a branch address, and a 16-bit return address stacked in the stack area 32 are stored in a 24-bit area. A stack construction instruction for changing to a return address is prepared. The interrupt circuit 20 outputs an interrupt request signal of logic “1” to the microprocessor 10 as necessary, and also connects the bus 40 to the microprocessor 10. Output the old branch instruction via

【0020】また、このマイクロプロセッサ10には、
バス制御回路11と、割り込み受付回路12が備えられ
ており、バス制御回路11によって、バス40を介した
データ入出力が制御される。割り込み受付回路12には
ANDゲート121が接続されており、このANDゲー
ト121には、割り込み回路20からの割り込み要求信
号が入力される。また、割り込み受付回路12は、AN
Dゲート121からの論理「1」の信号の入力を受け
て、バス制御回路11に対して、割り込み回路20から
のデータの受取りを、メモリからのデータの読込みより
も優先して行うように指示する。
The microprocessor 10 includes:
A bus control circuit 11 and an interrupt receiving circuit 12 are provided, and the bus control circuit 11 controls data input / output via the bus 40. An AND gate 121 is connected to the interrupt receiving circuit 12, and an interrupt request signal from the interrupt circuit 20 is input to the AND gate 121. Further, the interrupt receiving circuit 12
In response to the input of a signal of logic “1” from D gate 121, instructs bus control circuit 11 to receive data from interrupt circuit 20 in preference to reading data from memory. I do.

【0021】また、このマイクロプロセッサ10には、
フェッチ・解読回路13と、プログラムカウンタ14が
備えられており、フェッチ・解読回路13によって、バ
ス40およびバス制御回路11を介して、プログラム領
域31から命令がフェッチされ、あるいは割り込み回路
20からの命令が取り込まれる。その後、フェッチ・解
読回路13によって、命令が解読され、マイクロプロセ
ッサの各部へ各部の動作を指示する信号が送られる。フ
ェッチ・解読回路13は、旧分岐命令を解読すると、そ
の解読後、分岐先アドレスに格納されている命令をフェ
ッチするまで、論理「0」の割り込み禁止信号をAND
ゲート121へ出力する。この結果、ANDゲート12
1の出力は、割り込み要求信号と割り込み禁止信号との
論理和である論理「0」の信号となり、この出力が割り
込み受付回路12に入力されて割り込みが禁止される。
プログラムカウンタ14のカウント値は、フェッチ・解
読回路13によって命令がフェッチされる度に、プログ
ラム領域31上の、フェッチされた命令が格納されてい
たアドレスの次のアドレスを示す値に更新される。
The microprocessor 10 includes:
A fetch / decode circuit 13 and a program counter 14 are provided. The fetch / decode circuit 13 fetches an instruction from the program area 31 via the bus 40 and the bus control circuit 11 or an instruction from the interrupt circuit 20. Is taken in. Thereafter, the instruction is decoded by the fetch / decode circuit 13, and a signal instructing the operation of each unit is sent to each unit of the microprocessor. When the fetch / decode circuit 13 decodes the old branch instruction, the fetch / decode circuit 13 outputs the logical "0" interrupt disable signal until the instruction stored at the branch destination address is fetched after decoding.
Output to the gate 121. As a result, the AND gate 12
The output of 1 becomes a signal of logic "0" which is the logical sum of the interrupt request signal and the interrupt disable signal, and this output is input to the interrupt accepting circuit 12 to disable the interrupt.
Each time an instruction is fetched by the fetch / decode circuit 13, the count value of the program counter 14 is updated to a value indicating the next address on the program area 31 where the fetched instruction was stored.

【0022】また、このマイクロプロセッサ10には、
旧分岐命令実行回路15と、レジスタ16が備えられて
おり、フェッチ・解読回路13によって旧分岐命令が解
読されると、旧分岐命令実行回路15によって、プログ
ラムカウンタ14のカウント値に基づいて戻りアドレス
が認識され、バス40およびバス制御回路11を介し
て、スタック領域32に16ビットの戻りアドレスが、
後述する図2に示すように積まれるとともに、レジスタ
16に24ビットの戻りアドレスが格納される。その
後、旧分岐命令実行回路15によって、プログラムカウ
ンタ14のカウント値が、分岐先アドレスを示すカウン
ト値に更新され、フェッチ・解読回路13によって、プ
ログラムカウンタ14のカウント値に基づいて、バス4
0およびバス制御回路11を介して、プログラム領域3
1上の分岐先アドレスから命令がフェッチされる。
The microprocessor 10 includes:
An old branch instruction execution circuit 15 and a register 16 are provided. When the old branch instruction is decoded by the fetch / decode circuit 13, the old branch instruction execution circuit 15 returns a return address based on the count value of the program counter 14. Is recognized, and a 16-bit return address is stored in the stack area 32 via the bus 40 and the bus control circuit 11.
Stacked as shown in FIG. 2 described later, and a 24-bit return address is stored in the register 16. Thereafter, the old branch instruction execution circuit 15 updates the count value of the program counter 14 to a count value indicating the branch destination address, and the fetch / decode circuit 13 sets the bus 4 based on the count value of the program counter 14.
0 and the program area 3 via the bus control circuit 11
The instruction is fetched from the branch destination address on 1.

【0023】フェッチ・解読回路13には、判定回路1
31が備えられており、判定回路131によって、フェ
ッチ・解読回路13が旧分岐命令の次にフェッチした命
令がスタック構築命令であるか否かが判定される。
The fetch / decode circuit 13 includes a judgment circuit 1
The determination circuit 131 determines whether the instruction fetched by the fetch / decode circuit 13 next to the old branch instruction is a stack construction instruction.

【0024】また、このマイクロプロセッサ10には、
スタック構築命令実行回路17が備えられており、この
スタック構築命令実行回路17は、判定回路131によ
る、フェッチ・解読回路13が旧分岐命令の次にフェッ
チした命令がスタック構築命令であるとの判定結果を受
けて、バス40およびバス制御回路11を介して、スタ
ック領域32から16ビットの戻りアドレスを取り出
し、レジスタ16に格納されている24ビットの戻りア
ドレスを取り込んで、バス40およびバス制御回路11
を介して、スタック領域32に、24ビットの戻りアド
レスを積む。これによって、スタック領域32に積まれ
た戻りアドレスの再構築が行われることとなる。
The microprocessor 10 includes:
A stack construction instruction execution circuit 17 is provided. The stack construction instruction execution circuit 17 determines by the determination circuit 131 that the instruction fetched next to the old branch instruction by the fetch / decode circuit 13 is a stack construction instruction. In response to the result, a 16-bit return address is fetched from the stack area 32 via the bus 40 and the bus control circuit 11, and a 24-bit return address stored in the register 16 is fetched. 11
, A 24-bit return address is stacked in the stack area 32. As a result, the return address stored in the stack area 32 is reconstructed.

【0025】図2は、第1実施形態のマイクロプロセッ
サによってスタック領域に構築されるデータ構造を示す
図である。
FIG. 2 is a diagram showing a data structure constructed in the stack area by the microprocessor of the first embodiment.

【0026】スタック領域32には、図の上方から下方
へと向かってデータが積まれる。また、スタック領域3
2には、図1に示すマイクロプロセッサ10によって戻
りアドレスが積まれる前に、分岐先で利用されるパラメ
ータD10が積まれている。
Data is stacked on the stack area 32 from the upper side to the lower side in the figure. Also, stack area 3
2 stores a parameter D10 used at the branch destination before the return address is stored by the microprocessor 10 shown in FIG.

【0027】図2(A)には、図1に示す旧分岐命令実
行回路15によって戻りアドレスが積まれる場合に構築
されるデータ構造が示されており、パラメータD10の
次に、戻りアドレスの、第8ビットから第15ビットま
での8ビット分D20が積まれ、次に、戻りアドレス
の、第0ビットから第7ビットまでの8ビット分D30
が積まれる。
FIG. 2A shows a data structure constructed when a return address is stacked by the old branch instruction execution circuit 15 shown in FIG. 1. A parameter D10 is followed by a return address. Eight bits D20 from the eighth bit to the fifteenth bit are stacked, and then D30 of eight bits from the 0th bit to the seventh bit of the return address are stored.
Is piled up.

【0028】図2(B)には、図1に示すスタック構築
命令実行回路17によって戻りアドレスが積み直される
場合に構築されるデータ構造が示されており、パラメー
タD10の次に、戻りアドレスの、第16ビットから第
23ビットまでの8ビット分D40が積まれ、次に、戻
りアドレスの、第8ビットから第15ビットまでの8ビ
ット分D50が積まれ、次に、戻りアドレスの、第0ビ
ットから第7ビットまでの8ビット分D60が積まれ
る。
FIG. 2B shows a data structure constructed when the return address is re-stacked by the stack construction instruction execution circuit 17 shown in FIG. 1. The parameter D10 is followed by the return address. , 16-th to 23-th bits, D40, are stacked, and then the return address, 8-bit to 15-th bits, D50, are stacked. Eight bits D60 from the 0th bit to the 7th bit are stacked.

【0029】これらのデータ構造は、最終的には、分岐
先にスタック構築命令が存在するか否かに応じて、マイ
クロプロセッサによって選択されることとなるが、旧分
岐命令によってプログラムが分岐される分岐先は、プロ
グラム上の、分岐が発生する位置に関わらず、プログラ
マによって予め予定された位置である。従って、プログ
ラマは、割り込み発生時等に予定されている分岐先にス
タック構築命令を書き込むことによって、マイクロプロ
セッサに、24ビットの戻りアドレスをスタックさせる
ことができ、これによって、旧分岐命令の実行位置に関
わらず、プログラムの正常な進行が保証される。
These data structures are ultimately selected by the microprocessor depending on whether or not a stack construction instruction exists at the branch destination, but the program is branched by the old branch instruction. The branch destination is a position in the program that is predetermined by the programmer regardless of the position where the branch occurs. Therefore, the programmer can cause the microprocessor to stack the 24-bit return address by writing the stack construction instruction at the branch destination that is scheduled when an interrupt occurs or the like. Regardless, the normal progress of the program is guaranteed.

【0030】なお、第1実施形態では、レジスタに24
ビットの戻りアドレスが格納されるが、本発明のマイク
ロプロセッサは、相対的に語長が長い戻りアドレスのう
ちの、相対的に短い語長の戻りアドレスを越える部分の
みを保存するものであってもよい。
In the first embodiment, 24 bits are stored in the register.
A bit return address is stored, but the microprocessor of the present invention stores only a portion of a relatively long word length return address that exceeds a relatively short word length return address. Is also good.

【0031】以下、本発明のマイクロプロセッサの他の
実施形態について説明するが、図1に示す回路等と同様
の回路等については、同一の符号を付して重複説明を省
略する。
Hereinafter, other embodiments of the microprocessor of the present invention will be described. Circuits and the like similar to those shown in FIG. 1 are denoted by the same reference numerals, and redundant description will be omitted.

【0032】図3は、本発明のマイクロプロセッサの第
2実施形態を示す図である。
FIG. 3 is a diagram showing a second embodiment of the microprocessor of the present invention.

【0033】このマイクロプロセッサ50には、スタッ
ク領域32に戻りアドレスを積んで分岐先に分岐する旧
分岐命令と、一種の標識であるスタック構築命令が用意
されている。
The microprocessor 50 is provided with an old branch instruction for stacking a return address in the stack area 32 and branching to a branch destination, and a stack construction instruction as a kind of indicator.

【0034】また、このマイクロプロセッサ50には、
プリフェッチ回路51が備えられており、プリフェッチ
回路51によって、フェッチ・解読回路13で解読され
た命令の実行中に、その命令の次に実行される命令が、
プログラムカウンタ14のカウント値に基づいて、バス
40およびバス制御回路11を介して取り込まれ、実行
中の命令の実行が終了すると、プリフェッチ回路51に
取り込まれている命令がフェッチ・解読回路13に送ら
れる。
The microprocessor 50 includes:
A prefetch circuit 51 is provided. During execution of an instruction decoded by the fetch / decode circuit 13 by the prefetch circuit 51, an instruction executed next to the instruction is:
Based on the count value of the program counter 14, the instruction fetched via the bus 40 and the bus control circuit 11 and when the execution of the instruction being executed is completed, the instruction fetched by the prefetch circuit 51 is transmitted to the fetch / decode circuit 13. Can be

【0035】また、フェッチ・解読回路13には、判定
回路132が備えられており、判定回路132は、フェ
ッチ・解読回路13によって旧分岐命令が解読される
と、プリフェッチ回路51に取り込まれている、次に実
行すべき命令がスタック構築命令であるか否かを判定す
る。
The fetch / decode circuit 13 is provided with a judgment circuit 132. When the old branch instruction is decoded by the fetch / decode circuit 13, the judgment circuit 132 is taken into the prefetch circuit 51. , It is determined whether the next instruction to be executed is a stack construction instruction.

【0036】また、マイクロプロセッサ50には、旧分
岐命令実行回路52が備えられており、旧分岐命令実行
回路52は、フェッチ・解読回路13によって旧分岐命
令が解読されると、プログラムカウンタ14のカウント
値に基づいて戻りアドレスを認識する。また、この旧分
岐命令実行回路52は、判定回路132によって、プリ
フェッチ回路51に取り込まれている命令がスタック構
築命令であると判定されると、バス40およびバス制御
回路11を介して、スタック領域32に、24ビットの
戻りアドレスを積み、スタック構築命令でないと判定さ
れると、16ビットの戻りアドレスを積む。その後、旧
分岐命令実行回路52は、プログラムカウンタ14のカ
ウント値を、分岐先アドレスを示す値に更新する。
The microprocessor 50 is provided with an old branch instruction execution circuit 52. When the old branch instruction is decoded by the fetch / decode circuit 13, the old branch instruction execution circuit 52 The return address is recognized based on the count value. When the determination circuit 132 determines that the instruction fetched by the prefetch circuit 51 is a stack construction instruction, the old branch instruction execution circuit 52 outputs the stack area via the bus 40 and the bus control circuit 11 to the stack area. 32, a 24-bit return address is stacked, and if it is determined that the instruction is not a stack construction instruction, a 16-bit return address is stacked. After that, the old branch instruction execution circuit 52 updates the count value of the program counter 14 to a value indicating the branch destination address.

【0037】上述した各動作の結果、第1実施形態同様
に、分岐先アドレスに格納されている命令がスタック構
築命令であるか否かに応じて、それぞれ、24ビットの
戻りアドレスあるいは16ビットの戻りアドレスがスタ
ック領域32に積まれることとなり、プログラムの正常
な進行が保証される。
As a result of each operation described above, as in the first embodiment, a 24-bit return address or a 16-bit return address is used, depending on whether or not the instruction stored at the branch destination address is a stack construction instruction. The return address is stacked on the stack area 32, and normal progress of the program is guaranteed.

【0038】なお、第2実施形態では、判定回路がフェ
ッチ・解読回路内に備えられているが、本発明にいう判
定回路は、フェッチ・解読回路とは独立の回路であって
も良い。
In the second embodiment, the decision circuit is provided in the fetch / decode circuit. However, the decision circuit according to the present invention may be a circuit independent of the fetch / decode circuit.

【0039】図4は、本発明のマイクロプロセッサの第
3実施形態を示す図である。
FIG. 4 is a diagram showing a third embodiment of the microprocessor of the present invention.

【0040】図1に示すマイクロプロセッサ10同様
に、図4に示すマイクロプロセッサ60には、スタック
領域32に、16ビットの戻りアドレスを積んで分岐ア
ドレスに分岐する旧分岐命令と、スタック領域32に積
まれた16ビットの戻りアドレスを、24ビットの戻り
アドレスに変更するスタック構築命令が用意されてい
る。但し、本実施形態における、スタック領域32に戻
りアドレスを積む順序は、以下で説明するように、第1
実施形態および第2実施形態における順序とは逆の順序
となっている。
As in the microprocessor 10 shown in FIG. 1, the microprocessor 60 shown in FIG. 4 includes, in the stack area 32, an old branch instruction for stacking a 16-bit return address and branching to a branch address. A stack construction instruction for changing the stacked 16-bit return address to a 24-bit return address is provided. However, in this embodiment, the order of stacking the return address in the stack area 32 is the first order as described below.
The order is opposite to the order in the embodiment and the second embodiment.

【0041】このマイクロプロセッサ60には、スタッ
クポインタ61が備えられており、スタックポインタ6
1は、スタック領域32上の、スタック領域32に積ま
れているデータのうちの、最後に積まれたデータが積ま
れているアドレスを示しており、スタックポインタ61
が示すアドレスに基づいて、バス40およびバス制御回
路11を介した、スタック領域32へのアクセスが行わ
れるとともに、スタック領域32へのアクセスが行われ
る度に、スタックポインタ61が示すアドレスが更新さ
れる。
The microprocessor 60 has a stack pointer 61, and the stack pointer 6
Reference numeral 1 denotes an address on the stack area 32 at which the last stacked data among the data stacked on the stack area 32 is stacked.
Are accessed via the bus 40 and the bus control circuit 11 on the basis of the address indicated by, and each time the access to the stack area 32 is performed, the address indicated by the stack pointer 61 is updated. You.

【0042】また、このマイクロプロセッサ60には、
旧分岐命令実行回路62が備えられており、旧分岐命令
実行回路62は、フェッチ・解読回路13によって旧分
岐命令が解読されると、プログラムカウンタ14のカウ
ント値に基づいて戻りアドレスを認識し、24ビットの
戻りアドレスを、8ビット分ずつ、第1実施形態および
第2実施形態とは逆に、下位側から順にスタック領域3
2に積み、その後、スタックポインタ61が示すアドレ
スを1アドレス戻す。これによって、後述する図5に示
すように、スタック領域32には、実質的に16ビット
の戻りアドレスが積まれることとなる。その後、この旧
分岐命令実行回路62は、プログラムカウンタ14のカ
ウント値を、分岐先アドレスを示す値に更新する。
The microprocessor 60 includes:
An old branch instruction execution circuit 62 is provided. When the old branch instruction is decoded by the fetch / decode circuit 13, the old branch instruction execution circuit 62 recognizes a return address based on the count value of the program counter 14, The 24-bit return address is stored in the stack area 3 in order from the lower side, in the order of 8 bits, contrary to the first embodiment and the second embodiment.
Then, the address indicated by the stack pointer 61 is returned by one address. As a result, as shown in FIG. 5 described later, a 16-bit return address is substantially stacked in the stack area 32. Thereafter, the old branch instruction execution circuit 62 updates the count value of the program counter 14 to a value indicating the branch destination address.

【0043】また、このマイクロプロセッサ60には、
スタック構築命令実行回路63が備えられており、判定
回路131による、分岐先アドレスに格納されている命
令がスタック構築命令であるとの判定結果を受けて、ス
タック構築命令実行回路63によって、スタックポイン
タ61が示すアドレスが1アドレス進められる。これに
よって、後述する図5に示すように、実質的に、スタッ
ク領域32に積まれた16ビットの戻りアドレスが、2
4ビットの戻りアドレスに変更されることとなる。
The microprocessor 60 includes:
A stack construction instruction execution circuit 63 is provided. Upon receiving a result of determination by the determination circuit 131 that the instruction stored at the branch destination address is a stack construction instruction, the stack construction instruction execution circuit 63 The address indicated by 61 is advanced by one address. As a result, as shown in FIG. 5, which will be described later, the 16-bit return address stacked in the stack area 32 is substantially 2 bits.
This will be changed to a 4-bit return address.

【0044】図5は、第3実施形態のマイクロプロセッ
サによってスタック領域に積まれたデータの構造を示す
図である。
FIG. 5 is a diagram showing a structure of data stacked in a stack area by the microprocessor according to the third embodiment.

【0045】図2に示すスタック領域同様に、図5に示
すスタック領域32には、図の上方から下方へとデータ
が積まれ、第1実施形態および第2実施形態とは逆順で
積まれる戻りアドレスの前にはパラメータD10が積ま
れている。
As in the stack area shown in FIG. 2, data is stacked in the stack area 32 shown in FIG. 5 from the upper side to the lower side in the figure, and is stacked in the reverse order to the first and second embodiments. A parameter D10 is loaded before the address.

【0046】図5(A)には、図4に示す旧分岐命令実
行回路62によって戻りアドレスが積まれた後のデータ
構造が示されており、スタック領域32には、図の上方
から順に、戻りアドレスの、第0ビットから第7ビット
までの8ビット分D70と、戻りアドレスの、第8ビッ
トから第15ビットまでの8ビット分D80と、戻りア
ドレスの、第16ビットから第23ビットまでの8ビッ
ト分D90が積まれており、スタックポインタは、図5
(A)に矢印で示すように、戻りアドレスの、第8ビッ
トから第15ビットまでの8ビット分D80が積まれて
いるアドレスを示す。このため、スタックポインタが示
すアドレスよりも先のアドレスに積まれている、戻りア
ドレスの、第16ビットから第23ビットまでの8ビッ
ト分D90は、いわば無視されて、スタック領域32
は、実質的に、16ビットの戻りアドレスが積まれた状
態となる。
FIG. 5A shows the data structure after the return address is stacked by the old branch instruction execution circuit 62 shown in FIG. 8 bits D70 from the 0th bit to the 7th bit of the return address, 8 bits D80 from the 8th bit to the 15th bit of the return address, and 16th bit to the 23rd bit of the return address D90 is stacked for 8 bits of the
As shown by an arrow in (A), an address where eight bits D80 from the eighth bit to the fifteenth bit of the return address are stacked is shown. Therefore, the D90 of the return address, which is stacked at an address ahead of the address indicated by the stack pointer, for eight bits from the 16th bit to the 23rd bit is ignored, so to speak, and the stack area 32
Is in a state in which a 16-bit return address is loaded.

【0047】図5(B)には、図4に示すスタック構築
命令実行回路63によりスタック構築命令が実行された
後のデータ構造が示されている。上述したように、スタ
ック構築命令実行回路63は、スタックポインタを操作
するだけの回路であるので、スタック領域32に積まれ
ているデータは、図5(A)同様である。また、スタッ
クポインタは、図5(B)に矢印で示すように、戻りア
ドレスの、第16ビットから第23ビットまでの8ビッ
ト分D90が積まれているアドレスを示す。つまり、ス
タックポインタが示すアドレスが、図5(A)に矢印で
示された位置から、図5(B)に矢印で示された位置へ
と移動することとなり、実質的に、16ビットの戻りア
ドレスが24ビットの戻りアドレスに変更されることと
なる。
FIG. 5B shows a data structure after the stack construction instruction is executed by the stack construction instruction execution circuit 63 shown in FIG. As described above, since the stack construction instruction execution circuit 63 is a circuit that only operates the stack pointer, the data stored in the stack area 32 is the same as that in FIG. Further, the stack pointer indicates an address in which eight bits D90 from the 16th bit to the 23rd bit of the return address are stacked as indicated by an arrow in FIG. 5B. In other words, the address indicated by the stack pointer moves from the position indicated by the arrow in FIG. 5A to the position indicated by the arrow in FIG. 5B, and substantially returns 16 bits. The address will be changed to a 24-bit return address.

【0048】結局、第1実施形態および第2実施形態同
様に、第3実施形態でも、分岐先アドレスに格納されて
いる命令がスタック構築命令であるか否かに応じて、そ
れぞれ、24ビットの戻りアドレスあるいは16ビット
の戻りアドレスがスタック領域32に積まれることとな
り、プログラムの正常な進行が保証される。
After all, similarly to the first and second embodiments, in the third embodiment as well, depending on whether or not the instruction stored in the branch destination address is a stack construction instruction, each of the 24-bit instructions is a stack construction instruction. The return address or the 16-bit return address is stacked in the stack area 32, and normal progress of the program is guaranteed.

【0049】なお、第1実施形態および第3実施形態に
おいてスタック構築命令実行回路は、分岐先アドレスに
スタック構築命令が格納されていた場合にのみ、戻りア
ドレスの再構築を行うものであるが、本発明にいうスタ
ック構築命令実行回路は、スタック構築命令の格納場所
に関わらず、戻りアドレスの再構築が行われるものであ
ってもよい。
In the first and third embodiments, the stack construction instruction execution circuit reconstructs the return address only when the stack construction instruction is stored in the branch destination address. In the stack construction instruction execution circuit according to the present invention, the return address may be reconstructed regardless of the storage location of the stack construction instruction.

【0050】ところで、上記では、メモリが有するアド
レス空間上にスタック領域とプログラム領域が1つずつ
設けられている実施形態について説明したが、狭いアド
レス空間を前提とした旧型マイクロプロセッサとの互換
性を有し広いアドレス空間を取り扱うことができる新型
マイクロプロセッサが開発される場合には、スタック領
域とプログラム領域が2つずつ設けられることが多い。
つまり、新型マイクロプロセッサが取り扱うことができ
る広いアドレス空間のうち、旧型マイクロプロセッサが
前提としている狭いアドレス空間に対応するアドレス空
間部分(以下このアドレス空間部分のことを「従来空間
部分」と称する)にスタック領域とプログラム領域が設
けられるとともに、新型マイクロプロセッサが取り扱う
ことができる広いアドレス空間のうち従来空間部分を除
くアドレス空間部分(以下このアドレス空間部分のこと
を「拡張空間部分」と称し、従来空間部分と拡張空間部
分とを総称して「アドレス空間部分」と称する)にもス
タック領域とプログラム領域が設けられる。
In the above description, the embodiment in which one stack area and one program area are provided on the address space of the memory has been described. However, compatibility with the old microprocessor assuming a narrow address space is considered. When a new microprocessor that can handle a wide address space is developed, two stack areas and two program areas are often provided.
In other words, of the wide address space that can be handled by the new microprocessor, the address space corresponding to the narrow address space assumed by the old microprocessor (hereinafter, this address space is referred to as “conventional space”) A stack area and a program area are provided, and an address space portion excluding the conventional space portion of the wide address space that can be handled by the new microprocessor (hereinafter, this address space portion is referred to as an "extended space portion, The stack area and the program area are also provided in the section and the extension space section.

【0051】しかし、スタック領域が従来空間部分およ
び拡張空間部分それぞれに設けられる場合には、スタッ
ク構築命令が用意されていても、戻りアドレスの再構築
等が正常に行われずに、プログラムの進行に以上が生じ
る場合がある。
However, when the stack area is provided in each of the conventional space portion and the extended space portion, even if a stack construction instruction is prepared, the reconstruction of the return address and the like are not performed normally, so that the program can proceed. The above may occur.

【0052】そこで、以下では、スタック領域が従来空
間部分および拡張空間部分それぞれに設けられ、かつ、
プログラムの正常な進行が保証されるように工夫が施さ
れた実施形態について説明する。
Therefore, in the following, a stack region is provided in each of the conventional space portion and the extended space portion, and
An embodiment devised so that a normal progress of a program is guaranteed will be described.

【0053】図6は、本発明のマイクロプロセッサの第
4実施形態を示す図である。
FIG. 6 is a diagram showing a fourth embodiment of the microprocessor of the present invention.

【0054】この図6に示す回路等のうち、図1に示す
回路等と同様の回路等については、同一の符号を付して
重複説明を省略する。
Of the circuits and the like shown in FIG. 6, the same circuits and the like as the circuits and the like shown in FIG. 1 are denoted by the same reference numerals, and redundant description will be omitted.

【0055】この図6には、24ビットのアドレス空間
を有するメモリ35が示されており、このメモリ35の
アドレス空間のうち、16進数表示でアドレス「000
000」からアドレス「00FFFF」までが従来空間
部分36であり、16進数表示でアドレス「01000
0」からアドレス「FFFFFF」までが拡張空間部分
37である。また、スタック領域およびプログラム領域
の両方が従来空間部分36および拡張空間部分37それ
ぞれに設けられている。
FIG. 6 shows a memory 35 having a 24-bit address space. Of the address space of this memory 35, an address "000" in hexadecimal notation is shown.
000 ”to address“ 00FFFF ”is the conventional space portion 36, and the address“ 01000 ”in hexadecimal notation.
The area from “0” to the address “FFFFFF” is the extended space part 37. Further, both a stack area and a program area are provided in the conventional space portion 36 and the extended space portion 37, respectively.

【0056】マイクロプロセッサ70には、アドレス空
間のページ(24ビットのアドレスの上位8ビット分)
を示すページレジスタ71が備えられており、スタック
領域へのアクセスを伴う命令が実行された場合には、ペ
ージレジスタ71の値は、拡張空間部分37に設けられ
たスタック領域が設けられているページを示しているも
のとする。
The microprocessor 70 has a page in the address space (the upper 8 bits of the 24-bit address).
Is provided, and when an instruction involving access to the stack area is executed, the value of the page register 71 is set to the page in which the stack area provided in the extension space 37 is provided. Shall be shown.

【0057】マイクロプロセッサ70は、スタック領域
へのアクセスを伴う従来の命令のうち旧分岐命令を除く
命令が実行される場合には、原則としてその命令が格納
されているアドレスが属する方のアドレス空間部分に設
けられたスタック領域へのアクセスを行う。また、マイ
クロプロセッサ70には、拡張空間部分37に設けられ
たスタック領域へ、命令が配置されている場所にかかわ
らずアクセス可能な新命令が用意されている。
When an instruction other than the old branch instruction among the conventional instructions involving access to the stack area is executed, the microprocessor 70 basically stores the address space to which the address storing the instruction belongs. Access to the stack area provided in the section. Further, the microprocessor 70 is provided with a new instruction that can access the stack area provided in the extended space portion 37 regardless of where the instruction is located.

【0058】フェッチ・解読回路13で旧分岐命令が解
読されると、旧分岐命令実行回路15によって、プログ
ラムカウンタ14の値が示すアドレスが属する方のアド
レス空間部分に設けられているスタック領域に16ビッ
トの戻りアドレスが積まれ、レジスタ16に24ビット
の戻りアドレスが保存され、プログラムカウンタ14の
値が分岐先アドレスを示す値に更新される。
When the old branch instruction is decoded by the fetch / decode circuit 13, the old branch instruction execution circuit 15 stores the old branch instruction in the stack area provided in the address space to which the address indicated by the value of the program counter 14 belongs. The bit return address is accumulated, the 24-bit return address is stored in the register 16, and the value of the program counter 14 is updated to a value indicating the branch destination address.

【0059】また、マイクロプロセッサ70には、空間
選択レジスタ72が備えられており、旧分岐命令実行回
路15によって16ビットの戻りアドレスが積まれたス
タック領域が設けられている方のアドレス空間部分が従
来空間部分36であると空間選択レジスタ72の値が値
「0」に設定され、拡張空間部分37であると空間選択
レジスタ72の値が値「1」に設定される。
Further, the microprocessor 70 is provided with a space selection register 72, and the former branch instruction execution circuit 15 has an address space portion where a stack area in which a 16-bit return address is stacked is provided. In the case of the conventional space portion 36, the value of the space selection register 72 is set to the value “0”, and in the case of the extension space portion 37, the value of the space selection register 72 is set to the value “1”.

【0060】バス制御回路11には、選択器111が備
えられており、選択器111は、従来空間部分36に相
当するページを示す16進数の値「00」およびページ
レジスタ71が示す値のうちのいずれかの値を、空間選
択レジスタ72の値に応じて選択する。選択器111に
よって選択された値は、スタック構築命令実行回路17
が16ビットの戻りアドレスをスタック領域から取り出
す際に、バス制御回路11によって、16ビットの戻り
アドレスが積まれている方のスタック領域が設けられて
いるページ(アドレスの上位8ビット分)を示すものと
して用いられる。
The bus control circuit 11 is provided with a selector 111. The selector 111 includes a hexadecimal value “00” indicating a page corresponding to the conventional space portion 36 and a value indicated by the page register 71. Is selected according to the value of the space selection register 72. The value selected by the selector 111 is stored in the stack construction instruction execution circuit 17.
When the 16-bit return address is extracted from the stack area, the bus control circuit 11 indicates the page (upper 8 bits of the address) in which the stack area on which the 16-bit return address is stacked is provided. Used as a thing.

【0061】この結果、空間選択レジスタ72の値が示
す方のスタック領域から16ビットの戻りアドレスが正
常に取り出されて戻りアドレスの再構築が正常に行わ
れ、これによって正常なプログラム進行が保証される。
なお、本実施形態では、割込発生時の分岐先アドレスは
必ず従来空間部分36に属しており、これに対し、スタ
ック構築命令実行回路17は24ビットの戻りアドレス
を拡張空間部分37に設けられているスタック領域に積
む。そして、分岐先から分岐元へ戻るときには新命令が
用いられて、拡張空間部分37に設けられているスタッ
ク領域へのアクセスが行われることによってプログラム
が正常に進行する。
As a result, the 16-bit return address is normally taken out from the stack area indicated by the value of the space selection register 72, and the return address is normally reconstructed, whereby the normal program progress is guaranteed. You.
In the present embodiment, the branch destination address at the time of occurrence of an interrupt always belongs to the conventional space portion 36, whereas the stack construction instruction execution circuit 17 provides a 24-bit return address in the extension space portion 37. Stack area. Then, when returning from the branch destination to the branch source, the new instruction is used and the stack area provided in the extended space portion 37 is accessed, so that the program proceeds normally.

【0062】図7は、本発明のマイクロプロセッサの第
5実施形態を示す図である。
FIG. 7 is a diagram showing a fifth embodiment of the microprocessor of the present invention.

【0063】この図7に示す回路等のうち、図3および
図6に示す回路等と同様の回路等については、同一の符
号を付して重複説明を省略する。
Of the circuits and the like shown in FIG. 7, the same circuits and the like as the circuits and the like shown in FIGS. 3 and 6 are denoted by the same reference numerals, and redundant description will be omitted.

【0064】この図7に示すマイクロプロセッサ80に
は、空間判定回路81が備えられており、フェッチ・解
読回路13で旧分岐命令が解読されると、空間判定回路
81によって、プログラムカウンタ14が示す戻りアド
レスが属しているアドレス空間部分が従来空間部分であ
るか拡張空間部分であるかが判定され、従来空間部分で
あると判定されると空間判定回路81から値「0」が出
力され、拡張空間部分であると判定されると値「1」が
出力される。また、上述したように、フェッチ・解読回
路13によって旧分岐命令が解読されると、判定回路1
32は、プリフェッチ回路51に取り込まれている、次
に実行すべき命令がスタック構築命令であるか否かを判
定する。スタック構築命令であると判定されると判定回
路132から値「1」が出力され、スタック構築命令で
ないと判定されると値「0」が出力される。
The microprocessor 80 shown in FIG. 7 is provided with a space judgment circuit 81. When the old branch instruction is decoded by the fetch / decode circuit 13, the space judgment circuit 81 indicates the program counter 14. It is determined whether the address space to which the return address belongs is a conventional space part or an extended space part. If it is determined that the address space part is a conventional space part, a value “0” is output from the space determination circuit 81, and If it is determined that it is a space portion, a value “1” is output. As described above, when the old branch instruction is decoded by the fetch / decode circuit 13, the determination circuit 1
Reference numeral 32 determines whether or not the next instruction to be executed, which is fetched by the prefetch circuit 51, is a stack construction instruction. When it is determined that the instruction is a stack construction instruction, the determination circuit 132 outputs a value “1”, and when it is determined that the instruction is not a stack construction instruction, a value “0” is output.

【0065】フェッチ・解読回路13で旧分岐命令が解
読されると、上述したように、旧分岐命令実行回路52
によって、判定回路132による判定結果に応じたビッ
ト数の戻りアドレスがスタック領域に積まれる。また、
旧分岐命令実行回路52によって戻りアドレスが積まれ
るスタック領域は、以下説明するように、メモリ35に
設けられた2つのスタック領域の中からバス制御回路1
1によって選択される。
When the old branch instruction is decoded by the fetch / decode circuit 13, as described above, the old branch instruction execution circuit 52
As a result, the return address of the number of bits according to the determination result by the determination circuit 132 is stacked on the stack area. Also,
As described below, the stack area where the return address is stacked by the old branch instruction execution circuit 52 is selected from the two stack areas provided in the memory 35 by the bus control circuit 1.
Selected by 1.

【0066】バス制御回路11には、NORゲート11
2と、選択器113が備えられており、NORゲート1
12には判定回路132の出力と空間判定回路81の出
力が入力される。従って、NORゲート112からは、
次に実行すべき命令がスタック構築命令でなく、かつ、
戻りアドレスが属しているアドレス空間部分が従来空間
部分である場合にだけ、値「1」が出力され、それ以外
の場合には値「0」が出力される。
The bus control circuit 11 includes a NOR gate 11
2 and a selector 113, and a NOR gate 1
The output of the determination circuit 132 and the output of the space determination circuit 81 are input to 12. Therefore, from the NOR gate 112,
The instruction to be executed next is not a stack construction instruction, and
The value “1” is output only when the address space to which the return address belongs is the conventional space, and otherwise the value “0” is output.

【0067】NORゲート112の出力は選択器113
に入力され、選択器113によって、従来空間部分36
に相当するページを示す16進数の値「00」およびペ
ージレジスタ71が示す値のうちのいずれかの値が、N
ORゲート112の出力に応じて選択される。図6に示
す選択器111によって選択された値が、戻りアドレス
をスタック領域から取り出す際に用いられるのに対し
て、選択器113によって選択された値は、旧分岐命令
実行回路52によって戻りアドレスがスタック領域に積
まれる際に、バス制御回路11によるスタック領域の選
択に用いられる。
The output of the NOR gate 112 is supplied to the selector 113
To the conventional space portion 36 by the selector 113.
Is one of the hexadecimal value “00” indicating the page corresponding to
The selection is made according to the output of the OR gate 112. While the value selected by the selector 111 shown in FIG. 6 is used when extracting the return address from the stack area, the value selected by the selector 113 It is used by the bus control circuit 11 to select a stack area when the data is stacked on the stack area.

【0068】このように、適切なビット数の戻りアドレ
スが適切な方のスタック領域に積まれ、これによってプ
ログラムの正常な進行が保証されることとなる。
As described above, the return address having an appropriate number of bits is stacked on the appropriate stack area, thereby guaranteeing the normal progress of the program.

【0069】[0069]

【発明の効果】以上説明したように、本発明のマイクロ
プロセッサによれば、プログラム上の、プログラマが予
測不可能な位置で旧分岐命令が実行される場合であって
も、プログラムを正常に進行することができる。
As described above, according to the microprocessor of the present invention, even when an old branch instruction is executed at a position on the program which cannot be predicted by the programmer, the program can be normally executed. can do.

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

【図1】本発明のマイクロプロセッサの第1実施形態を
示す図である。
FIG. 1 is a diagram showing a first embodiment of a microprocessor of the present invention.

【図2】第1実施形態のマイクロプロセッサによってス
タック領域に構築されるデータ構造を示す図である。
FIG. 2 is a diagram illustrating a data structure constructed in a stack area by a microprocessor according to the first embodiment.

【図3】本発明のマイクロプロセッサの第2実施形態を
示す図である。
FIG. 3 is a diagram showing a second embodiment of the microprocessor of the present invention.

【図4】本発明のマイクロプロセッサの第3実施形態を
示す図である。
FIG. 4 is a diagram showing a third embodiment of the microprocessor of the present invention.

【図5】第3実施形態のマイクロプロセッサによってス
タック領域に積まれたデータの構造を示す図である。
FIG. 5 is a diagram illustrating a structure of data stacked in a stack area by a microprocessor according to a third embodiment.

【図6】本発明のマイクロプロセッサの第4実施形態を
示す図である。
FIG. 6 is a diagram showing a fourth embodiment of the microprocessor of the present invention.

【図7】本発明のマイクロプロセッサの第5実施形態を
示す図である。
FIG. 7 is a diagram showing a fifth embodiment of the microprocessor of the present invention.

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

10,50,60,70,80 マイクロプロセッサ 11 バス制御回路 12 割り込み受付回路 14 プログラムカウンタ 15,52,62 旧分岐命令実行回路 16 レジスタ 17,63 スタック構築命令実行回路 20 割り込み回路 30,35 メモリ 31 プログラム領域 32 スタック領域 36 従来空間部分 37 拡張空間部分 40 バス 51 プリフェッチ回路 61 スタックポインタ 71 ページレジスタ 72 空間選択レジスタ 81 空間判定回路 111,113 選択器 112 NORゲート 121 ANDゲート 131,132 判定回路 10, 50, 60, 70, 80 Microprocessor 11 Bus control circuit 12 Interrupt acceptance circuit 14 Program counter 15, 52, 62 Old branch instruction execution circuit 16 Register 17, 63 Stack construction instruction execution circuit 20 Interrupt circuit 30, 35 Memory 31 Program area 32 Stack area 36 Conventional space part 37 Extended space part 40 Bus 51 Prefetch circuit 61 Stack pointer 71 Page register 72 Space selection register 81 Space determination circuit 111, 113 Selector 112 NOR gate 121 AND gate 131, 132 Determination circuit

Claims (5)

【特許請求の範囲】[Claims] 【請求項1】 データが積まれるスタック領域と、複数
の命令が格納されたプログラム領域とを有するメモリに
接続され、命令を順次取り込んで実行するマイクロプロ
セッサにおいて、 前記スタック領域に戻りアドレスを積んで、前記プログ
ラム領域上の分岐先アドレスに分岐する分岐命令を実行
する分岐命令実行回路と、 前記分岐先アドレスに格納された命令が所定のスタック
構築命令であるか否かを判定する判定回路とを備え、 前記分岐命令実行回路が、前記判定回路により、前記分
岐先アドレスに格納された命令が所定のスタック構築命
令であると判定されたか否かに応じて、前記スタック領
域に、それぞれ、相対的に語長が長い戻りアドレスもし
くは相対的に語長が短い戻りアドレスを積むものである
ことを特徴とするマイクロプロセッサ。
1. A microprocessor connected to a memory having a stack area in which data is stacked and a program area in which a plurality of instructions are stored, and sequentially fetching and executing the instructions. A branch instruction execution circuit that executes a branch instruction that branches to a branch destination address on the program area; and a determination circuit that determines whether the instruction stored at the branch destination address is a predetermined stack construction instruction. The branch instruction execution circuit, relative to the stack area, depending on whether or not the instruction stored at the branch destination address is a predetermined stack construction instruction by the determination circuit, A return address having a long word length or a return address having a relatively short word length. Sessa.
【請求項2】 前記メモリが、それぞれに前記プログラ
ム領域および前記スタック領域の両方が設けられてなる
2つのアドレス空間部分からなるアドレス空間を有する
ものであり、 前記分岐命令実行回路が、前記判定回路により、前記分
岐先アドレスに格納された命令が所定のスタック構築命
令であると判定されたか否かに応じて、それぞれ、相対
的に語長が長い戻りアドレスを、該スタック構築命令が
存在するアドレス空間部分に設けられたスタック領域に
積み、あるいは相対的に語長が短い戻りアドレスを、前
記分岐命令が存在するアドレス空間部分に設けられたス
タック領域に積むものであることを特徴とする請求項1
記載のマイクロプロセッサ。
2. The memory according to claim 1, wherein the memory has an address space including two address space portions each provided with both the program area and the stack area, and the branch instruction execution circuit includes the determination circuit. According to whether or not the instruction stored at the branch destination address is determined to be a predetermined stack construction instruction, a return address having a relatively long word length is set to an address at which the stack construction instruction exists. 2. The method according to claim 1, wherein a return address having a relatively short word length is stored in a stack area provided in an address space where the branch instruction exists.
The microprocessor as described.
【請求項3】 データが積まれるスタック領域と、複数
の命令が格納されたプログラム領域とを有するメモリに
接続され、命令を順次取り込んで実行するマイクロプロ
セッサにおいて、 前記スタック領域に戻りアドレスを積んで分岐先アドレ
スに分岐する分岐命令を実行する分岐命令実行回路と、 前記分岐命令実行回路によりスタック領域に積まれた戻
りアドレスを再構築するスタック構築命令を実行するス
タック構築命令実行回路とを備え、 前記分岐命令実行回路が、相対的に語長が短い戻りアド
レスを前記スタック領域に積むとともに、相対的に語長
が長い戻りアドレスを保存しておくものであって、 前記スタック構築命令実行回路が、前記スタック領域に
積まれた相対的に語長が短い戻りアドレスを、前記分岐
命令実行回路によって保存された相対的に語長が長い戻
りアドレスに変更するものであることを特徴とするマイ
クロプロセッサ。
3. A microprocessor which is connected to a memory having a stack area for storing data and a program area for storing a plurality of instructions, and sequentially fetches and executes the instructions. A branch instruction execution circuit that executes a branch instruction that branches to a branch destination address; and a stack construction instruction execution circuit that executes a stack construction instruction that reconstructs a return address stacked in a stack area by the branch instruction execution circuit. The branch instruction execution circuit stores a return address having a relatively short word length in the stack area, and stores a return address having a relatively long word length. The return address stacked in the stack area and having a relatively short word length is converted by the branch instruction execution circuit. Microprocessor, wherein the presence has been relatively word length is to change the long return address.
【請求項4】 前記メモリが、それぞれに前記プログラ
ム領域および前記スタック領域の両方が設けられてなる
2つのアドレス空間部分からなるアドレス空間を有する
ものであり、 前記分岐命令実行回路が、相対的に語長が短い戻りアド
レスを前記分岐命令が存在するアドレス空間部分に設け
られたスタック領域に積み前記分岐命令が存在するアド
レス空間部分を前記2つのアドレス空間部分の中から特
定する空間部分情報を保存するとともに、相対的に語長
が長い戻りアドレスを保存しておくものであり、 前記スタック構築命令実行回路が、前記分岐命令実行回
路によって保存された空間部分情報により特定されるア
ドレス空間部分に設けられたスタック領域に積まれた相
対的に語長が短い戻りアドレスを読み出して、前記スタ
ック構築命令が存在するアドレス空間部分に設けられた
スタック領域に、前記分岐命令実行回路によって保存さ
れた相対的に語長が長い戻りアドレスを積むものである
ことを特徴とする請求項3記載のマイクロプロセッサ。
4. The memory according to claim 1, wherein the memory has an address space including two address space portions each provided with both the program area and the stack area. A return address having a short word length is stacked on a stack area provided in the address space where the branch instruction exists, and space portion information for specifying the address space where the branch instruction exists from the two address space portions is stored. And a return address having a relatively long word length is stored. The stack construction instruction execution circuit is provided in an address space portion specified by the space portion information stored by the branch instruction execution circuit. The return address having a relatively short word length, which is stacked in the stack area, is read, and The microprocessor of claim 3, wherein a but the stack area provided in the address space portion existing, relatively word length stored by said branch instruction execution circuit is intended to gain long return address.
【請求項5】 前記分岐命令を受け付け、受け付けた分
岐命令を前記分岐命令実行回路に優先的に実行させる割
り込み受付回路を備えたことを特徴とする請求項1また
は3記載のマイクロプロセッサ。
5. The microprocessor according to claim 1, further comprising an interrupt receiving circuit that receives the branch instruction and causes the branch instruction execution circuit to execute the received branch instruction preferentially.
JP25051998A 1998-03-20 1998-09-04 Microprocessor Expired - Fee Related JP3678330B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP25051998A JP3678330B2 (en) 1998-03-20 1998-09-04 Microprocessor

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
JP7209498 1998-03-20
JP10-72094 1998-03-20
JP25051998A JP3678330B2 (en) 1998-03-20 1998-09-04 Microprocessor

Publications (2)

Publication Number Publication Date
JPH11327904A true JPH11327904A (en) 1999-11-30
JP3678330B2 JP3678330B2 (en) 2005-08-03

Family

ID=26413232

Family Applications (1)

Application Number Title Priority Date Filing Date
JP25051998A Expired - Fee Related JP3678330B2 (en) 1998-03-20 1998-09-04 Microprocessor

Country Status (1)

Country Link
JP (1) JP3678330B2 (en)

Also Published As

Publication number Publication date
JP3678330B2 (en) 2005-08-03

Similar Documents

Publication Publication Date Title
US6408385B1 (en) Data processor
US4937738A (en) Data processing system which selectively bypasses a cache memory in fetching information based upon bit information of an instruction
AU608921B2 (en) Jump prediction
EP0213843A2 (en) Digital processor control
US6178492B1 (en) Data processor capable of executing two instructions having operand interference at high speed in parallel
US20050038983A1 (en) Novel flash memory arrangement
US5146581A (en) Subprogram executing data processing system having bank switching control storing in the same address area in each of memory banks
US4446517A (en) Microprogram memory with page addressing and address decode in memory
EP0240606B1 (en) Pipe-line processing system and microprocessor using the system
JPS59116855A (en) Control memory mechanism
US5404471A (en) Method and apparatus for switching address generation modes in CPU having plural address generation modes
JPS6212529B2 (en)
JPH11327904A (en) Microprocessor
JPS6049340B2 (en) Branch instruction prefetch method
US7124261B2 (en) Access to bit values within data words stored in a memory
US6321319B2 (en) Computer system for allowing a two word jump instruction to be executed in the same number of cycles as a single word jump instruction
JP3583918B2 (en) Microprocessor
JPH09505428A (en) Microcontroller with page address mode
US5093784A (en) Data processor with efficient transfer between subroutines and main program
JPS62236034A (en) Microcomputer
JPS62151936A (en) Cache circuit built in microprocessor
JPH01216429A (en) Microcomputer
JPS62145430A (en) Data processor
JPH11232099A (en) Microprocessor
JP2000284965A (en) Microprocessor

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20040123

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20050425

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20050502

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20050506

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080520

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090520

Year of fee payment: 4

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20100520

Year of fee payment: 5

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110520

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20110520

Year of fee payment: 6

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120520

Year of fee payment: 7

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130520

Year of fee payment: 8

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20140520

Year of fee payment: 9

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313111

R360 Written notification for declining of transfer of rights

Free format text: JAPANESE INTERMEDIATE CODE: R360

R360 Written notification for declining of transfer of rights

Free format text: JAPANESE INTERMEDIATE CODE: R360

R371 Transfer withdrawn

Free format text: JAPANESE INTERMEDIATE CODE: R371

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313111

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees