JP3643270B2 - Data processing device - Google Patents
Data processing device Download PDFInfo
- Publication number
- JP3643270B2 JP3643270B2 JP24169599A JP24169599A JP3643270B2 JP 3643270 B2 JP3643270 B2 JP 3643270B2 JP 24169599 A JP24169599 A JP 24169599A JP 24169599 A JP24169599 A JP 24169599A JP 3643270 B2 JP3643270 B2 JP 3643270B2
- Authority
- JP
- Japan
- Prior art keywords
- byte
- instruction
- bit
- data
- register
- 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
Links
Images
Landscapes
- Executing Machine-Instructions (AREA)
Description
【0001】
【発明の属する技術分野】
本発明はバイト極性の異なるフォーマットのデータの処理を容易に行えるデータ処理装置に関するものである。
【0002】
【従来の技術】
バイトごとにアドレスが付けられ、しかもバイト中のビットにも順番を示す番号が付けられたメモリ上にデータを配置するとき、データの上位側をメモリの大きなアドレス側に配置するか小さなアドレス側に配置するかに関しては従来より多くの議論がなされてきた。
データの上位側をメモリの大きなアドレスに配置し、データの下位側をメモリの小さなアドレスに配置する方法はリトルエンディアンと称され、データの上位側をメモリの小さなアドレスに配置し、データの下位側をメモリの大きなアドレスに配置する方法はビッグエンディアンと称される。
【0003】
近年のデータ処理装置ではメモリのアドレスは8ビットを1バイトとしてバイト毎に付けられているのが一般的である。しかし、ビットマップディスプレイやバイトの整数倍でないビット長のビットフィールドを扱う場合にはバイトアドレス以外にビットの位置も示すビットアドレスも必要となり、ビットアドレスに付いてもリトルエンディアンとビッグエンディアンの概念が存在する。バイトとビットがリトルエンディアンかビッグエンディアンかを示すバイト極性とビット極性とは必ずしも一致している必要はない。リトルエンディアンがよいかビッグエンディアンがよいか、あるいは従来のデータ処理装置がどちらを採用しているかについては D. Cohen, "On Holy Wars and a Plea for Peace," Computer, Vol. 14, NO.10, Oct. 1981, pp. 48-54.で詳しく述べられている。
【0004】
【発明が解決しようとする課題】
リトルエンディアン、ビッグエンディアンの問題はメモリ上のバイトやビットのアドレスについてだけでなく、レジスタ上のバイトやビットの位置についても存在する。
バイト極性とビット極性がともにビッグエンディアンであるデータ処理装置でレジスタのバイト長より短いバイト長のデータをレジスタに格納する場合、メモリ上に格納する場合と同様に、アドレスの小さい側に寄せて格納する例を第2図に示す。
【0005】
この場合、レジスタ上のデータサイズには拘らずビット位置を示すビットアドレスが同じになるが、2つのレジスタに格納されたデータサイズが異なる2進数データ間で加算などの算術演算を行う場合には、データの最下位ビットが揃っていないため問題となる。算術演算ではデータの最下位ビットを揃えて演算する必要があり、この場合サイズの短い方のデータを右方向に算術シフトしてサイズの大きいほうのデータと最下位ビット位置を揃えてから演算する必要がある。この算術シフトを行うハードウエアをレジスタ入出力部やALU入出力部にもてばデータ処理装置のハードウエアが増大するという問題点がある。また機械語命令やマイクロプログラムで行えば演算速度が低下するという問題点がある。
【0006】
米国モトローラ社製のマイクロプロセッサMC68000 シリーズでは第3図に示すようにバイト極性をビッグエンディアンにしてビット極性をリトルエンディアンにすることによりこの問題を避けている。しかしこの場合、ビット極性とバイト極性が異なるため、バイト列とビット列とを扱う場合にデータのアドレス計算順序を逆にする必要があるなどして、ソフトウエア設計の負担が大きいという問題がある。
バイト極性とビット極性とをともにリトルエンディアンにすると異種サイズオペランド間演算に対する問題はなくなるが、BCD 数やストリングスデータを扱うときのリトルエンディアン特有の問題が残る。リトルエンディアン特有の問題については上記のD. Cohenの論文に詳しく述べられている。
【0007】
また、バイト極性の異なるフォーマットのデータ処理装置を同一システムに組み込む場合にはそれらの装置間の結合バスが複雑になる問題点がある。なお、バイト極性の異なるデータ処理装置を結合する具体例は、H.Kirrmann, "Data Format and Bus Compatibility in Multiprocessors", IEEE Micro August 1983, pp.32-47. で述べられている。
【0008】
本発明は上記のような問題点を解決するためになされたもので、異なるバイトバイト極性でデータを扱う他のデータ処理装置に対するデータを容易に扱うことができるデータ処理装置を得ることを目的とする。
【0009】
【課題を解決するための手段】
本発明のデータ処理装置は、一つの2進数の値を表現する8Nビットのデータ(Nは4以上の整数)が、その連結するN個のバイトが当該データの下位桁の側であるほどバイト毎にアドレス付けされたメモリの大きいアドレスに配置されるビッグエンディアン、及び当該N個のバイトが当該データの上位桁の側であるほどバイト毎にアドレス付けされたメモリの大きいアドレスに配置されるリトルエンディアンのいずれか一方のバイト極性によって取り扱われる。命令デコード機構によりデコードされる複数の命令は、一つの2進数の値を表現する8Nビットのデータを指定するソースオペランド指定部分とバイトの配列順序を逆転する処理を指定する第1のオペコード部分とを有するバイトリバース命令、および二つのレジスタを指定する第一のオペランド指定部分および第二のオペランド指定部分と、加算演算を行う処理を指定する第2のオペコード部分とを有する加算命令を含む。実行機構は、各々8Nビット幅の複数のレジスタを含んだレジスタファイル、第1、第2および第3のバス、この第1および第2のバスに接続され、バイトリバース命令に対応する制御情報に従い、バイトリバース命令で指定された8Nビットのデータを第1のバスを介して入力し、その連結するN個のバイトの配列順序を逆転する処理を実行し、その逆転した8Nビットのデータが第2のバスを介して転送され複数のレジスタのうちの一つに格納されるバイト順序逆転回路、および、第1ないし第3のバスに接続され、前記第1および第2のバスの間では前記バイト順序逆転回路と並列に接続され、加算命令に対応する制御情報に従い、加算命令で指定された二つのレジスタからそれぞれ第1および第3のバスを介して読み出した二つの8Nビットのデータを読み出して加算し、その加算結果を第2のバスに出力するALUを有する。加算命令により指定される二つのレジスタはレジスタファイル内のものであり、加算命令はその指定される二つのレジスタの一方として逆転した8Nビットのデータが格納されるレジスタを指定することができる。
【0010】
【発明の実施の形態】
以下、本発明の実施の形態を図面を参照して説明する。
なお、本発明装置については本願出願人の出願に係る発明の名称「データ処理装置」(特願昭62−247418号)に詳細に説明されている。
【0011】
まず本発明のデータ処理装置では、データのバイト極性、ビット極性ともにビッグエンディアンを採用している。第1図に示すようにレジスタ上にレジスタのバイト長より小さいサイズのバイト長のデータを配置する場合には、そのデータのレジスタ上でのビット番号をずらせて、サイズによらず最下位ビットを揃えてデータを格納する。そしてレジスタ上のデータのビット位置を示す場合には命令により示されたデータサイズとビット番号とをもとにしてレジスタ上のデータに対するビット位置をサイズが8ビットでビット番号8より小さい番号nのときと、サイズが16ビットでビット番号がn+8のときと、サイズが32ビットでビット番号がn+24のときに同じレジスタビット位置が決定される。
【0012】
第4図に本発明のデータ処理装置における全体構成のブロック図を示す。
第4図において、(1)はアドレスバス(8)を通じてアドレスをメモリ(10)に送出して命令をメモリ(10)からデータバス(9)を通してフェッチする命令フェッチ部である。
(2)は命令フェッチ部(1) より命令を受取り、それをデコードしてその命令の実行に必要な情報を出力する命令デコード部である。
【0013】
(3)は命令デコード部(2) から出力されたマイクロプログラムエントリアドレスあるいは汎用レジスタ番号、オペランド、データサイズなどの情報をもとに、マイクロROM(7)に格納され、その命令を実行するマイクロプログラムの先頭番地を示すマイクロプログラムエントリアドレスをマイクロプログラムカウンタ(6)に出力し、マイクロプログラムカウンタ(6)によって次々に指示されるアドレスによりマイクロROM(7)から出力されたマイクロ命令と命令デコード部(2)から出力された他の情報とにより命令実行部(5)を制御して命令を実行する命令実行制御部である。
(4)は命令実行に際して必要になるオペランドがメモリ(10)にある時に、そのアドレスをアドレスバス(8)に出力してデータバス(9)を通してオペランドをフェッチし、あるいはオペランドをメモリ(10)に格納する必要があるときに、そのアドレスをアドレスバス(8)に出力し、またオペランドをデータバス(9)に出力するオペランドアクセス部である。
【0014】
第5図は第4図に示した命令実行部(5)の詳細を示すブロック図である。
(11)はオペランドとなるデータを格納するレジスタファイルである。
(12),(13),(14),(15)はそれぞれ演算装置である。なお、(12)は2つの2進数の加算などの算術演算及び2つのビット列の論理積などの論理演算を行うALUである。
(16),(17)はデータサイズがALU(12)のそれより小さいデータをALUに入力するときに、そのサイズをALU(12)が扱うデータサイズにゼロ拡張または符号拡張する拡張回路である。
(13)はデータを1度に複数ビット右あるいは左にシフトするバレルシフタである。
(14)はバイト列のバイトの配列順序を逆転させるバイト順逆転回路、(15)はビット列のビット順を逆転させるビット順逆転回路である。
(18),(19),(20)はレジスタファイル(11)と演算装置(12),(13),(14),(15)とをそれぞれ結合するそれぞれS1バス、S2バス、Dバスである。
レジスタファイル(11)はバス(18),(19),(20)を介してALU(12)などの演算器(12),(13),(14),(15)に32ビット並列に結合している。レジスタファイル(11)のビット格納位置とALU(12)の入出力ビット位置とは1対1に対応している。
【0015】
第6図は第5図に示したレジスタファイル(11)の詳細構造を示すブロック図である。
(21),(22),(23)はそれぞれレジスタのビット位置0から15まで、16から23まで、24から31までのデータを格納する回路である。
(24)はレジスタファイル(11)に入力すべきデータのサイズと入力すべきレジスタのレジスタ番号により必要なデータ格納位置の入力回路を制御してデータ格納するレジスタ入力制御回路である。
(25)はレジスタファイル(11)からバスごとに出力すべきデータを格納しているレジスタのレジスタ番号を入力してレジスタ中のデータをS1バス(18)、S2バス(19)に出力制御するレジスタ出力制御回路である。
【0016】
なお第6図の破線にて囲まれた部分(26)はレジスタファイル(11)中に32個あり本発明のデータ処理装置のマイクロプログラムではそれぞれをR0からR31として区別できる。
【0017】
第7図は第5図に示したバイト順逆転回路(14)の詳細構成を示すブロック図である。
この回路ではS2バス(19)から入力された4バイトのデータをBYIレジスタRBYIに入れ、8本づつまとめて交差する配線によりそのバイトの配列順序を逆転したデータをBYOレジスタRBY0に移し、BYOレジスタRBYOの値をDバス(20)に出力する。
【0018】
第8図は第5図に示したビット順逆転回路(15)の詳細構成を示すブロック図である。
この回路ではS2バス(19)から入力された4バイトのデータをBIIレジスタRBIIに入れ、交差する配線によりそのビット順を逆転したデータをBIOレジスタRBI0に移し、BIOレジスタRBIOの値をDバス(20)に出力する。
【0019】
第9図は第4図の命令実行制御部(3)に含まれる一部の回路の構成を示すブロック図である。
(27)は命令で指定されたオペランドのサイズ情報とビット番号とをもとに、レジスタ上のビット位置を示す番号をS1バス(18)に出力するビット位置番号出力回路である。また(28)は定数1をS2バス(19)に出力する回路であり、S2バス(19)の最下位ビットに'1'を、他のすべてのビットには'0'を出力する。
【0020】
以下、本発明のデータ処理装置の動作について説明する。
レジスタR0に格納された32ビットの符号付き2進数とレジスタR1の中に格納された8ビットの符号付き2進数を加算して8ビットの符号付き2進数としてレジスタR1に格納する符号付き加算命令(本発明のデータ処理装置では「ADD R0.W R1.B」と表現され、命令コードのビットパタンは第10図に示す通りである)を実行する場合を例にして本発明のデータ処理装置で異種サイズオペランド間の演算を行う動作を説明する。
【0021】
命令は第4図に示す命令フェッチ部(1)でメモリ(10)よりフェッチされ、デコード部(2) でデコードされ、命令実行制御部(3) にデコード結果が渡される。命令実行制御部(3)はレジスタR0とレジスタR1を示す2つのレジスタ番地とレジスタR0に格納されているオペランドのサイズとレジスタR1に格納されているオペランドのサイズをパラメータとしてマイクロROM (7) 中に格納されている符号付き加算プログラムルーチンのエントリ番地をマイクロプログラムカウンタ(6) にセットして、マイクロ命令を読み出し符号付き加算命令を実行する。
【0022】
命令実行制御部(3)での符号付き加算命令の実行シーケンスを示すフローチャートを第11図に示す。
2つのレジスタ番号はマイクロプログラムとは独立してレジスタ出力制御回路(25)に入力され、レジスタR0中のデータはS1バス(18)を通してALU (12)に転送され、R1中のデータはS2バス(19)を通してALU(12) に転送される。この際、レジスタR1の内容は32ビット総てがS2バス(19)に出力されるが、拡張回路(17)によりS2バス(19)の下位8ビットが符号拡張されてALU(12)に入力される。また、ALU(12)では32ビットの2つの符号付き2進数の符号付き加算が行われ32ビットの符号付き2進数を出力する。このとき、ALU(12)には符号付き加算結果を格納すべきレジスタサイズが8ビットであることが同時に指示されており、加算結果が8ビット以内の2進数で表現できるかどうか、あるいは加算結果が正か負かゼロかなどに従い各種の制御フラッグがセットされる。
ALU(12)の出力32ビットはDバス(20)を通してレジスタR1に転送される。Dバス(20)で転送されてきた32ビットのデータは、レジスタ入力制御回路(24)により選ばれたレジスタR1にその下位側8ビットであるビット位置24から31に下位の8ビットのみが格納される。
【0023】
次にレジスタR0中のオペランドのビット位置3に相当するビットに'1'をセットするビットセット命令を一例として、実施例の実際の動作を説明する。
本発明のデータ処理装置では、ビットセット命令は命令コードのビットパタンは第12図に示す通りである。また、本発明のデータ処理装置ではレジスタ上のビット位置は第1図に示すようになっているのでオペランドのサイズが1バイトか2バイトか4バイトかによりこのビットセット命令はそれぞれ「BSET #3 R0.B、BSET #11 R0.H、BSET #27R0.W」と表現される。命令実行制御部(3) でのビットセット命令の実行シーケンスを第13図のフローチャートに示す。
【0024】
ビットセット命令ではレジスタのビット位置を示す番号を求めるのに第14図のビット位置番号出力回路(27)を使用する。命令実行制御部(3)ではオペランドのサイズとビット番号をビット位置番号出力回路(27)に入力してビット位置番号をS2バス(19)に出力する。ビット位置番号出力回路(27)はサイズ情報が1バイトの時は(ビット番号3+24=27)をS1バス(18)に出力し、サイズ情報が2バイトの時は(ビット番号11+16=27)をS1バス(18)に出力する。サイズ情報が4バイトの時はビット番号27をそのままS1バス(18)に出力する。
【0025】
ビット位置番号出力回路(27)から出力されたビット位置番号はS1バス(18)を通してバレルシフタ(13)のシフト数指定データとして入力される。このとき同時にS2バス(19)を通して定数'1'が被シフト数としてバレルシフタ(13)に入力される。その結果バレルシフタ(13)からはビット番号27のみが'1'でその他のビットがすべて'0'の32ビットのビットパタンが出力される。このビットパタンは一度作業用レジスタであるレジスタR16に格納される。次にALU(12)でレジスタR0とレジスタR16の内容の論理和演算が行われる。このときレジスタR0中のオペランドのバイト長により符号付き加算命令実行の場合と同様に拡張回路(17)やレジスタ入力制御回路(24)が動作する。
【0026】
次にレジスタR0中の32ビットのデータのバイトの配列順序を逆転してレジスタR1に転送するバイトリバース命令の動作を説明する。
バイトリバース命令の命令コードビットパターンを第15図に示す。命令実行制御部(3) でのバイトリバース命令の実行シーケンスを示すフローチャートを第16図に示す。
レジスタR0中の32ビットのデータがS2バス(19)を通してバイト順序逆転回路(14)のBYIレジスタRBYIに送られ、バイトの配列順序が逆転された32ビットのデータがBY0レジスタRBY0からDバス(20)を通してレジスタR1に入力される。
【0027】
次にレジスタR0中の32ビットのデータのビット順を逆転してレジスタR1に転送するビットリバース命令の動作を説明する。ビットリバース命令の命令コードビットパターンを第17図に示す。命令実行制御部(3) でのビットリバース命令の実行シーケンスのフローチャートを第18図に示す。
レジスタR0中の32ビットのデータがS2バス(19)を通してビット順序逆転回路(15)のBIIレジスタRBIIに送られ、ビット順が逆転された32ビットのデータがBI0レジスタRBI0からDバス(20)を通してレジスタR1に入力される。
【0028】
上記実施例ではレジスタ中のビット位置番号を求める際にハードウエアを用いて求める例を示したが、オペランドのバイト長ごとにマイクロプログラムを別々に用意し、マイクロプログラムによりビット番号を補正してビット位置を求めてもよい。
【0029】
また、上記実施例ではレジスタ上のオペランドどうしの符号付き加算命令を例にとり、異種サイズのオペランド間の演算機能を述べたが、その他加減乗除の四則演算のすべてで同様の方法により異種サイズオペランド間の演算ができる。
【0030】
また、上記実施例ではバイトリバース命令とビットリバース命令とを32ビットのデータについてのみ説明したが、上記実施例のバイト順逆転回路(14)あるいはビット順逆転回路 (15)での演算とバレルシフタ(13)の演算とを組み合わせればマイクロプログラムにより他のサイズのデータに対してもバイトリバース命令やビットリバース命令を実行することができる。また、ALU(12)あるいはバレルシフタ(13)と作業用レジスタのみを用いてマイクロプログラムでこの2つの命令を実行しても同様の効果が得られる。
【0031】
【発明の効果】
以上のように本発明のデータ処理装置では、バイトリバース命令を実行して一つの2進数の値を表現する8Nビットのデータの連結するN個のバイトの配列順序を逆転することにより、変換前のデータはデータ処理装置自身のバイト極性とは異なるバイト極性により取り扱えるデータに変換される。加算命令により加算が実行されるが、加算命令はオペランドとして指定する二つのレジスタの一方として、バイトリバース命令によって変換されたデータが格納されるレジスタを指定することができるので、データ処理装置自身のバイト極性とは異なるバイト極性で規定されるデータを用いて加算をする場合には、正しい値に変換して加算を実行することができる。特にプログラム設計者は一つの命令で正しい値を表現するデータを変換できるためプログラムの設計に負担をかからないから、ソフトウェア開発のコストを低減できるデータ処理装置を実現することができる。
【図面の簡単な説明】
【図1】 本発明のデータ処理装置の4バイトのバイト長のレジスタ上に1バイト、2バイト、4バイトのデータを格納したときの各データの格納位置とビット番号を示した模式図である。
【図2】 バイト極性とビット極性がともにビッグエンディアンであるデータ処理装置でレジスタのバイト長より短いバイト長のデータをレジスタに格納する場合に、アドレスの小さい側に寄せて格納する例を示す模式図である。
【図3】 バイト極性をビッグエンディアンにしてビット極性をリトルエンディアンにした場合の模式図である。
【図4】 本発明装置の全体構成を示すブロック図である。
【図5】 命令実行部の構成を示すブロック図である。
【図6】 レジスタファイルの構成を示すブロック図である。
【図7】 バイト順逆転回路の構成を示すブロック図である。
【図8】 ビット順逆転回路の構成を示すブロック図である。
【図9】 命令実行制御部の一部の構成を示すブロック図である。
【図10】 本発明装置の符号付き加算命令のビットパターンを示す模式図である。
【図11】 符号付き加算命令の実行シーケンスを示すフローチャート図である。
【図12】 命令コードのビットパターンの模式図である。
【図13】 ビットセット命令の実行シーケンスを示すフローチャート図である。
【図14】 ビット位置番号出力回路の構成を示す回路図である。
【図15】 バイトリバース命令の命令コードビットパタンを示す模式図である。
【図16】 バイトリバース命令の実行シーケンスを示すフローチャートである。
【図17】 ビットリバース命令の命令コードビットパタンを示す模式図である。
【図18】 ビットリバース命令の実行シーケンスを示すフローチャート図である。
【符号の説明】
RBYI・・BYIレジスタ、RBYO・・BYOレジスタ、RBII・・BIIレジスタ、RBIO・・BIOレジスタ、1・・命令フェッチ部、2・・命令アクセス部、3・・命令実行制御部、4・・オペランアクセス部、5・・命令実行部、6・・マイクロプログラムカウンタ、7・・マイクロROM、11・・レジスタファイル、12・・ALU、13・・バレルシフタ、14・・バイト順逆転回路、15・・ビット順逆転回路
なお、図中同一符号は同一または相当部分を示す。[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a data processing apparatus capable of easily processing data in formats having different byte polarities.
[0002]
[Prior art]
When placing data on a memory where an address is assigned to each byte, and the bits in the byte are also numbered to indicate the order, the upper side of the data is placed on the larger address side of the memory or on the smaller address side. Many discussions have been made on whether to arrange them.
The method of placing the upper side of data at a large address in the memory and placing the lower side of data at a small address in the memory is called little endian. The upper side of data is placed at a small address in the memory, and the lower side of the data The method of arranging the memory at a large address in the memory is called big endian.
[0003]
In recent data processing apparatuses, the memory address is generally assigned to each byte with 8 bits as 1 byte. However, when handling a bit display with a bit length that is not an integer multiple of bytes, a bit address indicating the bit position is required in addition to the byte address, and the concept of little endian and big endian is attached to the bit address. Exists. The byte polarity indicating whether the byte and the bit are little endian or big endian and the bit polarity do not necessarily have to coincide with each other. D. Cohen, "On Holy Wars and a Plea for Peace," Computer, Vol. 14, NO.10, as to whether little endian or big endian is preferred , Oct. 1981, pp. 48-54.
[0004]
[Problems to be solved by the invention]
Little-endian and big-endian problems exist not only for byte and bit addresses in memory, but also for byte and bit positions on registers.
When data with a byte length and bit polarity both big endian is stored in a register with a byte length shorter than the byte length of the register, the data is stored closer to the smaller address as in the memory. An example of this is shown in FIG.
[0005]
In this case, the bit address indicating the bit position is the same regardless of the data size on the register, but when performing arithmetic operations such as addition between binary data having different data sizes stored in the two registers. This is a problem because the least significant bits of the data are not complete. Arithmetic operations require that the least significant bit of the data be aligned, and in this case, the shorter data is arithmetically shifted to the right to perform the operation after aligning the larger data with the least significant bit position. There is a need. If the hardware for performing this arithmetic shift is connected to the register input / output unit or the ALU input / output unit, the hardware of the data processing apparatus increases. Further, there is a problem that the operation speed is reduced if machine language instructions or microprograms are used.
[0006]
In the microprocessor MC68000 series manufactured by Motorola, USA, this problem is avoided by setting the byte polarity to little endian and the bit polarity to little endian as shown in FIG. However, in this case, since the bit polarity and the byte polarity are different, there is a problem that the burden of software design is heavy, for example, when the byte sequence and the bit sequence are handled, it is necessary to reverse the data address calculation order.
If both byte polarity and bit polarity are set to little endian, there is no problem with operations between different-size operands, but problems specific to little endian when handling BCD numbers and string data remain. The little endian-specific issues are detailed in the above D. Cohen paper.
[0007]
Further, when data processing devices having different byte polarities are incorporated in the same system, there is a problem that a coupling bus between these devices becomes complicated. A specific example of combining data processing devices having different byte polarities is described in H. Kirrmann, “Data Format and Bus Compatibility in Multiprocessors”, IEEE Micro August 1983, pp. 32-47.
[0008]
The present invention has been made to solve the above-described problems, and an object of the present invention is to provide a data processing device that can easily handle data for other data processing devices that handle data with different byte-byte polarities. To do.
[0009]
[Means for Solving the Problems]
According to the data processing device of the present invention, 8N-bit data (N is an integer of 4 or more) representing one binary value, the N bytes to be concatenated are closer to the lower digit side of the data. Big endian placed at the large address of the memory addressed every time, and Little placed at the larger address of the memory addressed per byte as the N bytes are on the higher digit side of the data Handled by the byte polarity of either endian. A plurality of instructions decoded by the instruction decoding mechanism includes a source operand designation part for designating 8N-bit data representing one binary value, and a first opcode part for designating processing for reversing the byte order. byte reverse instructions having, and includes a first operand specified portion and a second operand specifying part which specifies the two registers, the addition instruction and a second opcode portion specifying a process for performing addition operation. The execution mechanism is connected to the register file including a plurality of registers each having a width of 8N bits, the first, second and third buses, and the first and second buses, and according to control information corresponding to the byte reverse instruction. The 8N-bit data designated by the byte reverse instruction is input via the first bus, and the process of reversing the arrangement order of the N bytes to be connected is executed. A byte order reversing circuit that is transferred through two buses and stored in one of a plurality of registers, and is connected to first to third buses, and is connected between the first and second buses. is connected in parallel with the byte order reversal circuit, in accordance with control information corresponding to the add instruction, the two read through the first and third bus from each of two registers specified by the
[0010]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
The device of the present invention is described in detail in the name of the invention “data processing device” (Japanese Patent Application No. 62-247418) according to the application of the present applicant.
[0011]
First, the data processing apparatus of the present invention employs big endian for both the byte polarity and bit polarity of data. As shown in Fig. 1, when data with a byte length smaller than the register byte length is placed on the register, the bit number on the register of the data is shifted, and the least significant bit is set regardless of the size. Store the data in alignment. When the bit position of data on the register is indicated, the bit position for the data on the register is set to 8 bits in size n smaller than
[0012]
FIG. 4 is a block diagram showing the overall configuration of the data processing apparatus according to the present invention.
In FIG. 4, (1) is an instruction fetch unit which sends an address to the memory (10) through the address bus (8) and fetches an instruction from the memory (10) through the data bus (9).
(2) is an instruction decode unit that receives an instruction from the instruction fetch unit (1), decodes it, and outputs information necessary for executing the instruction.
[0013]
(3) is stored in the micro ROM (7) based on information such as the microprogram entry address or general-purpose register number, operand, and data size output from the instruction decode unit (2) and executes the instruction. A microprogram entry address indicating the start address of the program is output to the microprogram counter (6), and the microinstruction and instruction decode unit output from the microROM (7) according to the addresses sequentially designated by the microprogram counter (6) The instruction execution control unit executes the instruction by controlling the instruction execution unit (5) based on the other information output from (2).
(4) When an operand required for instruction execution is in the memory (10), the address is output to the address bus (8) and the operand is fetched through the data bus (9), or the operand is stored in the memory (10). Is an operand access unit that outputs the address to the address bus (8) and outputs the operand to the data bus (9).
[0014]
FIG. 5 is a block diagram showing details of the instruction execution unit (5) shown in FIG.
(11) is a register file for storing operand data.
(12), (13), (14), and (15) are arithmetic units, respectively. Note that (12) is an ALU that performs arithmetic operations such as addition of two binary numbers and logical operations such as logical product of two bit strings.
(16) and (17) are expansion circuits that zero-extend or sign-extend the data size to the data size handled by ALU (12) when data smaller than that of ALU (12) is input to ALU. .
(13) is a barrel shifter that shifts data to the right or left multiple bits at a time.
(14) is a byte forward reversing circuit for reversing the byte sequence of the byte string, and (15) is a bit forward reversing circuit for reversing the bit order of the bit string.
(18), (19), and (20) are the S1 bus, S2 bus, and D bus, respectively, which connect the register file (11) and the arithmetic units (12), (13), (14), and (15). is there.
Register file (11) is connected in parallel to arithmetic units (12), (13), (14), (15) such as ALU (12) via buses (18), (19), (20) in 32-bit parallel doing. There is a one-to-one correspondence between the bit storage position of the register file (11) and the input / output bit position of the ALU (12).
[0015]
FIG. 6 is a block diagram showing a detailed structure of the register file (11) shown in FIG.
(21), (22), and (23) are circuits for storing data in
A register input control circuit (24) stores data by controlling an input circuit of a necessary data storage position according to the size of data to be input to the register file (11) and the register number of the register to be input.
(25) inputs the register number of the register that stores the data to be output for each bus from the register file (11) and controls the output of the data in the register to the S1 bus (18) and S2 bus (19) It is a register output control circuit.
[0016]
Note that there are 32 portions (26) surrounded by a broken line in FIG. 6 in the register file (11), and each can be distinguished from R0 to R31 in the microprogram of the data processing apparatus of the present invention.
[0017]
FIG. 7 is a block diagram showing a detailed configuration of the byte forward reversing circuit (14) shown in FIG.
In this circuit, the 4-byte data input from the S2 bus (19) is put into the BYI register RBYI, and the data in which the array order of the bytes is reversed by the wiring that intersects 8 pieces at a time is transferred to the BYO register RBY0. The value of RBYO is output to D bus (20).
[0018]
FIG. 8 is a block diagram showing a detailed configuration of the bit forward inversion circuit (15) shown in FIG.
In this circuit, the 4-byte data input from the S2 bus (19) is put into the BII register RBII, the data whose bit order is reversed by crossing wiring is transferred to the BIO register RBI0, and the value of the BIO register RBIO is transferred to the D bus ( Output to 20).
[0019]
FIG. 9 is a block diagram showing a configuration of a part of circuits included in the instruction execution control unit (3) of FIG.
(27) is a bit position number output circuit for outputting a number indicating the bit position on the register to the S1 bus (18) based on the size information and bit number of the operand designated by the instruction. (28) is a circuit for outputting the constant 1 to the S2 bus (19), and outputs "1" to the least significant bit of the S2 bus (19) and "0" to all other bits.
[0020]
The operation of the data processing apparatus of the present invention will be described below.
Signed addition instruction that adds the 32-bit signed binary number stored in register R0 and the 8-bit signed binary number stored in register R1 to store in register R1 as an 8-bit signed binary number (In the data processing apparatus of the present invention, it is expressed as “ADD R0.W R1.B” and the bit pattern of the instruction code is as shown in FIG. 10). An operation for performing an operation between different size operands will be described.
[0021]
The instruction is fetched from the memory (10) by the instruction fetch unit (1) shown in FIG. 4, decoded by the decode unit (2), and the decode result is passed to the instruction execution control unit (3). The instruction execution control unit (3) uses the two register addresses indicating the register R0 and the register R1, the size of the operand stored in the register R0, and the size of the operand stored in the register R1 as parameters. The entry address of the signed addition program routine stored in is set in the microprogram counter (6), the microinstruction is read, and the signed addition instruction is executed.
[0022]
FIG. 11 is a flowchart showing the execution sequence of the signed addition instruction in the instruction execution control unit (3).
The two register numbers are input to the register output control circuit (25) independently of the microprogram, the data in the register R0 is transferred to the ALU (12) through the S1 bus (18), and the data in the R1 is transferred to the S2 bus. It is transferred to ALU (12) through (19). At this time, all 32 bits of the contents of register R1 are output to the S2 bus (19), but the lower 8 bits of the S2 bus (19) are sign-extended by the expansion circuit (17) and input to the ALU (12). Is done. In ALU (12), a signed addition of two 32-bit binary numbers is performed and a 32-bit signed binary number is output. At this time, the ALU (12) is simultaneously instructed that the register size for storing the signed addition result is 8 bits, and whether the addition result can be expressed by a binary number within 8 bits, or the addition result. Various control flags are set according to whether is positive, negative or zero.
The 32-bit output of ALU (12) is transferred to register R1 through D bus (20). The 32-bit data transferred on the D bus (20) is stored in the register R1 selected by the register input control circuit (24) only in the lower 8 bits in the bit positions 24 to 31, which are the lower 8 bits. Is done.
[0023]
Next, the actual operation of the embodiment will be described by taking as an example a bit set instruction that sets '1' to the bit corresponding to bit position 3 of the operand in register R0.
In the data processing device of the present invention, the bit set instruction has the bit pattern of the instruction code as shown in FIG. In the data processing apparatus of the present invention, the bit position on the register is as shown in FIG. 1. Therefore, depending on whether the operand size is 1 byte, 2 bytes or 4 bytes, this bit set instruction is “BSET # 3”. R0.B, BSET # 11 R0.H, BSET # 27R0.W ”. The flowchart of FIG. 13 shows the execution sequence of the bit set instruction in the instruction execution control unit (3).
[0024]
In the bit set instruction, the bit position number output circuit (27) of FIG. 14 is used to obtain a number indicating the bit position of the register. The instruction execution control unit (3) inputs the operand size and bit number to the bit position number output circuit (27) and outputs the bit position number to the S2 bus (19). The bit position number output circuit (27) outputs (bit number 3 + 24 = 27) to the S1 bus (18) when the size information is 1 byte, and (bit number 11 + 16 = 27) when the size information is 2 bytes. Output to S1 bus (18). When the size information is 4 bytes, the
[0025]
The bit position number output from the bit position number output circuit (27) is input as shift number designation data of the barrel shifter (13) through the S1 bus (18). At the same time, the constant “1” is input to the barrel shifter (13) as the shifted number through the S2 bus (19). As a result, the
[0026]
Next, the operation of a byte reverse instruction for reversing the arrangement order of the 32-bit data bytes in the register R0 and transferring it to the register R1 will be described.
The instruction code bit patterns byte reverse instruction shown in Figure 15. FIG. 16 is a flowchart showing an execution sequence of the byte reverse instruction in the instruction execution control unit (3).
The 32-bit data in the register R0 is sent to the BYI register RBYI of the byte order reversing circuit (14) through the S2 bus (19), and the 32-bit data in which the byte arrangement order is reversed is transferred from the BY0 register RBY0 to the D bus ( 20) through register R1 .
[0027]
Next, the operation of a bit reverse instruction for reversing the bit order of 32-bit data in the register R0 and transferring it to the register R1 will be described. The instruction code bit patterns of the bit reverse instruction shown in FIG. 17. FIG. 18 shows a flowchart of the execution sequence of the bit reverse instruction in the instruction execution control unit (3).
The 32-bit data in the register R0 is sent to the BII register RBII of the bit order reversing circuit (15) through the S2 bus (19), and the 32-bit data whose bit order is reversed is transferred from the BI0 register RBI0 to the D bus (20). Through the register R1 .
[0028]
In the above embodiment, an example is shown in which hardware is used to determine the bit position number in the register. However, a microprogram is prepared separately for each byte length of the operand, and the bit number is corrected by the microprogram to correct the bit number. The position may be obtained.
[0029]
In the above embodiment, an arithmetic function between operands of different sizes is described using a signed addition instruction between operands on a register as an example, but other arithmetic operations of addition, subtraction, multiplication, and division are used in the same way for all other arithmetic operations. Can be calculated.
[0030]
Also, have been described and byte reverse instruction and the bit reverse instruction for 32-bit data only in the above embodiments, the operation of the byte order reversal circuit of the above embodiment (14) or the bit order reversing circuits (15) a barrel shifter When combined with the operation of (13), a byte reverse instruction and a bit reverse instruction can be executed for data of other sizes by a microprogram. The same effect can be obtained by executing these two instructions by a microprogram using only the ALU (12) or barrel shifter (13) and the working register.
[0031]
【The invention's effect】
As described above, in the data processing apparatus of the present invention, the byte reverse instruction is executed to reverse the array order of N bytes to which 8 N-bit data representing one binary value is connected, before conversion. Is converted into data that can be handled with a byte polarity different from the byte polarity of the data processing device itself. Addition is executed by the add instruction, but since the add instruction can specify a register in which data converted by the byte reverse instruction is stored as one of the two registers specified as the operand, the data processor itself When the addition is performed using data defined by a byte polarity different from the byte polarity, the addition can be executed after converting to a correct value. In particular, since the program designer can convert data expressing a correct value with one instruction and thus does not put a burden on the design of the program, a data processing apparatus capable of reducing the cost of software development can be realized.
[Brief description of the drawings]
FIG. 1 is a schematic diagram showing storage positions and bit numbers of data when 1-byte, 2-byte, and 4-byte data are stored on a 4-byte byte length register of the data processing apparatus of the present invention. .
FIG. 2 is a schematic diagram showing an example in which data having a byte length shorter than the register byte length is stored in the register in a data processing apparatus in which both the byte polarity and the bit polarity are big endian, and stored closer to the smaller address side. FIG.
FIG. 3 is a schematic diagram when the byte polarity is set to big endian and the bit polarity is set to little endian.
FIG. 4 is a block diagram showing the overall configuration of the device of the present invention.
FIG. 5 is a block diagram illustrating a configuration of an instruction execution unit.
FIG. 6 is a block diagram illustrating a configuration of a register file.
FIG. 7 is a block diagram showing a configuration of a byte forward reversing circuit.
FIG. 8 is a block diagram showing a configuration of a bit forward reversing circuit.
FIG. 9 is a block diagram illustrating a partial configuration of an instruction execution control unit.
FIG. 10 is a schematic diagram showing a bit pattern of a signed addition instruction of the device of the present invention.
FIG. 11 is a flowchart showing an execution sequence of a signed addition instruction.
FIG. 12 is a schematic diagram of a bit pattern of an instruction code.
FIG. 13 is a flowchart showing an execution sequence of a bit set instruction.
FIG. 14 is a circuit diagram showing a configuration of a bit position number output circuit.
FIG. 15 is a schematic diagram showing an instruction code bit pattern of a byte reverse instruction.
FIG. 16 is a flowchart showing an execution sequence of a byte reverse instruction.
FIG. 17 is a schematic diagram showing an instruction code bit pattern of a bit reverse instruction.
FIG. 18 is a flowchart showing an execution sequence of a bit reverse instruction.
[Explanation of symbols]
RBYI ·· BYI register, RBYO ·· BYO register, RBII ·· BII register, RBIO ·· BIO register, 1 ·· Instruction fetch unit, 2 ·· Instruction access unit, 3 ·· Instruction execution control unit, 4 · Operan Access unit, 5 ... Instruction execution unit, 6 ... Micro program counter, 7 ... Micro ROM, 11 ... Register file, 12 ... ALU, 13 ... Barrel shifter, 14 ... Byte forward reversal circuit, 15 ... Bit forward reversing circuit In the figure, the same reference numerals indicate the same or corresponding parts.
Claims (1)
各々コード化された複数の命令をそれぞれデコードして、各命令に対応する制御情報を出力する命令デコード機構と、
前記命令デコード機構からの制御情報に従って演算を行い、前記複数の命令の各々により指定された処理を実行する実行機構とを備え、
前記複数の命令は、一つの2進数の値を表現する8Nビットのデータを指定するソースオペランド指定部分とバイトの配列順序を逆転する処理を指定する第1のオペコード部分とを有するバイトリバース命令、および二つのレジスタを指定する第一のオペランド指定部分および第二のオペランド指定部分と、加算演算を行う処理を指定する第2のオペコード部分とを有する加算命令を含み、
前記実行機構は、
各々8Nビット幅の複数のレジスタを含んだレジスタファイルと、
第1、第2および第3のバスと、
この第1および第2のバスに接続され、前記バイトリバース命令に対応する制御情報に従い、前記バイトリバース命令で指定された8Nビットのデータを前記第1のバスを介して入力し、その連結するN個のバイトの配列順序を逆転する処理を実行し、その逆転した8Nビットのデータが前記第2のバスを介して転送され前記複数のレジスタのうちの一つに格納されるバイト順序逆転回路と、
前記第1ないし第3のバスに接続され、前記第1および第2のバスの間では前記バイト順序逆転回路と並列に接続され、前記加算命令に対応する制御情報に従い、前記加算命令で指定された二つのレジスタからそれぞれ前記第1および第3のバスを介して読み出した二つの8Nビットのデータを読み出して加算し、その加算結果を前記第2のバスに出力するALUとを有し、
前記加算命令により指定される二つのレジスタは前記レジスタファイル内のものであり、前記加算命令はその指定される二つのレジスタの一方として前記逆転したビットのデータが格納されるレジスタを指定することのできる、データ処理装置。
【請求項2】 前記バイトリバース命令は、一つの2進数の値を表現する8Nビットのデータとしてレジスタファイル内の一つのレジスタを指定し、バイト順序逆転回路に入力される8Nビットのデータは、前記バイトリバース命令により指定されたレジスタに格納されていることを特徴とする特許請求の範囲第1項に記載のデータ処理装置。
【請求項3】 Nは4であることを特徴とする特許請求の範囲第1項に記載のデータ処理装置。1. An 8N-bit data (N is an integer of 4 or more) representing one binary value, and the address of each byte is such that the N bytes to be concatenated are on the lower digit side of the data. Either a big endian placed at a large address of the attached memory, or a little endian placed at a large address of the memory addressed for each byte so that the N bytes are on the higher digit side of the data A data processing device handled by the byte polarity of one of them,
An instruction decoding mechanism for decoding each of a plurality of encoded instructions and outputting control information corresponding to each instruction;
An operation mechanism that performs an operation according to control information from the instruction decode mechanism and executes processing specified by each of the plurality of instructions;
The plurality of instructions includes a byte reverse instruction having a source operand designating part for designating 8N-bit data representing one binary value and a first opcode part for designating a process for reversing the order of bytes . And an add instruction having a first operand designating part and a second operand designating part for designating two registers, and a second opcode part for designating processing for performing an addition operation,
The execution mechanism is:
A register file containing a plurality of registers each 8 N bits wide;
First, second and third buses;
This is connected to the first and second bus, in accordance with control information corresponding to the byte reverse instruction, enter the 8N-bit data specified by the byte reverse command through the first bus and the coupling A byte order reversing circuit that performs a process of reversing the arrangement order of N bytes, and the inverted 8N-bit data is transferred via the second bus and stored in one of the plurality of registers. When,
It is connected to the first to third bus, between the first and second bus is connected in parallel with the byte order reversal circuit in accordance with the control information corresponding to the add instruction, designated by the addition instruction ALU for reading out and adding two 8N-bit data read from the two registers through the first and third buses respectively, and outputting the addition result to the second bus,
The two registers designated by the addition instruction are in the register file, and the addition instruction designates a register in which the inverted bit data is stored as one of the two designated registers. Data processing device that can.
2. The byte reverse instruction designates one register in a register file as 8N bit data representing one binary value, and the 8N bit data inputted to the byte order reversing circuit is: The data processing device according to claim 1, wherein the data processing device is stored in a register designated by the byte reverse instruction.
3. The data processing apparatus according to claim 1, wherein N is four.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP24169599A JP3643270B2 (en) | 1999-08-27 | 1999-08-27 | Data processing device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP24169599A JP3643270B2 (en) | 1999-08-27 | 1999-08-27 | Data processing device |
Related Parent Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP62246621A Division JP3041308B2 (en) | 1987-09-30 | 1987-09-30 | Data processing device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2000076067A JP2000076067A (en) | 2000-03-14 |
| JP3643270B2 true JP3643270B2 (en) | 2005-04-27 |
Family
ID=17078158
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP24169599A Expired - Lifetime JP3643270B2 (en) | 1999-08-27 | 1999-08-27 | Data processing device |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP3643270B2 (en) |
-
1999
- 1999-08-27 JP JP24169599A patent/JP3643270B2/en not_active Expired - Lifetime
Also Published As
| Publication number | Publication date |
|---|---|
| JP2000076067A (en) | 2000-03-14 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US5132898A (en) | System for processing data having different formats | |
| KR100327777B1 (en) | Data processing device using multiple instruction sets | |
| CN105247472B (en) | Processor, method, system and instructions for transcoding variable length code points of Unicode characters | |
| KR940009094B1 (en) | Data processing system | |
| US5129068A (en) | Operand address calculation in a pipeline processor by decomposing the operand specifier into sequential step codes | |
| TW201820125A (en) | Systems and methods for executing a fused multiply-add instruction for complex numbers | |
| JP3203401B2 (en) | Data processing device | |
| JPS6312029A (en) | information processing equipment | |
| JPH06332792A (en) | Data processor, data reading control circuit thereof and data writing control circuit | |
| TWI455024B (en) | Unique packed data element identification processors, methods, systems, and instructions | |
| JP2017529601A (en) | Bit shuffle processor, method, system, and instructions | |
| TWI564796B (en) | Apparatus and method for performing a check to optimize instruction flow | |
| JPH03218523A (en) | Data processor | |
| TWI637317B (en) | Processor, method, system and apparatus for expanding a mask into a vector of mask values | |
| JPS63273134A (en) | Method and apparatus for altering microinstruction using microinstruction pipeline | |
| JP2507638B2 (en) | Data processing device | |
| US4945511A (en) | Improved pipelined processor with two stage decoder for exchanging register values for similar operand instructions | |
| TW201640336A (en) | Method and apparatus for performing a vector bit reversal | |
| US7822955B2 (en) | Data processing apparatus and method for utilizing endianess independent data values | |
| JP3578883B2 (en) | Data processing device | |
| EP1267255A2 (en) | Conditional branch execution in a processor with multiple data paths | |
| TW201732571A (en) | Systems, apparatuses, and methods for getting even and odd data elements | |
| JP3004108B2 (en) | Information processing device | |
| JP2609618B2 (en) | Data processing device | |
| JP3643270B2 (en) | Data processing device |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| RD04 | Notification of resignation of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7424 Effective date: 20031211 |
|
| A911 | Transfer of reconsideration by examiner before appeal (zenchi) |
Free format text: JAPANESE INTERMEDIATE CODE: A911 Effective date: 20040202 |
|
| A912 | Removal of reconsideration by examiner before appeal (zenchi) |
Free format text: JAPANESE INTERMEDIATE CODE: A912 Effective date: 20040227 |
|
| A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20041124 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20050127 |
|
| R150 | Certificate of patent (=grant) or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| EXPY | Cancellation because of completion of term | ||
| FPAY | Renewal fee payment (prs date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20080204 Year of fee payment: 3 |