JP4125531B2 - Microprocessor - Google Patents
Microprocessor Download PDFInfo
- Publication number
- JP4125531B2 JP4125531B2 JP2002087895A JP2002087895A JP4125531B2 JP 4125531 B2 JP4125531 B2 JP 4125531B2 JP 2002087895 A JP2002087895 A JP 2002087895A JP 2002087895 A JP2002087895 A JP 2002087895A JP 4125531 B2 JP4125531 B2 JP 4125531B2
- Authority
- JP
- Japan
- Prior art keywords
- bank
- register
- interrupt
- bank number
- setting
- 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.)
- Expired - Fee Related
Links
Images
Landscapes
- Memory System (AREA)
Description
【0001】
【発明の属する技術分野】
本発明は、効率的にバンク機能を用いる機構を有するマイクロプロセッサに関するものである。
【0002】
【従来の技術】
複数のバンクを使用してプログラムを作成する際、割り込み時に切り替えたバンクの一貫性を保障する必要がある。従来では、バンクの一貫性を保障するための方法として、別のバンクをアクセスするためにバンクを切り替えている期間割り込みを無効にする手法を用いていた。
【0003】
図12は従来のマイクロプロセッサにおける割り込み時のバンク値の一貫性を保障する手法を示している。図12において、符号1はバンクを用いたデータアクセスを示すバンクアクセスシーケンスの全体図を示している。
【0004】
バンクアクセスシーケンス1中で、符号11は割り込み禁止工程であり、割り込み処理プログラムの実行を抑制することによって、以降の工程でバンク番号を設定することによる割り込み処理の不具合を回避している。
【0005】
符号12はバンク番号設定工程であり、データの置かれているバンク番号をバンク番号設定レジスタに格納するための工程である。
【0006】
符号13はバンク有効化工程であり、バンク番号設定工程12で設定したバンク番号を有効にし、以後のデータアクセスをバンク番号設定工程12で設定されたバンク番号のメモリに対してアクセスすることを決定している。
【0007】
符号14はバンクデータアクセス工程であり、バンク番号設定工程12で設定したバンク番号が示すメモリへのデータアクセスを行っている。
【0008】
符号15はバンク無効化工程であり、これにより、バンクメモリへのアクセスを無効にし、通常のメモリアクセスへ復帰する。
【0009】
符号16は割り込み許可工程であり、以降のプログラムで割り込みの処理を許可する。
【0010】
以上のような処理によって、バンクメモリへのデータアクセス時の割り込み処理による不具合を回避していた。
【0011】
【発明が解決しようとする課題】
しかしながら、バンクを切り替えている期間、割り込みを無効にする手法では、別のバンクにあるデータをアクセスするたびにバンク番号設定レジスタへの値の設定と割り込み禁止、許可の操作が必要となり、プログラムコードサイズと実行時間が大きくなり、また割り込みを禁止することによって、割り込み処理プログラムの応答時間が長くなるという課題があった。
【0012】
【課題を解決するための手段】
本発明では、バンク機能(有効無効、バンク番号、バンク番号の退避・復帰等)の設定と割り込み許可禁止の動作を同時に行う機構を備えることによって、プログラムのコードサイズと実行時間を縮小できる。また、割り込み処理の応答性も改善することができる。
【0013】
以下、請求項毎に説明する。
【0014】
請求項1記載のマイクロプロセッサは、同一アドレスの設定レジスタに配置された第1および第2のフラグを有し、第1のフラグに所定の値が設定されたときに割り込み有効となり、第2のフラグに所定の値が設定されたときにバンク無効となることを特徴とする。
【0015】
この構成によれば、バンク有効無効の設定と割り込み許可禁止の動作を同時に行うことが可能となり、プログラムのコードサイズと実行時間を縮小できる。また、割り込み処理の応答性も改善することができる。
【0016】
請求項2記載のマイクロプロセッサは、請求項1記載のマイクロプロセッサにおいて、割り込み有効にするときに第1のフラグに設定される値とバンク無効にするときに第2のフラグに設定される値とが同じ値である。
【0017】
この構成によれば、請求項1記載のマイクロプロセッサと同様の作用を有する。
【0035】
【発明の実施の形態】
以下、本発明の実施の形態を図面に基づいて詳細に説明する。
【0036】
図1は本発明の第1の実施の形態におけるマイクロプロセッサのバンクアクセス手法を示している。図1において、符号2はバンクアクセスシーケンスであり、バンクアクセスの方法の全体を示している。
【0037】
符号21はバンク有効かつ割り込み禁止工程であり、この工程によってバンク番号の有効化処理と割り込みの禁止設定処理とを同時に行っている。
【0038】
符号22はバンク番号設定工程であり、データの置かれているバンク番号をバンク番号設定レジスタに格納するための工程である。
【0039】
符号23はバンクデータアクセス工程であり、バンク番号設定工程22で設定したバンク番号の示すメモリへのデータアクセスを行っている。
【0040】
符号24はバンク無効かつ割り込み許可工程であり、この工程によって設定したバンク番号の無効化処理と割り込みの許可設定処理とを同時に行っている。
【0041】
図3(a)は、バンク有効かつ割り込み禁止工程21においてバンク番号の有効化処理と割り込みの禁止設定処理との同時処理を実現し、バンク無効かつ割り込み許可工程24においてバンク番号の無効化処理と割り込みの許可設定処理との同時処理を実現するためのハードウェア構成である、マイクロプロセッサのバンク・割り込み設定レジスタの一例を示している。図3(a)において、符号4は設定レジスタであり、割り込みの有効処理とバンクの無効化処理の設定を行うフラグが格納されている。符号41は割り込み有効フラグであり、割り込みの有効無効を切り替える。符号42はバンク無効化フラグであり、バンクの有効無効を切り替える。つまり、割り込み有効フラグ41とバンク無効化フラグ42は、同一アドレスの設定レジスタ4に配置されている。
【0042】
図3(b)は割り込み有効フラグ41とバンク無効化フラグ42の符号化の状態を示している。割り込み有効フラグ41に関しては、本実施の形態では値1を設定すると割り込み有効になり、値0を設定すると割り込みが無効になる。バンク無効化フラグ42に関しては、本実施の形態では値1を設定するとバンク番号設定が無効になり、値0を設定するとバンク番号設定が有効となる。
【0043】
なお、上記の説明とは逆に、割り込み有効フラグ41に関しては、値0を設定すると割り込み有効になり、値1を設定すると割り込みが無効になり、バンク無効化フラグ42に関しては、値0を設定するとバンク番号設定が無効になり、値1を設定するとバンク番号設定が有効となるようにしてもよい。
【0044】
上記のような設定レジスタ4を備え、図3(b)のような符号化を行うことによって、バンク有効かつ割り込み禁止工程21のようなバンク有効かつ割り込み禁止の同時処理や、バンク無効かつ割り込み許可工程24のようなバンク無効かつ割り込み許可の同時処理を、AND命令とOR命令のような一般的なプロセッサの命令の1命令で容易に行うことができる。
【0045】
例えば、割り込み有効フラグ41に関しては、値1を設定すると割り込み有効になり、値0を設定すると割り込みが無効になり、バンク無効化フラグ42に関しては、値1を設定するとバンク番号設定が無効になり、値0を設定するとバンク番号設定が有効となるような構成の場合、AND命令とOR命令は以下のようになる。すなわち、割り込み許可かつバンク無効にする場合、同レジスタの他のビットに影響を与えずに設定を変更する場合、“OR 0xc0,R”命令により実行可能である。上記のOR命令で、Rは設定レジスタであり、その意味は、設定レジスタRの値と16進数c0とのORをとり、設定レジスタRに代入することを意味する。
【0046】
また、“AND 0x3f,R”命令の実行によって割り込み禁止かつバンク有効にすることが可能である。このAND命令の意味は、設定レジスタRの値と16進数3fとのANDをとり、設定レジスタRに代入することを意味する。
【0047】
つまり、上記のように値を設定することで、フラグを設定する設定レジスタ4の他のビットに影響を与えずに、1つの命令で両方の設定の変更を実現できる。
【0048】
なお、割り込み有効フラグ41が値1で割り込み有効になり、バンク無効化フラグ42が値1でバンク有効になるような符号化の形態では、上記のように、一般的なマイクロプロセッサに備わっているようなAND命令、OR命令のような一般的な命令の一命令で、上記のような割り込み有効かつバンク無効のような処理を行うことはできない。しかし、レジスタの他のビットを使用しないものとすれば、上記のような処理を行うことは可能である。以下の実施の形態では、上記のような制限はない。
【0049】
図4はバンク有効かつ割り込み禁止工程21における同時処理とバンク無効かつ割り込み許可工程24における同時処理を実現するためのもう一つのハードウェア構成である、マイクロプロセッサのバンク・割り込み設定回路の一例を示している。図4において、符号51はインストラクションレジスタであり、メモリからフェッチされた命令コードが格納される。符号52はインストラクションデコーダであり、インストラクションレジスタ51に格納された命令コードをデコードし、インストラクションレジスタ51に格納された命令コードに応じた制御信号を送出する回路である。
【0050】
符号53はバンク無効化レジスタであり、本レジスタに設定された値によりバンクの有効無効を切り替える。符号531はバンク無効化レジスタセット信号であり、本信号が値1のときにバンク無効化レジスタ53がセットされる。符号532はバンク無効化レジスタクリア信号であり、本信号が値1のときにバンク無効化レジスタ53がクリアされる。
【0051】
符号54は割り込み有効レジスタであり、本レジスタに設定された値により割り込みの有効無効を切り替える。符号541は割り込み有効レジスタセット信号であり、本信号が値1のときに割り込み有効レジスタ54がセットされる。符号542は割り込み有効レジスタクリア信号であり、本信号が値1のときに割り込み有効レジスタ54がクリアされる。
【0052】
図5はインストラクションデコーダ52の動作の一部を示す真理値表であり、インストラクションレジスタ51に格納された命令コードを入力として、それに対する制御信号線531、532、541、542の動作を表している。本実施の形態では、バンク無効化割り込み有効化命令(DBEI)に割り付けられた命令コードを“10”とし、バンク有効化割り込み無効化命令(EBDI)を“20”とした場合を示している。
【0053】
図4および図5のようなハードウェアを備えることによって、バンク有効かつ割り込み禁止工程21とバンク無効かつ割り込み許可工程24における同時処理を、特別な小さな命令コードに割り当てることができる。したがって、バンク有効無効の設定と割り込み許可禁止の動作を同時に行うことが可能となり、プログラムのコードサイズと実行時間を小さくすることができる。また、割り込み処理の応答性も改善することができる。
【0054】
なお、上記の実施の形態では、バンク無効化割り込み有効化命令(DBEI)およびバンク有効化割り込み無効化命令(EBDI)の2つの命令コードをインストラクションデコーダ52でデコードする構成にしていたが、バンク無効化レジスタ53と割り込み有効レジスタ54の設定値をともに反転させる一つの命令コードのみをデコードする回路でもよい。
【0055】
図2は本発明の第2の実施の形態におけるマイクロプロセッサのバンクアクセス手法を示している。図2において、符号3はバンクアクセスシーケンスであり、バンクアクセスの方法の全体を示している。
【0056】
符号31はバンク番号設定かつ割り込み禁止工程であり、この工程によってバンク番号の設定処理およびバンクの有効化と割り込みの禁止設定を同時に行っている。
【0057】
符号32はバンクデータアクセス工程であり、バンク番号設定かつ割り込み禁止工程31で設定したバンク番号の示すメモリへのデータアクセスを行っている。
【0058】
符号33はバンク番号復帰かつ割り込み許可工程であり、この工程によってバンクアクセスシーケンス3の前に設定していたバンク番号の復帰処理とバンクの無効化と割り込み許可処理を同時に行っている。
【0059】
図6はバンク番号設定かつ割り込み禁止工程31における同時処理およびバンク番号復帰かつ割り込み許可工程33における同時処理を実現するためのハードウェア構成である、マイクロプロセッサのバンク・割り込み設定回路の一例を示している。図6において、符号61はインストラクションレジスタであり、メモリからフェッチされた命令コードが格納される。
【0060】
符号62はインストラクションデコーダであり、インストラクションレジスタ61に格納された命令コードをデコードし、格納された命令コードに応じた制御信号を送出する回路である。
【0061】
符号63はバンク無効化レジスタであり、本レジスタに設定された値によりバンクの有効無効を切り替える。符号631はバンク無効化レジスタセット信号であり、本信号が値1のときにバンク無効化レジスタ63がセットされる。符号632はバンク無効化レジスタクリア信号であり、本信号が値1のときにバンク無効化レジスタ63がクリアされる。
【0062】
符号64は割り込み有効レジスタであり、本レジスタに設定された値により割り込みの有効無効を切り替える。符号641は割り込み有効レジスタセット信号であり、本信号が値1のときに割り込み有効レジスタ64がセットされる。符号642は割り込み有効レジスタクリア信号であり、本信号が値1のときに割り込み有効レジスタ64がクリアされる。
【0063】
符号65はバンク番号設定レジスタであり、データアクセスするバンク番号を格納するレジスタである。符号651はバンク番号データバスであり、バンク番号設定レジスタ65に設定されるバンク番号を伝達する信号線である。符号652はバンク番号設定レジスタライトイネーブル信号であり、本信号が値1のときにバンク番号設定レジスタ65にバンク番号データバス651のバンク番号が格納される。
【0064】
符号66はバンク番号デコーダであり、バンク番号データバス651とバンク番号設定レジスタライトイネーブル信号652の値から制御信号であるバンク無効化レジスタセット信号631とバンク無効化レジスタクリア信号632と割り込み有効レジスタセット信号641と割り込み有効レジスタクリア信号642とを生成する。
【0065】
図7はバンク番号デコーダ66の動作を示した真理値表である。本実施の形態では、データバス651は2ビットとなっており、このうち値1,2,3をバンクの切り替えに使用し、値0をバンク無効化を示す符号として使用している。
【0066】
本構成によって、バンク番号の設定とバンク無効有効の切り替え、割り込み有効無効の切り替えを同時に実行でき、コードサイズ、実行時間、割り込みの応答時間を小さくすることができる。
【0067】
図8はバンク番号設定かつ割り込み禁止工程31における同時処理およびバンク番号復帰かつ割り込み許可工程33における同時処理を実現するための別のハードウェア構成である、マイクロプロセッサのバンク番号退避レジスタ付バンク・割り込み設定回路の一例を示している。図8において、符号71はインストラクションレジスタであり、メモリからフェッチされた命令コードが格納される。
【0068】
符号72はインストラクションデコーダであり、インストラクションレジスタ71に格納された命令コードをデコードし、格納された命令コードに応じた制御信号を送出する回路である。
【0069】
符号73はバンク番号退避メモリ(レジスタ)であり、バンク番号設定レジスタ75の設定値を一時的に退避するためのメモリである。符号731はバンク番号退避メモリライトイネーブル信号であり、値1のときにバンク番号退避メモリ73に退避すべきバンク番号が格納される。
【0070】
符号74は割り込み有効レジスタであり、本レジスタに設定された値により割り込みの有効無効を切り替える。符号741は割り込み有効レジスタセット信号であり、本信号が値1のときに割り込み有効レジスタ74がセットされる。符号742は割り込み有効レジスタクリア信号であり、本信号が値1のときに割り込み有効レジスタ74がクリアされる。
【0071】
バンク番号設定レジスタ75は、データアクセスするバンク番号を格納するレジスタである。符号751はバンク番号設定レジスタライトイネーブル信号であり、本信号が値1のときにバンク番号設定レジスタ75にバンク番号が格納される。
【0072】
符号76はバンク番号デコーダであり、バンク番号設定レジスタライトイネーブル信号751とバンク番号設定データ用バス772の値から制御信号であるバンク番号選択信号771とバンク番号退避メモリライトイネーブル信号731と割り込み有効レジスタセット信号741と割り込み有効レジスタクリア信号742を生成する。
【0073】
符号77はセレクタであり、バンク番号設定レジスタ75に格納するバンク番号の設定または退避された値の復帰を選択する。符号771はバンク番号選択信号であり、値0のときにバンク番号設定データ用バス772が選択され、したがってバンク番号設定データ用バス772を通して送られたバンク番号が選択され、値1のときにバンク番号退避データ用バス773が選択され、したがってバンク番号退避メモリ73に退避されたバンク番号が選択される。
【0074】
バンク番号設定データ用バス772は、バンク番号設定レジスタ75に設定されるバンク番号を伝達する信号線である。バンク番号退避データ用バス773は、バンク番号退避メモリ73に退避されたバンク番号をセレクタ77に伝達する信号線である。符号774はバンク番号選択結果であり、バンク番号をセレクタ77で選択された結果の値を出力している。
【0075】
図9はバンク番号デコーダ76の動作を示した真理値表である。本実施の形態では、バンク番号設定レジスタ75は2ビットとなっており、このうち値0,1,2をバンク番号の指定に使用し、値3を退避された以前のバンクの設定値を復帰させる符号として用いている。
【0076】
ここで、バンクの有効・無効とバンク番号の退避・復帰との関係について説明する。バンク番号の退避・復帰ができると、バンクの有効・無効の設定の必要はない。バンクの有効・無効フラグの場合、バンクの無効時にデータアクセスすると、予めハードウェアで決められたバンク番号のデフォルト値を使うことになるが、退避復帰を用いる場合、デフォルト値をユーザーが任意に決めることができる。復帰処理によって前に設定した値に戻る。
【0077】
本バンク番号デコーダ76によって、バンク番号0,1,2いずれの領域から別のバンクに設定を変更した場合でも、バンク番号3を設定することによって、前回のバンク番号に復帰することができる。
【0078】
この構成によれば、バンク番号設定および以前のバンク番号の退避・復帰等のバンク機能の設定と割り込み許可禁止の動作を同時に行うことが可能となり、プログラムのコードサイズと実行時間を縮小できる。また、割り込み処理の応答性も改善することができる。
【0079】
図10はバンク番号設定かつ割り込み禁止工程31における同時処理およびバンク番号復帰かつ割り込み許可工程33における同時処理を実現するためのさらに別のハードウェア構成である、マイクロプロセッサのバンク番号退避メモリ付バンク・割り込み設定回路の一例を示している。図10において、符号81はインストラクションレジスタであり、メモリからフェッチされた命令コードが格納される。
【0080】
符号82はインストラクションデコーダであり、インストラクションレジスタ81に格納された命令コードをデコードし、格納された命令コードに応じた制御信号を送出する回路である。
【0081】
符号83はバンク番号退避メモリであり、バンク番号設定レジスタ85の設定値を一時的に退避するためのメモリである。本メモリは複数、例えば4個の設定値を格納することができるようアドレス指定(0,1,2,3)ができるようになっている。符号831はバンク番号退避メモリライトイネーブル信号であり、値1のときにバンク番号退避メモリ83に退避するバンク番号が格納される。符号832はバンク番号退避メモリアドレス信号であり、バンク番号退避メモリ83のメモリのアドレスを指定することができる。
【0082】
符号84は割り込み有効レジスタであり、本レジスタに設定された値により割り込みの有効無効を切り替える。符号841は割り込み有効レジスタセット信号であり、本信号が値1のときに割り込み有効レジスタ84がセットされる。符号842は割り込み有効レジスタクリア信号であり、本信号が値1のときに割り込み有効レジスタ84がクリアされる。
【0083】
バンク番号設定レジスタ85は、データアクセスするバンク番号を格納するレジスタである。符号851はバンク番号設定レジスタライトイネーブル信号であり、本信号が値1のときにバンク番号設定レジスタ85にバンク番号が格納される。
【0084】
符号86はバンク番号デコーダであり、バンク番号設定レジスタライトイネーブル信号851とバンク番号設定データ用バス872の値とアドレスレジスタ88から出力されるアドレス値861とから制御信号であるバンク番号選択信号871とバンク番号退避メモリライトイネーブル信号831と加減算選択信号891と割り込み有効レジスタセット信号841と割り込み有効レジスタクリア信号842とを生成する。符号861はアドレス値であり、アドレスレジスタ88の値をデコーダ86へ伝達している。
【0085】
符号87はバンク番号セレクタであり、バンク番号設定レジスタ85に格納するバンク番号の設定または退避された値の復帰を選択する。バンク番号選択信号871は、値0のときにバンク番号設定データ用バス872が選択され、したがってバンク番号設定データ用バス872を通して送られたバンク番号が選択され、値1のときにバンク番号退避データ用バス873が選択され、したがってバンク番号退避メモリ83に退避されてアドレスで指定されたバンク番号が選択される。バンク番号設定データ用バス872は、バンク番号設定レジスタ85に設定されるバンク番号を伝達する信号線である。バンク番号退避データ用バス873は、バンク番号退避メモリ83に退避されたバンク番号をセレクタ87に伝達する信号線である。符号874はバンク番号選択結果であり、バンク番号セレクタ87で選択された結果の値を出力している。
【0086】
アドレスレジスタ88は、バンク番号退避メモリ83のアドレスを保持している。
【0087】
符号89は演算器を構成する加減算器であり、アドレスレジスタ88の値を演算する。加減算器89は、制御信号である加減算選択信号891によって加算と減算を切り替えることができる。加減算器89は、加減算選択信号891が値0のときに加算を行い、値1のときに減算を行う。なお、加減算器89の代わりにデコーダを用いても同様の機能を実現することができる。このような回路をアドレス値を変更する回路手段と称している。
【0088】
符号8aはアドレスセレクタであり、バンク退避メモリ83へ与えるアドレスを選択している。制御信号である加減算選択信号89が値0のときに加減算器89の値を選択し、値1のときにアドレスレジスタ88の値を選択する。
【0089】
図11はデコーダ86の動作を示す真理値表である。
【0090】
本実施の形態では、バンク番号設定レジスタ85は2ビットとなっており、このうち値0,1,2をバンク番号の指定に使用し、値3を退避された以前のバンクの設定値を復帰させる符号として用いている。この例では、アドレス値861がバンク番号デコーダ86に入力されており、アドレスレジスタ88のアドレス値が初期値の0に復帰するまで、割り込み有効レジスタセット信号841が出力されないようになっている。つまり、退避したバンク番号がすべて復帰されたときに初めて割り込み有効レジスタセット信号841が出力され、割り込みが有効となる。この点が、図8および図9の実施の形態の構成との違いである。
【0091】
本実施の形態ではバンク番号退避メモリ83を複数備えることによって、複数回バンクを切り替えることを可能にし、元のバンクへと復帰するまで割り込み無効状態とすることができる。
【0092】
ここで、アドレスレジスタ88、加減算器89、セレクタ8aに関連する動作について説明する。加減算器選択信号891は、バンク番号を設定する時、すなわちバンク番号値0,1,2を書き込んだ時は加算となり、バンク番号を復帰させる時、すなわちバンク番号3を書き込む時は減算となるように動作を選択する信号である。バンク番号を設定するとき、バンク番号退避用メモリを指し示すアドレス値は、アドレスレジスタ88の値に1を加算した値がセレクタ8aにより選択される。退避されるバンク番号が、加算されたアドレス値が指し示すバンク番号退避メモリ番地に退避される。次サイクルでアドレス88には、1加算された値が記憶される。
【0093】
バンク番号を復帰させるとき、セレクタ8aはアドレスレジスタ88の出力を選択し、アドレスレジスタ88に記憶されているアドレス値が指し示すバンク退避メモリに記憶されているバンク番号がバンク番号退避データ用バス873を通り、バンク番号設定レジスタ85に復帰される。次サイクルで加減算器89の値から1減算された値をアドレスレジスタ88に記憶する。
【0094】
上記の動作により複数個のバンク番号退避処理を実現している。上記の回路は、ポストインクリメントプリデクリメントのスタック動作を行う回路と等価のものであり、アドレスレジスタ88はスタックポインタということもできる。
【0095】
この構成によれば、バンク番号設定および以前のバンク番号の退避・復帰等のバンク機能の設定と割り込み許可禁止の動作を同時に行うことが可能となり、プログラムのコードサイズと実行時間を縮小できる。また、割り込み処理の応答性も改善することができる。また、以前のバンク番号を複数個、退避・復帰可能であり、元のバンクに復帰させるまでに複数回のバンク切替を行うことが可能である。
【0096】
【発明の効果】
本発明の請求項1、2記載のマイクロプロセッサによれば、バンク有効無効の設定と割り込み許可禁止の動作を同時に行うことが可能となり、プログラムのコードサイズと実行時間を縮小できる。また、割り込み処理の応答性も改善することができる。
【図面の簡単な説明】
【図1】本発明の第1の実施の形態のマイクロプロセッサにおけるバンクアクセス手法を示すフローチャートである。
【図2】本発明の第2の実施の形態のマイクロプロセッサにおけるバンクアクセス手法を示すフローチャートである。
【図3】 (a)は本発明の第1の実施の形態のマイクロプロセッサにおけるバンク・割り込み設定レジスタの一例を示す模式図、(b)は同じくレジスタ設定値を示す模式図である。
【図4】本発明の第1の実施の形態のマイクロプロセッサにおけるバンク・割り込み設定回路の一例を示すブロック図である。
【図5】図4のデコーダ真理値表を示す説明図である。
【図6】本発明の第2の実施の形態のマイクロプロセッサにおけるバンク・割り込み設定回路の一例を示すブロック図である。
【図7】図6のデコーダ真理値表を示す説明図である。
【図8】本発明の第2の実施の形態のマイクロプロセッサにおけるバンク番号退避レジスタ付バンク・割り込み設定回路の一例を示すブロック図である。
【図9】図8のデコーダ真理値表を示す説明図である。
【図10】本発明の第2の実施の形態のマイクロプロセッサにおけるバンク番号退避メモリ付バンク・割り込み設定回路の一例を示すブロック図である。
【図11】図10のデコーダ真理値表を示す説明図である。
【図12】従来のマイクロプロセッサにおけるバンクアクセス手法を示すフローチャートである。
【符号の説明】
1 バンクアクセスシーケンス
11 割り込み禁止工程
12 バンク番号設定工程
13 バンク有効化工程
14 バンクデータアクセス工程
15 バンク無効化工程
16 割り込み許可工程
2 バンクアクセスシーケンス
21 バンク有効かつ割り込み禁止工程
22 バンク番号設定工程
23 バンクデータアクセス工程
24 バンク無効かつ割り込み許可工程
3 バンクアクセスシーケンス
31 バンク番号設定かつ割り込み禁止工程
32 バンクデータアクセス工程
33 バンク番号復帰かつ割り込み許可工程
4 設定レジスタ
41 割り込み有効フラグ
42 バンク無効化フラグ
51 インストラクションレジスタ
52 インストラクションデコーダ
53 バンク無効化レジスタ
531 バンク無効化レジスタセット信号
532 バンク無効化レジスタクリア信号
54 割り込み有効レジスタ
541 割り込み有効レジスタセット信号
542 割り込み有効レジスタクリア信号
61 インストラクションレジスタ
62 インストラクションデコーダ
63 バンク無効化レジスタ
631 バンク無効化レジスタセット信号
632 バンク無効化レジスタクリア信号
64 割り込み有効レジスタ
641 割り込み有効レジスタセット信号
642 割り込み有効レジスタクリア信号
65 バンク番号設定レジスタ
651 バンク番号データバス
652 バンク番号設定レジスタライトイネーブル信号
66 バンク番号デコーダ
71 インストラクションレジスタ
72 インストラクションデコーダ
73 バンク番号退避メモリ
731 バンク番号退避メモリライトイネーブル信号
74 割り込み有効レジスタ
741 割り込み有効レジスタセット信号
742 割り込み有効レジスタクリア信号
75 バンク番号設定レジスタ
751 バンク番号設定レジスタライトイネーブル信号
76 バンク番号デコーダ
77 セレクタ
771 バンク番号選択信号
772 バンク番号設定データ用バス
773 バンク番号退避データ用バス
774 バンク番号選択結果
81 インストラクションレジスタ
82 インストラクションデコーダ
83 バンク番号退避メモリ
831 バンク番号退避メモリライトイネーブル信号
832 バンク番号退避メモリアドレス信号
84 割り込み有効レジスタ
841 割り込み有効レジスタセット信号
842 割り込み有効レジスタクリア信号
85 バンク番号設定レジスタ
851 バンク番号設定レジスタライトイネーブル信号
86 バンク番号デコーダ
861 アドレス値
87 バンク番号セレクタ
871 バンク番号選択信号
872 バンク番号設定データ用バス
873 バンク番号退避データ用バス
874 バンク番号選択結果
88 アドレスレジスタ
89 加減算器
891 加算減算選択信号
8a アドレスセレクタ[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a microprocessor having a mechanism that efficiently uses a bank function.
[0002]
[Prior art]
When creating a program using multiple banks, it is necessary to ensure the consistency of the bank that was switched at the time of interrupt. Conventionally, as a method for ensuring the consistency of a bank, a method of disabling interrupts while switching banks to access another bank has been used.
[0003]
FIG. 12 shows a technique for ensuring the consistency of bank values at the time of interruption in a conventional microprocessor. In FIG. 12,
[0004]
In the
[0005]
[0006]
[0007]
[0008]
[0009]
[0010]
With the processing as described above, problems due to interrupt processing at the time of data access to the bank memory are avoided.
[0011]
[Problems to be solved by the invention]
However, the method of disabling interrupts while switching banks requires setting the value in the bank number setting register and disabling and enabling interrupts every time data in another bank is accessed. There is a problem that the response time of the interrupt processing program becomes long by increasing the size and execution time and prohibiting the interrupt.
[0012]
[Means for Solving the Problems]
In the present invention, the code size and execution time of the program can be reduced by providing a mechanism for simultaneously setting the bank function (valid / invalid, bank number, saving / returning bank number, etc.) and interrupt permission prohibition. In addition, the responsiveness of interrupt processing can be improved.
[0013]
Hereinafter, each claim will be described.
[0014]
The microprocessor according to
[0015]
According to this configuration, it becomes possible to simultaneously perform the bank valid / invalid setting and the interrupt permission prohibiting operation, and the code size and execution time of the program can be reduced. In addition, the responsiveness of interrupt processing can be improved.
[0016]
According to a second aspect of the present invention, in the microprocessor according to the first aspect, a value set in the first flag when the interrupt is enabled and a value set in the second flag when the bank is disabled. Are the same value.
[0017]
According to this configuration, the operation is the same as that of the microprocessor according to the first aspect.
[0035]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
[0036]
FIG. 1 shows a bank access method of a microprocessor according to the first embodiment of the present invention. In FIG. 1,
[0037]
[0038]
[0039]
[0040]
[0041]
FIG. 3A shows the simultaneous processing of the bank number enabling process and the interrupt prohibition setting process in the bank valid and interrupt prohibiting
[0042]
FIG. 3B shows the coding state of the interrupt
[0043]
Contrary to the above description, with respect to the interrupt
[0044]
By providing the
[0045]
For example, for the interrupt enable
[0046]
Further, it is possible to disable the interrupt and enable the bank by executing the “AND 0x3f, R” instruction. The meaning of this AND instruction means that the AND of the value of the setting register R and the hexadecimal number 3f is taken and substituted into the setting register R.
[0047]
That is, by setting the value as described above, it is possible to change both settings with a single instruction without affecting other bits of the
[0048]
It should be noted that, in the form of encoding in which the interrupt
[0049]
FIG. 4 shows an example of a microprocessor bank / interrupt setting circuit, which is another hardware configuration for realizing the simultaneous processing in the bank valid and interrupt prohibiting
[0050]
[0051]
[0052]
FIG. 5 is a truth table showing a part of the operation of the
[0053]
By providing the hardware as shown in FIGS. 4 and 5, the simultaneous processing in the bank valid / interrupt prohibiting
[0054]
In the above embodiment, the
[0055]
FIG. 2 shows a bank access method of the microprocessor according to the second embodiment of the present invention. In FIG. 2,
[0056]
[0057]
[0058]
[0059]
FIG. 6 shows an example of a bank / interrupt setting circuit of a microprocessor, which is a hardware configuration for realizing the simultaneous processing in the bank number setting and interrupt
[0060]
[0061]
[0062]
[0063]
[0064]
[0065]
FIG. 7 is a truth table showing the operation of the
[0066]
With this configuration, bank number setting, bank invalid / effective switching, and interrupt valid / invalid switching can be executed simultaneously, and the code size, execution time, and interrupt response time can be reduced.
[0067]
FIG. 8 shows another hardware configuration for realizing the simultaneous processing in the bank number setting and interrupt
[0068]
[0069]
[0070]
[0071]
The bank
[0072]
[0073]
[0074]
The bank number setting
[0075]
FIG. 9 is a truth table showing the operation of the
[0076]
Here, the relationship between bank validity / invalidity and saving / restoring of bank numbers will be described. If the bank number can be saved / restored, there is no need to enable / disable the bank. In the case of the bank valid / invalid flag, if data is accessed when the bank is invalid, the default value of the bank number determined in advance by hardware is used. However, when using save / restore, the user arbitrarily determines the default value. be able to. Return to the previously set value by return processing.
[0077]
Even when the
[0078]
According to this configuration, it is possible to simultaneously perform bank function settings such as bank number setting and saving / restoring of previous bank numbers, and interrupt permission prohibition operations, and the code size and execution time of the program can be reduced. In addition, the responsiveness of interrupt processing can be improved.
[0079]
FIG. 10 shows another hardware configuration for realizing the simultaneous processing in the bank number setting and interrupt
[0080]
[0081]
[0082]
[0083]
The bank
[0084]
[0085]
[0086]
The
[0087]
[0088]
Reference numeral 8 a denotes an address selector that selects an address to be given to the bank save
[0089]
FIG. 11 is a truth table showing the operation of the
[0090]
In the present embodiment, the bank
[0091]
In the present embodiment, by providing a plurality of bank
[0092]
Here, operations related to the
[0093]
When restoring the bank number, the selector 8a selects the output of the
[0094]
A plurality of bank number saving processes are realized by the above operation. The above circuit is equivalent to a circuit that performs a post-increment pre-decrement stack operation, and the
[0095]
According to this configuration, it is possible to simultaneously perform bank function settings such as bank number setting and saving / restoring of previous bank numbers, and interrupt permission prohibition operations, and the code size and execution time of the program can be reduced. In addition, the responsiveness of interrupt processing can be improved. Further, a plurality of previous bank numbers can be saved and restored, and bank switching can be performed a plurality of times before returning to the original bank.
[0096]
【The invention's effect】
[Brief description of the drawings]
FIG. 1 is a flowchart illustrating a bank access method in a microprocessor according to a first embodiment of this invention.
FIG. 2 is a flowchart showing a bank access method in a microprocessor according to a second embodiment of the present invention.
3A is a schematic diagram illustrating an example of a bank / interrupt setting register in the microprocessor according to the first embodiment of the present invention, and FIG. 3B is a schematic diagram illustrating register setting values.
FIG. 4 is a block diagram showing an example of a bank / interrupt setting circuit in the microprocessor according to the first embodiment of the present invention;
FIG. 5 is an explanatory diagram showing a decoder truth table of FIG. 4;
FIG. 6 is a block diagram showing an example of a bank / interrupt setting circuit in the microprocessor according to the second embodiment of the present invention;
7 is an explanatory diagram showing a decoder truth table of FIG. 6; FIG.
FIG. 8 is a block diagram showing an example of a bank / interrupt setting circuit with a bank number saving register in the microprocessor according to the second embodiment of the present invention;
9 is an explanatory diagram showing a decoder truth table of FIG. 8. FIG.
FIG. 10 is a block diagram showing an example of a bank / interrupt setting circuit with bank number saving memory in the microprocessor according to the second embodiment of the present invention;
FIG. 11 is an explanatory diagram showing a decoder truth table of FIG. 10;
FIG. 12 is a flowchart showing a bank access method in a conventional microprocessor.
[Explanation of symbols]
1 Bank access sequence
11 Interrupt disable process
12 Bank number setting process
13 Bank validation process
14 Bank data access process
15 Bank invalidation process
16 Interrupt enable process
2 Bank access sequence
21 Bank enabled and interrupt disabled process
22 Bank number setting process
23 Bank data access process
24 Bank invalid and interrupt enable process
3 Bank access sequence
31 Bank number setting and interrupt disable process
32 Bank data access process
33 Bank number return and interrupt enable process
4 Setting register
41 Interrupt enable flag
42 Bank invalidation flag
51 Instruction Register
52 Instruction decoder
53 Bank Invalidation Register
531 Bank invalidation register set signal
532 Bank invalidation register clear signal
54 Interrupt enable register
541 Interrupt enable register set signal
542 Interrupt enable register clear signal
61 Instruction Register
62 Instruction decoder
63 Bank invalidation register
631 Bank invalidation register set signal
632 Bank invalidation register clear signal
64 Interrupt enable register
641 Interrupt enable register set signal
642 Interrupt valid register clear signal
65 Bank number setting register
651 Bank number data bus
652 Bank number setting register write enable signal
66 Bank number decoder
71 Instruction Register
72 Instruction decoder
73 Bank number saving memory
731 Bank number saving memory write enable signal
74 Interrupt enable register
741 Interrupt enable register set signal
742 Interrupt valid register clear signal
75 Bank number setting register
751 Bank number setting register write enable signal
76 Bank number decoder
77 Selector
771 Bank number selection signal
772 Bank number setting data bus
773 Bank number saving data bus
774 Bank number selection result
81 Instruction register
82 Instruction decoder
83 Bank number save memory
831 Bank number save memory write enable signal
832 Bank number save memory address signal
84 Interrupt enable register
841 Interrupt enable register set signal
842 Interrupt enable register clear signal
85 Bank number setting register
851 Bank number setting register write enable signal
86 Bank number decoder
861 Address value
87 Bank number selector
871 Bank number selection signal
872 Bank number setting data bus
873 Bank number saving data bus
874 Bank number selection result
88 Address register
89 Adder / Subtractor
891 Addition / subtraction selection signal
8a Address selector
Claims (2)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002087895A JP4125531B2 (en) | 2002-03-27 | 2002-03-27 | Microprocessor |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2002087895A JP4125531B2 (en) | 2002-03-27 | 2002-03-27 | Microprocessor |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2003280923A JP2003280923A (en) | 2003-10-03 |
JP4125531B2 true JP4125531B2 (en) | 2008-07-30 |
Family
ID=29233932
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2002087895A Expired - Fee Related JP4125531B2 (en) | 2002-03-27 | 2002-03-27 | Microprocessor |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP4125531B2 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP7258256B1 (en) * | 2022-07-19 | 2023-04-14 | 三菱電機株式会社 | Programmable logic controller, sequence control system, and active state control program |
-
2002
- 2002-03-27 JP JP2002087895A patent/JP4125531B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP2003280923A (en) | 2003-10-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP4939387B2 (en) | Data processing apparatus and address space protection method | |
WO1999028817A2 (en) | An instruction decoder | |
JP4125531B2 (en) | Microprocessor | |
JPH05257808A (en) | Microprocessor and its operation converting method | |
CA1289265C (en) | Microprocessor with selective cache memory | |
JP2001075804A (en) | Parallel processor processing expansion instruction | |
JP2006072961A (en) | Memory circuit for arithmetic processing unit | |
JP4889235B2 (en) | Program control processor | |
JP2004062309A (en) | Method of processing illegal instruction and processor | |
JP4498705B2 (en) | Cash system | |
US7073049B2 (en) | Non-copy shared stack and register file device and dual language processor structure using the same | |
JPH0241770B2 (en) | ||
JPH09128248A (en) | Microprocessor | |
JP3197045B2 (en) | Extended central processing unit | |
JP2901454B2 (en) | Programmable controller | |
JP4564025B2 (en) | Interrupt processing method in information processing apparatus | |
JP2000029508A (en) | Programmable controller | |
JPH06301534A (en) | Information processor | |
EP0101759B1 (en) | Data processing system having branch instruction prefetching performance | |
JPS6149695B2 (en) | ||
JP2013161325A (en) | Simd (single instruction-stream multiple data-stream) type microprocessor, processor system and data processing method for simd type microprocessor | |
JPH0683986A (en) | Single chip microcomputer | |
JPS617961A (en) | Control system of address converting buffer | |
JPH04270420A (en) | Sequence operation processing device | |
JPH0467229A (en) | Microprocessor and memory system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20050314 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20071116 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20071204 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20080125 |
|
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: 20080415 |
|
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: 20080508 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110516 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110516 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120516 Year of fee payment: 4 |
|
LAPS | Cancellation because of no payment of annual fees |