JP2004355477A - Microprocessor - Google Patents
Microprocessor Download PDFInfo
- Publication number
- JP2004355477A JP2004355477A JP2003154477A JP2003154477A JP2004355477A JP 2004355477 A JP2004355477 A JP 2004355477A JP 2003154477 A JP2003154477 A JP 2003154477A JP 2003154477 A JP2003154477 A JP 2003154477A JP 2004355477 A JP2004355477 A JP 2004355477A
- Authority
- JP
- Japan
- Prior art keywords
- instruction
- instruction code
- code
- type
- microprocessor
- 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.)
- Withdrawn
Links
Images
Landscapes
- Executing Machine-Instructions (AREA)
Abstract
Description
【0001】
【発明の属する技術分野】
本発明は、命令コードを順次フェッチして実行するマイクロプロセッサに関し、特に、命令コードを格納する命令メモリなどの容量の削減を可能としたマイクロプロセッサに関する。
【0002】
【従来の技術】
近年、マイクロプロセッサを搭載した情報通信機器、家電機器などが広く普及しており、性能を向上させつつも、コストの削減が可能なマイクロプロセッサに対する要望が高まっている。
【0003】
一般に、32ビットの命令コード長を有するマイクロプロセッサコアやDSP(Digital Signal Processor)コアを実現しようとした場合、プロセッサが命令メモリなどから常に32ビットの命令コードをフェッチする必要がある。すなわち、プロセッサが1サイクルで命令コードをフェッチするためには、32本の信号線(データバス)が必要である。また、16本の信号線のみを使用した場合には、プロセッサは命令コードを2サイクルでフェッチすることになり、性能が低下することになる。
【0004】
また、命令メモリとして、命令数×32ビット分の容量を有する記憶装置が必要とされ、命令メモリの容量を削減したり、プログラム自体の容量を削減したりすることが困難である。これに関連する技術として、特開平11−167488号公報に開示された演算処理装置がある。
【0005】
特開平11−167488号公報に開示された演算処理装置は、32ビットの縮小命令セットの固定長の冗長な部分を、予め決められた規則にしたがって圧縮し、16ビットの圧縮命令セットを生成することにより、RISC(Reduced Instruction Set Computer)型のマイクロプロセッサのオブジェクトコードサイズを小さくするものである。
【0006】
【特許文献1】
特開平11−167488号公報
【0007】
【発明が解決しようとする課題】
上述した特開平11−167488号公報に開示された演算処理装置は、オブジェクトコードのサイズを小さくすることができるが、全ての命令セットを固定長とすることによって命令セットの幾つかに冗長な部分が多く含まれるという、RISC型のマイクロプロセッサ特有の問題点に着目してなされたものである。したがって、冗長な部分を含まない命令セットを圧縮することができず、オブジェクトサイズを小さくすることができないといった問題点があった。
【0008】
本発明は、上記問題点を解決するためになされたものであり、その目的は、命令メモリの容量やプログラム自体の容量を削減することが可能なマイクロプロセッサを提供することである。
【0009】
【課題を解決するための手段】
本発明のある局面に従えば、ロングタイプの命令コードとショートタイプの命令コードとを実行することのできるマイクロプロセッサであって、命令コードをフェッチするための命令フェッチ手段と、命令フェッチ手段によってフェッチされた命令コードをデコードするための命令デコード手段と、命令デコード手段によるデコード結果に応じて、命令コードを実行するための命令実行手段とを含み、命令フェッチ手段は、フェッチした命令コードがロングタイプの命令コードの場合には、当該命令コードをそのまま命令デコード手段へ出力し、フェッチした命令コードがロングタイプの命令コードに続くショートタイプの命令コードの場合には、直近のロングタイプの命令コードの一部によって拡張し、拡張後の命令コードを命令デコード手段へ出力する。
【0010】
本発明の別の局面に従えば、ロングタイプの命令コードとショートタイプの命令コードとを実行することのできるマイクロプロセッサであって、命令コードをフェッチするための命令フェッチ手段と、命令フェッチ手段によってフェッチされた命令コードをデコードするための命令デコード手段と、命令デコード手段によるデコード結果に応じて、命令コードを実行するための命令実行手段とを含み、命令フェッチ手段は、フェッチした命令コードがロングタイプの命令コードの場合には、当該命令コードをそのまま前記命令デコード手段へ出力し、フェッチした命令コードがショートタイプの命令コードの場合には、予めレジスタに設定された値によって拡張し、拡張後の命令コードを命令デコード手段へ出力する。
【0011】
【発明の実施の形態】
図1は、マイクロプロセッサの概略構成の一例を示すブロック図である。このマイクロプロセッサ100は、命令メモリ101からフェッチされた命令コードを保持するIF(Instruction Fetch)ステージ保持回路103と、IFステージ保持回路103に保持される命令コードをデコードするデコード用組合せ回路105と、デコード用組合せ回路105によるデコード結果を保持するID(Instruction Decode)ステージF/F(Flip Flop)107と、PC(Program Counter)の値を制御するPC制御部108と、IDステージF/F107に保持されるデコード結果に応じて命令を実行する演算器などの組合せ回路110と、組合せ回路110による演算結果などを保持するEX(Execution)ステージF/F112とを含む。
【0012】
図1は、簡単のために、命令フェッチ、命令デコード、命令実行からなる3段のパイプライン構成で命令コードを処理する場合を想定している。なお、本明細書における値の表記方法として、ハードウェア記述言語として広く用いられているVerilog−HDL(Hardware Description Language)言語の文法に従った表記を用いるものとする。
【0013】
PC制御部108は、PCの値を制御する。なお、このPCの値の制御の詳細は後述する。命令メモリ101は、PC制御部108から出力された命令アドレス113に応じて命令コードを出力する。IFステージ保持回路103は、命令メモリ101から出力された命令コード102を保持する。
【0014】
デコード用組合せ回路105は、IFステージ保持回路103によって保持される命令コード104をデコードし、デコード結果を制御信号106としてIDステージF/F107へ出力する。IDステージF/F107は、デコード用組合せ回路105から出力された制御信号106を保持して演算器などの組合せ回路110へ出力する。
【0015】
組合せ回路110は、IDステージF/F107から出力された制御信号109に応じて演算等の命令実行を行ない、命令実行結果111をEXステージF/F112へ出力する。EXステージF/F112は、組合せ回路110から出力された命令実行結果を保持する。
【0016】
図2は、PC制御部108の詳細を示す図である。PC制御部108は、セレクタ156と、セレクタ156の選択信号を生成する選択信号生成部151と、PCの値を保持するPC保持用F/F157と、PC保持用F/F157に保持されるPCの値をインクリメントするインクリメンタ159とを含む。
【0017】
選択信号生成部151は、その一部がデコード用組合せ回路105に含まれる回路であり、割込みアドレス152、分岐先アドレス153およびPC保持用F/F157に保持される命令アドレスがインクリメントされた値のいずれかを選択するための選択信号158を生成する。
【0018】
割込みが発生して割込みルーチンへジャンプする場合には、セレクタ156は割込みアドレス152を選択して出力する。分岐命令等の実行によって分岐先アドレス153へジャンプする場合には、セレクタ156は分岐先アドレス153を選択して出力する。また、割込みおよび分岐先アドレス153への分岐のいずれも発生しない場合には、セレクタ156はインクリメンタ159から出力される命令アドレスを選択して出力する。
【0019】
インクリメンタ159は、PC保持用F/F157に保持される命令アドレスを1だけインクリメントする。本来であれば、命令コードが32ビットであれば、命令アドレスを4だけインクリメントする必要があるが、簡単のために1だけインクリメントするものとして説明する。
【0020】
(第1の実施の形態)
図3は、本発明の第1の実施の形態におけるマイクロプロセッサで実行される命令フォーマットの概念を説明するための図である。図3(a)は、L(Long)タイプの命令フォーマット1を示しており、図3(b)は、S(Short)タイプの命令フォーマット2を示している。
【0021】
図3(a)に示すように、Lタイプの命令フォーマット1は、L/Sフォーマット識別用のビットである1ビットのfmと、演算の種類を示す10ビットのoperationと、それぞれ6ビットのoperand1〜operand3と、3ビットのoptionとを含む。fmビットは、命令コードがLタイプの命令フォーマット1であるか、Sタイプのフォーマット2であるかを示す。Lタイプの命令フォーマット1においては、命令コードが32ビットで指定され、サポートしている全ての命令コードを指定することが可能である。
【0022】
図3(b)に示すように、Sタイプの命令フォーマット2は、1ビットのfmと、9ビットのoperation’と、それぞれ2ビットのop1’〜op3’とを含む。Sタイプの命令フォーマット2においては、命令コードが16ビットで指定され、最も直近で指定されたLタイプの命令コードの値によって補間され、32ビットの命令コードが生成される。
【0023】
図3(b)に示すSタイプの命令コードがデコードされるときに、9ビットのoperation’に、直近のLタイプの命令コードのoperationの上位1ビットが付加されて、10ビットのoperationが生成される。また、2ビットのop1’〜op3’のそれぞれに、直近のLタイプの命令コードのoperand1〜operand3の上位4ビットが付加されて、それぞれ6ビットのoperand1〜operand3が生成される。なお、Sタイプの命令コードにおいて、3ビットのoptionは存在せず、直近のLタイプのoptionの3ビットをそのまま用いる。
【0024】
図4は、本発明の第1の実施の形態におけるマイクロプロセッサのIFステージ保持回路103の内部構成を示すブロック図である。このIFステージ保持回路103は、セレクタ251〜256および261〜265と、命令コードの一部を保持するF/F271〜276および281〜285と、セレクタ251〜256および261〜265の選択信号を生成する選択信号生成回路291と、選択信号生成回路291から出力される選択信号を1サイクル保持するF/F294と、F/F271〜276および281〜285に保持される32ビットの命令コード297またはnop命令コード296を選択するセレクタ298とを含む。
【0025】
まず、図3(a)に示すLタイプの命令コードが与えられた場合のIFステージ保持回路103の動作について説明する。命令コードがLタイプの場合、2サイクルで32ビットの命令コードがフェッチされる。
【0026】
1サイクル目において、32ビットの命令コードのうち上位の16ビット[0:15]がIFステージ保持回路103に入力される。このとき、選択信号生成回路291が選択信号292に“01”を出力する。したがって、F/F271,281,272,282および273のそれぞれには、icode[00]212、icode[01]213、icode[02:10]215、icode[11:14]216およびicode[15]218の値が取込まれる。
【0027】
なお、F/F274,283,275,284,276および285は、前のサイクルで保持していた値を保持する。すなわち、F/F274,283,275,284,276および285の値は更新されない。このサイクルにおいて、32ビットの命令コードを出力することができないため、選択信号生成回路291はセレクタ298に選択信号293を出力して、セレクタ298にnop命令コード296を出力させる。
【0028】
2サイクル目において、32ビットの命令コードのうち下位の16ビット[16:31]がIFステージ保持回路103に入力される。このとき、選択信号生成回路291が選択信号292に“10”を出力する。したがって、F/F274,283,275,284,276および285のそれぞれには、icode[00]220、icode[01:04]221、icode[05:06]223、icode[07:10]224、icode[11:12]226およびicode[13:15]227の値が取込まれる。
【0029】
なお、F/F271,281,272,282および273は、前のサイクルで保持していた値を保持する。すなわち、F/F271,281,272,282および273の値は更新されず、1サイクル目で書込まれた命令コードの上位16ビットが保持される。このサイクルにおいて、32ビットの命令コードを出力することができるため、選択信号生成回路291はセレクタ298に選択信号293を出力して、セレクタ298に32ビットの命令コード297を出力させる。
【0030】
次に、図3(b)に示すSタイプの命令コードが与えられた場合のIFステージ保持回路103の動作について説明する。命令コードがLタイプの場合、1サイクルで16ビットの命令コードがフェッチされ、最も直近で指定されたLタイプの命令コードの値によって補間される。
【0031】
このサイクルにおいて、Sタイプの16ビットの命令コードがIFステージ保持回路103に入力される。このとき、選択信号生成回路291が選択信号292に“00”を出力する。したがって、F/F271,272,273,274,275および276のそれぞれには、icode[00]211、icode[01:09]214、icode[10]217、icode[11]219、icode[12:13]222およびicode[14:15]225の値が取込まれる。
【0032】
なお、F/F281,282,283,284および285は、前のサイクルで保持していた値を保持する。すなわち、F/F281,282,283,284および285の値は更新されない。このサイクルにおいて、32ビットの命令コードを出力することができるため、選択信号生成回路291はセレクタ298に選択信号293を出力して、セレクタ298に32ビットの命令コード297を出力させる。
【0033】
図5は、選択信号生成回路291によって生成される選択信号292の値と、生成条件との関係を示す図である。F/F294の値(1つ前のサイクルの選択信号値)が2’b00または2’b10であり、かつicode[00]211の値が1’b0の場合には、選択信号値として2’b00が出力される。すなわち、1つ前のサイクルでフェッチした命令コードがSタイプまたはLタイプの命令コードのうち下位16ビットであり、今回フェッチした命令コードがSタイプの場合には、選択信号値として2’b00が出力される。
【0034】
また、F/F294の値が2’b00または2’b10であり、かつicode[00]211の値が1’b1の場合には、選択信号値として2’b01が出力される。すなわち、1つ前のサイクルでフェッチした命令コードがSタイプまたはLタイプの命令コードのうち下位16ビットであり、今回フェッチした命令コードがLタイプの場合には、選択信号値として2’b01が出力される。
【0035】
また、F/F294の値が2’b01の場合には、選択信号値として2’b10が出力される。すなわち、1つ前のサイクルでフェッチした命令コードがLタイプの命令コードのうち上位16ビットの場合には、選択信号値として2’10が出力される。
【0036】
なお、F/F271〜276および281〜285をリセット(セット)付きのF/Fとすることによって、マイクロプロセッサのリセット時に初期値を与えることができる。その結果、最初にフェッチされた命令がSタイプの命令であっても初期値に基づいて正しく動作を行なわせることができる。
【0037】
また、上述した説明においては、Sタイプの種類が1つの場合のみについて説明したが、L/Sフォーマット識別用fmのビット数を増やし、それに対応して図4に示す構成を複数備えることによって、複数種類のSタイプの命令コードをサポートしたマイクロプロセッサを提供することが可能である。
【0038】
以上説明したように、本実施の形態におけるマイクロプロセッサによれば、Sタイプの命令コードをフェッチした場合には、最も直近のLタイプの命令コードによって補間し、32ビットの命令コードを生成するようにしたので、性能の低下を最小限に抑えつつ信号線を削減することができると共に、命令メモリの容量やプログラム自体の容量を削減することが可能となった。
【0039】
(第2の実施の形態)
第1の実施の形態においては、フェッチした命令コードがSタイプの命令コードの場合には、直近のLタイプの命令コードによって補間し、32ビットの命令コードを生成するようにした。本発明の第2の実施の形態においては、フェッチした命令コードがSタイプの命令コードの場合には、ユーザが指定した任意の値によってSタイプの命令コードを補間し、32ビットの命令コードを生成するものである。
【0040】
図6は、本発明の第2の実施の形態におけるマイクロプロセッサの概念を説明するための図である。この命令コードは、Sタイプの命令コードのものであり、32ビットの命令コードのうち、[01]321,[11:14]322,[17:20]323,[23:26]324および[29:31]325が、IREG_0(331),IREG_1(332),IREG_2(333)およびIREG_3(334)の値によって補間される。レジスタIREG_0(331)〜IREG_3(334)は、それぞれ4ビットの明示的なレジスタであり、マイクロプロセッサが命令によって書込み/読出しが可能である。
【0041】
たとえば、Sタイプの命令コードとして、以下のような特殊命令を設けることによって実現することができる。
【0042】
書込み命令: LDSP IREG_0 4’b0101
読出し命令: STSP IREG_0
これらの命令は、Sフォーマットでのみ有効な命令であるが、それ以外には特殊性はない。すなわち、一般的なプロセッサが備えている、即値をレジスタに設定する命令、およびあるレジスタの値を読出す命令と全く同じ動作を行なう。したがって、ここでの詳細な説明は行なわない。
【0043】
以上説明したように、本実施の形態におけるマイクロプロセッサによれば、命令コードがSタイプの場合には、ユーザが予めレジスタに設定した値によって命令コードを補間するようにしたので、第1の実施の形態において説明した効果に加えて、汎用性をさらに高めることが可能となった。
【0044】
(第3の実施の形態)
本発明の第3の実施の形態におけるマイクロプロセッサは、割込みや分岐が発生したとき、その分岐先がSフォーマットの命令コードである場合に対応した構成を有するものである。
【0045】
図7は、本発明の第3の実施の形態におけるマイクロプロセッサのIFステージ保持回路およびPC制御部の概略構成を示すブロック図である。なお、本実施の形態においては、IFステージ保持回路およびPC制御部の参照符号をそれぞれ103’および108’として説明する。
【0046】
IFステージ保持回路103’は、図4に示す第1の実施の形態におけるIFステージ保持回路103と、IFステージ保持回路103に保持される32ビットの命令コード402から分岐命令を検出する分岐命令検出回路403と、分岐命令検出回路403による検出結果を保持する分岐命令保持F/F405と、IFステージ保持回路103によって保持される32ビットの命令コード410またはnop命令コード411を選択して、デコード用組合せ回路105へ出力するセレクタ412とを含む。
【0047】
また、PC制御部108’は、セレクタ438と、分岐命令保持F/F405に保持される分岐命令の検出結果406および命令コードのfmビット407に応じてセレクタ438の選択信号422を生成する選択信号生成部421と、設定された値から1ずつデクリメントする減算カウンタ414と、PCの値を保持するPC保持用F/F439と、PC保持用F/F439に保持されるPC値から16を減算するデクリメンタ434と、PC保持用F/F439に保持されるPC値を1ずつ加算するインクリメンタ435とを含む。
【0048】
分岐命令検出回路403は、IFステージ保持回路103から出力された32ビットの命令コードをデコード等することによって分岐命令を検出する。また、分岐命令保持F/F405は、分岐命令検出回路403による検出結果404を保持する。
【0049】
選択信号生成部421は割込みを検出した場合には、選択信号422を出力して、セレクタ438に割込みベクタアドレスに対応した割込みアドレス431を選択させる。また、選択信号生成部421は、分岐命令保持F/F405からの検出結果406を参照して分岐命令であることを検出した場合には、セレクタ438に分岐先アドレス432を選択させる。
【0050】
選択信号生成部421は、分岐命令保持F/F405からの検出結果406を参照して分岐命令であることを検出した後、分岐先の命令コードのfmビット407がSフォーマットであることを示す“0”であれば、PC保持用F/F439に保持されるPC値から16を減算したアドレス436をセレクタ438に選択させる。このとき、減算カウンタ414に“16”が設定される。この減算カウンタ414は、毎サイクル“1”ずつ値を減算し、その値が“0”になると減算を停止する。
【0051】
このようにして、分岐先の命令コードがSフォーマットの場合には、分岐先命令のアドレスから16個分だけさかのぼることによって、必ずLフォーマットの命令コードがIFステージ保持回路103に保持されるようにしている。なお、減算カウンタ414は、カウント値が“0”になるまで選択信号415を出力して、セレクタ412にnop命令コード411を選択させる。これによって、分岐先命令から16個分だけさかのぼった命令コードから、分岐先命令の直前の命令コードまでが実行されないようにしている。なお、減算カウンタ414は、カウント値が“0”になったときに選択信号415を出力して、セレクタ412にIFステージ保持回路103から出力される32ビットの命令コード410を選択させる。
【0052】
選択信号生成部421は、割込みおよび分岐のいずれも検出されず、かつ分岐先命令がSフォーマットの命令コードでない場合には、セレクタ438にインクリメンタ435から出力される値437を選択させる。
【0053】
また、割込みまたは例外が発生した場合には、セレクタ438はベクタアドレスに対応した割込みアドレス(例外アドレス)432の命令コードを選択して出力するが、この分岐先の命令コードがSフォーマットの命令コードの場合には、図4に示すIFステージ保持回路103内のF/F271〜276および281〜285をリセット(セット)して、Lフォーマットの命令コードの初期値を設定するするようにしてもよい。これによって、分岐先アドレスの命令コードがSフォーマットの場合でも、正しく動作を行なうことが可能になる。
【0054】
以上の説明においては、全てハードウェアによって処理を行なうようにしているが、分岐先命令がSフォーマットの命令コードであることが検出されたときに、TRAPを発生させることによってソフトウェアによって処理させることも可能である。
【0055】
また、プログラム中に静的に固定されている割込みアドレスや、分岐先を示すラベルで指定されるアドレスに必ずLフォーマットの命令コードが配置されるように、コンパイラなどを設計することによって、マイクロプロセッサの誤動作を防止することも可能である。
【0056】
以上説明したように、本実施の形態におけるマイクロプロセッサによれば、分岐先命令がSフォーマットの命令コードの場合には、分岐先命令から16個分だけさかのぼった命令コードを実行するようにしたので、分岐先のSフォーマットの命令コードに対応したLフォーマットの命令コードが、必ずIFステージ保持回路103に保持されるようになり、マイクロプロセッサの誤動作を防止することが可能となった。
【0057】
今回開示された実施の形態は、すべての点で例示であって制限的なものではないと考えられるべきである。本発明の範囲は上記した説明ではなくて特許請求の範囲によって示され、特許請求の範囲と均等の意味および範囲内でのすべての変更が含まれることが意図される。
【0058】
【発明の効果】
本発明のある局面によれば、命令フェッチ手段は、フェッチした命令コードがショートタイプの命令コードの場合には、直近のロングタイプの命令コードの一部によってショートタイプの命令コードを拡張し、拡張後の命令コードを命令デコード手段へ出力するので、命令メモリの容量やプログラム自体の容量を削減することが可能となった。
【0059】
本発明の別の局面によれば、命令フェッチ手段は、フェッチした命令コードがショートタイプの命令コードの場合には、予めレジスタに設定された値によってショートタイプの命令コードを拡張し、拡張後の命令コードを命令デコード手段へ出力するので、命令メモリの容量やプログラム自体の容量を削減することが可能となった。
【図面の簡単な説明】
【図1】マイクロプロセッサの概略構成の一例を示すブロック図である。
【図2】PC制御部108の詳細を示す図である。
【図3】本発明の第1の実施の形態におけるマイクロプロセッサで実行される命令フォーマットの概念を説明するための図である。
【図4】本発明の第1の実施の形態におけるマイクロプロセッサのIFステージ保持回路103の内部構成を示すブロック図である。
【図5】選択信号生成回路291によって生成される選択信号292の値と、生成条件との関係を示す図である。
【図6】本発明の第2の実施の形態におけるマイクロプロセッサの概念を説明するための図である。
【図7】本発明の第3の実施の形態におけるマイクロプロセッサのIFステージ保持回路およびPC制御部の概略構成を示すブロック図である。
【符号の説明】
100 マイクロプロセッサ、101 命令メモリ、103 IFステージ保持回路、105 デコード用組合せ回路、107 IDステージF/F、108PC制御部、110 組合せ回路、112 EXステージF/F、151,421 選択信号生成部、156,251〜256,261〜265,298,412,438 セレクタ、157,439 PC保持用F/F、159,435インクリメンタ、271〜276,281〜285,294 F/F、291選択信号生成回路、403 分岐命令検出回路、405 分岐命令保持F/F、414 減算カウンタ、434 デクリメンタ。[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a microprocessor that sequentially fetches and executes instruction codes, and more particularly to a microprocessor that can reduce the capacity of an instruction memory for storing instruction codes.
[0002]
[Prior art]
2. Description of the Related Art In recent years, information communication devices and home electric appliances equipped with a microprocessor have become widespread, and there has been an increasing demand for a microprocessor capable of reducing the cost while improving the performance.
[0003]
Generally, when attempting to realize a microprocessor core or a DSP (Digital Signal Processor) core having a 32-bit instruction code length, the processor must always fetch a 32-bit instruction code from an instruction memory or the like. That is, in order for the processor to fetch the instruction code in one cycle, 32 signal lines (data buses) are required. Further, when only 16 signal lines are used, the processor fetches the instruction code in two cycles, and the performance is reduced.
[0004]
Further, a storage device having a capacity of the number of instructions × 32 bits is required as the instruction memory, and it is difficult to reduce the capacity of the instruction memory or the capacity of the program itself. As a technique related to this, there is an arithmetic processing device disclosed in Japanese Patent Application Laid-Open No. 11-167488.
[0005]
The arithmetic processing device disclosed in Japanese Patent Application Laid-Open No. H11-167488 compresses a fixed-length redundant part of a 32-bit reduced instruction set according to a predetermined rule to generate a 16-bit compressed instruction set. Thus, the object code size of a RISC (Reduced Instruction Set Computer) type microprocessor is reduced.
[0006]
[Patent Document 1]
JP-A-11-167488
[0007]
[Problems to be solved by the invention]
The arithmetic processing device disclosed in the above-mentioned Japanese Patent Application Laid-Open No. 11-167488 can reduce the size of the object code. However, by making all instruction sets have a fixed length, some of the instruction sets have redundant parts. Is focused on the problem inherent in the RISC type microprocessor, which contains a lot of. Therefore, there is a problem that an instruction set that does not include a redundant portion cannot be compressed, and the object size cannot be reduced.
[0008]
The present invention has been made to solve the above problems, and an object of the present invention is to provide a microprocessor capable of reducing the capacity of an instruction memory and the capacity of a program itself.
[0009]
[Means for Solving the Problems]
According to one aspect of the present invention, there is provided a microprocessor capable of executing a long type instruction code and a short type instruction code, wherein the instruction fetch means for fetching the instruction code and the instruction fetch means fetched by the instruction fetch means. Instruction decoding means for decoding the instruction code, and instruction execution means for executing the instruction code in accordance with the result of the decoding by the instruction decoding means. In the case of an instruction code, the instruction code is output to the instruction decoding means as it is, and in the case where the fetched instruction code is a short type instruction code following a long type instruction code, a part of the latest long type instruction code And decode the extended instruction code And outputs it to the stage.
[0010]
According to another aspect of the present invention, there is provided a microprocessor capable of executing a long-type instruction code and a short-type instruction code, wherein the instruction fetch means for fetching the instruction code and the instruction fetch means Instruction decoding means for decoding the received instruction code, and instruction execution means for executing the instruction code in accordance with the result of the decoding by the instruction decoding means. In the case of the instruction code, the instruction code is output to the instruction decoding means as it is, and when the fetched instruction code is a short type instruction code, the instruction code is extended by a value set in a register in advance, and the extended instruction The code is output to the instruction decoding means.
[0011]
BEST MODE FOR CARRYING OUT THE INVENTION
FIG. 1 is a block diagram illustrating an example of a schematic configuration of a microprocessor. The
[0012]
FIG. 1 assumes, for simplicity, that an instruction code is processed by a three-stage pipeline configuration including instruction fetch, instruction decode, and instruction execution. Note that, as a notation method of a value in this specification, a notation according to a grammar of Verilog-HDL (Hardware Description Language) language widely used as a hardware description language is used.
[0013]
The
[0014]
The
[0015]
[0016]
FIG. 2 is a diagram illustrating details of the
[0017]
The selection
[0018]
When an interrupt occurs and the process jumps to the interrupt routine, the
[0019]
The
[0020]
(First Embodiment)
FIG. 3 is a diagram for explaining the concept of an instruction format executed by the microprocessor according to the first embodiment of the present invention. 3A illustrates an L (Long)
[0021]
As shown in FIG. 3A, the L-
[0022]
As shown in FIG. 3B, the S
[0023]
When the S-type instruction code shown in FIG. 3B is decoded, the most significant one bit of the operation of the latest L-type instruction code is added to the 9-bit operation ′ to generate a 10-bit operation. Is done. In addition, the upper 4 bits of the latest L-type instruction code, operand1 to operand3, are added to each of the two bits op1 'to op3', thereby generating 6 bits of operand1 to operand3. Note that, in the S type instruction code, there is no 3-bit option, and the latest 3 bits of the L type option are used as they are.
[0024]
FIG. 4 is a block diagram showing an internal configuration of the IF
[0025]
First, the operation of the IF
[0026]
In the first cycle, the upper 16 bits [0:15] of the 32-bit instruction code are input to the IF
[0027]
Note that the F /
[0028]
In the second cycle, the lower 16 bits [16:31] of the 32-bit instruction code are input to the IF
[0029]
Note that the F /
[0030]
Next, the operation of the IF
[0031]
In this cycle, an S type 16-bit instruction code is input to the IF
[0032]
Note that the F /
[0033]
FIG. 5 is a diagram illustrating the relationship between the value of the
[0034]
When the value of F /
[0035]
When the value of the F /
[0036]
By setting the F /
[0037]
Also, in the above description, only one type of the S type is described. However, by increasing the number of bits of the L / S format identification fm and providing a plurality of configurations shown in FIG. It is possible to provide a microprocessor that supports a plurality of types of S-type instruction codes.
[0038]
As described above, according to the microprocessor of the present embodiment, when an S-type instruction code is fetched, a 32-bit instruction code is generated by interpolating with the nearest L-type instruction code. As a result, it is possible to reduce the number of signal lines while minimizing a decrease in performance, and to reduce the capacity of the instruction memory and the capacity of the program itself.
[0039]
(Second embodiment)
In the first embodiment, when the fetched instruction code is an S-type instruction code, interpolation is performed using the nearest L-type instruction code to generate a 32-bit instruction code. In the second embodiment of the present invention, when the fetched instruction code is an S-type instruction code, the S-type instruction code is interpolated by an arbitrary value specified by the user, and the 32-bit instruction code is converted. To generate.
[0040]
FIG. 6 is a diagram for explaining the concept of a microprocessor according to the second embodiment of the present invention. This instruction code is an S-type instruction code, and among the 32-bit instruction codes, [01] 321, [11:14] 322, [17:20] 323, [23:26] 324, and [ 29:31] 325 is interpolated by the values of IREG — 0 (331), IREG — 1 (332), IREG — 2 (333), and IREG — 3 (334). Each of the registers IREG_0 (331) to IREG_3 (334) is an explicit register of 4 bits, and can be written / read by a microprocessor by an instruction.
[0041]
For example, it can be realized by providing the following special instructions as S-type instruction codes.
[0042]
Write command: LDSP IREG — 0 4'b0101
Read command: STSP IREG_0
These instructions are valid only in the S format, but have no special characteristics. That is, it performs exactly the same operation as an instruction provided in a general processor for setting an immediate value to a register and an instruction for reading a value of a certain register. Therefore, a detailed description will not be given here.
[0043]
As described above, according to the microprocessor of the present embodiment, when the instruction code is of the S type, the instruction code is interpolated by the value set in the register in advance by the user. In addition to the effects described in the embodiment, the versatility can be further improved.
[0044]
(Third embodiment)
The microprocessor according to the third embodiment of the present invention has a configuration corresponding to the case where an interrupt or a branch occurs, and the branch destination is an S-format instruction code.
[0045]
FIG. 7 is a block diagram illustrating a schematic configuration of an IF stage holding circuit and a PC control unit of a microprocessor according to a third embodiment of the present invention. In the present embodiment, the description will be made with reference numerals 103 'and 108' for the IF stage holding circuit and the PC control unit, respectively.
[0046]
The IF
[0047]
Further, the
[0048]
The branch
[0049]
When detecting an interrupt, the selection
[0050]
The
[0051]
In this way, when the instruction code at the branch destination is in the S format, the instruction code in the L format is always held in the IF
[0052]
The
[0053]
When an interrupt or an exception occurs, the
[0054]
In the above description, all the processing is performed by hardware. However, when it is detected that the branch destination instruction is an S-format instruction code, the processing may be performed by software by generating a TRAP. It is possible.
[0055]
Further, by designing a compiler or the like such that an L-format instruction code is always arranged at an interrupt address statically fixed in a program or at an address specified by a label indicating a branch destination, Can be prevented from malfunctioning.
[0056]
As described above, according to the microprocessor of the present embodiment, when the branch destination instruction is the S-format instruction code, the instruction code that is 16 times older than the branch destination instruction is executed. The instruction code in the L format corresponding to the instruction code in the S format at the branch destination is always held in the IF
[0057]
The embodiments disclosed this time are to be considered in all respects as illustrative and not restrictive. The scope of the present invention is defined by the terms of the claims, rather than the description above, and is intended to include any modifications within the scope and meaning equivalent to the terms of the claims.
[0058]
【The invention's effect】
According to one aspect of the present invention, when the fetched instruction code is a short-type instruction code, the instruction fetch unit extends the short-type instruction code by a part of the latest long-type instruction code, and Since the instruction code is output to the instruction decoding means, the capacity of the instruction memory and the capacity of the program itself can be reduced.
[0059]
According to another aspect of the present invention, when the fetched instruction code is a short-type instruction code, the instruction fetch means extends the short-type instruction code by a value set in a register in advance, and expands the instruction code. Is output to the instruction decoding means, so that the capacity of the instruction memory and the capacity of the program itself can be reduced.
[Brief description of the drawings]
FIG. 1 is a block diagram illustrating an example of a schematic configuration of a microprocessor.
FIG. 2 is a diagram showing details of a
FIG. 3 is a diagram for explaining the concept of an instruction format executed by a microprocessor according to the first embodiment of the present invention.
FIG. 4 is a block diagram showing an internal configuration of an IF
FIG. 5 is a diagram illustrating a relationship between a value of a
FIG. 6 is a diagram illustrating a concept of a microprocessor according to a second embodiment of the present invention.
FIG. 7 is a block diagram illustrating a schematic configuration of an IF stage holding circuit and a PC control unit of a microprocessor according to a third embodiment of the present invention.
[Explanation of symbols]
100 microprocessor, 101 instruction memory, 103 IF stage holding circuit, 105 decoding combination circuit, 107 ID stage F / F, 108 PC control unit, 110 combination circuit, 112 EX stage F / F, 151, 421 selection signal generation unit, 156,251-256,261-265,298,412,438 Selector, 157,439 PC holding F / F, 159,435 incrementer, 271-276,281-285,294 F / F, 291 selection signal generation Circuit, 403 branch instruction detection circuit, 405 branch instruction holding F / F, 414 subtraction counter, 434 decrementer.
Claims (8)
命令コードをフェッチするための命令フェッチ手段と、
前記命令フェッチ手段によってフェッチされた命令コードをデコードするための命令デコード手段と、
前記命令デコード手段によるデコード結果に応じて、命令コードを実行するための命令実行手段とを含み、
前記命令フェッチ手段は、フェッチした命令コードがロングタイプの命令コードの場合には、当該命令コードをそのまま前記命令デコード手段へ出力し、フェッチした命令コードがロングタイプの命令コードに続くショートタイプの命令コードの場合には、直近のロングタイプの命令コードの一部によって前記ショートタイプの命令コードを拡張し、該拡張後の命令コードを前記命令デコード手段へ出力する、マイクロプロセッサ。A microprocessor capable of executing a long type instruction code and a short type instruction code,
Instruction fetch means for fetching an instruction code;
Instruction decoding means for decoding the instruction code fetched by the instruction fetch means;
Instruction execution means for executing an instruction code according to a decoding result by the instruction decoding means,
When the fetched instruction code is a long type instruction code, the instruction fetch means outputs the instruction code as it is to the instruction decoding means, and the fetched instruction code is a short type instruction code following the long type instruction code. In the case of the microprocessor, the short-type instruction code is extended by a part of the latest long-type instruction code, and the extended instruction code is output to the instruction decoding means.
命令コードをフェッチするための命令フェッチ手段と、
前記命令フェッチ手段によってフェッチされた命令デコードをデコードするための命令デコード手段と、
前記命令デコード手段によるデコード結果に応じて、命令コードを実行するための命令実行手段とを含み、
前記命令フェッチ手段は、フェッチした命令コードがロングタイプの命令コードの場合には、当該命令コードをそのまま前記命令デコード手段へ出力し、フェッチした命令コードがショートタイプの命令コードの場合には、予めレジスタに設定された値によって前記ショートタイプの命令コードを拡張し、該拡張後の命令コードを前記命令デコード手段へ出力する、マイクロプロセッサ。A microprocessor capable of executing a long type instruction code and a short type instruction code,
Instruction fetch means for fetching an instruction code;
Instruction decoding means for decoding the instruction decode fetched by the instruction fetch means;
Instruction execution means for executing an instruction code according to a decoding result by the instruction decoding means,
When the fetched instruction code is a long type instruction code, the instruction fetch means outputs the instruction code as it is to the instruction decoding means. A microprocessor that expands the short-type instruction code by the value set in (1) and outputs the expanded instruction code to the instruction decoding unit.
前記命令フェッチ手段は、前記所定数だけさかのぼった命令コードから前記分岐先命令の直前の命令コードまでをノーオペレーション命令として出力する、請求項1〜5のいずれかに記載のマイクロプロセッサ。When the branch destination instruction is an instruction code of a short type, the microprocessor further sets an address that is a predetermined number of times ahead of the address of the branch destination instruction as a program count value, and sequentially increments and outputs the program count value. Program counter control means,
The microprocessor according to any one of claims 1 to 5, wherein the instruction fetch means outputs, as a no-operation instruction, a part from the instruction code which has been advanced by the predetermined number to an instruction code immediately before the branch destination instruction.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003154477A JP2004355477A (en) | 2003-05-30 | 2003-05-30 | Microprocessor |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003154477A JP2004355477A (en) | 2003-05-30 | 2003-05-30 | Microprocessor |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2004355477A true JP2004355477A (en) | 2004-12-16 |
Family
ID=34049123
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2003154477A Withdrawn JP2004355477A (en) | 2003-05-30 | 2003-05-30 | Microprocessor |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2004355477A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2009093513A (en) * | 2007-10-11 | 2009-04-30 | Oki Semiconductor Co Ltd | Method for reducing instruction bit length |
JP2012252475A (en) * | 2011-06-01 | 2012-12-20 | Fujitsu Ltd | Processor, compression program, compression device, and compression method |
US9189234B2 (en) | 2013-09-04 | 2015-11-17 | Globalfoundries Inc. | Reducing overhead in loading constants |
-
2003
- 2003-05-30 JP JP2003154477A patent/JP2004355477A/en not_active Withdrawn
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2009093513A (en) * | 2007-10-11 | 2009-04-30 | Oki Semiconductor Co Ltd | Method for reducing instruction bit length |
JP2012252475A (en) * | 2011-06-01 | 2012-12-20 | Fujitsu Ltd | Processor, compression program, compression device, and compression method |
US9619235B2 (en) | 2011-06-01 | 2017-04-11 | Fujitsu Limited | Compressing detected current and preceding instructions with the same operation code and operand patterns |
US9189234B2 (en) | 2013-09-04 | 2015-11-17 | Globalfoundries Inc. | Reducing overhead in loading constants |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP3592230B2 (en) | Data processing device | |
US5727194A (en) | Repeat-bit based, compact system and method for implementing zero-overhead loops | |
US5404552A (en) | Pipeline risc processing unit with improved efficiency when handling data dependency | |
JP4986431B2 (en) | Processor | |
US20020049894A1 (en) | Method and apparatus for interfacing a processor to a coprocessor | |
KR100423910B1 (en) | Method and apparatus for executing coprocessor instructions | |
JPH04313121A (en) | Instruction memory device | |
CN108319559B (en) | Data processing apparatus and method for controlling vector memory access | |
JPH07120278B2 (en) | Data processing device | |
JP2001034471A (en) | Vliw system processor | |
US6055628A (en) | Microprocessor with a nestable delayed branch instruction without branch related pipeline interlocks | |
EP1609058A2 (en) | Method and apparatus for hazard detection and management in a pipelined digital processor | |
US7707389B2 (en) | Multi-ISA instruction fetch unit for a processor, and applications thereof | |
US20230359385A1 (en) | Quick clearing of registers | |
US20190369995A1 (en) | Vector generating instruction | |
JP2004355477A (en) | Microprocessor | |
JP2000207210A (en) | Microprocessor | |
US6877082B1 (en) | Central processing unit including address generation system and instruction fetch apparatus | |
JP5068529B2 (en) | Zero-overhead branching and looping in time-stationary processors | |
JPH1091441A (en) | Program execution method and device using the method | |
JP2021168036A (en) | Arithmetic processing unit | |
JP3699796B2 (en) | Processor | |
JP2005149297A (en) | Processor and assembler thereof | |
JP3915019B2 (en) | VLIW processor, program generation device, and recording medium | |
US20100153688A1 (en) | Apparatus and method for data process |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A300 | Withdrawal of application because of no request for examination |
Free format text: JAPANESE INTERMEDIATE CODE: A300 Effective date: 20060801 |