JP2004362368A - Processor and exception handling method - Google Patents

Processor and exception handling method Download PDF

Info

Publication number
JP2004362368A
JP2004362368A JP2003161489A JP2003161489A JP2004362368A JP 2004362368 A JP2004362368 A JP 2004362368A JP 2003161489 A JP2003161489 A JP 2003161489A JP 2003161489 A JP2003161489 A JP 2003161489A JP 2004362368 A JP2004362368 A JP 2004362368A
Authority
JP
Japan
Prior art keywords
data
exception
register
instruction
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.)
Granted
Application number
JP2003161489A
Other languages
Japanese (ja)
Other versions
JP4311087B2 (en
Inventor
Koji Ozaki
浩治 尾崎
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.)
Sony Corp
Original Assignee
Sony 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 Sony Corp filed Critical Sony Corp
Priority to JP2003161489A priority Critical patent/JP4311087B2/en
Publication of JP2004362368A publication Critical patent/JP2004362368A/en
Application granted granted Critical
Publication of JP4311087B2 publication Critical patent/JP4311087B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Advance Control (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To accurately identify an occurrence state and increase overall processing speed when an exception or interrupt occurs. <P>SOLUTION: When an exception occurs in a computing unit or data transfer unit connected to an exception bus 33, an exception occurrence signal is output. An exception handling part 6, upon detecting the exception occurrence signal, identifies the exception cause and notifies the exception occurrence to a bus master 3. The bus master 3 stops a currently executed data transfer instruction, saves values of a program counter showing the addresses where the instruction and the instruction to be executed next to the former are stored, in an executed instruction saving register 3c and a program counter saving register 25 respectively, and writes a leading address of a program for exception handling into the program counter 21 to pass the control to exception handling. <P>COPYRIGHT: (C)2005,JPO&NCIPI

Description

【0001】
【発明の属する技術分野】
本発明は、読み込んだ命令に従って演算処理等の種々の処理を行うプロセッサおよび例外処理方法に関し、特に、例外や割り込み発生時の処理時間を短縮するプロセッサおよび例外処理方法に関する。
【0002】
【従来の技術】
現在、コンピュータや携帯端末はもとより、あらゆる電子機器においてマイクロプロセッサが用いられている。従来のマイクロプロセッサは、演算等の処理を指定するオペコードが与えられて、このオペコードをデコードすることにより、各演算器等の制御を行っていた。
【0003】
図9は、従来のプロセッサの構成例を示す機能ブロック図である。
図9に示すプロセッサは、命令の取得と命令の発行とを行う命令制御部110と、命令に従って演算等を実行するデータパス部120と、データパス部120による処理の実行結果を確定する確定処理部130とを具備する。データパス部120は、例えば、整数演算器121、浮動小数演算器122、読み出し/書き出し器123等を具備する。
【0004】
命令制御部110は、図示しない外部バスを介して読み込んだ命令に対するデコード処理を行い、命令実行のための内部の制御信号を生成する。データパス部120は、命令制御部110からの制御信号に従って、各種演算等の処理を行う。例えば、整数演算器121は、整数に対する加算、乗算等の演算を行う。また、浮動小数演算器122は、浮動小数に対する加算、乗算等の演算を行う。また、読み出し/書き出し器123は、図示しない外部メモリとの間でデータの読み出しや書き出しを行う。確定処理部130は、データパス部120による処理結果を確定値としてよいか否かを判定する。
【0005】
ところで、このようなプロセッサにおいて、例外や割り込みが発生した場合には、通常、命令制御部110が発行した命令の順序通りに、データパス部120における処理結果が確定処理部130によって確定される必要がある。これにより、例外や割り込みの発生状態を正確に特定してこのときのレジスタ状態を保持するとともに、後続の命令を中止させることができる。一方、命令の実行結果の確定順を命令の記述順に行わない場合は、例外や割り込みの発生状態の特定が不正確になってしまう。
【0006】
なお、例外発生時の多重例外の発生を禁止し、例外からの復帰時の処理の整合性を向上させた例外処理装置として、以下のようなものがあった(特許文献1参照)。この例外処理装置は、並列同時実行可能な演算ユニットにおいて例外発生を検出すると、命令の実行が終了していない演算ユニットの動作を中断し、プログラムカウンタや実行中断した命令の数など、例外処理ハンドラが必要とする例外情報を退避させる。そして、例外要因が除去され、例外処理ハンドラから復帰する場合には、退避された実行が中断された命令の個数に基づいて、中断された命令の再実行を繰り返し、例外発生前シーケンスに復帰する。
【0007】
【特許文献1】
特開平5−20070号公報
【0008】
【発明が解決しようとする課題】
上述したように、従来のプロセッサでは、例外や割り込みの発生状態を正確に特定するために、命令の実行結果の確定順を命令の記述順に行うように制御する必要があった。このため、実行結果の確定順を制御する確定処理部130のような余分なハードウェアが必要となるとともに、このような制御処理が処理速度の高速化を妨げる要因となっていた。
【0009】
また、上記の特許文献1で開示された例外処理装置では、例外の発生時に、実行が終了していないすべての演算が中断される構造となっているため、復帰時に再び演算を実行する必要があり、処理速度の高速化を阻害する原因となる。
【0010】
本発明はこのような課題に鑑みてなされたものであり、例外や割り込みの発生時に、その発生状態を正確に特定可能でありながら全体の処理速度を向上させることが可能なプロセッサ及び例外処理方法を提供することを目的とする。
【0011】
【課題を解決するための手段】
本発明では上記課題を解決するために、読み込んだ命令に従って動作するプロセッサにおいて、レジスタ間でデータを転送するためのレジスタ間転送手段と、前記レジスタ間転送手段を通じてデータが入力される演算データレジスタとデータが出力される結果格納レジスタとを具備し、すべての前記演算データレジスタにデータが入力されると、入力されたデータを用いて所定の演算処理を行い、その演算結果を前記結果格納レジスタに書き込み、例外の発生で処理を中断して例外発生信号を出力する、それぞれ単一の演算機能を有する複数の演算手段と、前期例外発生信号を伝える例外発生信号線に接続し、前記例外発生信号が出力されたことを検出すると、その例外原因を特定し、例外発生の通知を行う例外受付手段と、例外発生時の情報を格納する退避レジスタを具備し、通常時にはデータの転送先および転送元のレジスタを指定する情報が記述された前記命令を読み込んでデコードすることにより前記レジスタ間転送手段を通じたデータ転送動作を制御し、前記例外発生の通知によって転送実行中の命令を停止し、前記命令および次に実行される命令が格納されているアドレスを示すプログラムカウンタの値を前記退避レジスタに格納し、例外処理を実行させるためのプログラムが格納された先頭アドレスを前記プログラムカウンタに書き込むことによって前記例外処理に制御を移す転送制御手段と、を有することを特徴とするプロセッサが提供される。
【0012】
このようなプロセッサでは、通常時には、転送制御手段によって、演算手段が具備する演算データレジスタと、同一または別の演算手段が具備する結果格納レジスタとの間のレジスタ間転送手段を通じたデータ転送動作が制御される。各演算手段は、すべての演算データレジスタにデータが入力されることによって、動作を開始するので、転送制御手段によるデータ転送制御のみにより、各演算手段の動作が制御される。演算手段は例外が発生すると、処理を中断して例外発生信号を出力する。例外受付手段は、この例外発生信号を検出すると、例外原因を特定し、例外発生を転送制御手段に通知する。転送制御手段は、そのとき実行していたデータの転送命令を停止し、この命令およびこの命令の次に実行される命令が格納されているアドレスを示すプログラムカウンタの値を退避レジスタに格納し、プログラムカウンタに例外処理のためのプログラムの先頭アドレスを書き込むことによって例外処理に制御を移す。従って、例外が発生した演算手段以外は、それぞれの演算処理終了後に自動的に停止する。
【0013】
また、上記課題を解決するために、読み込んだ命令に従って動作するプロセッサの例外処理方法において、レジスタ間でデータを転送するレジスタ間転送手段を通じてデータが入力される演算データレジスタにデータが入力されると、入力されたデータを用いて所定の演算処理を行い、前記レジスタ間転送手段を通じてデータが出力される結果格納レジスタにその演算結果を書き込むとともに、例外の発生で処理を中断して例外発生信号を出力する、それぞれ単一の演算機能を有する複数の演算手段を、データの転送先および転送元のレジスタを指定する情報が記述された前記命令をデコードして前記レジスタ間転送手段を通じたデータ転送を制御することによって動作制御し、前記演算手段の出力した前記例外発生信号を検出すると、前記例外発生信号に基づいてその例外原因を検出し、例外発生時に転送実行中の命令を停止し、前記命令および次に実行される命令が格納されているアドレスを示すプログラムカウンタの値を退避レジスタに退避し、前記例外原因に応じた例外処理を実行させるためのプログラムが格納された先頭アドレスを前記プログラムカウンタに書き込むことによって制御を前記例外処理に移すことを特徴とする例外処理方法、が提供される。
【0014】
このような例外処理方法では、演算手段が具備する演算データレジスタと、結果格納レジスタとの間のレジスタ間転送手段を通じたデータ転送を制御することによって演算手段の動作が制御されている演算手段に例外が発生し、例外発生信号が出力されると、この例外発生信号に基づいて例外原因を特定し、このとき実行していたデータの転送命令を停止し、この命令およびこの命令の次に実行される命令が格納されているアドレスを示すプログラムカウンタの値を退避レジスタに格納し、プログラムカウンタに例外処理のためのプログラムの先頭アドレスを書き込むことによって例外処理に制御を移す。
【0015】
【発明の実施の形態】
以下、本発明の実施の形態を図面を参照して説明する。
図1は、本発明のプロセッサの構成例を示す機能ブロック図である。
【0016】
図1に示すプロセッサ1は、命令の取得と命令の発行とを行う命令取り出し器(図中ではFetchと表示)2と、入力された命令に従って、アドレスバス31、データバス32および例外バス33によってなる内部バスに接続された各種のデータ転送器や演算器の動作を制御するバスマスタ3と、外部から読み込まれた命令を記憶する命令キャッシュ4aと、処理結果や外部から読み込まれたデータを記憶するデータキャッシュ4bと、外部からのデータ等の読み込みや、処理結果の外部への出力を行うための外部バスI/F(インタフェース)5と、例外発生および外部割込みを監視する例外処理部6と、を具備する。
【0017】
また、内部のアドレスバス31およびデータバス32には、例えば外部とのデータ転送処理等を行うデータ転送器や、各種の演算処理を行う演算器等が接続されている。データ転送器としては、読み出し器(図中ではLoadと表示)61、書き出し器(同Store)62、メモリ転送器(同Move)63、スタック処理器(同Stack)64、およびデータ交換器(同Swp)65が接続されている。また、演算器としては、比較器(同Cmp)66、整数加算器(同Add)67、整数減算器(同Sub)68、整数乗算器(同Mul)69、整数除算器(同Div)70、論理積演算器(同And)71、論理和演算器(同Or)72、排他的論理積演算器(同Xand)73、排他的論理和演算器(同Xor)74、ビット反転演算器(同Not)75、浮動小数加算器(同Fadd)76、浮動小数減算器(同Fsub)77、浮動小数乗算器(同Fmul)78、浮動小数除算器(同Fdiv)79、および積和演算器(同Muladd)80が接続されている。さらに、これらとともに、アドレスバス31およびデータバス32には、汎用レジスタ81が接続されている。
【0018】
また、これらの演算器およびデータ転送器のうち、例外を発生させる可能性のあるものは、例外発生信号を伝える例外発生信号線(以下、例外バスとする)33を介して例外処理部6と接続している。例えば、データ転送器は、データキャッシュ4bを介して外部とのデータ転送処理を行う際に、ページフォルト等の例外が発生する場合がある。また、演算器は、演算によりオーバーフローやアンダーフロー、ゼロ割などによって有効範囲外のデータ入力や演算結果が得られた場合に例外が発生する。
【0019】
また、このプロセッサ1の外部には、割込みコントローラ8と、外部バスI/F5から外部のアドレスバス51およびデータバス52を介して、書き換え可能なメモリ10とが接続されている。
【0020】
命令取り出し器2は、命令キャッシュ4aおよび外部バスI/F5を介して、外部のメモリ10から命令を読み込み、バスマスタ3に対して出力する。バスマスタ3は、入力された命令を解析し、アドレスバス31にセレクト信号を出力してレジスタのアドレス指定を行い、場合によってはデータバス32を通じて即値を送信することにより、アドレスバス31およびデータバス32に接続した各データ転送器の間のデータ転送動作を制御する。また、読み込んだ命令中に命令実行回数の情報が含まれている場合には、この命令を指定された回数分だけ繰り返して実行させる。
【0021】
命令キャッシュ4aは、外部バスI/F5を通じてメモリ10から読み込まれた命令を記憶しておき、命令取り出し器2により指定されたメモリ10上のアドレスがヒットした場合に、記憶していた命令を命令取り出し器2に対して出力する。データキャッシュ4bは、外部バスI/F5を通じてメモリ10から読み込まれたデータを記憶しておき、読み出し器61により指定されたメモリ10上のアドレスがヒットした場合に、記憶していたデータを読み出し器61に出力する。外部バスI/F5は、プロセッサ1の内部の信号を外部のバス信号に変換し、例えばメモリ10等の外部とのデータの読み書きを行う。
【0022】
アドレスバス31およびデータバス32に接続された読み出し器61、書き出し器62、メモリ転送器63、スタック処理器64、データ交換器65、比較器66、整数加算器67、整数減算器68、整数乗算器69、整数除算器70、論理積演算器71、論理和演算器72、排他的論理積演算器73、排他的論理和演算器74、ビット反転演算器75、浮動小数加算器76、浮動小数減算器77、浮動小数乗算器78、浮動小数除算器79および積和演算器80は、入力用のレジスタおよび出力がある場合には出力用のレジスタを具備している。これらはともにアドレスバス31およびデータバス32に接続されている。バスマスタ3によりアドレスバス31を通じて指定された入力用のレジスタに、データバス32を通じてデータが入力されると、所定のデータ処理を開始する。これらのデータ転送器および演算器は、それぞれ1つの処理機能のみ有している。データ処理が終了し、得られた処理結果のデータは、出力用のレジスタに格納する。この格納されたデータは、バスマスタ3によるアドレス指定に基づいて、他のデータ転送器や演算器等に転送される。
【0023】
読み出し器61は、それぞれ1つずつのアドレスレジスタとデータレジスタを具備する。読み出し器61は、アドレスレジスタにデータが格納されると、格納されたデータを読み出しアドレスとして、データキャッシュ4bおよび外部バスI/F5を通じて外部のメモリ10にアクセスする。そして、メモリ10上の対応するアドレスからデータを読み出し、データレジスタに格納する。また、出力した読み出しアドレスがデータキャッシュ4bにおいてヒットした場合には、このデータキャッシュ4bから対応するデータを読み出し、データレジスタに格納する。
【0024】
書き出し器62は、アドレスレジスタとデータレジスタを1つずつ具備しており、アドレスレジスタにはメモリ10上のデータ書き出し先のアドレスが格納され、データレジスタには、メモリ10に書き出すデータが格納される。アドレスレジスタおよびデータレジスタの双方にデータが入力されると、データキャッシュ4bおよび外部バスI/F5を通じて外部のメモリ10にアクセスし、メモリ10上の対応するアドレスにデータを書き出す。
【0025】
メモリ転送器63は、2つのアドレスレジスタと1つの転送量レジスタを具備しており、一方のアドレスレジスタには、メモリ10あるいは他のメモリ上の転送元となるアドレスが格納され、もう一方のアドレスレジスタには転送先となるアドレスが格納される。また、転送量レジスタには、指定されたアドレスから読み出すデータのデータサイズが格納される。これらのデータが入力されると、データキャッシュ4bおよび外部バスI/F5を通じて外部のメモリ10あるいはその他のメモリにアクセスし、対応するアドレス間のデータ転送を指示する。
【0026】
スタック処理器64は、ポインタレジスタと、データレジスタとを具備しており、ポインタレジスタには、メモリ10上のアドレスを指定するためのスタックポインタが格納され、データレジスタには、メモリ10への書き出し対象となるデータが格納される。これらのデータが入力されると、データレジスタにおける読み書きによりメモリ10からの読み出しおよび書き出しの各動作を判断し、読み出し動作の場合は、ポインタレジスタへのデータ格納動作が完了すると、メモリ10にアクセスして、対応するアドレスからデータを読み出し、データレジスタに格納する。また、書き出し動作の場合は、ポインタレジスタおよびデータレジスタの双方へのデータ格納動作が完了すると、メモリ10の対応するアドレスに対してデータを書き出す。
【0027】
データ交換器65は、アドレスレジスタと、入力データレジスタと、出力データレジスタとを具備しており、入力データレジスタおよびアドレスレジスタへのデータ格納が完了すると、アドレスレジスタの示すメモリ10内のアドレスに、データキャッシュ4bおよび外部バスI/F5を通じてアクセスする。そして、メモリ10上の対応するアドレスからデータを読み出し、出力データレジスタに格納する。
【0028】
比較器66は、データ入力用の2つのデータレジスタと、演算結果を格納するステータスレジスタを具備しており、2つのデータレジスタ双方へのデータ入力が完了すると、入力された各データを比較して、比較結果をステータスレジスタに格納する。
【0029】
整数加算器67は、2つの入力レジスタと、1つの出力レジスタを具備しており、2つの入力レジスタに、それぞれ加算される数値と加算する数値が入力されると、各データを使用して整数加算処理を行い、加算結果を出力レジスタに格納する。
【0030】
整数減算器68、整数乗算器69および整数除算器70は、整数加算器67と同様に、2つの入力レジスタと、1つの出力レジスタを具備している。整数加算器67と同様に、2つの入力レジスタに演算対象のデータが入力されると、各データを使用して、整数減算器68は整数減算処理、整数乗算器69は整数乗算処理、および整数除算器70は整数除算処理を開始し、演算結果を出力レジスタに格納する。
【0031】
論理積演算器71、論理和演算器72、排他的論理積演算器73および排他的論理和演算器74も、整数加算器67等と同様に、2つの入力レジスタと、1つの出力レジスタをそれぞれ具備している。論理積演算器71は、2つの入力レジスタに、演算対象のデータが格納されると、各データを使用して論理積演算処理を行い、演算結果を出力レジスタに格納する。同様に、2つの入力レジスタに演算対象のデータが格納されると、論理和演算器72は論理和演算処理、排他的論理積演算器73は排他的論理積演算処理、および排他的論理和演算器74は排他的論理和演算処理を行い、演算結果を出力レジスタに格納する。
【0032】
ビット反転演算器75は、データの入出力が可能な1つの入出力データレジスタを具備し、入出力レジスタへのデータ格納動作が完了すると、この格納データによるビット反転処理を開始し、演算結果を入出力レジスタに書き戻す。
【0033】
浮動小数加算器76、浮動小数減算器77、浮動小数乗算器78および浮動小数除算器79も、整数加算器67等と同様に、2つの入力レジスタと、1つの出力レジスタをそれぞれ具備している。浮動小数加算器76は、2つの入力レジスタに演算対象のデータが格納されると、これらのデータによる浮動小数加算処理を開始し、この演算結果を出力レジスタに格納する。同様に、2つの入力レジスタに演算対象のデータが格納されると、浮動小数減算器77は浮動小数減算処理、浮動小数乗算器78は浮動小数乗算処理、および浮動小数除算器79は浮動小数除算処理を開始し、この演算結果を出力レジスタに格納する。
【0034】
積和演算器80は、3つの入力レジスタと、出力レジスタを具備しており、3つの入力レジスタに演算対象の数値が入力されると、入力された数値による積和演算処理を行い、演算結果を出力レジスタに格納する。
【0035】
また、これらのデータ転送器および演算器のうち、例外を発生させる可能性のあるものは、例外バス33に接続される。図の例では、演算器の比較器66、整数加算器67、整数減算器68、整数乗算器69、整数除算器70、浮動小数加算器76、浮動小数減算器77、浮動小数乗算器78、浮動小数除算器79および積和演算器80と、データ転送器の読み出し器61、書き出し器62、メモリ転送器63、スタック処理器64およびデータ交換器65が例外バス33に接続されている。
【0036】
汎用レジスタ81は、各データ転送器および演算器の処理結果等を一時的に記憶し、バスマスタ3によるアドレス指定に基づいて、記憶したデータを他のデータ転送器もしくは演算器等に転送する。
【0037】
外部に接続されたメモリ10は、命令とデータとを格納しており、外部バスI/F5がアドレスバス51を介して要求するアドレスの命令またはデータを、データバス52を介して供給する。なお、外部のアドレスバス51およびデータバス52上には、メモリ10の他に例えば、プログラムや各種のデータを記憶するROM(Read Only Memory)やHDD(ハードディスクドライブ)のI/F、データ入力用のキーボードやモニタ、各種の通信ネットワーク等に接続するためのI/F等(いずれも図示せず)が接続されており、コンピュータシステムを構成している。プロセッサ1が、データバス52を通じてROMやHDD等からプログラムを読み込んで実行し、データバス52上の各部とのデータの読み書きを行うことにより、このコンピュータシステムが動作する。
【0038】
割込みコントローラ8は、例えば、データ受信完了等の外部の状態変化を検出すると、割り込み信号を発生させ、外部の状態変化を例外処理部6へ伝える。
このプロセッサ1では、メモリ10から命令が読み出され、バスマスタ3に順次供給されると、バスマスタ3はこの命令に従って、アドレスバス31およびデータバス32に接続されたデータ転送器や演算器の間のデータ転送動作を制御する。各データ転送器および演算器は、データバス32からのデータ入力用のレジスタを具備し、また一部のデータ転送器とすべての演算器はデータ出力用のレジスタを具備する。
【0039】
各データ転送器および各演算器は、単一の処理機能を有しており、入力用のレジスタへのデータ入力が完了すると、自動的に所定のデータ処理を実行する。また、出力用のレジスタを具備するものは処理結果をそのレジスタに格納する。これにより、バスマスタ3によって転送元のレジスタと転送先のレジスタとが指定されるだけで、各データ転送器および演算器を動作させることが可能となる。従って、バスマスタ3は基本的に、発行された命令を基に、転送元および転送先の各レジスタを指定する情報のみ解読すればよく、命令が単純化され、バスマスタ3におけるデコード処理が高速化されている。各データ転送器および各演算器は、処理の途中で例外が発生すると、実行中の処理を中断し、例外発生信号を出力する。例外発生信号は、例外原因が除去されるまで保持される。例外発生信号が出力されたことは、例外バス33によって例外処理部6へ伝わる。
【0040】
また、割込みコントローラ8は、予め指定されている外部の状態変化によって、割り込み信号を発生させる。割り込み信号は、割り込み信号線(図示せず)によって例外処理部6へ伝わる。
【0041】
例外処理部6は、例外発生信号または割り込み信号が出力されたことを検出すると、これらの信号から例外原因を示すデータを作成し、バスマスタ3へ例外発生または割り込み発生の通知を行う。なお、割り込み信号の受付は、例外が発生していない場合のみ行う。例外バス33は、各データ転送器および演算器に接続しており、例外処理部6は、例外発生信号を出力したデータ転送器あるいは演算器を正確に特定することができる。
【0042】
バスマスタ3は、そのとき実行していた転送命令を停止し、例外処理に制御を移す。従って、例外発生により中断されたデータ転送器または演算器以外のデータ転送器または演算器は、処理が終了した後、自動的に停止することになる。
【0043】
このように、レジスタ間のデータ転送を制御することによって、単一の処理を実行する各データ転送器および各演算器の動作が制御されているため、例外が発生した場合に、実行中の他のデータ転送器と演算器の処理を中断させなくても例外が発生した処理機能を正確に特定することができる。また、従来のように確定処理を実行する必要がないことから、確定処理を行う余分なハードウェアを設ける必要がなく、例外処理時間を短縮することができる。さらに、例外が発生した以外のデータ転送器および演算器は、その処理を中断されないため、復帰に要する時間も短縮することができる。
【0044】
次に、図2を用いて、命令取り出し器2、バスマスタ3および例外処理部6について、さらに詳しく説明する。なお、図2では、説明を簡略化するために、アドレスバス31およびデータバス32が1組のみ設けられているものとしているが、これらは複数組設けられてもよい。また、例外バス33は、アドレスバス31およびデータバス32と1対1に対応している必要はなく、複数組のアドレスバス31およびデータバス32に対して、1組設けられていてもよい。
【0045】
図2は、命令取り出し器、バスマスタおよび例外処理部の各内部構成を示すブロック図である。
図2に示すように、命令取り出し器2は、プログラムカウンタ21と、アドレス生成器22と、命令発行器23と、命令格納レジスタ24と、プログラムカウンタ退避レジスタ25を具備している。
【0046】
プログラムカウンタ21は、入力される図示しないクロック信号に同期して、アドレス生成器22に対してカウント値を順次出力する。また、アドレスバス31およびデータバス32に接続しており、アドレスバス31を通じてセレクト信号により選択されると、データバス32を通じて転送されたデータによって、カウント値が書き換えられる。
【0047】
アドレス生成器22は、プログラムカウンタ21から出力されるカウント値を、メモリ10における読み出しアドレスとして、命令発行器23に対して出力する。
【0048】
命令発行器23は、アドレス生成器22から出力された読み出しアドレスを、命令キャッシュ4aおよび外部バスI/F5を通じてメモリ10に転送する。そして、メモリ10から読み込まれた命令を命令格納レジスタ24に転送する。また、出力した読み出しアドレスが命令キャッシュ4aにおいてヒットした場合には、この命令キャッシュ4aから対応する命令を読み出し、命令格納レジスタ24に転送する。さらに、比較器66のステータスレジスタからのステータス信号の供給を受け、このステータス信号に応じて動作させることが可能となっている。
【0049】
命令格納レジスタ24は、命令発行器23から出力された命令を保持し、所定のタイミングでバスマスタ3に転送する。また、アドレスバス31およびデータバス32に接続して、データバス32からのデータ入力用のレジスタとしても機能し、アドレスバス31を通じてセレクト信号により選択されると、データバス32を通じて転送されたデータによって、出力する命令が書き換えられる。
【0050】
プログラムカウンタ退避レジスタ25は、例外発生時に停止された命令、あるいは割り込み発生で終了された命令の次に実行される命令が格納されているアドレスを示すプログラムカウンタを一時退避するためのレジスタである。アドレスバス31およびデータバス32に接続して、データバス32からのデータ入力レジスタおよび出力レジスタとして機能する。アドレスバス31を通じてセレクト信号により選択されると、入力レジスタとして機能する場合には、データバス32を通じて転送されたプログラムカウンタの値を書き込む。また、出力レジスタとして機能する場合には、データバス32を通じて保持しているプログラムカウンタの値を転送する。
【0051】
バスマスタ3は、デコーダ3aと、残実行回数退避レジスタ3bと、実行中命令退避レジスタ3cを具備している。
デコーダ3aは、アドレスバス31およびデータバス32に接続し、命令取り出し器2の命令格納レジスタ24より出力された命令を解析し、アドレスバス31に対してセレクト信号を出力して、アドレスバス31に接続された各データ転送器または各演算器等のレジスタを選択する。このとき、データ転送元のレジスタと、データ転送先のレジスタとを選択することにより、選択されたレジスタ間でのデータバス32を通じたデータ転送が行われる。また、デコーダ3aは、入力された命令に応じて、即値データを生成し、データ転送先のレジスタを選択してこのレジスタにデータバス32を通じて即値データを転送することも可能である。さらに、入力された命令中に実行回数を指定する情報が含まれる場合は、指定された回数分だけ同じ転送動作を繰り返すことも可能である。
【0052】
また、デコーダ3aは、セレクト信号の出力後にデータバス32を通じてWait信号を受信した場合には、Wait信号の受信が解除されるまでの間、このデータバス32および対応するアドレスバス31における制御状態を保持し、新たな命令のデコードに応じたセレクト信号および即値の出力を停止する。なお、アドレスバス31およびデータバス32が複数組設けられている場合には、Wait信号が受信されていない他のバスに対するデータ転送を継続させることが可能である。
【0053】
残実行回数退避レジスタ3bは、デコーダ3aと接続し、デコーダ3aから転送された繰り返し処理の残りの実行回数を書き込む。また、デコーダ3aから読み出しがあれば、格納された残実行回数をデコーダ3aに転送する。
【0054】
実行中命令退避レジスタ3cは、デコーダ3aと接続し、デコーダ3aから転送された実行中の命令が格納されたメモリ10上のアドレスを書き込む。また、デコーダ3aから読み出しがあれば、格納された実行中命令のメモリ10上のアドレスをデコーダ3aに転送する。
【0055】
デコーダ3aは、例外処理部6から例外信号を入力すると、転送実行中の命令を停止し、停止した命令のアドレスを実行中命令退避レジスタ3cに退避する。また、転送実行中の命令が実行回数付き命令である場合には、残りの実行回数を残実行回数退避レジスタ3bに退避する。なお、実行回数付きでない命令を実行中であった場合には、残りの実行回数を1として残実行回数退避レジスタ3bに退避する。また、割り込み信号が入力した場合には、転送実行中の命令が終了した後、同様の退避を行う。
【0056】
例外処理部6は、例外を発生させる可能性のある演算器もしくはデータ転送器が例外発生信号を出力する例外バス33と、外部割り込みを発生させる割込みコントローラに接続している。また、アドレスバス31、データバス32に接続した例外原因レジスタ6aを具備している。
【0057】
例外原因レジスタ6aは、例外の原因となった演算器もしくはデータ転送器を示すデータ、あるいは、割り込みが発生された原因を示すデータが格納されており、格納されたデータは、アドレスバス31およびデータバス32を使ってバスマスタ3あるいは命令取り出し器2などから読み出すことができる。
【0058】
例外処理部6は、例外バス33を通じて、例外バス33に接続する演算器もしくはデータ転送器が出力する例外発生信号を検出すると、例外発生信号に基づいて例外原因となる演算器もしくはデータ転送器を特定し、例外原因レジスタ6aへ特定された例外原因を格納する。また、例外が発生していない状態では、割込みコントローラからの割り込み信号を検出した場合には、これを受け付け、例外原因レジスタ6aに割り込み原因を格納する。さらに、例外もしくは割り込みが発生した場合、バスマスタ3に例外信号を出力し、例外もしくは割り込みが発生したことを通知する。この例外信号は、例外処理を行う例外ハンドラによって例外原因が除去されるか、割り込みハンドラによって割り込み処理が終了するまで保持される。
【0059】
このようなプロセッサ1では、命令取り出し器2では、命令発行器23が、プログラムカウンタ21に従ってアドレス生成器22が生成するアドレスを読み出しアドレスとして、順次メモリ10から命令を読み出し、命令格納レジスタ24経由でバスマスタ3へ転送する。
【0060】
バスマスタ3では、デコーダ3aが命令格納レジスタ24より出力された命令を解析し、アドレスバス31に接続された図示しないデータ転送器または演算器のレジスタを選択する。このとき、データ転送元のレジスタと、データ転送先のレジスタとが選択されることにより、選択されたレジスタ間でのデータバス32を通じたデータ転送が行われる。データ転送器または演算器は、単一の機能を有しており、このようなデータ転送によって入力レジスタにデータが格納されると、所定の処理を開始し、出力レジスタがある場合には、出力レジスタに演算結果を格納する。また、処理の途中で例外が発生した場合には、処理を中断し、例外バス33を通じて例外発生出力信号を出力する。さらに、具備するレジスタの読み出しを許可し、例外処理部6あるいはバスマスタ3からレジスタの内容が読み出せるようにしておく。
【0061】
例外処理部6は、例外バス33を通じて例外発生信号が出力されたことを検出すると、例外原因のデータ転送器または演算器を特定して例外原因レジスタ6aに格納し、例外信号をバスマスタ3へ出力する。例えば、例外が発生すると、レジスタの読み出しが可能となることから、これにより判別してもよい。
【0062】
バスマスタ3は、例外信号を受け付けると、データ転送処理を停止し、停止した命令のアドレスを実行中命令退避レジスタ3cに格納し、残りの実行回数を残実行回数退避レジスタ3bへ格納する。その後、プログラムカウンタ21の値を読み出し、プログラムカウンタ退避レジスタ25へ格納し、プログラムカウンタ21に例外ハンドラの先頭アドレスをプログラムカウンタ21に転送する。
【0063】
以上のように、例外の発生したデータ転送器もしくは演算器のみを停止し、例外ハンドラへ移行しても、例外の発生した演算器やデータ転送器は出力データの準備ができていないため、もし後続命令が例外の発生した演算器やデータ転送器のレジスタにアクセスしようとしても待たされ、後続命令の実行結果に例外発生の影響が及ぶことがない。また、例外の発生した演算器やデータ転送器の入力レジスタも同様に書き込みが待たされるため、入力レジスタのデータを解析すれば例外の原因の特定ができる。
【0064】
ここで、図3、図4、図5を用いて、各演算器もしくはデータ転送器と、例外処理部6と、バスマスタ3の動作について、具体的に説明する。ここでは、例として、例外が発生した場合について説明する。なお、割り込みが発生した場合の処理の内容は、例外処理部6およびバスマスタ3とも例外時の場合とは、命令の中断を行わず終了後に行うことを除き、同様である。ただし、例外ハンドラは、割り込みハンドラになる。
【0065】
図3、図4、図5は、各演算器もしくはデータ転送器、例外処理部およびバスマスタの間のシーケンス例を示す図である。
図3は、例外発生から例外信号出力までのシーケンス例である。
【0066】
タイミングT101において、演算器もしくはデータ転送器9に例外が発生する。続いて、タイミングT102において、例外が発生した演算器もしくはデータ転送器9の処理が停止される。さらに、タイミングT103において、例外バス33を通じて例外発生信号が出力される。その後、タイミングT104において、入力レジスタおよび出力レジスタがアドレスバス31およびデータバス32を通じて読み出せるように、レジスタ読み出しが許可される。以降、例外が発生した演算器もしくはデータ転送器9は、例外原因が除去されるのを待つ。
【0067】
一方、タイミングT105において、例外バス33に接続する例外処理部6によって、演算器もしくはデータ転送器9が出力した例外発生信号が検出され、例外を発生させた演算器もしくはデータ転送器9が特定され例外原因レジスタ6aに格納される。続いて、バスマスタ3に対して例外信号が出力される。
【0068】
次に、図4を用いて説明する。図4は、例外信号出力からハンドラ実行までのシーケンス例である。
タイミングT107において、例外処理部6によって出力された例外信号がバスマスタ3に入力され、データ転送命令の実行が停止される。続いて、タイミングT108において、停止したデータ転送命令のアドレスが実行中命令退避レジスタ3cに退避され、実行回数付き命令の残りの実行回数である残回数を残実行回数退避レジスタ3bに退避される。続く、タイミングT109において、命令取り出し器2のプログラムカウンタ21がプログラムカウンタ退避レジスタ25に退避され、例外処理復帰後の最初の命令のアドレスが退避される。その後、タイミングT110において、プログラムカウンタ21に、例外ハンドラのアドレスが転送され、制御が例外ハンドラに移る。例外ハンドラは、例外原因に応じて処理が異なるが、処理の分岐は、例外ハンドラが例外原因レジスタ6aの内容を参照し、対象の演算器もしくはデータ転送器9のレジスタ内容を確認することにより、原因を特定して行う。また、分岐は、バスマスタ3が例外原因レジスタ6aを参照して行うようにしてもよい。以上のようにして、プログラムカウンタ21の内容が例外ハンドラのアドレスに書き換わり、タイミングT111において、ハンドラルーチンの実行が開始される。
【0069】
次に、図5を用いて説明する。図5は、ハンドラ実行から例外復帰までのシーケンス例である。
図4のタイミングT111においてハンドラルーチンが開始されると、ハンドラルーチンでは、例外が発生した演算器もしくはデータ転送器9のレジスタを読み出し、例外原因を除去する処理を行う。例えば、データ転送器において、ページフォルトが発生したような場合には、ページングを行う。例外ハンドラのハンドラルーチンによって例外が除去されると、例外処理部6および演算器もしくはデータ転送器9によって例外原因が除去されたことが検出される。
【0070】
タイミングT112では、例外が発生していた演算器もしくはデータ転送器9の例外原因が除去されており、例外発生信号の出力が停止される。続いて、タイミングT113において、演算器もしくはデータ転送器9が初期化され、初期状態になる。一方、タイミングT112において、例外処理部6によっても例外原因が除去されたことが検出され、例外原因レジスタ6aから例外原因が削除される。続いて、例外信号の出力が停止される。図4では、同一のタイミングで例外発生信号の停止と例外原因削除が行われるとしたが、これらの処理は個々に行われるため、タイミングがずれてもかまわない。また、例外処理部6は、タイミングT112において演算器もしくはデータ転送器9が例外発生信号の出力を停止したことを受けて、例外原因削除を行うようにすることもできる。
【0071】
以上の処理によって、演算器もしくはデータ転送器9が初期化され、復帰可能な状態になる。また、例外信号が停止したことは、バスマスタ3へ通知される。次のタイミングT114において、例外信号が停止されたことを検出したバスマスタ3によって、プログラムカウンタが復帰される。続いて、タイミングT115において、実行命令と繰り返し命令の残回数が復帰される。このとき、必要に応じて、例外を発生した演算器もしくはデータ転送器9にデータ転送を行い、例外が発生した命令を再実行させる。この場合、プログラムカウンタ21には、実行中命令退避レジスタ3cの示すアドレスが転送される。そして、この処理が実行された後、プログラムカウンタ退避レジスタ25に格納されたプログラムカウンタが、プログラムカウンタ21に転送される。その後、例外ハンドラの処理を抜ける。
【0072】
以上の処理によって、プロセッサ1は、例外発生前の状態に戻る。そして、タイミングT116において、中断されていた処理が再開され、新規命令の受け取りが開始される。
【0073】
なお、上記の説明では、アドレスバス31とデータバス32が1組の場合について説明したが、これらのバスが複数組ある場合には、例外処理部6は、例外が発生した演算器もしくはデータ転送器9の属するバスマスタを特定し、特定されたバスマスタに対してのみ例外信号を出力する。他のバスマスタは、そのまま処理の実行を続ける。また、演算器もしくはデータ転送器9は、例外処理部6によって特定されたバスマスタのみすべてのレジスタを読み出し許可にし、そのほかのバスマスタからの選択に対してはwait信号を出力する。
【0074】
次に、本発明のプロセッサを用いた例外処理方法について説明する。ここでは、例として、図1に示したデータ読み出し器61に例外が発生した場合の読み出し器61の動作と、それに対する例外処理方法について説明する。
【0075】
図6は、読み出し器における処理の流れを示すフローチャートである。
ステップS01において、読み出し器61は、入力レジスタのデータ格納が完了したかどうかを確認している。入力レジスタのデータ格納が完了していない場合は、完了するまでステップS01の待ち状態を継続する。入力レジスタのデータ格納が完了している場合は、次のステップS02へ処理を進める。
【0076】
ステップS02において、パワーセーブ機能を解除する。なお、パワーセーブ機能は、それぞれが具備するデータ入力用のレジスタに、各処理を開始するために必要なデータ入力が行われていない処理待機状態において、処理回路への電流供給量を抑制する機能である。
【0077】
ステップS03において、データの読み出し処理を開始する。処理が開始された後、入力レジスタあるいは出力レジスタにおいてセレクト信号が受信された場合には、データ読み出し処理が終了するまでデータバス32上にWait信号を出力する。
【0078】
ステップS04において、入力レジスタに格納されたデータを読み出しアドレスとして、データキャッシュ4bおよび外部バスI/F5を通じて外部のメモリ10にアクセスし、データの読み出しを行う。
【0079】
ステップS05において、データ読み出し時に、例外が発生したかどうかを確認する。例外が発生していない場合は、処理をステップS06へ進め、例外が発生した場合には、ステップS11からステップS15までの例外発生時の処理を行う。
【0080】
ステップS06において、読み出したデータを出力用の結果格納レジスタに転送する。
ステップS07において、ステップS03において出力されたWait信号の出力を停止し、ステップS06で格納された結果格納レジスタのデータを読み出し可能にする。
【0081】
ステップS08において、パワーセーブ機能を設定し、次の処理開始までの消費電力を抑える。
以上の手順により、データ読み出しが行われる。
【0082】
ここで、例外発生時の処理について説明する。
ステップS11において、例外が発生したので、データ読み出し処理を停止する。
【0083】
ステップS12において、例外発生信号を例外バス33へ出力し、例外が発生したことを例外処理部6へ通知する。
ステップS13において、例外を発生した命令のデータ転送を行った特定バスマスタに対して、すべてのレジスタの読み出しを許可する。
【0084】
ステップS14において、例外原因が除去されたかどうかを確認する。例外原因が除去されていない場合は、ステップS14で待機状態を継続する。例外原因が除去された場合は、ステップS15へ処理を進める。
【0085】
ステップS15において、例外発生信号の出力を停止し、必要であれば初期化を行い、処理可能な状態に復帰させる。復帰後、処理をステップS07へ戻す。
以上の処理手順により、例外発生が例外処理通知され、例外ハンドラによって例外原因が除去される。例外原因が除去され、処理可能な状態となった場合、ステップS07に戻って、次の命令処理のための動作を再開する。
【0086】
次に、例外処理方法について説明する。
図7は、例外処理が起動されるまでの処理の流れを示すフローチャートである。
【0087】
ステップS21において、命令取り出し器2よりデータ転送元のレジスタとデータ転送先のレジスタを指定した命令を受け取る。
ステップS22において、受け取った命令をデコードする。
【0088】
ステップS23において、命令のデコード結果に応じて、転送元レジスタおよび転送先レジスタに対して、それぞれアドレスバス31を通じてセレクト信号を出力する。また、命令に即値が含まれていた場合は、アドレスバス31を通じて転送先レジスタにセレクト信号を出力するとともに、即値データを生成してデータバス32に出力する。
【0089】
ステップS24において、例外処理部6が出力する例外信号を受信したか否かを確認する。例外信号を受信している場合は、ステップS25の例外処理を行う。例外信号を受信していない場合は、ステップS26へ処理を進める。
【0090】
ステップS25において、後述する例外処理の実行により例外ハンドラを起動し、例外原因を除去する。例外原因が除去された後、ステップS21に戻って、次の命令処理の実行を再開させる。
【0091】
ステップS26において、データバス32よりWait信号を受信したか否かを判断する。Wait信号を受信した場合は、ステップS27に進み、受信していない場合はステップS28に進む。ステップS27において、現在のセレクト信号の出力状態を保持する。従って、ステップS26での判断により、Wait信号の受信が停止するまでの間、ステップS27でのセレクト信号の出力状態が保持される。
【0092】
ステップS28において、受け取った命令中で実行回数が指定されていた場合に、残りの実行回数が「0」であるか否かを判断し、「0」である場合はステップS21に進んで新たな命令を受け取る。また、「0」でない場合はステップS29に進む。ステップS29において、残りの実行回数の値を「1」だけ減じて、ステップS23に戻る。従って、指定された実行回数の分だけ、ステップS23〜S28の処理が繰り返される。
【0093】
ここで、例外処理について説明する。
図8は、例外処理の流れを示すフローチャートである。
ステップS31において、データ転送処理を停止する。すなわち、アドレスバス31を通じてのセレクト信号の出力を停止し、命令に即値が含まれていた場合は、データバス32を通じての即値データの出力を停止する。
【0094】
ステップS32において、データ転送処理を停止した実行命令のアドレスと、実行回数が指定されている命令の場合の残りの実行回数をそれぞれ実行中命令退避レジスタ3cと、残実行回数退避レジスタ3bに退避させる。
【0095】
ステップS33において、アドレスバス31とデータバス32を通じて、プログラムカウンタ21の内容を読み出しプログラムカウンタ退避レジスタ25へ書き込む。
【0096】
以上の処理により、実行中のデータ転送命令が停止され、その命令のアドレスおよび残実行回数と、プログラムカウンタがそれぞれの退避レジスタに退避される。
【0097】
ステップS34において、アドレスバス31とデータバス32を通じて、プログラムカウンタ21に、例外を処理する例外ハンドラの先頭アドレスを転送する。プログラムカウンタ21を例外ハンドラの先頭アドレスにしたことにより、次に実行される命令は、例外ハンドラの先頭命令となり、例外ハンドラに制御が移る。
【0098】
ステップS35において、ステップS34の処理によって例外ハンドラの命令が順次実行される。例外ハンドラでは、例外原因を特定し、その例外原因を除去する処理が行われる。これにより、例外原因が削除され、これに伴って、例外処理部6による例外信号の出力は停止され、データ読み出し器は初期状態に復帰し、例外発生信号の出力が停止される。この後、必要に応じて例外を発生したデータ読み出し器にデータ転送を行い、例外が発生した命令を再び実行させる。最後に、それぞれの退避レジスタに格納されたプログラムカウンタ、実行命令アドレス、残実行回数を復帰し、例外ハンドラを抜ける。
【0099】
ステップS36において、例外ハンドラによる例外除去処理が完了し、実行が再開される。
例外が発生しても、処理が停止されるのは例外を発生した演算器もしくはデータ転送器のみであり、そのとき動作していた他の演算器もしくはデータ転送器は、正常に処理を行った後、停止している。もし、例外の発生した演算器もしくはデータ転送器のレジスタにアクセスしようとしても、Wait信号により待たされた状態を継続する。このため、他の演算器もしくはデータ転送器の実行結果に例外発生の影響が及ぶことがない。従って、例外処理により例外が発生した演算器もしくはデータ転送器の例外原因が除去され、例外が発生した命令が再度実行されて正常に完了すれば、そのまま処理を再開させることができる。このように、例外からの復帰時に例外が発生した以外の演算器もしくはデータ転送器に再度演算を実行させる必要がなく、例外からの復帰に要する時間を短縮することができる。この結果、全体の処理速度を向上させることができる。
【0100】
【発明の効果】
以上説明したように、本発明のプロセッサでは、転送制御手段によるデータ転送制御のみによって、各演算手段の動作が制御される。従って、例外発生時に転送制御手段は、例外発生時に、実行命令やプログラムカウンタを退避レジスタに退避し、処理を停止させる。このとき、例外受付手段は、演算手段の出力する例外発生信号により例外が発生した演算手段を正確に特定している。さらに、例えば、その演算手段のレジスタを読み出すことにより、例外の発生状態をより正確に特定することができる。また、例外が発生した以外の演算手段は、処理終了後に自動的に停止するため、例外の復帰時に再度演算をさせる必要がない。この結果、例外からの復帰に要する時間を短縮し、全体の処理速度を向上させることができる。
【0101】
また、本発明の例外処理方法では、レジスタ間のデータ転送制御のみによって各演算手段の動作が制御されるプロセッサに例外が発生した場合、例外発生時の実行命令とプログラムカウンタを退避レジスタに退避し、例外が発生したことが特定された演算手段のレジスタを読み出すことにより、例外の発生状態を正確に特定することができる。
【図面の簡単な説明】
【図1】本発明のプロセッサの構成例を示す機能ブロック図である。
【図2】命令取り出し器、バスマスタおよび例外処理部の各内部構成を示すブロック図である。
【図3】例外発生から例外信号出力までのシーケンス例である。
【図4】例外信号出力からハンドラ実行までのシーケンス例である。
【図5】ハンドラ実行から例外復帰までのシーケンス例である。
【図6】データ読み出し器における処理の流れを示すフローチャートである。
【図7】例外処理が起動されるまでの処理の流れを示すフローチャートである。
【図8】例外処理の流れを示すフローチャートである。
【図9】従来のプロセッサの構成例を示す機能ブロック図である。
【符号の説明】
1・・・・・・プロセッサ、2・・・・・・命令取り出し器、3・・・・・・バスマスタ、3a・・・・・・デコーダ、3b・・・・・・残実行回数退避レジスタ、3c・・・・・・実行中命令退避レジスタ、4a・・・・・・命令キャッシュ、4b・・・・・・データキャッシュ、5・・・・・・外部バスI/F、6・・・・・・例外処理部、6a・・・・・・例外原因レジスタ、10・・・・・・メモリ、21・・・・・・プログラムカウンタ、22・・・・・・アドレス生成器、23・・・・・・命令発行器、24・・・・・・命令格納レジスタ、25・・・・・・プログラムカウンタ退避レジスタ、31・・・・・・アドレスバス、32・・・・・・データバス、33・・・・・・例外バス、61・・・・・・読み出し器、62・・・・・・書き出し器、63・・・・・・メモリ転送器、64・・・・・・スタック処理器、65・・・・・・データ交換器、67・・・・・・整数加算器、68・・・・・・整数減算器、69・・・・・・整数乗算器、70・・・・・・整数除算器、71・・・論理積演算器、72・・・・・・論理和演算器、73・・・・・・排他的論理積演算器、74・・・・・・排他的論理和演算器、75・・・・・・ビット反転演算器、76・・・・・・浮動小数加算器、77・・・・・・浮動小数減算器、78・・・・・・浮動小数乗算器、79・・・・・・浮動小数除算器、80・・・・・・積和演算器、81・・・・・・汎用レジスタ
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a processor and an exception handling method that perform various processes such as arithmetic processing in accordance with a read instruction, and more particularly to a processor and an exception handling method that reduce the processing time when an exception or an interrupt occurs.
[0002]
[Prior art]
At present, microprocessors are used in all electronic devices as well as computers and portable terminals. In a conventional microprocessor, an operation code for designating a process such as an operation is provided, and the operation unit is controlled by decoding the operation code.
[0003]
FIG. 9 is a functional block diagram illustrating a configuration example of a conventional processor.
The processor illustrated in FIG. 9 includes an instruction control unit 110 that acquires an instruction and issues an instruction, a data path unit 120 that performs an operation or the like in accordance with the instruction, and a determination process that determines an execution result of a process performed by the data path unit 120. And a unit 130. The data path unit 120 includes, for example, an integer operation unit 121, a floating-point operation unit 122, a read / write unit 123, and the like.
[0004]
The instruction control unit 110 decodes an instruction read via an external bus (not shown) and generates an internal control signal for executing the instruction. The data path unit 120 performs various calculations and the like according to a control signal from the instruction control unit 110. For example, the integer calculator 121 performs calculations such as addition and multiplication on integers. Further, the floating-point arithmetic unit 122 performs operations such as addition and multiplication on floating-point numbers. The read / write unit 123 reads and writes data from and to an external memory (not shown). The confirmation processing unit 130 determines whether or not the processing result of the data path unit 120 may be used as the confirmation value.
[0005]
By the way, when an exception or an interrupt occurs in such a processor, the processing result in the data path unit 120 usually needs to be determined by the determination processing unit 130 in the order of the instructions issued by the instruction control unit 110. There is. As a result, the state of occurrence of an exception or an interrupt can be accurately specified, the register state at this time can be held, and the subsequent instruction can be stopped. On the other hand, if the order of determining the execution results of the instructions is not performed in the order of the description of the instructions, the specification of the state of occurrence of the exception or the interrupt will be inaccurate.
[0006]
Note that there has been the following exception processing device that inhibits the occurrence of multiple exceptions when an exception occurs and improves the consistency of processing when returning from an exception (see Patent Document 1). When an exception is detected in an arithmetic unit that can execute simultaneously in parallel, the exception processing unit interrupts the operation of the arithmetic unit that has not completed execution of the instruction, and executes an exception handler such as a program counter or the number of interrupted instructions. Saves exception information required by. When the cause of the exception is removed and the process returns from the exception handling handler, re-execution of the interrupted instruction is repeated based on the number of saved instructions whose execution has been interrupted, and the sequence returns to the sequence before the occurrence of the exception. .
[0007]
[Patent Document 1]
JP-A-5-20070
[0008]
[Problems to be solved by the invention]
As described above, in a conventional processor, in order to accurately specify the state of occurrence of an exception or an interrupt, it is necessary to control the order in which the execution results of instructions are determined in the order in which the instructions are written. For this reason, extra hardware such as the determination processing unit 130 that controls the determination order of the execution results is required, and such control processing is a factor that hinders an increase in processing speed.
[0009]
Further, the exception handling device disclosed in Patent Document 1 has a structure in which, when an exception occurs, all the operations that have not been completed are interrupted, so that it is necessary to execute the operations again when returning. Yes, it hinders an increase in processing speed.
[0010]
The present invention has been made in view of such a problem, and when an exception or an interrupt occurs, a processor and an exception processing method capable of accurately specifying the state of occurrence and improving the overall processing speed The purpose is to provide.
[0011]
[Means for Solving the Problems]
In the present invention, in order to solve the above problem, in a processor operating according to a read instruction, an inter-register transfer unit for transferring data between registers, and an operation data register to which data is input through the inter-register transfer unit, And a result storage register from which data is output.When data is input to all the operation data registers, a predetermined operation process is performed using the input data, and the operation result is stored in the result storage register. A plurality of arithmetic means, each having a single arithmetic function, for interrupting processing upon writing and generating an exception and outputting an exception generating signal, and an exception generating signal line for transmitting the exception generating signal, Is detected, the cause of the exception is identified, the exception receiving means for notifying of the exception occurrence, and the information at the time of the exception occurrence The data transfer operation through the inter-register transfer means is controlled by reading and decoding the instruction in which information specifying the data transfer destination and transfer source registers is normally read and stored. Stopping the instruction being transferred by the notification of the occurrence of the exception, storing a value of a program counter indicating an address where the instruction and an instruction to be executed next are stored in the save register, and executing the exception processing. Transfer control means for transferring the control to the exception processing by writing a head address storing a program for the exception processing to the program counter.
[0012]
In such a processor, normally, the transfer control means performs a data transfer operation between the operation data register of the operation means and the result storage register of the same or another operation means through the inter-register transfer means. Controlled. Each operation means starts its operation when data is input to all the operation data registers. Therefore, the operation of each operation means is controlled only by the data transfer control by the transfer control means. When an exception occurs, the arithmetic unit interrupts the process and outputs an exception occurrence signal. Upon detecting the exception occurrence signal, the exception accepting unit identifies the cause of the exception and notifies the transfer control unit of the exception occurrence. The transfer control means stops the data transfer instruction being executed at that time, and stores the instruction and the value of the program counter indicating the address where the instruction executed next to the instruction is stored in the save register, Control is transferred to exception processing by writing the start address of the program for exception processing to the program counter. Therefore, the operation means other than the operation means in which the exception has occurred are automatically stopped after completion of each operation processing.
[0013]
According to another aspect of the present invention, there is provided an exception handling method for a processor operating in accordance with a read instruction, wherein data is input to an arithmetic data register to which data is input through inter-register transfer means for transferring data between registers. Performs a predetermined operation using the input data, writes the operation result in a result storage register to which data is output through the inter-register transfer means, and interrupts the process when an exception occurs to generate an exception occurrence signal. A plurality of output means, each having a single operation function, decode the instruction in which information specifying a data transfer destination and a transfer source register is described, and perform data transfer through the inter-register transfer means. The operation is controlled by controlling, and when the exception occurrence signal output from the arithmetic unit is detected, The cause of the exception is detected based on the externally generated signal, the instruction being transferred is stopped when the exception occurs, and the value of the program counter indicating the address where the instruction and the next instruction to be executed are stored is stored in the save register. An exception processing method is provided, wherein the method transfers the control to the exception processing by writing a leading address storing a program for executing the exception processing according to the cause of the exception to the program counter. You.
[0014]
In such an exception processing method, the operation of the arithmetic unit is controlled by controlling the data transfer between the arithmetic data register provided in the arithmetic unit and the result storage register through the inter-register transfer unit. When an exception occurs and an exception occurrence signal is output, the cause of the exception is identified based on the exception occurrence signal, the data transfer instruction being executed at this time is stopped, and this instruction and the instruction following this instruction are executed. The value of the program counter indicating the address where the instruction to be executed is stored is stored in the save register, and control is transferred to the exception processing by writing the start address of the program for the exception processing in the program counter.
[0015]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
FIG. 1 is a functional block diagram illustrating a configuration example of a processor according to the present invention.
[0016]
A processor 1 shown in FIG. 1 includes an instruction fetch unit (indicated as Fetch in the figure) 2 for acquiring an instruction and issuing an instruction, and an address bus 31, a data bus 32, and an exception bus 33 according to the input instruction. A bus master 3 for controlling the operation of various data transfer units and arithmetic units connected to the internal bus, an instruction cache 4a for storing instructions read from outside, and a processing result and data read from outside. A data cache 4b, an external bus I / F (interface) 5 for reading data and the like from the outside, and outputting a processing result to the outside, an exception processing unit 6 for monitoring occurrence of an exception and an external interrupt, Is provided.
[0017]
Further, the internal address bus 31 and data bus 32 are connected to, for example, a data transfer unit for performing data transfer processing with the outside and an arithmetic unit for performing various arithmetic processing. The data transfer unit includes a read unit (indicated as “Load” in the figure) 61, a write unit (the store) 62, a memory transfer unit (the Move) 63, a stack processor (the Stack) 64, and a data exchanger (the same) Swp) 65 is connected. In addition, as a computing unit, a comparator (the same Cmp) 66, an integer adder (the same Add) 67, an integer subtracter (the same Sub) 68, an integer multiplier (the same Mul) 69, and an integer divider (the same Div) 70 AND operation unit (And) 71, OR operation unit (Or) 72, exclusive AND operation unit (Xand) 73, exclusive OR operation unit (Xor) 74, bit inversion operation unit ( Not) 75, floating-point adder (Fadd) 76, floating-point subtractor (Fsub) 77, floating-point multiplier (Fmul) 78, floating-point divider (Fdiv) 79, and multiply-accumulate unit (The same Muladd) 80 is connected. In addition, a general-purpose register 81 is connected to the address bus 31 and the data bus 32.
[0018]
Among these arithmetic units and data transfer units, those which may cause an exception are connected to the exception processing unit 6 via an exception generation signal line (hereinafter referred to as an exception bus) 33 for transmitting an exception generation signal. Connected. For example, when the data transfer unit performs data transfer processing with the outside via the data cache 4b, an exception such as a page fault may occur. Further, the arithmetic unit generates an exception when a data input or an operation result outside the effective range is obtained due to an overflow, underflow, division by zero, or the like.
[0019]
Outside the processor 1, an interrupt controller 8 and a rewritable memory 10 are connected from an external bus I / F 5 via an external address bus 51 and a data bus 52.
[0020]
The instruction fetch unit 2 reads an instruction from the external memory 10 via the instruction cache 4a and the external bus I / F 5, and outputs the instruction to the bus master 3. The bus master 3 analyzes the input instruction, outputs a select signal to the address bus 31 to specify the address of the register, and in some cases, transmits an immediate value through the data bus 32, thereby providing the address bus 31 and the data bus 32. To control the data transfer operation between the data transfer units connected to. If the read instruction includes information on the number of times the instruction has been executed, this instruction is repeatedly executed the specified number of times.
[0021]
The instruction cache 4a stores an instruction read from the memory 10 through the external bus I / F 5, and when an address on the memory 10 specified by the instruction fetch unit 2 is hit, the stored instruction is stored in the instruction cache 4a. Output to extractor 2. The data cache 4b stores data read from the memory 10 via the external bus I / F 5, and when an address on the memory 10 specified by the read unit 61 hits, reads the stored data. 61. The external bus I / F 5 converts a signal inside the processor 1 into an external bus signal, and reads / writes data from / to an external device such as the memory 10.
[0022]
A read unit 61, a write unit 62, a memory transfer unit 63, a stack processor 64, a data exchanger 65, a comparator 66, an integer adder 67, an integer subtractor 68, an integer multiply connected to the address bus 31 and the data bus 32. Unit 69, integer divider 70, AND operator 71, OR operator 72, exclusive AND operator 73, exclusive OR operator 74, bit inversion operator 75, floating point adder 76, floating point The subtracter 77, the floating-point multiplier 78, the floating-point divider 79, and the product-sum operation unit 80 have a register for input and a register for output when there is an output. These are both connected to an address bus 31 and a data bus 32. When data is input through the data bus 32 to the input register specified by the bus master 3 through the address bus 31, predetermined data processing is started. Each of the data transfer unit and the arithmetic unit has only one processing function. The data processing is completed, and the obtained processing result data is stored in an output register. The stored data is transferred to another data transfer unit, arithmetic unit, or the like based on the address designation by the bus master 3.
[0023]
The reader 61 has one address register and one data register. When data is stored in the address register, the readout unit 61 accesses the external memory 10 through the data cache 4b and the external bus I / F 5 using the stored data as a readout address. Then, data is read from the corresponding address on the memory 10 and stored in the data register. If the output read address hits in the data cache 4b, the corresponding data is read from the data cache 4b and stored in the data register.
[0024]
The writer 62 includes one address register and one data register. The address register stores the address of the data write destination on the memory 10, and the data register stores the data to be written to the memory 10. . When data is input to both the address register and the data register, the external memory 10 is accessed through the data cache 4b and the external bus I / F 5, and the data is written to a corresponding address on the memory 10.
[0025]
The memory transfer device 63 includes two address registers and one transfer amount register. One address register stores an address to be a transfer source on the memory 10 or another memory, and the other address register. The register stores the destination address. The transfer amount register stores the data size of data read from the specified address. When these data are input, the external memory 10 or another memory is accessed through the data cache 4b and the external bus I / F 5, and data transfer between corresponding addresses is instructed.
[0026]
The stack processor 64 has a pointer register and a data register. The pointer register stores a stack pointer for specifying an address on the memory 10, and the data register writes data to the memory 10. Target data is stored. When these data are input, each operation of reading and writing from the memory 10 is determined by reading and writing in the data register. In the case of the reading operation, when the data storing operation to the pointer register is completed, the memory 10 is accessed. Then, data is read from the corresponding address and stored in the data register. In the case of a write operation, when the data storage operation to both the pointer register and the data register is completed, data is written to the corresponding address in the memory 10.
[0027]
The data exchanger 65 includes an address register, an input data register, and an output data register. When data storage in the input data register and the address register is completed, the data in the memory 10 indicated by the address register becomes Access is made through the data cache 4b and the external bus I / F5. Then, data is read from the corresponding address on the memory 10 and stored in the output data register.
[0028]
The comparator 66 includes two data registers for data input and a status register for storing the operation result. When data input to both of the two data registers is completed, the comparator 66 compares the input data. , And store the comparison result in the status register.
[0029]
The integer adder 67 has two input registers and one output register. When a numerical value to be added and a numerical value to be added are input to the two input registers, an integer is calculated using each data. Addition processing is performed, and the addition result is stored in an output register.
[0030]
The integer subtracter 68, the integer multiplier 69, and the integer divider 70 have two input registers and one output register, similarly to the integer adder 67. Similarly to the integer adder 67, when the data to be operated is input to the two input registers, the integer subtractor 68 performs the integer subtraction processing, the integer multiplier 69 performs the integer multiplication processing, and the integer. The divider 70 starts the integer division process and stores the operation result in the output register.
[0031]
Similarly to the integer adder 67, the AND operator 71, the OR operator 72, the exclusive OR operator 73, and the exclusive OR operator 74 also have two input registers and one output register, respectively. I have it. When the data to be operated is stored in the two input registers, the AND operation unit 71 performs an AND operation using the data, and stores the operation result in the output register. Similarly, when the data to be operated on is stored in the two input registers, the OR operation unit 72 performs the OR operation, the exclusive AND operation unit 73 performs the exclusive AND operation, and the exclusive OR operation. The unit 74 performs an exclusive OR operation and stores the operation result in an output register.
[0032]
The bit inversion operation unit 75 includes one input / output data register capable of inputting / outputting data. When the operation of storing data in the input / output register is completed, the bit inversion processing based on the stored data is started, and the operation result is calculated. Write back to I / O register.
[0033]
The floating-point adder 76, floating-point subtractor 77, floating-point multiplier 78, and floating-point divider 79 also have two input registers and one output register similarly to the integer adder 67 and the like. . When the data to be operated is stored in the two input registers, the floating-point adder 76 starts a floating-point addition process using these data, and stores the operation result in the output register. Similarly, when the data to be operated is stored in the two input registers, the floating-point subtractor 77 performs floating-point subtraction, the floating-point multiplier 78 performs floating-point multiplication, and the floating-point divider 79 performs floating-point division. Processing is started and the result of this operation is stored in the output register.
[0034]
The product-sum operation unit 80 has three input registers and an output register. When a numerical value to be operated is input to the three input registers, the product-sum operation unit 80 performs a product-sum operation using the input numerical values. Is stored in the output register.
[0035]
Among these data transfer units and arithmetic units, those which may cause an exception are connected to the exception bus 33. In the example shown in the figure, a comparator 66 of an arithmetic unit, an integer adder 67, an integer subtractor 68, an integer multiplier 69, an integer divider 70, a floating-point adder 76, a floating-point subtractor 77, a floating-point multiplier 78, The floating-point divider 79 and the product-sum operation unit 80, the data transfer unit read unit 61, write unit 62, memory transfer unit 63, stack processor 64, and data exchange 65 are connected to the exception bus 33.
[0036]
The general-purpose register 81 temporarily stores the processing result of each data transfer unit and the arithmetic unit, and transfers the stored data to another data transfer unit or arithmetic unit based on the address designation by the bus master 3.
[0037]
The externally connected memory 10 stores an instruction and data, and supplies an instruction or data of an address requested by the external bus I / F 5 via the address bus 51 via the data bus 52. The external address bus 51 and the data bus 52 have, in addition to the memory 10, for example, an I / F of a ROM (Read Only Memory) or a HDD (Hard Disk Drive) for storing programs and various data, and a data input / output port. And an I / F (not shown) for connecting to a keyboard, a monitor, various communication networks, and the like, and constitute a computer system. The computer system operates by the processor 1 reading and executing a program from a ROM, an HDD, or the like via the data bus 52 and reading / writing data from / to each unit on the data bus 52.
[0038]
When detecting an external state change such as completion of data reception, for example, the interrupt controller 8 generates an interrupt signal and transmits the external state change to the exception processing unit 6.
In the processor 1, when instructions are read from the memory 10 and sequentially supplied to the bus master 3, the bus master 3 operates in accordance with the instructions between the data transfer unit and the arithmetic unit connected to the address bus 31 and the data bus 32. Controls data transfer operation. Each data transfer unit and arithmetic unit has a register for data input from the data bus 32, and some data transfer units and all arithmetic units have registers for data output.
[0039]
Each data transfer unit and each arithmetic unit have a single processing function, and automatically execute predetermined data processing when data input to the input register is completed. Those having an output register store the processing result in the register. Thus, it is possible to operate the data transfer units and the arithmetic units only by specifying the transfer source register and the transfer destination register by the bus master 3. Therefore, the bus master 3 basically has to decode only the information designating the source and destination registers based on the issued instruction, simplifying the instruction and speeding up the decoding process in the bus master 3. ing. When an exception occurs during the processing, each data transfer unit and each arithmetic unit interrupts the processing being performed and outputs an exception occurrence signal. The exception occurrence signal is held until the cause of the exception is removed. The output of the exception generation signal is transmitted to the exception processing unit 6 via the exception bus 33.
[0040]
Further, the interrupt controller 8 generates an interrupt signal according to a change in an external state specified in advance. The interrupt signal is transmitted to the exception processing unit 6 via an interrupt signal line (not shown).
[0041]
When detecting that an exception occurrence signal or an interrupt signal has been output, the exception processing unit 6 creates data indicating the cause of the exception from these signals, and notifies the bus master 3 of the occurrence of the exception or the interruption. The reception of an interrupt signal is performed only when no exception has occurred. The exception bus 33 is connected to each data transfer unit and the arithmetic unit, and the exception processing unit 6 can accurately specify the data transfer unit or the arithmetic unit that has output the exception occurrence signal.
[0042]
The bus master 3 stops the transfer instruction being executed at that time, and transfers control to exception processing. Therefore, the data transfer device or the operation device other than the data transfer device or the operation device interrupted due to the occurrence of the exception automatically stops after the processing is completed.
[0043]
In this way, by controlling the data transfer between the registers, the operation of each data transfer unit and each operation unit that executes a single process is controlled. The processing function in which the exception has occurred can be accurately specified without interrupting the processing of the data transfer unit and the arithmetic unit. Further, since it is not necessary to execute the determination processing unlike the related art, there is no need to provide extra hardware for performing the determination processing, and the exception processing time can be reduced. Further, the processing of the data transfer unit and the arithmetic unit other than the case where the exception has occurred is not interrupted, so that the time required for return can be shortened.
[0044]
Next, the instruction fetch unit 2, the bus master 3, and the exception processing unit 6 will be described in more detail with reference to FIG. In FIG. 2, only one set of the address bus 31 and the data bus 32 is provided to simplify the description, but a plurality of sets may be provided. Further, the exception bus 33 does not need to correspond one-to-one with the address bus 31 and the data bus 32, and one set may be provided for a plurality of sets of the address bus 31 and the data bus 32.
[0045]
FIG. 2 is a block diagram showing each internal configuration of the instruction fetch unit, the bus master, and the exception processing unit.
As shown in FIG. 2, the instruction fetch unit 2 includes a program counter 21, an address generator 22, an instruction issuer 23, an instruction storage register 24, and a program counter save register 25.
[0046]
The program counter 21 sequentially outputs a count value to the address generator 22 in synchronization with an input clock signal (not shown). Also, it is connected to the address bus 31 and the data bus 32, and when selected by the select signal through the address bus 31, the count value is rewritten by the data transferred through the data bus 32.
[0047]
The address generator 22 outputs the count value output from the program counter 21 to the instruction issuer 23 as a read address in the memory 10.
[0048]
The instruction issuer 23 transfers the read address output from the address generator 22 to the memory 10 through the instruction cache 4a and the external bus I / F5. Then, the instruction read from the memory 10 is transferred to the instruction storage register 24. If the output read address hits in the instruction cache 4a, the corresponding instruction is read from the instruction cache 4a and transferred to the instruction storage register 24. Further, it is possible to receive a status signal from the status register of the comparator 66 and operate according to the status signal.
[0049]
The instruction storage register 24 holds the instruction output from the instruction issuer 23 and transfers the instruction to the bus master 3 at a predetermined timing. Further, it is connected to the address bus 31 and the data bus 32 and functions as a register for inputting data from the data bus 32. When selected by the select signal through the address bus 31, the data transferred through the data bus 32 The output instruction is rewritten.
[0050]
The program counter save register 25 is a register for temporarily saving a program counter indicating an address at which an instruction stopped at the time of occurrence of an exception or an instruction executed next to an instruction terminated by occurrence of an interrupt is stored. It is connected to the address bus 31 and the data bus 32, and functions as a data input register and an output register from the data bus 32. When selected by the select signal through the address bus 31, if it functions as an input register, the value of the program counter transferred through the data bus 32 is written. When functioning as an output register, the value of the program counter held is transferred through the data bus 32.
[0051]
The bus master 3 includes a decoder 3a, a remaining execution count saving register 3b, and an executing instruction saving register 3c.
The decoder 3 a is connected to the address bus 31 and the data bus 32, analyzes the instruction output from the instruction storage register 24 of the instruction fetch unit 2, outputs a select signal to the address bus 31, and outputs the select signal to the address bus 31. A register of each connected data transfer unit or each arithmetic unit is selected. At this time, by selecting the data transfer source register and the data transfer destination register, data transfer via the data bus 32 is performed between the selected registers. The decoder 3a can also generate immediate data in accordance with the input instruction, select a data transfer destination register, and transfer the immediate data to this register via the data bus 32. Further, when the input instruction includes information for specifying the number of times of execution, the same transfer operation can be repeated for the specified number of times.
[0052]
When the decoder 3a receives the Wait signal through the data bus 32 after outputting the select signal, the decoder 3a changes the control state of the data bus 32 and the corresponding address bus 31 until the reception of the Wait signal is canceled. Then, the output of the select signal and the immediate value according to the decoding of the new instruction is stopped. When a plurality of sets of the address bus 31 and the data bus 32 are provided, it is possible to continue data transfer to another bus in which the Wait signal is not received.
[0053]
The remaining execution count save register 3b is connected to the decoder 3a, and writes the remaining execution count of the repetition processing transferred from the decoder 3a. If there is a read from the decoder 3a, the stored remaining number of executions is transferred to the decoder 3a.
[0054]
The executing instruction save register 3c is connected to the decoder 3a, and writes an address on the memory 10 in which the executing instruction transferred from the decoder 3a is stored. If there is a read from the decoder 3a, the address of the stored instruction in execution on the memory 10 is transferred to the decoder 3a.
[0055]
Upon receiving an exception signal from the exception processing unit 6, the decoder 3a stops the instruction being transferred and saves the address of the stopped instruction in the executing instruction save register 3c. If the instruction being transferred is an instruction with an execution count, the remaining execution count is saved in the remaining execution count save register 3b. If an instruction with no execution count is being executed, the remaining execution count is set to 1 and saved in the remaining execution count save register 3b. When an interrupt signal is input, the same saving is performed after the instruction being transferred is completed.
[0056]
The exception processing unit 6 is connected to an exception bus 33 from which an arithmetic unit or a data transfer unit which may generate an exception outputs an exception generation signal, and an interrupt controller which generates an external interrupt. Further, an exception cause register 6a connected to the address bus 31 and the data bus 32 is provided.
[0057]
The exception cause register 6a stores data indicating an arithmetic unit or a data transfer unit which caused the exception or data indicating a cause of the occurrence of the interrupt. The stored data is stored in the address bus 31 and the data bus. The data can be read from the bus master 3 or the instruction fetch unit 2 using the bus 32.
[0058]
Upon detecting an exception occurrence signal output from an arithmetic unit or a data transfer unit connected to the exception bus 33 via the exception bus 33, the exception processing unit 6 identifies an arithmetic unit or a data transfer unit that causes an exception based on the exception occurrence signal. The specified exception cause is stored in the exception cause register 6a. In the state where no exception has occurred, if an interrupt signal from the interrupt controller is detected, the interrupt signal is accepted and the interrupt cause is stored in the exception cause register 6a. Further, when an exception or an interrupt occurs, an exception signal is output to the bus master 3 to notify that the exception or the interrupt has occurred. This exception signal is held until the cause of the exception is removed by an exception handler that performs exception processing, or until the interrupt processing is terminated by the interrupt handler.
[0059]
In such a processor 1, in the instruction fetch unit 2, the instruction issuer 23 sequentially reads instructions from the memory 10 using the address generated by the address generator 22 according to the program counter 21 as a read address, and sends the read instruction via the instruction storage register 24. Transfer to bus master 3.
[0060]
In the bus master 3, the decoder 3a analyzes the instruction output from the instruction storage register 24 and selects a register of a data transfer unit or an arithmetic unit (not shown) connected to the address bus 31. At this time, the data transfer source register and the data transfer destination register are selected, so that data transfer between the selected registers via the data bus 32 is performed. The data transfer unit or the arithmetic unit has a single function. When data is stored in an input register by such data transfer, a predetermined process is started. Store the operation result in the register. If an exception occurs during the processing, the processing is interrupted and an exception output signal is output through the exception bus 33. Further, reading of the provided registers is permitted, so that the contents of the registers can be read from the exception processing unit 6 or the bus master 3.
[0061]
Upon detecting that the exception occurrence signal has been output through the exception bus 33, the exception processing unit 6 specifies the data transfer unit or the operation unit of the exception cause, stores it in the exception cause register 6a, and outputs the exception signal to the bus master 3. I do. For example, when an exception occurs, the register can be read, so that the determination may be made based on this.
[0062]
When receiving the exception signal, the bus master 3 stops the data transfer process, stores the address of the stopped instruction in the executing instruction save register 3c, and stores the remaining execution count in the remaining execution count save register 3b. Thereafter, the value of the program counter 21 is read and stored in the program counter save register 25, and the start address of the exception handler is transferred to the program counter 21.
[0063]
As described above, even if only the data transfer unit or the operation unit where the exception occurred is stopped and the operation shifts to the exception handler, the operation unit or the data transfer unit where the exception has occurred is not ready for output data. Even if the subsequent instruction attempts to access the register of the arithmetic unit or the data transfer unit in which the exception has occurred, it is kept waiting, and the execution result of the subsequent instruction is not affected by the occurrence of the exception. Similarly, the input register of the arithmetic unit or the data transfer unit in which the exception has occurred is also waited for to be written. Therefore, by analyzing the data of the input register, the cause of the exception can be specified.
[0064]
Here, the operation of each arithmetic unit or data transfer unit, the exception processing unit 6, and the bus master 3 will be specifically described with reference to FIGS. Here, a case where an exception has occurred will be described as an example. The contents of the processing when an interrupt occurs are the same as those of the exception processing unit 6 and the bus master 3 at the time of exception except that the processing is performed after termination without interrupting the instruction. However, the exception handler becomes an interrupt handler.
[0065]
FIG. 3, FIG. 4, and FIG. 5 are diagrams illustrating an example of a sequence between each arithmetic unit or data transfer unit, the exception processing unit, and the bus master.
FIG. 3 is a sequence example from the occurrence of an exception to the output of an exception signal.
[0066]
At timing T101, an exception occurs in the arithmetic unit or the data transfer unit 9. Subsequently, at timing T102, the processing of the arithmetic unit or the data transfer unit 9 in which the exception has occurred is stopped. Further, at timing T103, an exception occurrence signal is output through the exception bus 33. Thereafter, at timing T104, register reading is permitted so that the input register and the output register can be read through the address bus 31 and the data bus 32. Thereafter, the arithmetic unit or data transfer unit 9 in which the exception has occurred waits for the cause of the exception to be removed.
[0067]
On the other hand, at timing T105, the exception processing unit 6 connected to the exception bus 33 detects the exception occurrence signal output from the arithmetic unit or the data transfer unit 9, and identifies the arithmetic unit or the data transfer unit 9 that has generated the exception. It is stored in the exception cause register 6a. Subsequently, an exception signal is output to the bus master 3.
[0068]
Next, a description will be given with reference to FIG. FIG. 4 is a sequence example from the output of the exception signal to the execution of the handler.
At timing T107, the exception signal output by the exception processing unit 6 is input to the bus master 3, and the execution of the data transfer instruction is stopped. Subsequently, at a timing T108, the address of the stopped data transfer instruction is saved in the executing instruction saving register 3c, and the remaining number of executions of the instruction with the number of executions is saved in the remaining execution number saving register 3b. At the subsequent timing T109, the program counter 21 of the instruction fetch unit 2 is saved in the program counter save register 25, and the address of the first instruction after returning from the exception processing is saved. Thereafter, at timing T110, the address of the exception handler is transferred to the program counter 21, and the control shifts to the exception handler. The exception handler performs different processing depending on the cause of the exception. The processing branches when the exception handler refers to the contents of the exception cause register 6a and confirms the contents of the register of the target arithmetic unit or the data transfer unit 9. Identify the cause and perform. The branch may be performed by the bus master 3 with reference to the exception cause register 6a. As described above, the contents of the program counter 21 are rewritten to the address of the exception handler, and the execution of the handler routine is started at the timing T111.
[0069]
Next, a description will be given with reference to FIG. FIG. 5 is an example of a sequence from execution of a handler to return to an exception.
When the handler routine is started at timing T111 in FIG. 4, the handler routine reads the register of the arithmetic unit or the data transfer unit 9 in which the exception has occurred, and performs processing for removing the cause of the exception. For example, when a page fault occurs in the data transfer device, paging is performed. When the exception is removed by the handler routine of the exception handler, the exception processing unit 6 and the arithmetic unit or the data transfer unit 9 detect that the cause of the exception has been removed.
[0070]
At timing T112, the cause of the exception of the arithmetic unit or the data transfer unit 9 in which the exception has occurred has been removed, and the output of the exception occurrence signal is stopped. Subsequently, at a timing T113, the arithmetic unit or the data transfer unit 9 is initialized and enters an initial state. On the other hand, at the timing T112, it is detected that the exception cause is also removed by the exception processing unit 6, and the exception cause is deleted from the exception cause register 6a. Subsequently, the output of the exception signal is stopped. In FIG. 4, the exception occurrence signal is stopped and the exception cause is deleted at the same timing. However, since these processes are performed individually, the timing may be shifted. Further, the exception processing unit 6 may delete the cause of the exception in response to the fact that the arithmetic unit or the data transfer unit 9 stops outputting the exception occurrence signal at the timing T112.
[0071]
By the above processing, the arithmetic unit or the data transfer unit 9 is initialized, and can be restored. The stop of the exception signal is notified to the bus master 3. At the next timing T114, the bus master 3 that has detected that the exception signal has been stopped returns the program counter. Subsequently, at timing T115, the remaining number of execution instructions and repetition instructions is restored. At this time, if necessary, data is transferred to the arithmetic unit or the data transfer unit 9 in which the exception has occurred, and the instruction in which the exception has occurred is re-executed. In this case, the address indicated by the executing instruction save register 3c is transferred to the program counter 21. After this processing is executed, the program counter stored in the program counter save register 25 is transferred to the program counter 21. Then, the process exits from the exception handler.
[0072]
Through the above processing, the processor 1 returns to the state before the occurrence of the exception. Then, at timing T116, the interrupted processing is resumed, and the reception of a new instruction is started.
[0073]
In the above description, the case where the address bus 31 and the data bus 32 are a single set has been described. However, when there are a plurality of these buses, the exception processing unit 6 determines whether the exception unit generates the arithmetic unit or the data transfer. The bus master to which the device 9 belongs is specified, and an exception signal is output only to the specified bus master. Other bus masters continue to execute the process. Further, the arithmetic unit or the data transfer unit 9 permits reading of all registers only for the bus master specified by the exception processing unit 6, and outputs a wait signal for selection from other bus masters.
[0074]
Next, an exception handling method using the processor of the present invention will be described. Here, as an example, the operation of the data reader 61 when an exception occurs in the data reader 61 shown in FIG. 1 and an exception handling method therefor will be described.
[0075]
FIG. 6 is a flowchart showing the flow of processing in the reader.
In step S01, the reading device 61 checks whether or not the data storage of the input register has been completed. If the data storage in the input register has not been completed, the wait state in step S01 is continued until the data storage is completed. If the data storage of the input register has been completed, the process proceeds to the next step S02.
[0076]
In step S02, the power save function is released. The power saving function is a function of suppressing a current supply amount to the processing circuit in a processing standby state in which data input necessary to start each processing is not performed in a data input register provided in each of the power saving functions. It is.
[0077]
In step S03, the data reading process starts. After the processing is started, when a select signal is received in the input register or the output register, a wait signal is output on the data bus 32 until the data reading processing is completed.
[0078]
In step S04, the external memory 10 is accessed through the data cache 4b and the external bus I / F 5 using the data stored in the input register as a read address to read data.
[0079]
In step S05, it is confirmed whether or not an exception has occurred during data reading. If no exception has occurred, the process proceeds to step S06. If an exception has occurred, the process from step S11 to step S15 when an exception has occurred is performed.
[0080]
In step S06, the read data is transferred to the output result storage register.
In step S07, the output of the Wait signal output in step S03 is stopped, and the data in the result storage register stored in step S06 can be read.
[0081]
In step S08, a power save function is set to reduce power consumption until the start of the next process.
Data reading is performed by the above procedure.
[0082]
Here, the processing when an exception occurs will be described.
In step S11, since an exception has occurred, the data reading process is stopped.
[0083]
In step S12, an exception occurrence signal is output to the exception bus 33 to notify the exception processing unit 6 that an exception has occurred.
In step S13, the reading of all registers is permitted to the specific bus master that has performed data transfer of the instruction in which the exception has occurred.
[0084]
In step S14, it is confirmed whether or not the cause of the exception has been removed. If the cause of the exception has not been eliminated, the standby state is continued in step S14. If the exception cause has been removed, the process proceeds to step S15.
[0085]
In step S15, the output of the exception occurrence signal is stopped, initialization is performed if necessary, and the process returns to a processable state. After the return, the process returns to step S07.
Through the above processing procedure, the occurrence of the exception is notified of the exception processing, and the exception handler removes the cause of the exception. When the cause of the exception has been removed and the state is ready for processing, the process returns to step S07 to resume the operation for the next instruction processing.
[0086]
Next, an exception handling method will be described.
FIG. 7 is a flowchart showing the flow of processing until the exception processing is activated.
[0087]
In step S21, an instruction specifying the data transfer source register and the data transfer destination register is received from the instruction fetching unit 2.
In step S22, the received instruction is decoded.
[0088]
In step S23, a select signal is output to the transfer source register and the transfer destination register via the address bus 31 according to the decoding result of the instruction. If the instruction includes an immediate value, the instruction signal is output to the transfer destination register via the address bus 31, and the immediate data is generated and output to the data bus 32.
[0089]
In step S24, it is confirmed whether or not an exception signal output by the exception processing unit 6 has been received. If an exception signal has been received, exception processing of step S25 is performed. If no exception signal has been received, the process proceeds to step S26.
[0090]
In step S25, an exception handler is started by executing exception processing described later, and the cause of the exception is removed. After the cause of the exception is removed, the process returns to step S21 to resume execution of the next instruction processing.
[0091]
In step S26, it is determined whether a Wait signal has been received from the data bus 32. If a Wait signal has been received, the process proceeds to step S27; otherwise, the process proceeds to step S28. In step S27, the current output state of the select signal is held. Therefore, the output state of the select signal in step S27 is held until the reception of the Wait signal is stopped by the determination in step S26.
[0092]
In step S28, when the number of executions is specified in the received instruction, it is determined whether or not the remaining number of executions is "0". Receive instructions. If it is not "0", the process proceeds to step S29. In step S29, the value of the remaining number of executions is reduced by "1", and the process returns to step S23. Therefore, the processes of steps S23 to S28 are repeated for the designated number of executions.
[0093]
Here, the exception processing will be described.
FIG. 8 is a flowchart showing the flow of exception processing.
In step S31, the data transfer processing is stopped. That is, the output of the select signal via the address bus 31 is stopped, and the output of the immediate data via the data bus 32 is stopped if the instruction includes an immediate value.
[0094]
In step S32, the address of the execution instruction whose data transfer process has been stopped and the remaining number of executions for the instruction whose execution number is specified are saved in the executing instruction saving register 3c and the remaining execution number saving register 3b, respectively. .
[0095]
In step S33, the contents of the program counter 21 are read out via the address bus 31 and the data bus 32 and written into the program counter save register 25.
[0096]
By the above processing, the data transfer instruction being executed is stopped, and the address of the instruction, the remaining execution count, and the program counter are saved in the respective save registers.
[0097]
In step S34, the head address of the exception handler that handles the exception is transferred to the program counter 21 via the address bus 31 and the data bus 32. By setting the program counter 21 to the top address of the exception handler, the next instruction to be executed becomes the top instruction of the exception handler, and the control is transferred to the exception handler.
[0098]
In step S35, instructions of the exception handler are sequentially executed by the processing of step S34. In the exception handler, a process for identifying the cause of the exception and removing the cause of the exception is performed. As a result, the cause of the exception is deleted, and accordingly, the output of the exception signal by the exception processing unit 6 is stopped, the data reader returns to the initial state, and the output of the exception occurrence signal is stopped. Thereafter, if necessary, data transfer is performed to the data reader that has generated the exception, and the instruction in which the exception has occurred is executed again. Finally, the program counter, execution instruction address, and remaining execution count stored in each save register are restored, and the process exits from the exception handler.
[0099]
In step S36, the exception removal processing by the exception handler is completed, and the execution is resumed.
Even if an exception occurs, the processing is stopped only in the arithmetic unit or data transfer unit that generated the exception, and the other operation units or data transfer units that were operating at that time performed the processing normally. After, it is stopped. Even if an attempt is made to access the register of the arithmetic unit or data transfer unit in which the exception has occurred, the state kept waiting by the Wait signal is continued. Therefore, the execution result of another arithmetic unit or data transfer unit is not affected by the occurrence of the exception. Therefore, if the cause of the exception of the arithmetic unit or the data transfer unit in which the exception has occurred is removed by the exception processing, and the instruction in which the exception has occurred is executed again and completed normally, the processing can be resumed as it is. As described above, there is no need to cause the arithmetic unit or the data transfer unit to execute the operation again except for the case where the exception has occurred when returning from the exception, and the time required for returning from the exception can be reduced. As a result, the overall processing speed can be improved.
[0100]
【The invention's effect】
As described above, in the processor of the present invention, the operation of each arithmetic unit is controlled only by the data transfer control by the transfer control unit. Therefore, when an exception occurs, the transfer control unit saves the execution instruction and the program counter in the save register and stops the processing when the exception occurs. At this time, the exception accepting means correctly specifies the arithmetic means in which the exception has occurred by the exception occurrence signal output from the arithmetic means. Furthermore, for example, by reading the register of the arithmetic means, the occurrence state of the exception can be specified more accurately. Also, since the operation means other than the one where the exception has occurred is automatically stopped after the processing is completed, there is no need to perform the operation again when the exception is returned. As a result, the time required for returning from the exception can be reduced, and the overall processing speed can be improved.
[0101]
Further, in the exception handling method of the present invention, when an exception occurs in a processor in which the operation of each arithmetic unit is controlled only by data transfer control between registers, an execution instruction and a program counter at the time of occurrence of the exception are saved in a save register. By reading the register of the arithmetic means in which the occurrence of the exception has been specified, the state of occurrence of the exception can be accurately specified.
[Brief description of the drawings]
FIG. 1 is a functional block diagram illustrating a configuration example of a processor according to the present invention.
FIG. 2 is a block diagram showing internal configurations of an instruction fetch unit, a bus master, and an exception processing unit.
FIG. 3 is a sequence example from the occurrence of an exception to the output of an exception signal.
FIG. 4 is an example of a sequence from output of an exception signal to execution of a handler.
FIG. 5 is a sequence example from execution of a handler to return from an exception.
FIG. 6 is a flowchart showing a flow of processing in a data reader.
FIG. 7 is a flowchart showing a flow of processing until exception processing is started.
FIG. 8 is a flowchart illustrating a flow of exception processing.
FIG. 9 is a functional block diagram illustrating a configuration example of a conventional processor.
[Explanation of symbols]
1 Processor 2 Instruction fetching device 3 Bus master 3a Decoder 3b Remaining execution count saving register .., 3c... Executing instruction save register, 4a... Instruction cache, 4b... Data cache, 5... External bus I / F, 6. ····· Exception processing unit, 6a ····· Exception cause register, 10 ···· Memory, 21 ···· Program counter, 22 ···· Address generator, 23 ... Instruction issuer, 24... Instruction storage register, 25... Program counter save register, 31... Address bus, 32. Data bus 33 ... Exception bus 61 ... Reader 62 ... ... Writer, 63 ... Memory transferer, 64 ... Stack processor, 65 ... Data exchanger, 67 ... Integer adder, 68: an integer subtracter, 69: an integer multiplier, 70: an integer divider, 71: an AND operator, 72: an logic Sum operator 73 ... Exclusive AND operator 74 ... Exclusive OR operator 75 ... Bit inversion operator 76 ... Floating point adder, 77 Floating point subtractor, 78 Floating point multiplier, 79 Floating point divider, 80 Product Sum operator, 81 ... General purpose register

Claims (10)

読み込んだ命令に従って動作するプロセッサにおいて、
レジスタ間でデータを転送するためのレジスタ間転送手段と、
前記レジスタ間転送手段を通じてデータが入力される演算データレジスタとデータが出力される結果格納レジスタとを具備し、すべての前記演算データレジスタにデータが入力されると、入力されたデータを用いて所定の演算処理を行い、その演算結果を前記結果格納レジスタに書き込み、例外の発生で処理を中断して例外発生信号を出力する、それぞれ単一の演算機能を有する複数の演算手段と、
前記例外発生信号を伝える例外発生信号線に接続し、前記例外発生信号が出力されたことを検出すると、その例外原因を特定し、例外発生の通知を行う例外受付手段と、
例外発生時の情報を格納する退避レジスタを具備し、通常時にはデータの転送先および転送元のレジスタを指定する情報が記述された前記命令を読み込んでデコードすることにより前記レジスタ間転送手段を通じたデータ転送動作を制御し、前記例外発生の通知によって転送実行中の命令を停止し、前記命令および次に実行される命令が格納されているアドレスを示すプログラムカウンタの値を前記退避レジスタに格納し、例外処理を実行させるためのプログラムが格納された先頭アドレスを前記プログラムカウンタに書き込むことによって前記例外処理に制御を移す転送制御手段と、
を有することを特徴とするプロセッサ。
In a processor that operates according to the read instruction,
Inter-register transfer means for transferring data between registers;
An operation data register to which data is input through the inter-register transfer means; and a result storage register to which data is output. When data is input to all of the operation data registers, a predetermined value is set using the input data. A plurality of arithmetic means, each having a single arithmetic function, each of which has a single arithmetic function, performs an arithmetic processing of the arithmetic operation, writes the arithmetic result to the result storage register, interrupts the processing when an exception occurs, and outputs an exception occurrence signal,
Connected to an exception occurrence signal line for transmitting the exception occurrence signal, and detecting that the exception occurrence signal has been output, identifying the cause of the exception, and receiving an exception occurrence,
A save register for storing information at the time of occurrence of an exception; normally, by reading and decoding the instruction in which information designating a data transfer destination and a transfer source register is described, the data transmitted through the inter-register transfer means is read. Controlling a transfer operation, stopping the instruction being transferred by the notification of the occurrence of the exception, storing a value of a program counter indicating an address at which the instruction and an instruction to be executed next are stored in the save register, Transfer control means for transferring control to the exception processing by writing a start address in which a program for executing the exception processing is stored in the program counter;
A processor comprising:
前記例外受付手段は、さらに、外部割り込みを発生させる割り込み制御手段と接続し、前記割り込み制御手段が発生させる外部割り込み信号を検出すると、割り込み発生の通知を行い、
前記転送制御手段は、前記割り込み発生の通知によって、転送実行中の命令が終了すると、前記命令および前記プログラムカウンタの値を前記退避レジスタに格納し、割り込み処理を実行させるためのプログラムが格納された先頭アドレスを前記プログラムカウンタに書き込むことによって前記割り込み処理に制御を移すことを特徴とする請求項1記載のプロセッサ。
The exception accepting unit is further connected to an interrupt control unit for generating an external interrupt, and when detecting an external interrupt signal generated by the interrupt control unit, notifies the occurrence of an interrupt.
The transfer control means stores the instruction and the value of the program counter in the save register when the instruction being transferred is completed by the notification of the occurrence of the interrupt, and stores a program for executing the interrupt processing. 2. The processor according to claim 1, wherein control is transferred to said interrupt processing by writing a start address to said program counter.
前記転送制御手段は、前記例外処理または前記割り込み処理から制御が戻ってきた場合、前記退避レジスタに格納した停止させた転送実行中の命令の復帰と次の命令アドレスを前記プログラムカウンタに転送し、処理を復帰させることを特徴とする請求項1または2記載のプロセッサ。The transfer control means, when control is returned from the exception processing or the interrupt processing, returns the stopped instruction being transferred and stored in the save register and transfers the next instruction address to the program counter; 3. The processor according to claim 1, wherein the processing is returned. 少なくとも前記例外発生時に、前記演算手段の前記演算データレジスタに入力されたデータを読み出し、要求元へ転送する入力データ転送手段を有することを特徴とする請求項1記載のプロセッサ。2. The processor according to claim 1, further comprising input data transfer means for reading data input to said operation data register of said operation means and transferring it to a request source at least when said exception occurs. 前記例外受付手段は、前記例外原因を格納し、レジスタのデータを要求元へ転送するデータ転送手段を通じて前記例外原因を読み出し可能な例外原因レジスタを具備し、特定された前記例外原因を前記例外原因レジスタに格納することを特徴とする請求項1記載のプロセッサ。The exception accepting means includes an exception cause register that stores the exception cause and that can read the exception cause through data transfer means that transfers data in a register to a request source. The processor according to claim 1, wherein the data is stored in a register. 前記転送制御手段は、前記例外原因レジスタに格納された前記例外原因に応じて前記例外原因ごとに用意された前記例外処理の先頭アドレスを選択し、前記プログラムカウンタに転送することを特徴とする請求項5記載のプロセッサ。The transfer control means selects a start address of the exception processing prepared for each exception cause according to the exception cause stored in the exception cause register and transfers the start address to the program counter. Item 6. The processor according to item 5. 外部のメモリから読み込んだデータ、および前記メモリへ書き出すデータを一時記憶するデータキャッシュと、
前記レジスタ間転送手段を通じてデータの入出力が行われる第1のアドレスレジスタと第1のデータレジスタを具備し、前記第1のアドレスレジスタにデータが入力されると前記データキャッシュを通じて前記第1のアドレスレジスタのデータで指示される前記メモリからデータを読み出して前記第1のデータレジスタに転送するデータ読み出し手段と、
前記レジスタ間転送手段を通じてデータの入出力が行われる第2のアドレスレジスタと第2のデータレジスタを具備し、前記第2のアドレスレジスタと前記第2のデータレジスタの双方にデータが入力されると前記データキャッシュを通じて前記第2のデータレジスタのデータを前記第2のアドレスレジスタのデータで指示される前記メモリに転送するデータ転送手段と、
前記レジスタ間転送手段を通じてデータの入出力が行われる第3のアドレスレジスタと第4のアドレスレジスタを具備し、前記第3のアドレスレジスタと前記第4のアドレスレジスタの双方にデータが入力されると、入力されたデータをそれぞれ転送元アドレスおよび転送先アドレスとして前記データキャッシュを通じて前記メモリ上のデータ転送を行うメモリ転送手段と、
をさらに有し、
前記データ読み出し手段、前記データ転送手段および前記メモリ転送手段は、例外が発生すると処理を中断して前記例外発生信号を出力することを特徴とする請求項1記載のプロセッサ。
A data cache for temporarily storing data read from an external memory, and data to be written to the memory;
A first address register for inputting and outputting data through the inter-register transfer means; and a first data register. When data is input to the first address register, the first address is transmitted through the data cache. Data reading means for reading data from the memory indicated by data in a register and transferring the data to the first data register;
A second address register for inputting and outputting data through the inter-register transfer means; and a second data register, wherein data is input to both the second address register and the second data register. Data transfer means for transferring the data of the second data register to the memory indicated by the data of the second address register through the data cache;
A third address register and a fourth address register for inputting and outputting data through the inter-register transfer means, wherein data is input to both the third address register and the fourth address register; A memory transfer unit that performs data transfer on the memory through the data cache, using input data as a transfer source address and a transfer destination address, respectively;
Further having
2. The processor according to claim 1, wherein the data reading unit, the data transfer unit, and the memory transfer unit interrupt processing when an exception occurs and output the exception occurrence signal.
少なくとも前記例外発生時に、前記データ読み出し手段、前記データ転送手段および前記メモリ転送手段の前記アドレスレジスタあるいは前記データレジスタに入力されたデータを読み出し、要求元へ転送する入力データ転送手段を有することを特徴とする請求項7記載のプロセッサ。At least upon occurrence of the exception, input data transfer means for reading data input to the address register or the data register of the data read means, the data transfer means and the memory transfer means and transferring the read data to a request source. The processor according to claim 7, wherein 前記命令は、その実行回数を指定する情報をさらに含み、
前記転送制御手段は、前記例外発生時に前記実行回数が指定された命令を実行中の場合は停止した時点での残りの実行回数を前記退避レジスタに格納することを特徴とする請求項1記載のプロセッサ。
The instruction further includes information specifying the number of times of execution.
2. The transfer register according to claim 1, wherein the transfer control unit stores, in the save register, a remaining execution count at the time when the instruction whose execution count is specified is being executed when the exception occurs. Processor.
読み込んだ命令に従って動作するプロセッサの例外処理方法において、
レジスタ間でデータを転送するレジスタ間転送手段を通じてデータが入力される演算データレジスタにデータが入力されると、入力されたデータを用いて所定の演算処理を行い、前記レジスタ間転送手段を通じてデータが出力される結果格納レジスタにその演算結果を書き込むとともに、例外の発生で処理を中断して例外発生信号を出力する、それぞれ単一の演算機能を有する複数の演算手段を、データの転送先および転送元のレジスタを指定する情報が記述された前記命令をデコードして前記レジスタ間転送手段を通じたデータ転送を制御することによって動作制御し、
前記演算手段の出力した前記例外発生信号を検出すると、前記例外発生信号に基づいてその例外原因を検出し、
例外発生時に転送実行中の命令を停止し、前記命令および次に実行される命令が格納されているアドレスを示すプログラムカウンタの値を退避レジスタに退避し、
前記例外原因に応じた例外処理を実行させるためのプログラムが格納された先頭アドレスを前記プログラムカウンタに書き込むことによって制御を前記例外処理に移すことを特徴とする例外処理方法。
In the exception handling method of the processor operating according to the read instruction,
When data is input to an arithmetic data register to which data is input through inter-register transfer means for transferring data between registers, a predetermined arithmetic process is performed using the input data, and the data is transferred through the inter-register transfer means. A plurality of arithmetic means, each having a single arithmetic function, for writing the arithmetic result to the output result storage register, interrupting the processing when an exception occurs, and outputting an exception occurrence signal, respectively, Controlling the operation by decoding the instruction in which information specifying the original register is described and controlling data transfer through the inter-register transfer means;
Upon detecting the exception occurrence signal output by the arithmetic unit, detecting the exception cause based on the exception occurrence signal,
When an exception occurs, the instruction being transferred is stopped, and the value of the program counter indicating the address where the instruction and the next instruction to be executed are stored is saved in a save register.
An exception processing method, wherein a control is transferred to the exception processing by writing a leading address at which a program for executing the exception processing according to the exception cause is stored in the program counter.
JP2003161489A 2003-06-06 2003-06-06 Processor and exception handling method Expired - Fee Related JP4311087B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003161489A JP4311087B2 (en) 2003-06-06 2003-06-06 Processor and exception handling method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003161489A JP4311087B2 (en) 2003-06-06 2003-06-06 Processor and exception handling method

Publications (2)

Publication Number Publication Date
JP2004362368A true JP2004362368A (en) 2004-12-24
JP4311087B2 JP4311087B2 (en) 2009-08-12

Family

ID=34053883

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003161489A Expired - Fee Related JP4311087B2 (en) 2003-06-06 2003-06-06 Processor and exception handling method

Country Status (1)

Country Link
JP (1) JP4311087B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113608914A (en) * 2021-08-10 2021-11-05 安谋科技(中国)有限公司 Chip, chip function safety detection method, medium and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113608914A (en) * 2021-08-10 2021-11-05 安谋科技(中国)有限公司 Chip, chip function safety detection method, medium and electronic equipment
CN113608914B (en) * 2021-08-10 2024-04-26 安谋科技(中国)有限公司 Chip, functional safety detection method of chip, medium and electronic equipment

Also Published As

Publication number Publication date
JP4311087B2 (en) 2009-08-12

Similar Documents

Publication Publication Date Title
CN112445310A (en) Active DI/DT voltage droop suppression
US6772355B2 (en) System and method for reducing power consumption in a data processor having a clustered architecture
TWI514275B (en) Systems and method for unblocking a pipeline with spontaneous load deferral and conversion to prefetch
US20060294344A1 (en) Computer processor pipeline with shadow registers for context switching, and method
JP4689087B2 (en) Information processing apparatus and power saving transition control method
KR101077425B1 (en) Efficient interrupt return address save mechanism
JP2009506410A (en) Coprocessor support in computer equipment
JP4800582B2 (en) Arithmetic processing unit
EP1039376B1 (en) Sub-instruction emulation in a VLIW processor
JP4311087B2 (en) Processor and exception handling method
US11775336B2 (en) Apparatus and method for performance state matching between source and target processors based on interprocessor interrupts
JPH06295243A (en) Data processor
JPH1196006A (en) Information processor
US20110231637A1 (en) Central processing unit and method for workload dependent optimization thereof
US6453412B1 (en) Method and apparatus for reissuing paired MMX instructions singly during exception handling
JPH1049373A (en) Method and device for operating multiplex and highly accurate event for pipeline digital processor
JP3520372B2 (en) Elimination of critical path in operation of memory control unit and input / output control unit
US6807628B2 (en) System and method for supporting precise exceptions in a data processor having a clustered architecture
RU2427883C2 (en) Completion of instruction with account of consumed energy
JP4264622B2 (en) Processor
JP3729142B2 (en) Parallel processing unit
KR20180126518A (en) Vector instruction processing
JPH0524537B2 (en)
JP2761324B2 (en) High-speed processing method
JP5993687B2 (en) One chip processor

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20060418

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20080808

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20080819

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20081017

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: 20090421

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20090504

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

Free format text: PAYMENT UNTIL: 20120522

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20120522

Year of fee payment: 3

LAPS Cancellation because of no payment of annual fees