JPH06119169A - Microcomputer - Google Patents

Microcomputer

Info

Publication number
JPH06119169A
JPH06119169A JP26708392A JP26708392A JPH06119169A JP H06119169 A JPH06119169 A JP H06119169A JP 26708392 A JP26708392 A JP 26708392A JP 26708392 A JP26708392 A JP 26708392A JP H06119169 A JPH06119169 A JP H06119169A
Authority
JP
Japan
Prior art keywords
instruction
program
stack
memory
address
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
JP26708392A
Other languages
Japanese (ja)
Inventor
Hiroshi Tanase
寛 多那瀬
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.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial Co 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 Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP26708392A priority Critical patent/JPH06119169A/en
Publication of JPH06119169A publication Critical patent/JPH06119169A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To accelerate instruction execution speed when another processing is performed by interrupting the execution of a program by a specific address and afterwards, an interrupted program is restored again. CONSTITUTION:When another processing is performed by interrupting the execution of the program by the specific address, the instruction execution speed of a microcomputer which employs pipeline processing can be accelerated by saving the address information of an instruction to be executed when it is restored and the information of an instruction itself to a stack 1, and taking out saved address information and instruction information from the stack 1 when the interrupted program is restored again.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は、マイクロコンピュータ
がプログラムの実行を特定のアドレスで中断して他の処
理を行い、その後、中断した上記プログラムに再び復帰
しようとする場合の動作に関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an operation in the case where a microcomputer suspends execution of a program at a specific address to perform other processing, and then tries to return to the suspended program again. .

【0002】[0002]

【従来の技術】近年、マイクロコンピュータの命令制御
は、命令の読み出し・解読を命令実行と並列に処理し、
命令の実行が終了すると同時に次の命令を実行するパイ
プライン処理が主流となっている。
2. Description of the Related Art In recent years, microcomputer instruction control processes reading and decoding of instructions in parallel with instruction execution.
The mainstream is pipeline processing in which the next instruction is executed at the same time when the execution of the instruction is completed.

【0003】以下に、図5に示す従来のマイクロコンピ
ュータの構成について説明する。プログラム・カウンタ
3はROM2およびスタック1に接続され、ROM2は
命令キュー5および命令レジスタ4と接続されている。
また、命令キュー5は命令レジスタ4とも接続されてい
る。
The structure of the conventional microcomputer shown in FIG. 5 will be described below. The program counter 3 is connected to the ROM 2 and the stack 1, and the ROM 2 is connected to the instruction queue 5 and the instruction register 4.
The instruction queue 5 is also connected to the instruction register 4.

【0004】スタック1はLIFO(Last In Fast Ou
t)形式のメモリであり、ROM2はプログラムの記録
されたメモリである。プログラム・カウンタ3はROM
2から読み出す命令のアドレスを指定するレジスタであ
り、前記プログラム・カウンタ3にはアドレス信号が格
納されている。ROM2はプログラム・カウンタ3から
アドレスを指定されると、対応する命令を命令キュー5
に読み出すメモリである。命令レジスタ4はマイクロコ
ンピュータが次に実行すべき命令を格納するメモリであ
る。
The stack 1 is a LIFO (Last In Fast Ou).
t) type memory, and the ROM 2 is a memory in which a program is recorded. Program counter 3 is ROM
2 is a register for designating an address of an instruction to be read from the program counter 3, and an address signal is stored in the program counter 3. When the address is specified by the program counter 3, the ROM 2 sends the corresponding instruction to the instruction queue 5
It is a memory to read. The instruction register 4 is a memory that stores an instruction to be executed next by the microcomputer.

【0005】次に通常のプログラムが実行中のときの従
来のマイクロコンピュータの動作について説明する。プ
ログラム・カウンタ3がROM2から読み出す命令のア
ドレスを指定すると、ROM2は指定されたアドレスに
対応した命令を命令キュー5に読み出す。命令は一旦命
令キュー5に格納され、その後、命令キュー5から命令
レジスタ4に転送される。これらの動作は、次に実行す
べき命令が既に命令レジスタ4に格納されている場合の
動作であり、命令の先取り(プリ・フェッチ)と呼ばれ
る。これに対して、次に実行すべき命令が命令レジスタ
4に格納されていない場合には、ROM2から読み出さ
れた命令は直接命令レジスタ4に読み出される。
Next, the operation of the conventional microcomputer when a normal program is being executed will be described. When the program counter 3 specifies the address of the instruction to be read from the ROM 2, the ROM 2 reads the instruction corresponding to the specified address into the instruction queue 5. The instruction is temporarily stored in the instruction queue 5, and then transferred from the instruction queue 5 to the instruction register 4. These operations are operations when an instruction to be executed next is already stored in the instruction register 4, and are called instruction prefetch. On the other hand, when the instruction to be executed next is not stored in the instruction register 4, the instruction read from the ROM 2 is directly read to the instruction register 4.

【0006】さて、前記従来のマイクロコンピュータに
おいてプログラムの実行が途中で中断されると、再び前
記プログラムに復帰する際に最初に実行されるべき命令
のアドレス信号がプログラム・カウンタ3からスタック
1に書込まれる。これがアドレスの退避である。
When the execution of the program in the conventional microcomputer is interrupted midway, the address signal of the instruction to be executed first when returning to the program is written from the program counter 3 to the stack 1. Get caught. This is address saving.

【0007】他方、中断していた前記プログラムに復帰
するときには、退避されていたアドレス信号がスタック
1から読み出され、プログラム・カウンタ3に格納され
る。そしてプログラム・カウンタ3がROM2のアドレ
スを指定し、ROM2から指定されたアドレスに対応す
る命令が読み出される。命令レジスタ4にはまだ次に実
行すべき命令は格納されておらず、ROM2から読み出
された命令は命令レジスタ4に直接読み出される。
On the other hand, when returning to the interrupted program, the saved address signal is read from the stack 1 and stored in the program counter 3. Then, the program counter 3 specifies the address of the ROM 2, and the instruction corresponding to the specified address is read from the ROM 2. The instruction to be executed next is not yet stored in the instruction register 4, and the instruction read from the ROM 2 is directly read to the instruction register 4.

【0008】[0008]

【発明が解決しようとする課題】しかしながら、従来の
構成では、中断していたプログラムへの復帰後、ROM
2から読み出される最初の命令が命令レジスタ4に格納
された時点では、命令キュー5は空の状態になってい
る。従って、復帰直後の命令が命令キュー5のデータを
必要とするタイプの命令であった場合には、命令キュー
5にデータが格納されるまで命令が実行できないという
現象(キュー待ち)が発生し、マイクロコンピュータの
命令実行速度を低下させることとなる。
However, in the conventional configuration, the ROM is not restored after the interrupted program is restored.
At the time when the first instruction read from 2 is stored in the instruction register 4, the instruction queue 5 is in an empty state. Therefore, if the instruction immediately after the return is of a type that requires the data in the instruction queue 5, the phenomenon that the instruction cannot be executed until the data is stored in the instruction queue 5 (waiting for queue) occurs, This will reduce the instruction execution speed of the microcomputer.

【0009】本発明は上記課題を解決するものであり、
キュー待ちを発生させずに、マイクロコンピュータの命
令実行速度を向上させることを目的としている。
The present invention is intended to solve the above problems,
The purpose is to improve the instruction execution speed of a microcomputer without causing queue waiting.

【0010】[0010]

【課題を解決するための手段】本発明は上記目的を達成
するために、第1の発明では、命令を格納するメモリ
と、前記メモリに対してアドレスを指定するプログラム
カウンタと、前記メモリまたは前記プログラム・カウン
タからの出力を格納するスタックと、前記メモリからの
出力を格納するキューと、前記メモリまたは前記スタッ
クまたは前記キューからの出力を格納するレジスタとを
有し、プログラムの実行が中断された時は、前記プログ
ラムに復帰したときに最初に実行されるべき第1の命令
を前記メモリまたは、前記レジスタから前記スタックに
退避させるとともに、前記第1の命令の次に実行される
べき第2の命令に関するデータを前記プログラムカウン
タから前記スタックに退避させ、前記プログラムに復帰
したときは、最初のサイクルで前記スタックから前記第
2の命令に関するデータを前記プログラムカウンタに読
み出し、次のサイクルで前記スタックから前記第1の命
令を前記レジスタに読み出し、かつ、前記第2の命令に
関するデータに応じて前記プログラムカウンタによって
アドレス指定された前記第2の命令を前記メモリから前
記キューに読み出す手段を有することを特徴とするもの
である。
In order to achieve the above object, the present invention is, in the first invention, a memory for storing an instruction, a program counter for designating an address to the memory, the memory or the memory. Execution of the program was interrupted, having a stack for storing the output from the program counter, a queue for storing the output from the memory, and a register for storing the output from the memory or the stack or the queue When the program returns to the program, the first instruction to be executed first is saved from the memory or the register to the stack, and the second instruction to be executed next to the first instruction is saved. When the data related to the instruction is saved from the program counter to the stack and returned to the program, the first Cycle, the data related to the second instruction is read from the stack to the program counter, the first instruction is read from the stack to the register in the next cycle, and the data related to the second instruction is read according to the data. And a means for reading the second instruction addressed by the program counter from the memory into the queue.

【0011】また、第2の発明では、命令を格納するメ
モリと、前記メモリに対してアドレスを指定するプログ
ラムカウンタと、前記メモリまたは前記プログラム・カ
ウンタからの入力を制御して出力する制御回路と、前記
制御回路からの出力を格納するスタックと、前記メモリ
からの出力を格納するキューと、前記メモリまたは前記
制御回路または前記キューからの出力を格納するレジス
タとを有し、プログラムの実行が中断された時は、前記
プログラムに復帰したときに最初に実行されるべき第1
の命令を前記メモリまたは、前記レジスタから前記制御
回路に入力するとともに、前記第1の命令の次に実行さ
れるべき第2の命令に関するデータを前記プログラムカ
ウンタから前記制御回路に入力し、前記制御回路で前記
第1の命令とともに、前記第2の命令に関するデータを
前記スタックに退避させるかを判断し、前記第2の命令
に関するデータを退避させると判断された場合で、前記
プログラムに復帰した時は、最初のサイクルで前記スタ
ックから前記第2の命令に関するデータを前記制御回路
を介して前記プログラムカウンタに読み出し、次のサイ
クルで前記スタックから前記第1の命令を前記制御回路
を介して前記レジスタに読み出し、かつ、前記第2の命
令に関するデータに応じて前記プログラムカウンタによ
ってアドレス指定された前記第2の命令を前記メモリか
ら前記キューに読み出し、前記第2の命令に関するデー
タを退避させないと判断された場合で、前記プログラム
に復帰したときは、最初のサイクルで前記スタックから
前記制御回路を介して前記第1の命令に関するデータを
前記プログラム・カウンタに出力し、次のサイクルで、
前記第1の命令に関するデータに応じて前記プログラム
カウンタによってアドレス指定された第1の命令を前記
メモリから前記命令レジスタに出力する手段を有するこ
とを特徴とするものである。
In the second invention, a memory for storing an instruction, a program counter for designating an address to the memory, and a control circuit for controlling and outputting an input from the memory or the program counter. Having a stack for storing the output from the control circuit, a queue for storing the output from the memory, and a register for storing the output from the memory or the control circuit or the queue, and the execution of the program is interrupted When executed, the first to be executed first when returning to the program
Is input to the control circuit from the memory or the register, and data related to a second instruction to be executed next to the first instruction is input from the program counter to the control circuit, and the control is performed. When the circuit determines whether to save the data related to the second instruction to the stack together with the first instruction, and determines to save the data related to the second instruction, and returns to the program Reads data relating to the second instruction from the stack to the program counter via the control circuit in the first cycle, and reads the first instruction from the stack via the control circuit into the register in the next cycle. Read out and addressed by the program counter in response to data relating to the second instruction When it is determined that the stored second instruction is read from the memory to the queue and the data related to the second instruction is not saved, and when the program is restored, the control is performed from the stack in the first cycle. Outputting data relating to the first instruction to the program counter via a circuit, and in the next cycle,
It is characterized in that it has means for outputting the first instruction addressed by the program counter from the memory to the instruction register according to the data relating to the first instruction.

【0012】[0012]

【作用】本発明は上記した構成により、プログラムの実
行が中断された後、前記プログラムに復帰したときは、
最初のサイクルで前記スタックから前記第2の命令に関
するデータを前記プログラムカウンタに読み出し、次の
サイクルで前記スタックから前記第1の命令を前記レジ
スタに出力し、かつ、前記第2の命令に関するデータに
応じて前記プログラムカウンタによってアドレス指定さ
れた前記第2の命令を前記メモリから前記キューに出力
する手段を有するので、プログラムの実行が中断された
後の、復帰の際にキュー待ちの発生を抑えることができ
るものである。
According to the present invention, when the program is resumed after the execution of the program is interrupted,
In the first cycle, the data related to the second instruction is read from the stack to the program counter, in the next cycle, the first instruction is output from the stack to the register, and the data related to the second instruction is output. Accordingly, it has means for outputting the second instruction addressed by the program counter from the memory to the queue, thereby suppressing the occurrence of queue waiting at the time of return after the execution of the program is interrupted. Is something that can be done.

【0013】[0013]

【実施例】本発明の第一の実施例におけるマイクロコン
ピュータの構成を図1を参照にしながら説明する。
DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS The configuration of a microcomputer according to the first embodiment of the present invention will be described with reference to FIG.

【0014】図1に示すように、従来の技術と同様にプ
ログラム・カウンタ3はROM2およびスタック1に接
続され、ROM2は命令キュー5および命令レジスタ4
と接続されている。また、命令キュー5は命令レジスタ
4と接続されている。従来の技術と異なる点は、スタッ
ク1がプログラム・カウンタ3の以外にROM2と命令
レジスタ4にも接続されていることである。
As shown in FIG. 1, the program counter 3 is connected to the ROM 2 and the stack 1 as in the prior art, and the ROM 2 includes the instruction queue 5 and the instruction register 4.
Connected with. The instruction queue 5 is connected to the instruction register 4. The difference from the conventional technique is that the stack 1 is connected to the ROM 2 and the instruction register 4 in addition to the program counter 3.

【0015】命令レジスタ4はマイクロコンピュータが
次に実行すべき命令を格納する第1のメモリである。命
令キュー5はROM2から読み出された命令の先取りを
行う第2のメモリであり、本実施例では1段の命令キュ
ーを用いている。スタック1はLIFO形式の第3のメ
モリであり、ROM2はプログラム・カウンタ3が指定
したアドレスに対応する命令を命令キュー5に読み出す
メモリであり、プログラムが格納されている。プログラ
ム・カウンタ3はROM2から読み出す命令のアドレス
を指定するレジスタであり、前記プログラム・カウンタ
3にはアドレス信号が格納されている。
The instruction register 4 is a first memory for storing an instruction to be executed next by the microcomputer. The instruction queue 5 is a second memory for prefetching instructions read from the ROM 2, and in this embodiment, a one-stage instruction queue is used. The stack 1 is a third memory in the LIFO format, and the ROM 2 is a memory for reading an instruction corresponding to an address designated by the program counter 3 into the instruction queue 5, and stores a program. The program counter 3 is a register for designating an address of an instruction read from the ROM 2, and the program counter 3 stores an address signal.

【0016】以上のように構成された本発明のマイクロ
コンピュータにおける通常のプログラムの実行中の動作
は、従来の技術と同様である。
The operation during execution of a normal program in the microcomputer of the present invention configured as described above is the same as that of the prior art.

【0017】次にプログラムの実行が中断された時の動
作について説明する。プログラムの実行が途中で中断さ
れると、まず前記プログラムに復帰する時に最初に実行
されるべき命令のアドレスA1をプログラム・カウンタ
3がROM2に指定し、アドレスA1に対応した命令
(オペコード)D1がROM2から読み出される。読み
出された命令D1は、前記プログラムに復帰する時に最
初に実行されるべき命令として、スタック1に退避され
る。続いて、それまでのアドレスA1を1だけ増分した
アドレスA2のアドレス信号(アドレスA1に対応した
命令D1の次に実行される命令のアドレス)がプログラ
ム・カウンタ3からスタック1に書き込まれる。
Next, the operation when the execution of the program is interrupted will be described. When the execution of the program is interrupted midway, the program counter 3 designates in the ROM 2 the address A1 of the instruction to be executed first when returning to the program, and the instruction (opcode) D1 corresponding to the address A1 It is read from the ROM2. The read instruction D1 is saved in the stack 1 as an instruction to be executed first when returning to the program. Then, the address signal of the address A2 (the address of the instruction to be executed next to the instruction D1 corresponding to the address A1) obtained by incrementing the address A1 up to that time by 1 is written from the program counter 3 to the stack 1.

【0018】中断していた上記プログラムに復帰する時
には、命令D1よりも先にアドレスA2のアドレス信号
がスタック1からプログラム・カウンタ3に読み出さ
れ、プログラム・カウンタ3がROM2のアドレスを指
定する(第1のマシン・サイクル)。ROM2はアドレ
スA2の指定を受けて、アドレスA2に対応する命令D
2を命令キュー5に読み出す。また、スタック1からは
上記アドレスA2のアドレス信号に続いて命令D1が命
令レジスタ4に読み出され、そこに格納される。この命
令D1の読み出しは、ROM2が命令D2を命令キュー
5に読み出すのと同じマシン・サイクル(第2のマシン
・サイクル)内で並列に処理される。従って、命令キュ
ー5と命令レジスタ4は、次のマシンサイクル(第3の
マシン・サイクル)が開始される時には既にデータが格
納された状態になっている。それ故、命令キュー5にデ
ータを格納するために発生するキュー待ちは起こり得
ず、命令の実行を効率的に処理することができ、命令実
行速度の向上を実現させることができる。
When returning to the interrupted program, the address signal of the address A2 is read from the stack 1 to the program counter 3 prior to the instruction D1, and the program counter 3 specifies the address of the ROM 2 ( First machine cycle). The ROM 2 receives the designation of the address A2, and receives the instruction D corresponding to the address A2.
2 is read into the instruction queue 5. The instruction D1 is read from the stack 1 to the instruction register 4 following the address signal of the address A2 and stored therein. This reading of the instruction D1 is processed in parallel within the same machine cycle (second machine cycle) as when the ROM 2 reads the instruction D2 into the instruction queue 5. Therefore, the instruction queue 5 and the instruction register 4 are already in a state of storing data when the next machine cycle (third machine cycle) is started. Therefore, queue waiting that occurs to store data in the instruction queue 5 cannot occur, the execution of instructions can be efficiently processed, and the instruction execution speed can be improved.

【0019】次に、本発明の第二の実施例におけるマイ
クロ・コンピュータの構成を図2を参照にしながら説明
する。
Next, the structure of the microcomputer according to the second embodiment of the present invention will be described with reference to FIG.

【0020】プログラム・カウンタ3とスタック1との
間、ROM2とスタック1との間、命令レジスタ4とス
タック1との間のそれぞれに制御回路6が介在するよう
に図1に示す第一の実施例に制御回路6を追加したもの
である。制御回路6はスタック1に退避するべき情報
を、復帰する時に最初に実行される命令のオペコードに
よって判定するものである。
The first embodiment shown in FIG. 1 is such that the control circuit 6 is interposed between the program counter 3 and the stack 1, between the ROM 2 and the stack 1, and between the instruction register 4 and the stack 1. The control circuit 6 is added to the example. The control circuit 6 determines the information to be saved in the stack 1 based on the opcode of the first instruction executed when returning.

【0021】以上のように構成された第二の実施例にお
ける通常のプログラム実行中の動作は、従来の技術と同
様である。
The operation during normal program execution in the second embodiment constructed as described above is the same as in the prior art.

【0022】次にプログラムの実行が中断された時の動
作について説明する。プログラムの実行が中断される
と、まず前記プログラムに復帰する時に最初に実行され
るべき命令のアドレスA1をプログラム・カウンタ3が
ROM2に指定し、指定されたアドレスA1に対応する
命令(オペコード)D1がROM2から読み出される。
読み出された命令D1は、前記プログラムに復帰する時
に最初に実行されるべき命令として、制御回路6に入力
される。そこでスタック1にアドレスA1を1だけ増分
したアドレスA2のアドレス信号と命令(オペコード)
D1の双方を退避させる処理を行うか、それともアドレ
スA1のアドレス信号だけを退避させる処理を行うかの
判定が下される。
Next, the operation when the execution of the program is interrupted will be described. When the execution of the program is interrupted, the program counter 3 designates in the ROM 2 the address A1 of the instruction to be executed first when returning to the program, and the instruction (opcode) D1 corresponding to the designated address A1. Is read from the ROM 2.
The read instruction D1 is input to the control circuit 6 as an instruction to be executed first when returning to the program. Therefore, the address signal and instruction (opcode) of address A2, which is obtained by incrementing address A1 by 1 in stack 1,
It is determined whether the process of saving both D1 or the process of saving only the address signal of the address A1 is performed.

【0023】アドレスA2のアドレス信号とオペコード
D1の双方を退避させる処理が選択された場合には、前
記第一の実施例と同様の動作が行われ、中断していたプ
ログラムに復帰される。
When the process of saving both the address signal of the address A2 and the operation code D1 is selected, the same operation as in the first embodiment is performed and the interrupted program is restored.

【0024】これに対して、アドレスA1のアドレス信
号だけを退避する処理が選択された場合には、従来の技
術と同様にプログラムに復帰する際に最初に実行される
べき命令のアドレスA1のアドレス信号だけがスタック
1に退避される。そして、中断していたプログラムへ復
帰するときには、退避されていたアドレスA1のアドレ
ス信号がスタック1からプログラム・カウンタ3に読み
出され、プログラム・カウンタ3がROM2のアドレス
A1を指定する。ROM2からは指定されたアドレスA
1に対応する命令D1が命令レジスタ4に読み出され、
プログラムの実行が再開される。
On the other hand, when the process of saving only the address signal of the address A1 is selected, the address of the address A1 of the instruction to be executed first when returning to the program is executed as in the conventional technique. Only signals are saved to stack 1. When returning to the interrupted program, the saved address signal of the address A1 is read from the stack 1 to the program counter 3, and the program counter 3 specifies the address A1 of the ROM 2. The specified address A from ROM2
The instruction D1 corresponding to 1 is read into the instruction register 4,
Program execution resumes.

【0025】次に、本発明の第三の実施例におけるマイ
クロ・コンピュータの構成を図3を参照にしながら説明
する。
Next, the structure of the microcomputer according to the third embodiment of the present invention will be described with reference to FIG.

【0026】図3に示すように、第一の実施例と同様に
プログラム・カウンタ3はROM2およびスタック1に
接続され、ROM2は命令キュー5および命令レジスタ
4と接続されている。また、命令キュー5は命令レジス
タ4と接続されている。命令レジスタ4はスタック1と
接続されている。第一の実施例と異なる点は、スタック
1がROM2とは接続されず、プログラム・カウンタ3
および命令レジスタ4とだけに接続されていることであ
る。
As in the first embodiment, as shown in FIG. 3, the program counter 3 is connected to the ROM 2 and the stack 1, and the ROM 2 is connected to the instruction queue 5 and the instruction register 4. The instruction queue 5 is connected to the instruction register 4. The instruction register 4 is connected to the stack 1. The difference from the first embodiment is that the stack 1 is not connected to the ROM 2 and the program counter 3
And the instruction register 4 only.

【0027】以上のように構成された第三の実施例にお
ける通常のプログラムの実行中の動作は、第一の実施例
と同様である。
The operation during execution of a normal program in the third embodiment configured as described above is the same as in the first embodiment.

【0028】次にプログラムの実行が中断された時の動
作について説明する。プログラムの実行が中断される
と、命令レジスタ4に格納されている命令D1が前記プ
ログラムに復帰する時に最初に実行されるべき命令とし
て、スタック1に退避される。続いて、前記命令D1に
対応するアドレスA1を1だけ増分したアドレスA2の
アドレス信号がプログラム・カウンタ3からスタック1
に書き込まれる。
Next, the operation when the execution of the program is interrupted will be described. When the execution of the program is interrupted, the instruction D1 stored in the instruction register 4 is saved in the stack 1 as the instruction to be executed first when returning to the program. Then, the address signal of the address A2 obtained by incrementing the address A1 corresponding to the instruction D1 by 1 is transferred from the program counter 3 to the stack 1
Written in.

【0029】中断していた前記プログラムに復帰する時
には、第一の実施例と同様にスタック1はLIFO形成
のメモリであるため命令D1よりも先にアドレスA2の
アドレス信号がスタック1からプログラム・カウンタ3
に読み出され、プログラム・カウンタ3がROM2のア
ドレスを指定する。その後の動作は第一の実施例と全く
同じである。従って、スタック1から命令レジスタ4に
命令D1が読み出されるのと同時に、ROM2から命令
キュー5に命令D1の次に実行される命令D2が読み出
されるので、命令キュー5にデータを格納するために発
生するキュー待ちは起こり得ず、命令の実行を効率的に
処理することができ、命令実行速度の向上を実現させる
ことができる。
When returning to the interrupted program, since the stack 1 is a memory formed by LIFO as in the first embodiment, the address signal of the address A2 is transferred from the stack 1 to the program counter before the instruction D1. Three
, And the program counter 3 specifies the address of the ROM 2. The subsequent operation is exactly the same as in the first embodiment. Therefore, at the same time that the instruction D1 is read from the stack 1 to the instruction register 4, the instruction D2 to be executed next to the instruction D1 is read from the ROM 2 to the instruction queue 5, so that the instruction queue 5 is generated to store data. The queue waiting that occurs cannot occur, the execution of the instruction can be efficiently processed, and the instruction execution speed can be improved.

【0030】次に、本発明の第四の実施例におけるマイ
クロ・コンピュータの構成を図4を参照にしながら説明
する。
Next, the structure of the microcomputer according to the fourth embodiment of the present invention will be described with reference to FIG.

【0031】プログラム・カウンタ3とスタック1との
間、命令レジスタ4とスタック1との間に同一の制御回
路6が介在するように図3に示す第三の実施例に制御回
路6を追加したものである。制御回路6はスタック1に
退避するべき情報を、復帰する時に最初に実行される命
令のオペコードによって判定するものである。
The control circuit 6 is added to the third embodiment shown in FIG. 3 so that the same control circuit 6 is interposed between the program counter 3 and the stack 1 and between the instruction register 4 and the stack 1. It is a thing. The control circuit 6 determines the information to be saved in the stack 1 based on the opcode of the first instruction executed when returning.

【0032】以上のように構成された第四の実施例にお
ける通常のプログラム実行中の動作は、第一の実施例と
同様である。
The operation during normal program execution in the fourth embodiment constructed as described above is the same as that in the first embodiment.

【0033】次にプログラムの実行が中断された時の動
作について説明する。プログラムの実行が中断される
と、命令レジスタ4に格納されている命令D1が前記プ
ログラムに復帰する時に最初に実行されるべき命令とし
て、制御回路6に退避される。そこでスタック1にアド
レスA1を1だけ増分したアドレスA2のアドレス信号
と命令(オペコード)D1の双方を退避させる処理を行
うか、それともアドレスA1のアドレス信号だけを退避
させる処理を行うかの判定が下される。
Next, the operation when the execution of the program is interrupted will be described. When the execution of the program is interrupted, the instruction D1 stored in the instruction register 4 is saved in the control circuit 6 as an instruction to be executed first when returning to the program. Therefore, it is determined whether the process of saving both the address signal of the address A2 and the instruction (opcode) D1 obtained by incrementing the address A1 by 1 in the stack 1 or the process of saving only the address signal of the address A1 is performed. To be done.

【0034】アドレスA2のアドレス信号とオペコード
D1の双方を退避させる処理が選択された場合には、前
記第三の実施例と同様の動作が行われ、中断していたプ
ログラムに復帰される。
When the process of saving both the address signal of the address A2 and the operation code D1 is selected, the same operation as in the third embodiment is performed, and the interrupted program is restored.

【0035】これに対して、アドレスA1のアドレス信
号だけを退避する処理が選択された場合には、従来の技
術と同様にプログラムに復帰する際に最初に実行される
べき命令のアドレスA1のアドレス信号だけがスタック
1に退避される。そして、中断していたプログラムへ復
帰するときには、退避されていたアドレスA1のアドレ
ス信号がスタック1からプログラム・カウンタ3に読み
出され、プログラム・カウンタ3がROM2のアドレス
A1を指定する。ROM2からは指定されたアドレスA
1に対応する命令D1が命令レジスタ4に読み出され、
プログラムの実行が再開される。
On the other hand, when the processing of saving only the address signal of the address A1 is selected, the address of the address A1 of the instruction to be executed first when returning to the program is selected as in the conventional technique. Only signals are saved to stack 1. When returning to the interrupted program, the saved address signal of the address A1 is read from the stack 1 to the program counter 3, and the program counter 3 specifies the address A1 of the ROM 2. The specified address A from ROM2
The instruction D1 corresponding to 1 is read into the instruction register 4,
Program execution resumes.

【0036】なお、上記第一から第四の実施例ではデー
タ処理の流れの中にROM2を組込んだ形で説明してい
るが、必ずしもROMはマイクロコンピュータの内部に
存在する必要はなく、入力されたアドレス信号に対応す
る命令が出力される装置と接続されていさえすればよ
い。また、命令キュー5の段数を1段以上にすることも
可能であり、退避する命令やアドレスの個数についても
本実施例の個数に限定する必要がないのは言うまでもな
い。また前記実施例では命令キューの段数を一段に設定
していたことから、退避する命令をオペコードとして扱
っているが、段数を拡張した場合にはオペランドの退避
も可能である。他方、退避するアドレスは、中断したプ
ログラムに復帰する時に最初に実行される命令のアドレ
スA1に1だけ増分したアドレスA2である必要はな
く、中断したプログラムに復帰する時に最初に実行され
る命令のアドレスに関するデータを含んでいればよい。
In the first to fourth embodiments described above, the ROM 2 is incorporated in the data processing flow, but the ROM does not necessarily have to exist inside the microcomputer, and the input is not necessary. It is only necessary to be connected to the device that outputs the command corresponding to the generated address signal. Further, it is needless to say that the number of stages of the instruction queue 5 can be one or more, and the number of instructions and addresses to be saved does not have to be limited to the number of this embodiment. Further, in the above-mentioned embodiment, the number of steps of the instruction queue is set to one, so the instruction to be saved is treated as an operation code. However, when the number of steps is expanded, it is possible to save the operand. On the other hand, the address to be saved does not need to be the address A2 which is incremented by 1 to the address A1 of the instruction executed first when returning to the interrupted program, and may be the address of the instruction executed first when returning to the interrupted program. It only needs to include data about the address.

【0037】[0037]

【発明の効果】以上の実施例から明らかなように、本発
明によれば中断したプログラムへの復帰の際にキュー待
ちの発生を抑えることができるので、マイクロコンピュ
ータの命令実行速度の向上を実現し、プログラムの処理
時間を短縮化することができ、特にサブルーチンや割込
みを多用したプログラムでは、大きな効果が得られるマ
イクロコンピュータを提供できる。
As is apparent from the above embodiments, according to the present invention, it is possible to suppress the occurrence of queue waiting at the time of returning to the interrupted program, so that the instruction execution speed of the microcomputer can be improved. However, the processing time of the program can be shortened, and particularly in the case of a program that uses a lot of subroutines and interrupts, it is possible to provide a microcomputer that produces a great effect.

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

【図1】本発明の第一の実施例におけるマイクロ・コン
ピュータのブロック図
FIG. 1 is a block diagram of a microcomputer according to a first embodiment of the present invention.

【図2】本発明の第二の実施例におけるマイクロ・コン
ピュータのブロック図
FIG. 2 is a block diagram of a microcomputer according to a second embodiment of the present invention.

【図3】本発明の第三の実施例におけるマイクロ・コン
ピュータのブロック図
FIG. 3 is a block diagram of a microcomputer according to a third embodiment of the present invention.

【図4】本発明の第四の実施例におけるマイクロ・コン
ピュータのブロック図
FIG. 4 is a block diagram of a microcomputer according to a fourth embodiment of the present invention.

【図5】従来のマイクロ・コンピュータのブロック図FIG. 5 is a block diagram of a conventional microcomputer.

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

1 スタック 2 ROM 3 プログラム・カウンタ 4 命令レジスタ 5 命令キュー 6 制御回路 1 stack 2 ROM 3 program counter 4 instruction register 5 instruction queue 6 control circuit

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】命令を格納するメモリと、前記メモリに対
してアドレスを指定するプログラムカウンタと、前記メ
モリまたは前記プログラム・カウンタからの出力を格納
するスタックと、前記メモリからの出力を格納するキュ
ーと、前記メモリまたは前記スタックまたは前記キュー
からの出力を格納するレジスタとを有し、プログラムの
実行が中断された時は、前記プログラムに復帰したとき
に最初に実行されるべき第1の命令を前記メモリまたは
前記レジスタから前記スタックに退避させるとともに、
前記第1の命令の次に実行されるべき第2の命令に関す
るデータを前記プログラムカウンタから前記スタックに
退避させ、前記プログラムに復帰したときは、最初のサ
イクルで前記スタックから前記第2の命令に関するデー
タを前記プログラムカウンタに読み出し、次のサイクル
で前記スタックから前記第1の命令を前記レジスタに読
み出し、かつ、前記第2の命令に関するデータに応じて
前記プログラムカウンタによってアドレス指定された前
記第2の命令を前記メモリから前記キューに読み出す手
段とを有したマイクロコンピュータ。
1. A memory for storing instructions, a program counter for designating an address to the memory, a stack for storing an output from the memory or the program counter, and a queue for storing an output from the memory. And a register for storing the output from the memory or the stack or the queue, and when the execution of the program is interrupted, the first instruction to be executed first when returning to the program is executed. While saving from the memory or the register to the stack,
When the data related to the second instruction to be executed next to the first instruction is saved from the program counter to the stack and the program is returned to, the data related to the second instruction from the stack is returned in the first cycle. Reading data to the program counter, reading the first instruction from the stack to the register in the next cycle, and the second address addressed by the program counter in response to data relating to the second instruction. A means for reading instructions from the memory to the queue.
【請求項2】命令を格納するメモリと、前記メモリに対
してアドレスを指定するプログラムカウンタと、前記メ
モリまたは前記プログラム・カウンタからの入力を制御
して出力する制御回路と、前記制御回路からの出力を格
納するスタックと、前記メモリからの出力を格納するキ
ューと、前記メモリまたは前記制御回路または前記キュ
ーからの出力を格納するレジスタとを有し、プログラム
の実行が中断された時は、前記プログラムに復帰したと
きに最初に実行されるべき第1の命令を前記メモリまた
は、前記レジスタから前記制御回路に入力するととも
に、前記第1の命令の次に実行されるべき第2の命令に
関するデータを前記プログラムカウンタから前記制御回
路に入力し、前記制御回路で前記第1の命令とともに、
前記第2の命令に関するデータを前記スタックに退避さ
せるかを判断し、前記第2の命令に関するデータを退避
させると判断された場合で、前記プログラムに復帰した
時は、最初のサイクルで前記スタックから前記第2の命
令に関するデータを前記制御回路を介して前記プログラ
ムカウンタに読み出し、次のサイクルで前記スタックか
ら前記第1の命令を前記制御回路を介して前記レジスタ
に読み出し、かつ、前記第2の命令に関するデータに応
じて前記プログラムカウンタによってアドレス指定され
た前記第2の命令を前記メモリから前記キューに読み出
し、前記第2の命令に関するデータを退避させないと判
断された場合で、前記プログラムに復帰したときは、最
初のサイクルで前記スタックから前記制御回路を介して
前記第1の命令に関するデータを前記プログラム・カウ
ンタに出力し、次のサイクルで、前記第1の命令に関す
るデータに応じて前記プログラムカウンタによってアド
レス指定された第1の命令を前記メモリから前記命令レ
ジスタに出力する手段を有するマイクロコンピュータ。
2. A memory for storing an instruction, a program counter for designating an address to the memory, a control circuit for controlling and outputting an input from the memory or the program counter, and a control circuit from the control circuit. A stack for storing an output, a queue for storing an output from the memory, and a register for storing an output from the memory, the control circuit, or the queue, and when the execution of the program is interrupted, Data relating to a second instruction to be executed next to the first instruction while inputting the first instruction to be executed first when returning to the program from the memory or the register to the control circuit From the program counter to the control circuit, and the control circuit together with the first instruction,
When it is determined whether to save the data related to the second instruction to the stack, and when it is determined to save the data related to the second instruction, and when the program is returned to, the stack is removed from the stack in the first cycle. Data relating to the second instruction is read to the program counter via the control circuit, the first instruction is read from the stack to the register via the control circuit in the next cycle, and the second instruction is read. When the second instruction addressed by the program counter in accordance with the instruction data is read from the memory into the queue and it is determined that the data regarding the second instruction is not saved, the program is returned to. In the first cycle, from the stack to the first instruction via the control circuit. Means for outputting data to the program counter, and in the next cycle, outputting a first instruction addressed by the program counter from the memory to the instruction register in accordance with data relating to the first instruction. Microcomputer having.
JP26708392A 1992-10-06 1992-10-06 Microcomputer Pending JPH06119169A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP26708392A JPH06119169A (en) 1992-10-06 1992-10-06 Microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP26708392A JPH06119169A (en) 1992-10-06 1992-10-06 Microcomputer

Publications (1)

Publication Number Publication Date
JPH06119169A true JPH06119169A (en) 1994-04-28

Family

ID=17439805

Family Applications (1)

Application Number Title Priority Date Filing Date
JP26708392A Pending JPH06119169A (en) 1992-10-06 1992-10-06 Microcomputer

Country Status (1)

Country Link
JP (1) JPH06119169A (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS57162034A (en) * 1981-03-31 1982-10-05 Fujitsu Ltd Data processing system

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS57162034A (en) * 1981-03-31 1982-10-05 Fujitsu Ltd Data processing system

Similar Documents

Publication Publication Date Title
JP3970609B2 (en) Processor system
JPH06119169A (en) Microcomputer
JP2529429B2 (en) Programmable controller
JPS5999552A (en) Microcomputer
JPH01291327A (en) Processing mode prefetch control system
JP2727023B2 (en) Information processing device
JP3414579B2 (en) Programmable controller
JPH0248733A (en) Information processor
JPS59144955A (en) Information processor
JPH0259829A (en) Microcomputer
JPS62151936A (en) Cache circuit built in microprocessor
JPS6230452B2 (en)
JPH04162135A (en) Data processor
JPS59189407A (en) Sequence control device
JPH08297583A (en) Processor and method for interruption processing
JPS6232507B2 (en)
JPH07113891B2 (en) Pipeline processing equipment
JPH10320380A (en) Vector processor
JPH02259838A (en) Processor system
JPH05100842A (en) Instruction processor
JPS63301331A (en) Processing system for program interruption
JPS6231439A (en) Instruction reprocessing control system
JPH0225933A (en) Data processor
JPH0454531A (en) Program reading circuit
JPS6120139A (en) Interruption control system