JP3541863B2 - Central processing unit - Google Patents

Central processing unit Download PDF

Info

Publication number
JP3541863B2
JP3541863B2 JP17795396A JP17795396A JP3541863B2 JP 3541863 B2 JP3541863 B2 JP 3541863B2 JP 17795396 A JP17795396 A JP 17795396A JP 17795396 A JP17795396 A JP 17795396A JP 3541863 B2 JP3541863 B2 JP 3541863B2
Authority
JP
Japan
Prior art keywords
register
data
bit
general
bits
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 - Lifetime
Application number
JP17795396A
Other languages
Japanese (ja)
Other versions
JPH1055304A (en
Inventor
和彦 原
慎一 山浦
圭一 吉岡
圭治 中村
貴雄 片山
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.)
Ricoh Co Ltd
Original Assignee
Ricoh Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ricoh Co Ltd filed Critical Ricoh Co Ltd
Priority to JP17795396A priority Critical patent/JP3541863B2/en
Publication of JPH1055304A publication Critical patent/JPH1055304A/en
Application granted granted Critical
Publication of JP3541863B2 publication Critical patent/JP3541863B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Landscapes

  • Executing Machine-Instructions (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は、中央演算処理装置に関する。
【0002】
【従来の技術】
レジスタをポインタとしてデータを参照するアドレッシングを、インダイレクトアドレッシングという。16ビットの汎用レジスタW0 を備えたCPU(CPU1とする)において、上記レジスタインダイレクトアドレッシングを行う場合、メモリのアクセス可能な番地は、0000h〜FFFFhであり、その範囲は64Kバイト(=216)となる。例えば、“1234h”というアドレスは16ビットで表され、16ビットの汎用レジスタW0 に上記アドレスが格納されていれば、汎用レジスタW0 をポインタとしてアドレッシングすることができる。
【0003】
一方、メモリのアクセス可能範囲を拡張する方法としてバンクアドレス方式が知られている。このバンクアドレス方式は、下位ビットのアドレスデータを汎用レジスタW0 に格納し、上位ビットのアドレスデータをデータバンクレジスタDBRに格納し、このデータバンクレジスタDBRと前記汎用レジスタW0 の両方のデータを合わせてアドレスを表す方法である(特開昭64−91254号公報、特開昭62−89294号公報、特開昭51−132047号公報、特開平1−92851号公報、及び特開平3−204029号公報参照)。
【0004】
前記バンクアドレス方式を用いたレジスタインダイレクトアドレッシングを以下に説明する。例えば、“123456h”というアドレスのように、汎用レジスタW0 のサイズ(16ビット)を越える場合には、下位16ビットの“3456h”は16ビットの汎用レジスタW0 に格納し、上位8ビットの“12h”はデータバンクレジスタDBRに格納する。そして、命令側で下位16ビットのアドレスを持つ汎用レジスタW0 指定するとともに、データバンクレジスタDBRから上位8ビット分のデータを出力させればよい。上記のごとく、データバンクレジスタDBRが8ビットで汎用レジスタW0 が16ビットであれば、8+16=24ビットで表現可能な数値、即ち224=16Mバイトのメモリ空間をアクセスすることが可能となる。
【0005】
ここで、32ビットの汎用レジスタW1 を備えたCPU(CPU2とする)においては、CPU2でレジスタインダイレクトアドレッシングを行うときには、汎用レジスタW1 が32ビットサイズであるので、データバンクレジスタDBRを用いること無く、64Kバイトのアクセス可能範囲を越える範囲のメモリをアクセスすることができる。即ち、前述した“123456h”という32ビットのアドレスは、そのまま32ビットの汎用レジスタW1 に格納されるので、データバンクレジスタDBRは使用しなくてよいことになる。
【0006】
一方、上記のCPU2がCPU1の上位互換機(CPU2はCPU1の上位機種としてCPU1のプログラムを実行できるが、CPU2のプログラムをCPU1が必ずしも実行できるとは限らない関係)である場合、CPU2はCPU1のプログラムが実行可能であることが要求されるので、当然ながらデータバンクレジスタDBRがCPU2のプログラミングモデルに含まれることになる。従って、CPU2においても、データバンクレジスタDBRを使ったレジスタインダイレクトアドレッシングも可能である必要がある。
【0007】
【発明が解決しようとする課題】
しかし、上位互換を可能とするために、レジスタサイズが16ビットのインダイレクトアドレッシングと、レジスタサイズが32ビットのインダイレクトアドレッシングの両方可能なCPU2を持つとすれば、インダイレクトアドレッシングの種類が増えることになる。しかも、このアドレッシングは、レジスタの数(レジスタインダイレクトアドレッシングで使用されるべきレジスタを何番から何番まで指定できるかということ)を乗算した数に増えてしまう。このようにアドレッシングの種類が増えると、例えば命令コード長が増大するあるいは命令の種類が減るといった問題を生じる。
【0008】
本発明は、上記の事情に鑑み、レジスタサイズが拡張された上位互換機のCPUであって、下位機のCPUがバンクレジスタでアドレッシングを行うものである場合、上位機のCPUが下位機のアドレッシングを持つことなく(即ち、互換のためだけに下位機のアドレッシングを持つことなく)、アドレッシングに互換性を持たせることを目的とする。
【0009】
【課題を解決するための手段】
ここで、当該中央演算処理装置(CPU)が、上位機として上位機のプログラムを処理する場合を考えると、前記の第1レジスタが32ビットであるとして当該レジスタに対してその下位側に16ビットのデータを書き込むときには、上位側の16ビットは意味のないデータであり、この第1のレジスタから32ビットのデータ全体を読み出すことはない。即ち、32ビットの第1のレジスタの下位側の16ビットデータを書き換えたときは、当該レジスタはレジスタインダイレクトアドレッシングで使用されることはない。
【0010】
一方、当該中央演算処理装置が上位機として下位機のプログラムを処理する場合、16ビットのデータの書換えを行うことは当然であり、この16ビットのデータの書換えを行った第1のレジスタもレジスタインダイレクトアドレッシングで使われる可能性がある。そして、このレジスタインダイレクトアドレッシングは、上記第1のレジスタの16ビットのデータに、データバンクレジスタDBR(第2のレジスタ)のデータ(このデータは一度セットされると固定的に保持されるので、以下固定値という場合がある)を付加する処理に相当するが、この処理は、32ビットの第1のレジスタの上位側16ビットに第2のレジスタのデータをコピーしておいて、当該コピーがなされた第1のレジスタの32ビットのデータをそのまま出す処理でよいことになる。
【0011】
本発明の中央演算装置は、レジスタをポインタとして用いてアドレッシングする中央演算装置において、複数の汎用レジスタからなる第1のレジスタと、データバンクレジスタとなる第2のレジスタと、定数値を発生する第1の定数値発生器と、モードを設定するモードフラグとを備え、前記モードフラグによる第1のレジスタへの選択的なデータ付与の設定が、前記複数のレジスタのうちの特定のレジスタと他のレジスタとで異なるように構成されるとともに、前記第1のレジスタのビットサイズに満たないデータを第1のレジスタに格納するときに、前記モードフラグに基づき、第1のレジスタ中の満たされないビット位置に前記第2のレジスタ又は第1の定数値発生器から選択的にデータが与えられるように構成されたことを特徴とする。
【0012】
ここで、上位機のプログラムにおけるレジスタインダイレクトアドレッシングでは、第1のレジスタに32ビットデータが書き込まれ、その32ビットのデータがアドレスとして出力される。一方、第1のレジスタに16ビットデータが書き込まれたときには、第1のレジスタの上位側に第2レジスタからの16ビットデータが与えられ、16ビットデータを拡張した32ビットデータとして記憶される。従って、第1のレジスタに16ビットデータを記憶させる下位機のプログラムにおいても、レジスタインダイレクトアドレッシングを32ビットデータのときと共通の処理とすればよいことになる。
【0014】
記の第2のレジスタのデータが変更されたときには、第1のレジスタの上記第2のレジスタのデータに相当する上位側のデータも変更されるべきである。しかし、通常の命令ではバンクレジスタ(第2のレジスタに相当)の内容は汎用レジスタ(第1のレジスタに相当)の下位に転送されるので、この下位側にデータが転送された後に汎用レジスタのシフト動作が必要になり、命令が二つ以上必要になる。命令数削減のためには当該処理を一つの命令で行うことが望まれる。例えば、第1のレジスタの上位側の16ビット位置の入力接点に第2のレジスタの出力接点を接続しておき、第1のレジスタのデータを読み出してこれに“0”を加算し、この加算結果を再び第1のレジスタに転送させる命令を持つことにより、当該一つの命令により、第2のレジスタの内容が前記加算結果に自動的にくっついて第1のレジスタの上位側の16ビット位置に自動的に格納される。
【0015】
前記第2のレジスタを8ビットサイズにするとともに、上位側の残り8ビットに特定の定数値(例えば、0)を与える定数値発生器を設けてもよい。これによれば、第2のレジスタを16ビットサイズのレジスタとする必要がなく、第2のレジスタとしてビットサイズの小さいものを用いることができる。
【0017】
また、上記の構成は、下位機の中央演算処理装置が処理するアプリケーションプログラムによっては、モードフラグにより、下位16ビットの上に置かれる(付加される)上位ビットの値を任意の固定値とするか又は“0”等の定数値とするかが決まる場合があることを考慮したものである。このような場合には、下位機の中央演算処理装置であれば、アドレスを出す瞬間に最終アドレスを作ればよい。しかし、本発明の上位機の中央演算処理装置は、第1のレジスタに下位16ビットデータを転送するときに上位ビットとして任意の固定値か又は定数値を入力する必要があるが、この場合には、第2のレジスタにおいて固定値を定数値に書き換えるのは好ましくない。そこで、第2のレジスタと第1の定数値発生器を用意し、転送のときに前記モードフラグに対応してどちらかを選択するようにした。これにより、第2のレジスタは固定値用として常に用いることができ、定数値に書き換えるといった必要がなくなる。
【0020】
また、複数のレジスタを備える場合に各々のレジスタの使い分けをする場合があり(レジスタ使用規約)、この場合に前記特定のレジスタがその上位側のデータに固定値ではなく定数値を設定される場合(例えば、当該特定のレジスタをレジスタインダイレクトアドレッシング用として使用しない場合)があるが、本構成であれば、そのような場合に対処できる。
【0021】
更に、データ転送処理の対象となる任意のレジスタを1回の命令で選択できるようにしてもよい。例えば、第1のレジスタが4つのレジスタからなる場合に、4ビットのデータで“0”が対象外、“1”が対象であるとしたデータを命令により与える。
【0022】
このように、第1のレジスタを構成する複数のレジスタの任意のレジスタを1回の命令で指定し、任意のレジスタのバンクアドレスに相当するビット位置のデータをバンクレジスタの値とすることができる。
【0023】
第2のレジスタをダイレクトアドレッシング(アブソリュート)時のバンクアドレスとして用いる構成としてもよい。
【0024】
これによれば、アドレスを直接命令で指定するダイレクトアドレッシングにおいて、バンク方式(バンクレジスタのデータを指定アドレスの上位に追加してアドレスを生成する方式)が、上記バンクレジスタを新たに設けることなく、上記の第2のレジスタによって行うことができる。
【0025】
第2のレジスタをダイレクトアドレッシング(アブソリュート)時のバンクアドレスとして用いる構成において、この第2のレジスタと“0”等の定数値を発生する第1の定数値発生器のいずれのデータを選択するかをモードフラグの値に応じて決定し、且つこの決定パターンが、インダイレクトアドレッシングの場合の第1のレジスタに対する転送データ選択パターンと同じパターンであるように構成してもよい。
【0026】
このように、ダイレクトアドレッシングにおいて、モード設定で第2のレジスタと第1の定数値発生器の選択を行うから、定数値を使用する場合でも第2のレジスタのデータを定数値に一々書き換える必要はない。更に、バンクアドレスを発生させるときと第1のレジスタへデータを格納するときとで決定パターンが同じであるので、インダイレクトアドレッシングとダイレクトアドレッシングでバンク値は一致することになる。
【0027】
また、第1のレジスタ中の満たされないビット位置に前記第2のレジスタからデータ(固定値)を与えるデータ転送処理が、特定のビットサイズの演算の場合にのみ行われるように構成されていてもよい。例えば、第1のレジスタが32ビットの場合、その上位データが得られない演算のデータサイズは、例えば、8ビットと16ビットとなるが、上位データに固定値が必要な演算が前記2種類のサイズのうちの16ビットサイズの場合だけである場合、固定値を必要としない8ビットサイズの演算では上位データに前回値を残すことにより、前回値を利用できるようになる。
【0028】
また、上記のように、8ビットサイズの演算では、下位16ビットのうちの8ビットだけを使うことになり、レジスタの使用効率が良くない。そこで、かかる場合には、第1のレジスタの下位16ビット部分を8ビット毎に二つに分割して独自の8ビットレジスタを二つ持つがごとく構成した。これにより、レジスタ使用効率を高めることができる。
【0029】
【発明の実施の形態】
以下、本発明の実施の形態を図に基づいて説明する。
【0030】
(実施の形態1)
図1は本発明の中央演算処理装置の概略構成を示した回路図である。汎用レジスタ(第1のレジスタ)1は、32ビットサイズを有し、データバス13からのデータCを入力し、データバス11,12にデータA,Bを出力する。第2レジスタ2は、8ビット幅を有し、データバス11からのデータAを入力し、データバス13にデータCを出力する。第1定数値発生器3a及び第2の定数値発生器3bは、それぞれ8ビット幅を有し、例えば“00000000”といった定数値を発生する回路であり、当該定数値をデータバス13に出力する。第2レジスタ2及び第1,第2定数値発生器3a,3bは、データ補填制御装置10により制御される。演算器4は32ビットの算術論理演算装置であり、データバス11からのデータAとデータバス12からのデータBとを入力して演算を実行し、演算結果をデータバス13に出力する。プロセッサステータスレジスタ5は、データバス11からのデータAを入力し、後述するモードフラグをセットする。以下、各要素の具体的構成を説明する。
【0031】
図2は、汎用レジスタ1及びこれを制御する書込信号発生器6を示した回路構成図である。なお、出力構成部分は省略して示している。また、図中の1aは汎用レジスタ1の一部(1ビット分)を示している。汎用レジスタ1は、データバス13からのデータC0〜C31を入力し、書込信号Dと書込信号EとによってデータCの所定ビット部分を書き込むようになっている。書込信号発生器6は、書込信号とサイズ信号を入力し、これら書込信号とサイズ信号によって前記の書込信号D,Eの生成を制御する。書込信号Dは下位8ビット(C0〜C7)の書き込みを制御し、書込信号Eは上位24ビット(C8〜C31)の書き込みを制御する。この制御では、汎用レジスタ1の0〜7ビット(下位8ビット)の位置に書き込むか、第1レジスタ1の0〜31ビット(全32ビット)の位置に書き込むかの二通りの書き込み選択がなされる。
【0032】
なお、実施の形態としては、上記図2のように、汎用レジスタ1が一つである形態も考えられるが、汎用レジスタ1が複数である形態が実際的であるので、この実施の形態では、後述するように(図7に汎用レジスタ1が複数である場合を示している)、汎用レジスタ1が複数設けられることとして説明する。
【0033】
図3は、第2のレジスタ2の回路構成図である。なお、入力構成部分は省略して示している。第2のレジスタ2は、各データ線に直列にスリーステートバッファ2aを備える。そして、各スリーステートバッファ2a…に前記のデータ補填制御装置10からのコントロール信号S1を入力することにより、データの出力と非出力とが選択されるようになっている。また、第2のレジスタ2の各データは、データバス13の第16ビット〜第23ビットに対応するラインに出力される(データC16〜C23)。即ち、汎用レジスタ1への入力の上位側の16ビット(データC16〜C31)のうちのデータC16〜C23の入力ビット位置に第2のレジスタ2の出力接点が直接繋がれている。
【0034】
図4(a)は、第1定数値発生器3aの回路構成図であり、同図(b)は第2定数値発生器3bの回路構成図である。第1定数値発生器3aは、データバス13の第16ビット〜第23ビットの部分へのデータC16〜C23として定数値(例えば、“00000000”)を出力する。また、第2定数値発生器3bは、データバス13の第24ビット〜第31ビットの部分へのデータC24〜C31として定数値(例えば、“00000000”)を出力する。定数値の出力制御は、前記のデータ補填制御装置10からのコントロール信号S2,S3により行われる。第1定数値発生器3aを設けたことにより、データバス13の第16ビット〜第23ビットの部分(演算器4の16ビット出力の上の8ビット)に置かれる(付加される)値を任意の固定値とするか“0”等の定数値とするかを選択できる。また、第2定数値発生器3bを設けたことにより、第2のレジスタ2を16ビットサイズのレジスタとする必要がなく、前記第2のレジスタ2として8ビットの小さいものを用いることができる。
【0035】
図5は、演算器4の回路構成図である。なお、データ入力構成部分は省略している。演算器4は、データバス13へ演算結果であるデータC0〜C31を出力する。データC0〜C15までの部分と、データC16〜C31までの部分は、それぞれ出力制御信号F,Gによって出力するか否かが制御される。具体的には、データC0〜C15の部分である下位16ビットのみを出力するか、データC0〜C31の全32ビットを出力するかが切り換えられる。
【0036】
図6は、プロセッサステータスレジスタ5の回路構成図である。このプロセッサステータスレジスタ5は、データバス11からのデータA0〜A7を入力し、データM0,M1を出力する。このデータM0,M1は、データA4,A5に対応するレジスタ5の出力信号である。以下、このデータM0,M1をモードフラグM0,M1と呼ぶ。
【0037】
図7は、4つの汎用レジスタ1A〜1D、及びレジスタ選択書込装置9を示した回路図である。レジスタ選択書込装置9は、書込信号と、レジスタ選択信号(汎用レジスタ1A〜1Dのいずれかを示す信号)と、サイズ信号(8ビット、16ビット、32ビットを区別する信号)とを入力し、選択された汎用レジスタに書込信号D,E(図2で説明した信号と同じである)を出力するようになっている。
【0038】
図8は、データ補填制御装置10、第2のレジスタ2、及び第1,第2の定数値発生器3a,3bの関係を示した回路図である。データ補填制御装置10は、モードフラグM0,M1と、レジスタ選択信号(図7の説明と同様)と、サイズ信号(図7の説明と同様)とを入力し、第2のレジスタ2、及び第1,第2の定数値発生器3a,3bの選択制御を行う。具体的内容については後述する。
【0039】
次に、中央演算処理装置の動作を、演算器4の演算結果を汎用レジスタ1に格納する場合を例に説明する。
【0040】
演算器4からの32ビットの演算結果の全て(データC0〜C31)を汎用レジスタ1に転送する処理は、以下のようにして実行できる。即ち、演算器4の出力幅は出力制御信号F,Gによって決まるので、これら出力制御信号F,Gにより演算器4の出力幅の全ビットを選択する。また、汎用レジスタ1では、書込信号D,Eにより全ビットを書き込むようにしておく。これにより、演算結果であるデータC0〜C31は、データバス13を経由し、汎用レジスタ1のビット位置0〜31に入力される。
【0041】
演算器4からの演算結果の下位8ビット(データC0〜C7)を汎用レジスタ1に転送する場合は、出力制御信号F,Gにより演算器4の下位16ビット(データC0〜C15)を選択する。また、汎用レジスタ1では、書込信号D,Eにより下位8ビット(データC0〜C7)を書き込むようにしておく。これにより、演算結果の8ビットは、データバス13を経由し、汎用レジスタ1のビット位置0〜7に入力される。この場合、汎用レジスタ1のビット位置8〜31にはデータは書き込まれない。
【0042】
なお、演算器4からの演算結果の下位8ビット(データC0〜C7)を汎用レジスタ1に転送することは、汎用レジスタ1のビット長に満たないデータを汎用レジスタ1に格納する場合に相当するが、この実施の態様では、下位8ビット転送の場合には、本発明の第2のレジスタ2のデータを汎用レジスタ1に転送することはしない。
【0043】
演算器4から演算結果の下位16ビット(データC0〜C15)を汎用レジスタ1に転送する場合は、出力制御信号F,Gにより演算器4の下位16ビット(データC0〜C15)を選択するとともに、上記の下位8ビット転送の場合とは異なり、汎用レジスタ1では、書込信号D,Eにより全32ビット(データC0〜C31)を書き込むようにしておく。そして、コントロール信号S1,S2,S3により、第2レジスタ2のデータC16〜C23又は第1の定数値発生器3aのデータC16〜C23のいずれかを出力するとともに、第2の定数値発生器3bのデータC24〜C31を出力させる。これにより、汎用レジスタ1のデータC0〜C15として演算器4の演算結果が格納され、汎用レジスタ1のデータC16〜C31として第2のレジスタ2などのデータが格納される。
【0044】
前記コントロール信号Sは、前述したように、モードフラグM0,M1と、レジスタ選択信号と、サイズ信号とにより、データ補填制御装置10から出力される。図9は、コントロール信号Sの内容自体ではなく、モードフラグM0,M1と、レジスタ選択信号と、サイズ信号とに基づく第2のレジスタ2などの出力の許否態様を示している。
【0045】
このように、汎用レジスタ1のビット長(32ビット)に満たない16ビットデータを汎用レジスタ1に格納するとき(その判断は、前記サイズ信号で判断できる)、汎用レジスタ1中の満たされない上位側の16ビット位置に前記第2のレジスタ2から8ビットのデータC16〜C23が与えられる。また、汎用レジスタ1の上位側(第16ビット〜第23ビット部分)に第2のレジスタ2のデータC16〜C23を格納する処理は、汎用レジスタ1の下位側16ビットにデータを格納する処理と同時に行うことができる。また、この処理は、汎用レジスタ1の上位側の16ビットのうちの8ビット(データC16〜C23が入力されるべき部分)に第2のレジスタ2の出力部分を接続してあるので、一つの命令で前述の書込信号等を生成して第2のレジスタ2のデータや第1の定数値発生器3aの出力を汎用レジスタ1に転送させることができる。
【0046】
また、図9に示したように、複数設けた汎用レジスタ1A〜1Dのうち、汎用レジスタ1Bと、これ以外の汎用レジスタ1A,1C,1Dとの間では、モードフラグM0,M1による第2のレジスタ2のデータ(図9ではDBRとしている)と第1の定数値発生器3aのデータの選択態様を異ならせている。
【0047】
具体的には、(M1,M0)が(0,1)のとき、汎用レジスタ1Bについては、第2のレジスタ2のデータを出力しないで第1の定数値発生器3aのデータを出力するが、汎用レジスタ1B以外の汎用レジスタ1A,1C,1Dについては、第1の定数値発生器3aのデータを出力しないで第2のレジスタ2のデータを出力するようにしている。これにより、複数の汎用レジスタ1A〜1Dを備える場合に各々のレジスタの使い分けをするレジスタ使用規約にも対応することができる。
【0048】
以上説明したように、32ビットデータは常に32ビットで汎用レジスタ1に記憶され、8ビットデータは常に8ビットで汎用レジスタ1に記憶される。一方、16ビットデータは常に上位16ビットを拡張した32ビットデータとして汎用レジスタ1に記憶される。そして、拡張部分は、第2のレジスタ2(バンクレジスタ)の内容或いは“00h”のなどの定数になっていて、その内容はモードフラグやレジスタ番号によるレジスタ間の差を反映させた状態となっている。そのため、16ビットデータで記憶させたレジスタ内容を使うレジスタインダイレクトアドレッシング時でも32ビットデータの時と共通の処理で可能である。
【0049】
(実施の形態2)
第2のレジスタ2のデータを、ダイレクトアドレッシングにおいてバンクデータとして使用することができるようにしている。ダイレクトアドレッシングとは、外部メモリ上のオペランドとのアクセスに使用するアドレスをプログラム中に直接に記述したアドレッシングである。例えば、24ビットのアドレス空間を持つ中央演算処理装置の場合、下位16ビットのアドレスをプログラムで直接指定し、上位8ビットについてはデータバンクレジスタDBRの内容を用いてアドレッシングを行う場合がある。このような処理を上位互換機である本発明の中央演算処理装置で行うために、アドレスの上位8ビットをデータバンクレジスタDBRとして機能する第2のレジスタ2の内容(固定値)とするか或いは第1の定数値発生器3aの定数値(例えば、“00h”)とするかを前述のモードフラグM0,M1の状態により決めるとともに、このモードフラグM0,M1の状態による固定値か定数値かの選択を、ダイレクトアドレッシング時と、インダイレクトアドレッシングの場合の汎用レジスタ1に対する転送データ選択パターン(図9参照)と同じパターンとする。
【0050】
このように、ダイレクトアドレッシングにおいて、モード設定で第2のレジスタ2と第1の定数値発生器3aの選択を行うから、定数値を使用する場合でも第2のレジスタのデータを定数値に一々書き換える必要はない。更に、バンクデータを発生させるときと汎用レジスタ1へデータを格納するときとで決定パターンが同じであるので、インダイレクトアドレッシングとダイレクトアドレッシングでバンク値は一致することになる。
【0051】
(実施の形態3)
実施の形態1では、汎用レジスタ1のビット長に満たないデータを汎用レジスタ1に格納する演算時に、汎用レジスタ1の満たされないビット位置に格納するデータを第2のレジスタ2で設定することを説明したが、このように、第2のレジスタ2で設定するのを、16ビットサイズの演算の場合のように特定の場合にだけ行うようにしてもよい。
【0052】
ここで、32ビットサイズの汎用レジスタ1の上位データが得られない演算のデータサイズとしては、8ビットサイズと16ビットサイズの二つ(二つ以上でもよい)があり、上位データに固定値が必要な演算が上記2種のサイズのうちの一方だけである場合がある。例えば、アドレス演算は16ビットだけである。
【0053】
このようなアドレス演算以外の演算(固定値を必要としない演算)では、汎用レジスタ1の上位データを第2のレジスタ2で設定することを行わないことにより、汎用レジスタ1の上位16ビットデータに前回値を残すことができ、当該前回値を利用することが可能になる。
【0054】
更に、32ビットサイズの汎用レジスタ1の下位8ビットだけを用いるのは効率的でないので、汎用レジスタ1の下位16ビットを二つの独自の8ビットレジスタとして用いることができるのが望ましい。
【0055】
図10は、汎用レジスタ1として4つのレジスタL0〜L3を備え、そのうちのレジスタL0,L1の各々の16ビットレジスタ部分W0,W1を二つに分割し、8ビットレジスタ部分R0,R2、及び8ビットレジスタ部分R1,R3とした場合を示している。
【0056】
図11は、8ビットレジスタ部分R0,R1を独自の8ビットレジスタとして機能させるための構成を示した回路図である。この図から分かるように、8ビットレジスタ部分R0,R2(又はR1,R3)に、データバス13のビット位置0〜7のデータC0〜C7のデータを書き込めるようにした。また、データバス11,12のビット位置0〜7のラインを用い、8ビットレジスタ部分R0,R2(又はR1,R3)の出力を、データA0〜A7(又はB0〜B7)として出力させるようにしている。
【0057】
このように、32ビットサイズの汎用レジスタ1の全ビットを使用しない場合に、汎用レジスタ1の下位16ビットを分割して用いるようにしたことにより、汎用レジスタ1の効率的利用が図れる。
【0058】
(実施の形態4)
この実施の形態では、汎用レジスタ1のビット長に満たないデータを汎用レジスタ1に格納する演算時に、汎用レジスタ1の満たされないビット位置に格納するデータを第2のレジスタ2で設定するための更新命令を中央演算処理装置が持つことについて説明する。なお、更新の有無や内容は、プロセッサステータスレジスタ(PSR)5のモード設定M0,M1に基づく。また、汎用レジスタ1が複数のレジスタから構成される場合には、そのレジスタ番号により異なる場合がある。例えば、実施の形態1で説明したように、レジスタ1Bは他のレジスタ1A,1C,1Dと異ならせたような場合である。
【0059】
図12は、汎用レジスタ1がn個のレジスタから構成される場合の更新命令による処理内容を示したフローチャートである。まず、初期設定としてi=0の処理を行う(ステップ1)。iは、処理されるレジスタ番号に対応する。次に、i=nの処理を行う(ステップ2)。即ち、全てのレジスタについて処理が終了したか否かを判断する。i=nであれば、処理を終了する。一方、i=nでなければlist=list>>1の処理を行う(ステップ3)。
【0060】
listは、命令により与えられる情報であり、各レジスタについての更新の有無を示した情報であり、n=4であればlistは4ビットで構成されることになる。また、この4ビットlistの第0番目のビットは第0レジスタに、第1番目のビットは第1レジスタに、というように対応させてあり、“0”は更新しないを、“1”は更新するをそれぞれ意味する。
【0061】
次に、シフトアウトビットが“0”か“1”を判断する(ステップ4)。従って、上記ステップ3によるlist=list>>1の処理、即ち、4ビットのlistを1ビット右シフトする処理を行い、このステップ4でシフトアウトビットが“0”か“1”を判断することにより、i番目のレジスタについて更新を行うのか否かが判断される。
【0062】
シフトアウトビットが“1”のときは、i番目のレジスタの更新処理を行う(ステップ5)。この更新処理は、まずi番目のレジスタのデータをデータバス11またはデータバス12を経由して演算器4に入力する。そして、演算器4で“0”との加算を行い、加算結果をデータバス13へ出力する。なお、このときには、サイズ信号は16ビットサイズを示す信号となっており、従って、データバス13の上位16ビットのデータC16〜C31は、第2のレジスタ2又は第1の定数値発生器3aの内容と、第2の定数値発生器3bの内容となる。これにより、レジスタの更新が行われたことになる。なお、更新の具体的態様は、例えば、実施の形態1で示した図9の内容に従ってされる。
【0063】
一方、シフトアウトビットが“1”のときは、i番目のレジスタについては更新処理を行わず、ステップ6に進む。ステップ6では、次のレジスタについての処理を行うために、i=i+1の処理を行う。そして、ステップ2に進む。レジスタの数だけ処理を繰り返すと、ステップ2でi=nとなり、終了する。
【0064】
【発明の効果】
以上のように、本発明によれば、レジスタサイズが拡張された上位互換機の中央演算処理装置であって、下位機の中央演算処理装置がバンクレジスタでアドレッシングを行うものである場合、上位機の中央演算処理装置が下位機のアドレッシングを持つことなく、アドレッシングに互換性を持たせることが可能になるという効果を奏する。
【図面の簡単な説明】
【図1】本発明の中央演算処理装置の概略構成図である。
【図2】本発明の汎用レジスタ及び書込信号発生器を示すブロック図である。
【図3】本発明の第2のレジスタの回路構成図である。
【図4】同図(a)は本発明の第1の定数値発生器の概略構成図であり、同図(b)は第2の定数値発生器の概略構成図である。
【図5】本発明の演算器の概略構成図である。
【図6】本発明のプロセッサステータスレジスタの概略構成図である。
【図7】本発明の複数のレジスタから成る第1のレジスタ及びそのコントロール装置を示す概略構成図である。
【図8】本発明のデータ補填制御装置を示す概略構成図である。
【図9】図8のデータ補填制御装置の動作説明図である。
【図10】本発明の第1のレジスタの分割例を示す説明図である。
【図11】図10の分割例を実現する第1レジスタの概略構成図である。
【図12】本発明の命令を説明するフローチャートである。
【符号の説明】
1 汎用レジスタ(第1のレジスタ)
2 第2のレジスタ
3a 第1の定数値発生器
3b 第2の定数値発生器
4 演算器
5 プロセッサステータスレジスタ
6 書込信号発生器
9 レジスタ選択書込装置
10 データ補填制御装置
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a central processing unit.
[0002]
[Prior art]
Addressing that refers to data using a register as a pointer is called indirect addressing. 16-bit general-purpose register W0When the above register indirect addressing is performed in a CPU having CPU (hereinafter referred to as CPU1), the accessible address of the memory is 0000h to FFFFh, and its range is 64 Kbytes (= 216). For example, the address "1234h" is represented by 16 bits, and the 16-bit general-purpose register W0Is stored in the general-purpose register W0Can be addressed as a pointer.
[0003]
On the other hand, a bank address method is known as a method of extending the accessible range of a memory. In this bank address system, lower-order bit address data is stored in a general-purpose register W.0And the higher-order bit address data is stored in the data bank register DBR.0(In Japanese Patent Application Laid-Open Nos. Sho 64-91254, Sho 62-89294, Sho 51-132047, Sho 1-92851, and JP-A-3-204029).
[0004]
The register indirect addressing using the bank address method will be described below. For example, as in the address “123456h”, the general-purpose register W0, The lower 16 bits of “3456h” are replaced with the 16-bit general-purpose register W.0And the upper 8 bits “12h” are stored in the data bank register DBR. Then, the general-purpose register W having the address of the lower 16 bits on the instruction side0At the same time, the data of the upper 8 bits may be output from the data bank register DBR. As described above, the data bank register DBR has 8 bits and the general-purpose register W0Is 16 bits, a numerical value that can be represented by 8 + 16 = 24 bits, that is, 2twenty four= 16 Mbytes of memory space can be accessed.
[0005]
Here, a 32-bit general-purpose register W1CPU (hereinafter referred to as CPU2) having the general-purpose register W when register indirect addressing is performed by the CPU2.1Is a 32-bit size, so that a memory beyond the accessible range of 64 Kbytes can be accessed without using the data bank register DBR. That is, the 32-bit address "123456h" described above is directly used as the 32-bit general-purpose register W.1Therefore, the data bank register DBR need not be used.
[0006]
On the other hand, if the CPU 2 is an upper compatible machine of the CPU 1 (the CPU 2 can execute the program of the CPU 1 as an upper model of the CPU 1, but the CPU 1 cannot always execute the program of the CPU 2), the CPU 2 Since the program is required to be executable, the data bank register DBR is naturally included in the programming model of the CPU 2. Therefore, the CPU 2 also needs to be able to perform register indirect addressing using the data bank register DBR.
[0007]
[Problems to be solved by the invention]
However, if the CPU 2 has both the 16-bit register size indirect addressing and the 32-bit register size indirect addressing to enable upward compatibility, the number of types of indirect addressing increases. become. In addition, this addressing is increased to the number obtained by multiplying the number of registers (how many registers to be used in register indirect addressing can be specified). When the number of types of addressing increases in this way, there arises a problem that, for example, the instruction code length increases or the number of instructions decreases.
[0008]
In view of the above circumstances, the present invention is directed to a CPU of an upper compatible machine having an expanded register size, and in a case where the CPU of the lower machine performs addressing using the bank register, the CPU of the upper machine is used for addressing the lower machine. It is an object of the present invention to make the addressing compatible without having the addressing (that is, without having the addressing of the lower device only for compatibility).
[0009]
[Means for Solving the Problems]
Here, considering the case where the central processing unit (CPU) processes a program of a high-order machine as a high-order machine, it is assumed that the first register has 32 bits and that the first register has 16 bits in the lower side. When writing the data, the upper 16 bits are meaningless data, and the entire 32-bit data is not read from the first register. That is, when the lower 16-bit data of the 32-bit first register is rewritten, the register is not used in register indirect addressing.
[0010]
On the other hand, when the central processing unit processes a program of a lower-level device as an upper-level device, it is natural that the 16-bit data is rewritten, and the first register that has rewritten the 16-bit data is also a register. May be used in indirect addressing. Then, this register indirect addressing is performed by adding the 16-bit data of the first register to the data of the data bank register DBR (the second register). Below fixed valueThatThis process corresponds to a process of adding the data of the second register to the upper 16 bits of the 32-bit first register. In this case, the process of outputting the 32-bit data of the register as it is is sufficient.
[0011]
The central processing unit of the present invention comprises:In a central processing unit for addressing using a register as a pointer, a first register including a plurality of general-purpose registers, a second register serving as a data bank register, a first constant value generator for generating a constant value, A mode flag for setting a mode, wherein the setting of selective data addition to the first register by the mode flag is different between a specific register of the plurality of registers and another register. In addition, when data less than the bit size of the first register is stored in the first register, the second register or the second register is placed in an unsatisfied bit position in the first register based on the mode flag. The constant value generator is configured to selectively receive data.
[0012]
Here, in the register indirect addressing in the program of the host machine, 32-bit data is written to the first register, and the 32-bit data is output as an address. On the other hand, when 16-bit data is written to the first register, 16-bit data from the second register is given to the upper side of the first register, and stored as 32-bit data obtained by expanding the 16-bit data. Accordingly, even in a program of a lower-order machine in which 16-bit data is stored in the first register, the register indirect addressing may be performed in the same manner as in the case of 32-bit data.
[0014]
PreviousWhen the data in the second register is changed, the data on the upper side of the first register corresponding to the data in the second register should also be changed. However, in a normal instruction, the contents of the bank register (corresponding to the second register) are transferred to a lower position of the general-purpose register (corresponding to the first register). A shift operation is required, and two or more instructions are required. In order to reduce the number of instructions, it is desired that the processing be performed by one instruction. For example, the output contact of the second register is connected to the input contact at the upper 16-bit position of the first register, the data of the first register is read, and "0" is added thereto. By having an instruction to transfer the result to the first register again, the content of the second register is automatically attached to the result of addition by the one instruction, and the result is added to the upper 16-bit position of the first register. Stored automatically.
[0015]
The second register may have an 8-bit size, and a constant value generator for giving a specific constant value (for example, 0) to the remaining 8 bits on the upper side may be provided. According to this, the second register does not need to be a 16-bit register, and a small register can be used as the second register.
[0017]
Also, the above configuration isDepending on the application program processed by the central processing unit of the lower device, the value of the upper bit placed (added) on the lower 16 bits may be an arbitrary fixed value or “0” or the like depending on the mode flag. It is taken into consideration that a constant value may be determined. In such a case, if the central processing unit is a lower-level machine, the final address may be created at the moment when the address is issued. However, the central processing unit of the host machine of the present invention needs to input an arbitrary fixed value or a constant value as the upper bit when transferring the lower 16-bit data to the first register. It is not preferable to rewrite a fixed value to a constant value in the second register. Therefore, a second register and a first constant value generator are prepared, and one of them is selected at the time of transfer in accordance with the mode flag. Thus, the second register can always be used for a fixed value, and there is no need to rewrite the second register with a constant value.
[0020]
Also,When there are a number of registers, there is a case where each register is used properly (register usage rules). In this case, the specific register is set to a constant value instead of a fixed value in the data on the upper side (for example, There is a case where the specific register is not used for register indirect addressing), but this configuration can cope with such a case.
[0021]
In addition, any registers subject to data transfer processingOne lifeYou may make it selectable by an order. For example, when the first register is composed of four registers, 4-bit data is used.“0” isNon-target data, “1”, which is a target, is given by an instruction.
[0022]
As described above, any one of the plurality of registers constituting the first register can be designated by one instruction, and the data at the bit position corresponding to the bank address of the arbitrary register can be used as the value of the bank register. .
[0023]
A configuration may be used in which the second register is used as a bank address at the time of direct addressing (absolute).
[0024]
According to this, in the direct addressing in which an address is directly specified by an instruction, the bank method (a method in which data of a bank register is added to a higher order of a specified address to generate an address) is used without newly providing the bank register. This can be performed by the above-mentioned second register.
[0025]
In a configuration in which the second register is used as a bank address at the time of direct addressing (absolute), which data is to be selected between the second register and the first constant value generator that generates a constant value such as "0" May be determined according to the value of the mode flag, and the determination pattern may be the same as the transfer data selection pattern for the first register in the case of indirect addressing.
[0026]
As described above, in the direct addressing, since the second register and the first constant value generator are selected by the mode setting, even when the constant value is used, it is not necessary to rewrite the data of the second register to the constant value one by one. Absent. Further, since the decision pattern is the same between when the bank address is generated and when the data is stored in the first register, the bank values match between indirect addressing and direct addressing.
[0027]
Further, even if the data transfer processing for giving data (fixed value) from the second register to an unsatisfied bit position in the first register is performed only in the case of an operation of a specific bit size, Good. For example, when the first register is 32 bits, the data size of the operation for which high-order data cannot be obtained is, for example, 8 bits or 16 bits. In the case of only the 16-bit size of the size, the previous value can be used by leaving the previous value in the higher-order data in the 8-bit size operation that does not require a fixed value.
[0028]
Further, as described above, in the operation of the 8-bit size, only the 8 bits out of the lower 16 bits are used, so that the use efficiency of the register is not good. Therefore, in such a case, the lower 16-bit portion of the first register is divided into two for every eight bits, so that two unique 8-bit registers are provided. Thereby, register use efficiency can be improved.
[0029]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
[0030]
(Embodiment 1)
FIG. 1 is a circuit diagram showing a schematic configuration of a central processing unit of the present invention. The general-purpose register (first register) 1 has a 32-bit size, inputs data C from the data bus 13, and outputs data A and B to the data buses 11 and 12. The second register 2 has an 8-bit width, inputs data A from the data bus 11, and outputs data C to the data bus 13. Each of the first constant value generator 3a and the second constant value generator 3b is a circuit having a width of 8 bits and generating a constant value such as "00000000", and outputs the constant value to the data bus 13. . The second register 2 and the first and second constant value generators 3a and 3b are controlled by the data compensation controller 10. The arithmetic unit 4 is a 32-bit arithmetic and logic unit that inputs data A from the data bus 11 and data B from the data bus 12 to execute a calculation, and outputs a calculation result to the data bus 13. The processor status register 5 receives the data A from the data bus 11 and sets a mode flag described later. Hereinafter, a specific configuration of each element will be described.
[0031]
FIG. 2 is a circuit diagram showing the general-purpose register 1 and the write signal generator 6 for controlling the general-purpose register. The output components are not shown. 1a in the figure indicates a part (for one bit) of the general-purpose register 1. The general-purpose register 1 receives data C0 to C31 from the data bus 13 and writes a predetermined bit portion of the data C by a write signal D and a write signal E. The write signal generator 6 receives a write signal and a size signal, and controls generation of the write signals D and E according to the write signal and the size signal. The write signal D controls writing of lower 8 bits (C0 to C7), and the writing signal E controls writing of upper 24 bits (C8 to C31). In this control, there are two types of writing selection, that is, writing at the position of 0 to 7 bits (lower 8 bits) of the general-purpose register 1 and writing at the position of 0 to 31 bits (32 bits in total) of the first register 1. You.
[0032]
In addition, as an embodiment, as shown in FIG. 2 described above, a form in which the number of the general-purpose registers 1 is one can be considered, but a form in which the number of the general-purpose registers 1 is plural is practical, so in this embodiment, As will be described later (FIG. 7 shows a case where there are a plurality of general-purpose registers 1), description will be made assuming that a plurality of general-purpose registers 1 are provided.
[0033]
FIG. 3 is a circuit configuration diagram of the second register 2. The input components are not shown. The second register 2 includes a three-state buffer 2a in series with each data line. By inputting the control signal S1 from the data compensation controller 10 to each of the three-state buffers 2a, data output or non-output is selected. Further, each data of the second register 2 is output to a line corresponding to the 16th to 23rd bits of the data bus 13 (data C16 to C23). That is, the output contact of the second register 2 is directly connected to the input bit positions of the data C16 to C23 of the upper 16 bits (data C16 to C31) of the input to the general-purpose register 1.
[0034]
FIG. 4A is a circuit configuration diagram of the first constant value generator 3a, and FIG. 4B is a circuit configuration diagram of the second constant value generator 3b. The first constant value generator 3a outputs a constant value (for example, “00000000”) as data C16 to C23 to the 16th to 23rd bit portions of the data bus 13. The second constant value generator 3b outputs a constant value (for example, “00000000”) as data C24 to C31 to the 24th to 31st bit portions of the data bus 13. The output control of the constant value is performed by control signals S2 and S3 from the data compensation controller 10. By providing the first constant value generator 3a, the value placed (added) to the 16th to 23rd bits of the data bus 13 (the upper 8 bits above the 16-bit output of the arithmetic unit 4) can be changed. It is possible to select any fixed value or a constant value such as “0”. In addition, since the second constant value generator 3b is provided, the second register 2 does not need to be a 16-bit register, and a small 8-bit register can be used as the second register 2.
[0035]
FIG. 5 is a circuit configuration diagram of the arithmetic unit 4. The data input component is omitted. The arithmetic unit 4 outputs data C0 to C31, which are operation results, to the data bus 13. The output control signals F and G control whether or not to output data C0 to C15 and data C16 to C31, respectively. Specifically, switching is performed between outputting only the lower 16 bits of the data C0 to C15 and outputting all 32 bits of the data C0 to C31.
[0036]
FIG. 6 is a circuit configuration diagram of the processor status register 5. The processor status register 5 receives data A0 to A7 from the data bus 11 and outputs data M0 and M1. The data M0 and M1 are output signals of the register 5 corresponding to the data A4 and A5. Hereinafter, these data M0 and M1 are referred to as mode flags M0 and M1.
[0037]
FIG. 7 is a circuit diagram showing the four general-purpose registers 1A to 1D and the register selection / write device 9. The register selection / write device 9 receives a write signal, a register selection signal (a signal indicating one of the general-purpose registers 1A to 1D), and a size signal (a signal for distinguishing between 8 bits, 16 bits, and 32 bits). Then, write signals D and E (the same as the signals described in FIG. 2) are output to the selected general-purpose register.
[0038]
FIG. 8 is a circuit diagram showing a relationship between the data compensation control device 10, the second register 2, and the first and second constant value generators 3a and 3b. The data supplement control device 10 receives the mode flags M0 and M1, a register selection signal (similar to the description in FIG. 7), and a size signal (similar to the description in FIG. 7), and outputs the second register 2 and the second register 2. First, selection control of the second constant value generators 3a and 3b is performed. Specific contents will be described later.
[0039]
Next, the operation of the central processing unit will be described by taking as an example a case where the operation result of the operation unit 4 is stored in the general-purpose register 1.
[0040]
The process of transferring all of the 32-bit operation results (data C0 to C31) from the arithmetic unit 4 to the general-purpose register 1 can be executed as follows. That is, since the output width of the arithmetic unit 4 is determined by the output control signals F and G, all bits of the output width of the arithmetic unit 4 are selected by the output control signals F and G. In the general-purpose register 1, all bits are written by the write signals D and E. As a result, the data C0 to C31, which are the operation results, are input to the bit positions 0 to 31 of the general-purpose register 1 via the data bus 13.
[0041]
When the lower 8 bits (data C0 to C7) of the operation result from the arithmetic unit 4 are transferred to the general-purpose register 1, the lower 16 bits (data C0 to C15) of the arithmetic unit 4 are selected by the output control signals F and G. . In the general-purpose register 1, the lower eight bits (data C0 to C7) are written by the write signals D and E. As a result, the eight bits of the operation result are input to bit positions 0 to 7 of the general-purpose register 1 via the data bus 13. In this case, no data is written to bit positions 8 to 31 of general-purpose register 1.
[0042]
Note that transferring the lower 8 bits (data C0 to C7) of the operation result from the arithmetic unit 4 to the general-purpose register 1 is equivalent to storing data less than the bit length of the general-purpose register 1 in the general-purpose register 1. However, in this embodiment, the data in the second register 2 of the present invention is not transferred to the general-purpose register 1 in the case of lower 8 bits transfer.
[0043]
When the lower 16 bits (data C0 to C15) of the operation result are transferred from the arithmetic unit 4 to the general-purpose register 1, the lower 16 bits (data C0 to C15) of the arithmetic unit 4 are selected by the output control signals F and G. Unlike the case of the transfer of the lower 8 bits described above, the general-purpose register 1 writes all 32 bits (data C0 to C31) by the write signals D and E. Then, according to the control signals S1, S2, S3, either the data C16 to C23 of the second register 2 or the data C16 to C23 of the first constant value generator 3a is output, and the second constant value generator 3b Are output. As a result, the operation result of the arithmetic unit 4 is stored as the data C0 to C15 of the general-purpose register 1, and the data of the second register 2 and the like are stored as the data C16 to C31 of the general-purpose register 1.
[0044]
As described above, the control signal S is output from the data compensation control device 10 based on the mode flags M0 and M1, the register selection signal, and the size signal. FIG. 9 shows a mode of permission / prohibition of output of the second register 2 and the like based on the mode flags M0 and M1, the register selection signal, and the size signal, not the content of the control signal S itself.
[0045]
As described above, when 16-bit data that is less than the bit length (32 bits) of the general-purpose register 1 is stored in the general-purpose register 1 (the determination can be made by the size signal), the unsatisfied upper side of the general-purpose register 1 The 8-bit data C16 to C23 are provided from the second register 2 at the 16-bit position. The process of storing the data C16 to C23 of the second register 2 in the upper side (the 16th to 23rd bits) of the general-purpose register 1 is the same as the process of storing data in the lower 16 bits of the general-purpose register 1. Can be done simultaneously. In this processing, since the output portion of the second register 2 is connected to 8 bits (portion to which the data C16 to C23 are to be input) of the upper 16 bits of the general-purpose register 1, The above-described write signal or the like can be generated by an instruction to transfer the data of the second register 2 and the output of the first constant value generator 3a to the general-purpose register 1.
[0046]
As shown in FIG. 9, among the plurality of general-purpose registers 1A to 1D, between the general-purpose register 1B and the other general-purpose registers 1A, 1C, 1D, a second mode flag M0, M1 is used. The selection mode of the data of the register 2 (DBR in FIG. 9) and the data of the first constant value generator 3a are different.
[0047]
Specifically, when (M1, M0) is (0, 1), the general-purpose register 1B outputs data of the first constant value generator 3a without outputting data of the second register 2. The general-purpose registers 1A, 1C, and 1D other than the general-purpose register 1B are configured to output the data of the second register 2 without outputting the data of the first constant value generator 3a. Accordingly, when a plurality of general-purpose registers 1A to 1D are provided, it is possible to cope with a register usage rule for selectively using each register.
[0048]
As described above, 32-bit data is always stored in the general-purpose register 1 in 32 bits, and 8-bit data is always stored in the general-purpose register 1 in 8 bits. On the other hand, 16-bit data is always stored in the general-purpose register 1 as 32-bit data obtained by expanding the upper 16 bits. The extension portion is a content of the second register 2 (bank register) or a constant such as "00h", and the content reflects a difference between the registers due to the mode flag and the register number. ing. Therefore, even when register indirect addressing uses register contents stored as 16-bit data, the same processing as that for 32-bit data can be performed.
[0049]
(Embodiment 2)
The data in the second register 2 can be used as bank data in direct addressing. Direct addressing is addressing in which an address used for accessing an operand on an external memory is directly described in a program. For example, in the case of a central processing unit having a 24-bit address space, the address of the lower 16 bits may be directly specified by a program, and the upper 8 bits may be addressed using the contents of the data bank register DBR. In order to perform such processing in the central processing unit of the present invention, which is an upward compatible machine, the upper 8 bits of the address are used as the contents (fixed value) of the second register 2 functioning as the data bank register DBR, or Whether to use the constant value of the first constant value generator 3a (for example, "00h") is determined by the state of the mode flags M0 and M1, and whether the value is a fixed value or a constant value depending on the state of the mode flags M0 and M1. Is the same as the transfer data selection pattern (see FIG. 9) for the general-purpose register 1 in the case of direct addressing and in the case of indirect addressing.
[0050]
As described above, in the direct addressing, the second register 2 and the first constant value generator 3a are selected by the mode setting. Therefore, even when the constant value is used, the data in the second register is rewritten one by one to the constant value. No need. Furthermore, since the decision pattern is the same between when bank data is generated and when data is stored in the general-purpose register 1, the bank values match between indirect addressing and direct addressing.
[0051]
(Embodiment 3)
In the first embodiment, it is described that at the time of an operation of storing data less than the bit length of general-purpose register 1 in general-purpose register 1, data to be stored in a bit position of general-purpose register 1 that is not satisfied is set in second register 2. However, the setting in the second register 2 may be performed only in a specific case as in the case of a 16-bit size operation.
[0052]
Here, there are two (or more than two) of 8-bit size and 16-bit size as the data size of the operation for which the high-order data of the 32-bit general-purpose register 1 cannot be obtained. The required operation may be only one of the two sizes. For example, the address operation is only 16 bits.
[0053]
In operations other than such an address operation (operations that do not require a fixed value), the upper data of the general-purpose register 1 is not set in the second register 2 so that the upper 16-bit data of the general-purpose register 1 is The previous value can be left, and the previous value can be used.
[0054]
Further, since it is not efficient to use only the lower 8 bits of the general-purpose register 1 having a 32-bit size, it is desirable that the lower 16 bits of the general-purpose register 1 can be used as two unique 8-bit registers.
[0055]
FIG. 10 includes four registers L0 to L3 as the general-purpose register 1. The 16-bit register portions W0 and W1 of the registers L0 and L1 are divided into two, and the 8-bit register portions R0, R2, and The case where the bit register portions are R1 and R3 is shown.
[0056]
FIG. 11 is a circuit diagram showing a configuration for causing the 8-bit register portions R0 and R1 to function as unique 8-bit registers. As can be seen from this figure, data of data C0 to C7 at bit positions 0 to 7 of the data bus 13 can be written in the 8-bit register portions R0 and R2 (or R1 and R3). Also, the output of the 8-bit register portion R0, R2 (or R1, R3) is output as data A0 to A7 (or B0 to B7) using the lines at bit positions 0 to 7 of the data buses 11, 12. ing.
[0057]
As described above, when not using all the bits of the general-purpose register 1 having a 32-bit size, the lower 16 bits of the general-purpose register 1 are divided and used, so that the general-purpose register 1 can be used efficiently.
[0058]
(Embodiment 4)
In this embodiment, at the time of an operation of storing data less than the bit length of general-purpose register 1 in general-purpose register 1, an update for setting data to be stored in a bit position of general-purpose register 1 that is not satisfied by second register 2. The fact that the central processing unit has instructions will be described. It should be noted that the presence or absence and content of the update are based on the mode settings M0 and M1 of the processor status register (PSR) 5. When the general-purpose register 1 includes a plurality of registers, the general-purpose register 1 may be different depending on the register number. For example, as described in the first embodiment, the register 1B is different from the other registers 1A, 1C, and 1D.
[0059]
FIG. 12 is a flowchart showing the processing contents by the update instruction when the general-purpose register 1 is composed of n registers. First, a process of i = 0 is performed as an initial setting (step 1). i corresponds to the register number to be processed. Next, the processing of i = n is performed (step 2). That is, it is determined whether the processing has been completed for all the registers. If i = n, the process ends. On the other hand, if i = n, the processing of list = list >> 1 is performed (step 3).
[0060]
The list is information given by the instruction, and is information indicating whether or not each register is updated. If n = 4, the list is composed of 4 bits. The 0-th bit of the 4-bit list is associated with the 0-th register, the first bit is associated with the first register, and so on. "0" is not updated, but "1" is updated. Means each.
[0061]
Next, it is determined whether the shift-out bit is "0" or "1" (step 4). Therefore, the processing of list = list >> 1 in step 3 above, that is, the processing of right-shifting the 4-bit list by one bit is performed, and in this step 4, it is determined whether the shift-out bit is “0” or “1”. Thus, it is determined whether or not to update the i-th register.
[0062]
When the shift-out bit is "1", the update processing of the i-th register is performed (step 5). In this updating process, first, the data of the i-th register is input to the arithmetic unit 4 via the data bus 11 or the data bus 12. Then, the arithmetic unit 4 performs addition with “0” and outputs the addition result to the data bus 13. At this time, the size signal is a signal indicating a 16-bit size, and therefore, the upper 16-bit data C16 to C31 of the data bus 13 is transmitted to the second register 2 or the first constant value generator 3a. The contents are the contents of the second constant value generator 3b. This means that the register has been updated. Note that a specific mode of the update is performed, for example, according to the contents of FIG. 9 described in the first embodiment.
[0063]
On the other hand, when the shift-out bit is “1”, the update process is not performed on the i-th register, and the process proceeds to step 6. In step 6, the processing of i = i + 1 is performed to perform the processing for the next register. Then, the process proceeds to step 2. When the process is repeated for the number of registers, i = n in step 2, and the process ends.
[0064]
【The invention's effect】
As described above, according to the present invention, when a central processing unit of an upper compatible machine with an expanded register size and the central processing unit of a lower machine performs addressing with a bank register, This makes it possible to make the addressing compatible without the central processing unit having the addressing of the subordinate machine.
[Brief description of the drawings]
FIG. 1 is a schematic configuration diagram of a central processing unit of the present invention.
FIG. 2 is a block diagram illustrating a general-purpose register and a write signal generator according to the present invention.
FIG. 3 is a circuit configuration diagram of a second register of the present invention.
FIG. 4A is a schematic configuration diagram of a first constant value generator of the present invention, and FIG. 4B is a schematic configuration diagram of a second constant value generator.
FIG. 5 is a schematic configuration diagram of an arithmetic unit according to the present invention.
FIG. 6 is a schematic configuration diagram of a processor status register of the present invention.
FIG. 7 is a schematic configuration diagram showing a first register including a plurality of registers and a control device thereof according to the present invention.
FIG. 8 is a schematic configuration diagram showing a data compensation control device of the present invention.
FIG. 9 is a diagram illustrating the operation of the data compensation control device of FIG. 8;
FIG. 10 is an explanatory diagram showing an example of division of a first register of the present invention.
11 is a schematic configuration diagram of a first register realizing the division example of FIG. 10;
FIG. 12 is a flowchart illustrating an instruction of the present invention.
[Explanation of symbols]
1 General-purpose register (first register)
2 Second register
3a first constant value generator
3b Second constant value generator
4 arithmetic unit
5 Processor status register
6 Write signal generator
9 Register selection writing device
10 Data compensation controller

Claims (4)

レジスタをポインタとして用いてアドレッシングする中央演算装置において、複数の汎用レジスタからなる第1のレジスタと、データバンクレジスタとなる第2のレジスタと、定数値を発生する第1の定数値発生器と、モードを設定するモードフラグとを備え、前記モードフラグによる第1のレジスタへの選択的なデータ付与の設定が、前記複数のレジスタのうちの特定のレジスタと他のレジスタとで異なるように構成されるとともに、前記第1のレジスタのビットサイズに満たないデータを第1のレジスタに格納するときに、前記モードフラグに基づき、第1のレジスタ中の満たされないビット位置に前記第2のレジスタ又は第1の定数値発生器から選択的にデータが与えられるように構成されたことを特徴とする中央演算処理装置。 In a central processing unit for addressing using a register as a pointer, a first register including a plurality of general-purpose registers, a second register serving as a data bank register, a first constant value generator for generating a constant value, e Bei a mode flag to set the mode, selective data providing settings to the first register by the mode flag is differently composed and certain registers and other registers of the plurality of registers And when storing data less than the bit size of the first register in the first register, the second register or the second register is placed in an unfilled bit position in the first register based on the mode flag. A central processing unit configured to selectively receive data from a first constant value generator. 第2のレジスタのデータがダイレクトアドレッシング時にバンクアドレスとして用いられるように構成されていることを特徴とする請求項1に記載の中央演算処理装置。2. The central processing unit according to claim 1, wherein data of the second register is used as a bank address at the time of direct addressing. 第2のレジスタのデータがダイレクトアドレッシング時にバンクアドレスとして用いられるとともに、前記モードフラグに基づき、第2のレジスタ又は第1の定数値発生器から選択的にバンク値としてデータが与えられ、且つこの選択パターンが第1のレジスタにデータが格納されるときのパターンと同一とされたことを特徴とする請求項1に記載の中央演算処理装置。The data of the second register is used as a bank address at the time of direct addressing, and the data is selectively supplied as a bank value from the second register or the first constant value generator based on the mode flag. 2. The central processing unit according to claim 1, wherein the pattern is the same as the pattern when data is stored in the first register. 前記第1のレジスタ中の満たされるビット部分が分割されて独自のレジスタ部分を構成していることを特徴とする請求項1に記載の中央演算処理装置。2. The central processing unit according to claim 1, wherein the bit portion to be filled in the first register is divided to form a unique register portion.
JP17795396A 1995-07-17 1996-07-08 Central processing unit Expired - Lifetime JP3541863B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP17795396A JP3541863B2 (en) 1995-07-17 1996-07-08 Central processing unit

Applications Claiming Priority (5)

Application Number Priority Date Filing Date Title
JP17997295 1995-07-17
JP8-141470 1996-06-04
JP7-179972 1996-06-04
JP14147096 1996-06-04
JP17795396A JP3541863B2 (en) 1995-07-17 1996-07-08 Central processing unit

Publications (2)

Publication Number Publication Date
JPH1055304A JPH1055304A (en) 1998-02-24
JP3541863B2 true JP3541863B2 (en) 2004-07-14

Family

ID=27318256

Family Applications (1)

Application Number Title Priority Date Filing Date
JP17795396A Expired - Lifetime JP3541863B2 (en) 1995-07-17 1996-07-08 Central processing unit

Country Status (1)

Country Link
JP (1) JP3541863B2 (en)

Also Published As

Publication number Publication date
JPH1055304A (en) 1998-02-24

Similar Documents

Publication Publication Date Title
KR100227277B1 (en) Computer methods for writing a sclar value to a vector
JPS5975347A (en) Simulation device of logical circuit
JP2001504959A (en) 8-bit microcontroller with RISC architecture
JP3616402B2 (en) Data processing system and method for providing extensible registers
JPH0916462A (en) Apparatus and method for data processing
JPH1049369A (en) Data processor
EP0338317B1 (en) Information processor operative both in direct mapping and in bank mapping and the method of switching the mapping schemes
JP2551167B2 (en) Microcomputer
JP3705811B2 (en) Microcontroller with reconfigurable program status word
US6266756B1 (en) Central processing unit compatible with bank register CPU
JP3541863B2 (en) Central processing unit
JP2000194551A (en) Flash memory rewriting circuit
JP2002099498A (en) Program performance device and program development support device
JP2703884B2 (en) Data write control method
JPH0192851A (en) Switching device for address space
EP0864983A2 (en) Computer system including memory adress management circuit for protecting memory from illegal writing
JPS6148174B2 (en)
JPS6410854B2 (en)
JPS5821300B2 (en) Memory address information
JP2003196087A (en) Memory addressing system of microcontroller and page mapping device
JP3696626B2 (en) Data-driven information processing device
JP3488059B2 (en) Interrupt address extension circuit
JPH0310323A (en) Microprocessor
JPH0531170B2 (en)
JPH0545978B2 (en)

Legal Events

Date Code Title Description
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: 20040309

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20040323

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20080409

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20090409

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20100409

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20100409

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20110409

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20120409

Year of fee payment: 8

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

Free format text: PAYMENT UNTIL: 20130409

Year of fee payment: 9

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

Free format text: PAYMENT UNTIL: 20140409

Year of fee payment: 10

EXPY Cancellation because of completion of term