JP3547585B2 - Microprocessor having conditional execution instruction - Google Patents
Microprocessor having conditional execution instruction Download PDFInfo
- Publication number
- JP3547585B2 JP3547585B2 JP12452597A JP12452597A JP3547585B2 JP 3547585 B2 JP3547585 B2 JP 3547585B2 JP 12452597 A JP12452597 A JP 12452597A JP 12452597 A JP12452597 A JP 12452597A JP 3547585 B2 JP3547585 B2 JP 3547585B2
- Authority
- JP
- Japan
- Prior art keywords
- instruction
- register
- execution
- general
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Images
Landscapes
- Advance Control (AREA)
Description
【0001】
【発明の属する技術分野】
この発明は、命令の一部に含まれる実行条件フィールドを用いて命令の実行を制御する条件実行命令を備えたマイクロプロセッサに関するものである。
【0002】
【従来の技術】
従来より、分岐のペナルティを減少させ、マイクロプロセッサの性能向上のための手法として、条件実行などの手法が検討されている。従来のARMマイクロプロセッサでは、条件実行の判定に用いるためのフラグとして、ネガティブフラグ(N),ゼロフラグ(Z),キャリーフラグ(C),オーバーフローフラグ(V)という特定の命令でのみ設定される専用フラグを用いている。
【0003】
また、マイクロプロセッサの性能向上のための従来の他の手法として、動作周波数の高速化を目的としてパイプラインの段数を多くした場合における演算結果のバイパス処理を用いた手法がある。この手法では、例えば、演算結果を汎用レジスタへ書き込む命令を実行し、次にそのレジスタを参照する命令を実行した場合、後者の命令でレジスタを参照する時点では、前者の命令における演算結果が汎用レジスタへ書き込まれていないため、前者の命令の演算結果を汎用レジスタを経由することなく、専用に設けられたバイパス経路を介して直接参照することで命令を効率良く実行する手法である。
【0004】
【発明が解決しようとする課題】
しかしながら、従来の条件実行命令を有するマイクロプロセッサにおいてバイパス経路を使用する場合、例えば、演算結果を汎用レジスタ内に書き込む条件実行命令を実行し、次にその演算結果が書き込まれた汎用レジスタを参照するのにバイパス経路を用いる命令を実行した場合に、前者の命令の実行条件が満たされず命令が無効となった場合には、後者の命令で間違ったデータをバイパスすることになり、誤動作を引き起こすという課題があった。
【0005】
この発明は上記のような課題を解決するためになされたもので、データを直接転送するバイパス経路を設けた条件実行命令を有するマイクロプロセッサにおいて、条件実行命令の後にバイパス経路を用いる命令が続いた場合でも、パイプラインのペナルティを課することなく効率良く、また誤動作なく命令を実行可能な条件実行命令を有するマイクロプロセッサを得ることを目的とする。
【0006】
【課題を解決するための手段】
請求項1記載の発明に係る条件実行命令を有するマイクロプロセッサは、実行条件フィールドおよび演算フィールドを含む条件実行命令等の各種命令をデコードする命令デコーダと、命令デコーダの出力に従って命令を実行する命令実行部と、命令実行部で実行された命令の演算結果を格納すると共に、条件データが設定される汎用フラグを含んでなる制御レジスタと、命令実行部で実行された命令の演算結果を格納する汎用レジスタと、命令実行部に設けられ、汎用レジスタに格納した演算結果を用いることなく、直前に実行された命令の演算結果を格納している制御レジスタ内の演算結果をバイパスするためのバイパス経路とを備える。特に、命令デコーダ内の条件実行判定部が、汎用フラグ内に設定された条件データと実行条件フィールド内に設定された条件とが合致しているか否かを判定し、バイパス制御部が条件実行判定部の判定結果に従って、バイパス経路を使用するか、若しくは、汎用レジスタに格納した演算結果を使用するかを制御して、条件実行命令の後にバイパス経路を用いる命令が続いた場合でも、パイプラインのペナルティを課することなく効率良く、また誤動作なく命令を実行するものである。
【0007】
請求項2記載の発明に係る条件実行命令を有するマイクロプロセッサは、バイパス制御部内のバイパス判定部が、命令実行部で実行される命令のパイプラインでデータ干渉が発生しているか否かを判定し、レジスタ出力制御部が、バイパス判定部の判定結果に基づいて、バイパス経路を介した制御レジスタのデータ転送動作を制御し、また、条件実行制御部内の条件実行判定部が、実行しようとする条件実行命令が有効であるか無効であるかを判定し、汎用レジスタ書き込み制御部が条件実行判定部の判定結果に基づいて汎用レジスタへのデータの書き込みを制御する。さらに、制御レジスタが、命令実行部で実行された命令の演算結果を取得して格納するレジスタと、汎用レジスタから演算結果を取得して格納すると共に、汎用レジスタを介して取得した演算結果をバイパス経路以外の経路でデータ転送するためのデータ転送経路に接続するレジスタとを有してなり、バイパス判定部がデータ干渉の発生を判定した場合であっても、レジスタ出力制御部は、条件実行判定部から送信される判定結果に従ってレジスタの動作を停止し、また汎用レジスタに格納していた演算結果のデータを使用するようにバイパス経路以外のデータ転送経路を介した制御レジスタのデータ転送を制御して、条件実行命令の後にバイパス経路を用いる命令が続いた場合でも、パイプラインのペナルティを課することなく効率良く、また誤動作なく命令を実行するものである。
【0008】
請求項3記載の発明に係る条件実行命令を有するマイクロプロセッサは、実行条件フィールドおよび演算フィールドを含む条件実行命令等の各種命令をデコードする命令デコーダと、条件が設定される汎用フラグを含む制御レジスタと、命令デコーダの出力に従って命令を実行する命令実行部と、命令実行部の実行結果を格納する複数の汎用レジスタと、命令実行部に設けられ、汎用レジスタを経由することなく、直前に実行された命令の演算結果を格納している複数のレジスタ内の演算結果をバイパスするための複数のバイパス経路と汎用レジスタを経由するデータ転送のためのデータ経路とを備える。特に、命令デコーダ内の条件実行制御部は、汎用フラグ内に設定された条件と実行条件フィールド内に設定された条件が合致しているか否かを判定し、バイパス制御部は、条件実行判定部の判定に従って、複数のバイパス経路および汎用レジスタを経由するデータ経路のうちいずれかを介したデータ転送を制御するので、条件実行命令の後にバイパス経路を用いる命令が続いた場合でも、パイプラインのペナルティを課することなく効率良く、また誤動作なく命令を実行するものである。
【0009】
請求項4記載の発明に係る条件実行命令を有するマイクロプロセッサは、バイパス制御部内のバイパス判定部が、命令実行部で実行される命令のパイプラインでデータ干渉が発生しているか否かを判定し、レジスタ出力制御部が、バイパス判定部の判定結果に基づいて、バイパス経路を介した制御レジスタのデータ転送動作を制御し、条件実行制御部内の条件実行判定部が、実行しようとする条件実行命令が有効であるか無効であるかを判定し、汎用レジスタ書き込み制御部が、条件実行判定部の判定結果に基づいて汎用レジスタへのデータの書き込みを制御し、バイパス判定部がデータ干渉の発生を判定した場合であっても、レジスタ出力制御部は、条件実行判定部から送信される判定結果に従って、複数のバイパス経路およびデータ経路のいずれかを選択して複数のレジスタあるいは複数の汎用レジスタのいずれかを介したデータ転送を制御するので、条件実行命令の後にバイパス経路を用いる命令が続いた場合でも、パイプラインのペナルティを課することなく効率良く、また誤動作なく命令を実行するものである。
【0010】
【発明の実施の形態】
以下、この発明の実施の一形態を説明する。
実施の形態1.
まず、この発明の条件実行命令を有するマイクロプロセッサの基本構成に関して説明する。
【0011】
マイクロプロセッサのハードウエア構成
図1は、この発明の条件実行命令を有するマイクロプロセッサの全体構成を示すブロック図であり、32ビットの内部データバスを有する32ビットマイクロプロセッサである。図において、1は条件実行命令を有するマイクロプロセッサコア、2は命令RAM6から64ビット幅のIDバスを介して入力した命令コードをデコードする処理を行う命令デコードユニット(命令デコーダ)、3はアドレス計算を行うメモリアクセスユニット(命令実行部)、4は算術論理演算またはシフト演算を行う整数演算ユニット、5は32ビット×64ワードの汎用レジスタ(複数の汎用レジスタ)、7はデータが格納されるデータRAMである。
【0012】
命令デコードユニット2において、8、9はそれぞれ命令コードをデコードするデコーダ、10はプロセッサの状態を示すプロセッサ状態語(Processor Status Word、以下プロセッサ状態語をPSWという)である。命令デコードユニット2は、さらに、制御信号11を作成し、それをメモリアクセスユニット3へ与える。また、命令デコードユニット2は、デコーダ9のデコード結果とPSW10の内容に基づいて制御信号12を作成しそれを整数演算ユニット4へ与える。
【0013】
メモリアクセスユニット3において、13はジャンプや分岐を含まない命令を実行するとPC(プログラムカウンタ)値に8を加えて次に実行する命令に対するPC値を算出するとともに、ジャンプや分岐を含む命令の実行時に分岐変位をPC値に加算したり、演算で指定されたアドレッシングモードに応じた計算を行ってジャンプ先の命令に対するPC値を計算するPC制御部である。14は、PC制御部13が計算したPC値を32ビット幅のIAバスを介して命令RAM6へ送るとともに、命令RAM6から命令コードを出力させるメモリ制御部である。
【0014】
メモリ制御部14は、32ビット幅のOAバスを介してアドレスデータをデータRAM7へ転送し、命令実行に必要なデータを64ビット幅のODバスを介してアクセスする。15は、汎用レジスタ5から32ビット幅のS1バス、S2バス、S6バスを介して転送された最大3ワードのデータを用いて算術論理演算を行い、演算結果を32ビット幅のW1バスを介して汎用レジスタ5に転送するALUである。16は、汎用レジスタ5からS1バス、S2バス、S6バスを介して転送されたデータを用いてシフト演算を行い、演算結果をW1バスを介して汎用レジスタ5へ転送するシフタである。
【0015】
メモリアクセスユニット3に対して、S1バス、S2バス、S5バス、S6バスを介して、32ビット長のデータを一時に4ワード転送することが可能である。従って、例えば、第1のレジスタの内容と第2のレジスタの内容との和でアドレッシングされるメモリの領域に第3のレジスタの内容をストアするとともに、第3のレジスタの内容をストアしたアドレスに所定値を加算して得られる値でアドレッシングされるメモリの領域に、第4のレジスタの内容をストアする2ワードストア命令を実現することができる。
【0016】
また、メモリアクセスユニット3は、W1バスおよびW3EバスおよびW3Oバスを介して、メモリアクセスユニット3内での2ワードの演算結果またはデータRAM7から転送された2ワードのデータを、汎用レジスタ5に転送することができる。
【0017】
整数演算ユニット4において、17は汎用レジスタ5から32ビット幅のS3バス、S4バス、S5バスを介して転送された最大3ワードのデータを用いて乗算を行い、演算結果を32ビット幅のW2バス、W3Eバス、W3Oバスを介して汎用レジスタ5へ転送する乗算器である。18は、乗算の結果を累積加算または累積減算して保持するアキュムレータである。アキュムレータとして、64ビットのものが2本組み込まれている。19は、汎用レジスタ5からS3バス、S4バス、S5バスを介して転送された最大3ワードのデータを用いて算術論理演算を行い、演算結果をW2バス、W3Eバス、W3Oバスを介して汎用レジスタ5へ転送するALUである。20は、汎用レジスタ5からS3バス、S4バス、S5バスを介して転送されたデータを用いてシフト演算を行い、演算結果をW2バス、W3Eバス、W3Oバスを介して汎用レジスタ5へ転送するシフタである。
【0018】
このマイクロプロセッサ1では、汎用レジスタ5から、最大6種類のレジスタ値を読み出すことが可能であり、読み出されたデータは、それぞれ、S1バス、S2バス、S3バス、S4バス、S5バス、S6バスへ出力される。また、汎用レジスタ5内へ、W1バス、W2バス、W3Eバス、W3Oバスを介して最大4種類のレジスタ値を同時に書き込むことが可能である。
【0019】
図2は、図1に示したこの発明における条件実行命令を有するマイクロプロセッサ1で用いられる命令フォーマットを示す説明図である。
命令フォーマットとして、1つの命令コードで2つの演算(operation)を指示する2演算命令のフォーマット101と、1つの令令コードで1つの演算を指示する1演算命令のフォーマット102とがある。
【0020】
2演算命令のフォーマット101には、フィールド103およびフィールド104からなるフォーマットフィールドと、2つの演算フィールド106、107に付属する各実行条件フィールド105とがある。1演算命令のフォーマット102には、フィールド108およびフィールド104からなるフオーマットフィールドと、フィールド108、109、110からなる演算フィールドと、演算フィールドに付属する実行条件フィールド105とがある。
【0021】
図3は、図1に示したこの発明における条件実行命令を有するマイクロプロセッサ1で用いられる命令フォーマットフィールドを示す説明図であり、図において、FMは、フィールド103およびフィールド104からなる2ビットの値である。
【0022】
フォーマットフィールドの値がFM=00の場合、この命令は2演算命令であることを示す。そして、演算フィールド106で指示されたoperation_0の演算と演算フィールド107で指示されたoperation_1の演算とが、デコード直後のクロックサイクルで並列に実行される。operation_0の演算はメモリアクセスユニット3で実行され、operation_1の演算は整数演算ユニット4で実行される。
【0023】
フォーマットフィールドの値がFM=01の場合、この命令は2演算命令であることを示す。そして、operation_0の演算がデコード直後のクロックサイクルに実行され、operation_1の演算がoperation_0の演算に対して1クロックサイクル遅れて実行される。
【0024】
フォーマットフィールドの値がFM=10の場合、この命令は2演算命令であることを示す。そして、operation_1の演算がデコード直後のクロックサイクルに実行され、operation_0の演算がoperation_1の演算に対して1クロックサイクル遅れて実行される。
【0025】
フォーマットフィールドの値がFM=11の場合、この命令は1演算命令であることを示す。そして、フィールド108、109、110からなる演算フィールドで指示された1つの演算がデコード直後のクロックサイクルで実行される。
【0026】
図4は、図1に示したこの発明における条件実行命令を有するマイクロプロセッサで用いられる命令フォーマット内の実行条件フィールド105の詳細な内容を示す説明図である。
実行条件フィールド105は、マイクロプロセッサ1の実行コントロールフラグF0、F1の値に応じて、演算フィールド106、107のoperation_0の演算やoperation_1の演算、および演算フィールド108、109、110の演算が有効であるか無効であるかを定める。実行コントロールフラグF0、F1の内容については後述する。
【0027】
演算が有効であるとは、演算結果がレジスタ、メモリおよびフラグに反映され、その演算による動作の結果が残ることを意味する。演算が無効であるとは、演算結果がレジスタ、メモリおよびフラグに反映されず、あたかも無効演算(NOP)が実行されたかのような動作の結果が残ることを意味する。
【0028】
実行条件フィールド105の値がCC=000ときには、実行コントロールフラグF0、F1の値に関わらず常に演算は有効である。命令に/TXを記述したときには、CC=000であることを意味する。
【0029】
実行条件フィールド105の値がCC=001のときには、実行コントロールフラグF0=真のときにのみ演算は有効である。実行コントロールフラグF1の状態はいずれでもよい。命令に/FXを記述したときには、CC=001であることを意味する。
【0030】
実行条件フィールド105の値がCC=010のときには、実行コントロールフラグF0=偽のときにのみ演算は有効である。実行コントロールフラグF1の状態はいずれでもよい。命令に/FXを記述したときには、CC=010であることを意味する。
【0031】
実行条件フィールド105の値がCC=011のときには、実行コントロールフラグF1=真のときにのみ演算は有効である。実行コントロールフラグF0の状態はいずれでもよい。命令に/XTを記述したときには、CC=011であることを意味する。CC=100のときには、実行コントロールフラグF1=偽のときにのみ演算は有効である。実行コントロールフラグF0の状態はいずれでもよい。命令に/XFを記述したときには、CC=100であることを意味する。
【0032】
実行条件フィールド105の値がCC=101のときには、実行コントロールフラグF0=真かつF1=真のときにのみ演算は有効である。命令に/TTを記述したときには、CC=101であることを意味する。CC=110のときには、実行コントロールフラグF0=真かつF1=偽のときのみ演算は有効である。命令に/TFを記述したときには、CC=110であることを意味する。
【0033】
実行条件フィールド105の値がCC=111のときの動作は未定義であり、ユーザは、CC=111となる命令を用いることはできない。
【0034】
図5は、図1に示したこの発明における条件実行命令を有するマイクロプロセッサで用いられる命令フォーマット内の演算フィールドを示す説明図である。図において、フォーマット111〜117は、それぞれ28ビットで表現される短型の演算フィールド106または演算フィールド107によるものである。フォーマット118、119は、フィールド108、109、110で構成される長型の演算フィールドによるものである。フォーマット111(Short_M)は、演算内容を指定するフィールド120、レジスタ番号を指定する2つのフィールド121、122、レジスタ番号または6ビット長の即値指定するフィールド123、およびフィールド123がレジスタ番号を示すのか即値を示すのかを指定するフィールド124で構成される。
【0035】
図5の説明図に示すように、フィールド124の値Xが「00」、「01」または「11」であるときにはフィールド123がレジスタ番号を示していることを示し、「10」であるときには即値を示していることを示す。このフォーマット111は、レジスタ間接アドレッシングのメモリアクセス演算に用いられる。
【0036】
フォーマット112(Short_A)は、演算内容を指定するフィールド120、レジスタ番号を指定する2つのフィールド121、122、レジスタ番号または6ビット長の即値を指定するフィールド123、およびフィールド123がレジスタ番号を示すのか即値を示すのかを指定するフィールド125で構成される。
【0037】
図5の説明図に示すように、フォーマット112内のフィールド125の値Xが「0」であるときにはフィールド123がレジスタ番号を示していることを示し、「1」であるときには即値を示していることを示す。このフォーマット112は、算術演算、論理演算、シフト演算およびビット演算に用いられる。
【0038】
フォーマット113(Short_B1)は、演算内容を指定するフィールド120およびレジスタ番号を指定するフィールド126で構成される。このフォーマット113は、レジスタ指定によるジャンプ命令および分岐命令に用いられる。
【0039】
フォーマット114(Short_B2)は、演算内容を指定するフィールド120および18ビット長のディスプレイスメントのフィールド127で構成される。このフォーマット114は、ジャンプ命令および分岐命令に用いられる。
【0040】
フォーマット115(Short_B3)は、演算内容を指定するフィールド120、レジスタ番号を指定するフィールド121、レジスタ番号または12ビット長の即値を指定するフィールド128、フィールド128がレジスタ番号を示すのか即値を示すのかを指定するフィールド129、およびゼロ判定に基づいてフィールド121に基づく条件ジャンプまたは条件分岐を行うか否かを指定するフィールド130で構成される。このフォーマット115は、条件ジャンプ命令および条件分岐命令に使用される。
【0041】
フォーマット116(Short_D1)は、演算内容を指定するフィールド120、レジスタ番号を指定するフィールド121、レジスタ番号または12ビット長の即値を指定するフィールド128、フィールド128がレジスタ番号を示すのか即値を示すのかを指定するフィールド129で構成される。このフォーマット116は、条件ジャンプ命令、条件分岐命令およびリピート命令に使用される。
【0042】
フォーマット117(Short_D2)は、演算内容を指定するフィールド120、レジスタ番号または12ビット長の即値を指定するフィールド128、フィールド128がレジスタ番号を示すのか即値を示すのかを指定するフィールド129、遅延命令(ディレイド命令)に関するフィールド131で構成される。このフォーマット117は、ディレイドジャンプ命令、ディレイド分岐命令およびリピート命令に使用される。
【0043】
フォーマット118(Long1)は、演算内容を指定するフィールド120、レジスタ番号を指定する2つのフィールド121、122、32ビット長の即値を指定するフィールド132で構成される。このフォーマット118は、複雑な算術演算、大きな即値を用いる算術演算、大きなディスプレイスメント付きレジスタ間接アドレッシングのメモリアクセス演算、大きな変位の分岐演算および絶対番値へのジャンプ命令などに使用される。
【0044】
フォーマット119(Long2)は、演算内容を指定するフィールド120、レジスタ番号を指定する2つのフィールド121、122、32ビット長の即値を指定するフィールド132、およびゼロ判定に基づいてフィールド132に基づく条件ジャンプまたは条件分岐を行うか否かを指定するフィールド133で構成される。
【0045】
このフォーマット119は、大きな分岐変位を持つ条件ジャンプや条件分岐命令に使用される。
【0046】
図6は、図1に示したこの発明における条件実行命令を有するマイクロプロセッサのレジスタの構成を示す説明図である。
このマイクロプロセッサ1は、64本の32ビット長の汎用レジスタ5、12本の制御レジスタ150、および2本のアキュムレータ18を備えている。R0の汎用レジスタ140の内容は常に0であり、そこへの書き込みは無視される。R62の汎用レジスタは、サブルーチンからの戻り先アドレスが設定されるリンクレジスタである。R63の汎用レジスタは、スタックポインタであり、PSW10のSMフィールドの値に応じてユーザスタックポインタ(SPU)または割り込みスタッタポインタ(SPI)として動作する。制御レジスタ150には、プログラムカウンタ151、PSW10、および各種の専用レジスタが含まれる。
【0047】
図5に示すフォーマット112による演算では、64本の汎用レジスタ5のそれぞれを上位16ビットと下位16ビットとに分けてアクセスできる。また、2本のアキュムレータ18を、上位32ビットと下位32ビットとに分けて別々にアクセスできる。
【0048】
図7は、図1に示したこの発明における条件実行命令を有するマイクロプロセッサのレジスタ内のPSWを示す説明図である。
PSW10の上位16ビットは、スタックポインタを切り替えるためのSMフィールド171、ソフトウェアデバッガトラップ(SDBT)の検出を示すEAフィールド172、SDBTの許可を指定するDBフィールド173、割り込み許可を指定するIEフィールド174、リピート動作の許可を指定するRPフィールド178、モジュロアドレッシングの許可を指定するMDフィールド176がある。
【0049】
下位16ビットは、フラグフィールド180である。フラグフィールド180には8個のフラグがあり、その中のF0フラグ181およびF1フラグ182は演算の有効/無効を指定する。各フラグの値は、比較演算や算術演算の結果に応じて変化する。また、フラグ初期化演算で初期化したり、フラグ値書き込み演算では任意の値をフラグフィールド180に書き込むことによって変化する。フラグフィールド180の内容は、フラグ値読み出し演算によって読み出される。
【0050】
以下、この発明の条件実行命令を有するマイクロプロセッサ1の命令一覧を示す。
【0051】
【0052】
【0053】
【0054】
reserved
【0055】
【0056】
【0057】
【0058】
【0059】
【0060】
【0061】
【0062】
【0063】
図8は、図1に示したこの発明における条件実行命令を有するマイクロプロセッサ1の並列2命令実行時のパイプライン動作を示す説明図である。
この動作は、命令のフォーマットフィールドの値FM=00のときに実行される。パイプライン190、195は、IFステージ191、D/Aステージ192、E/Mステージ193、Wステージ194で構成される。並列2命令実行時には、メモリアクセスユニット3での実行190と整数演算ユニット4での実行195が並列に行われる。
【0064】
図9は、図1に示したこの発明における条件実行命令を有するマイクロプロセッサのパイプライン動作を示す説明図であり、図において、各ステージはクロックに同期しており、クロックのHighの期間とLowの期間により、2つの期間に分割される。
【0065】
IFステージのクロックがHighのときがI1期間、LowのときがI2期間、D/AステージのクロックがHighのときがD1期間、LowのときがD2期間、E/MステージのクロックがHighのときがE1期間、LowのときがE2期間、IFステージのクロックがHighのときがW1期間、LowのときがW2期間である。
【0066】
IFステージでは命令のフェッチを行い、D/AステージではD1期間内に命令のデコード及び汎用レジスタのリードを行い、D2期間内にメモリのアドレス計算を行う。E/MステージとWステージのW1期間では演算の実行及びメモリのアクセスを行い、WステージのW2期間にて汎用レジスタへの書き込みを行う。
【0067】
図10は、マイクロプロセッサ1においてデータ干渉が起こる場合のプログラム例である。データ干渉については後述する。
【0068】
図において、ADD命令は、第2オペランド及び第3オペランドで指定される汎用レジスタの値を加算し、演算結果を第1オペランドで指定される汎用レジスタに書き込む命令である。ADD命令200では、汎用レジスタR2の値及び汎用レジスタR3の値が加算され、その加算結果が、汎用レジスタR4に書き込まれる。
【0069】
ADD命令210では、汎用レジスタR10の値及び汎用レジスタR4の値が加算され、その加算結果が、汎用レジスタR11内に書き込まれる。ADD命令210において、汎用レジスタR4の値は、ADD命令200の加算結果と等しい。
【0070】
ADD命令200において、汎用レジスタR4への加算結果の書き込みは、W2期間内に行われるために、ADD命令210のD2期間では、この汎用レジスタR4への加算結果の書き込みはまだ終っていないため、ADD命令210のD1期間で読み出した汎用レジスタR4の値は、演算に使用することができない。このような状況をデータ干渉と呼ぶ。データ干渉が起こる状況では、ADD命令200の加算結果を、汎用レジスタR4を経由せずに専用のデータ転送経路(バイパス経路)を介してADD命令210のD2期間に渡す制御を行う。
【0071】
図11は、図10のプログラムを実行したときのパイプラインの動作を示した説明図であり、図において、220は命令200に対応したパイプライン、230は命令210に対応したパイプラインである。パイプライン220とパイプライン230で同じ列にあるステージがそれぞれ同時に実行されることを示している。図11内の矢印が示すように、パイプライン220のE2期間からパイプライン230のD2期間に加算結果をバイパス経路を介して渡すことにより、パイプラインを乱さずに命令の実行を行う。
【0072】
図12は、図10に示すプログラムを実行するときのマイクロプロセッサ1の動作を説明するためのブロック図であり、図1に示すマイクロプロセッサ1のブロック図と同一の参照番号を用いている。即ち、ALU15、汎用レジスタ5、メモリアクセスユニット3、MUデコーダ8は、図1に示したものと同一構成要素である。
【0073】
メモリアクセスユニット3において、240はD2バスに出力されたデータをE1期間内に取り込み、取り込んだデータをALU15に出力するE1レジスタ、241は、ALU15からの出力データをE1バスを介してE2期間内に取り込み、取り込んだデータをE2バスに出力するとともに、レジスタ出力制御部252から出力される制御信号に従って取り込んだデータをバイパス経路B0を経由してD2バスへ出力するE2レジスタ、242は汎用レジスタ5の出力をS2バスを介してD2期間内に取り込み、レジスタ出力制御部252の出力に従って取り込んだデータをデータ経路D0を経由してD2バスへ出力するD2レジスタ、243はE2レジスタ241の出力をE2バスを介してW1期間内に取り込み、取り込んだデータをW1バスに出力するW1レジスタである。
【0074】
MUデコーダ8において、250はバイパス制御を行うバイパス制御部、260は条件実行命令における制御を行う条件実行制御部である。
【0075】
バイパス制御部250において、251はデータ干渉が起こっているか否かを判定するバイパス判定部、252はバイパス判定部の判定結果および条件実行判定部261の判定結果に従って、E2レジスタ241およびD2レジスタ242にD2バスへの出力を制御する信号を出力するレジスタ出力制御部である。
【0076】
条件実行制御部260において、261は条件実行命令が有効であるか無効であるかを判定する条件実行判定部、262は条件実行判定部261の判定結果に従って、汎用レジスタ5への書き込みを制御する信号を出力する汎用レジスタ書き込み制御部である。
【0077】
図13は、条件実行判定部261を示すブロック図であり、図において、270は図2における実行条件フィールド105と同じものである。271は図7におけるF0フラグ181およびF1フラグ182と同じものである。272は実行条件フィールド270に設定されている条件をデコードし実行コントロールフラグ271に設定されている条件と合致しているか否かを判断するデコーダである。
【0078】
次に動作について説明する。
先ず、図10に示すプログラムを実施の形態1の条件実行命令を有するマイクロプロセッサ1が実行したときの動作について説明する。
【0079】
図10に示すプログラム内の命令200が実行され得られる加算結果は、ALU15から出力され、E1バスを介して、命令200のE2期間内にE2レジスタ241に格納される。E2レジスタ241からの出力は、E2バスを介して命令200のW1期間内にW1レジスタ243に格納される。
【0080】
命令200の実行の場合には、実行条件フィールド270はCC=000の値を持ち、前に述べたように実行コントロールフラグ271の値によらずいつでも当該命令は有効である。従って、条件実行判定部261は、当該命令が有効であると判定し判定結果を汎用レジスタ書き込み制御部262およびレジスタ出力制御部252に出力する。汎用レジスタ書き込み制御部262は、条件実行判定部261の判定結果に従って書き込むことを許可する制御信号を汎用レジスタへ出力する。
【0081】
W1レジスタ243に格納されたデータは、汎用レジスタ書き込み制御部262の制御信号に従って、W1バスを介して汎用レジスタ内に、命令200のW2期間内に書き込まれる。命令210においてR4のデータは、汎用レジスタ5からS2バスを介して命令210のD2期間内にD2レジスタ242に取り込まれる。
【0082】
バイパス判定部251は、命令210がデータ干渉を起こしていると判定し、判定結果をレジスタ出力制御部252へ出力する。レジスタ出力制御部252は、バイパス判定部251の判定結果に従って、命令200の加算結果を保持しているE2レジスタ241に、D2バスへの出力を許可することを意味する制御信号を出力し、汎用レジスタ5のデータを保持するD2レジスタ242にD2バスへの出力を許可しないことを意味する制御信号を出力する。
【0083】
E2レジスタ241は、レジスタ出力制御部252の制御信号に従って保持したデータのD2バスへの出力を行う。一方、D2レジスタ242は、レジスタ出力制御部252の制御信号に従って保持したデータのD2バスへの出力を行わない。E1レジスタ240は、E2レジスタ241からの出力データをD2バスを介して命令210のE1期間内に取り込み、取り込まれたデータをALU15へ出力する。ALU15は、E1レジスタ240からの出力データをもとに命令210の加算演算を行う。
【0084】
次に、図10に示すプログラム内の命令200が条件実行命令であった場合の実施の形態1の条件実行命令を有するマイクロプロセッサ1の動作について説明する。
【0085】
図14は、図10に示すプログラム内の命令200が、条件実行命令である場合のデータ干渉の発生を示す説明図である。図において、命令280は条件実行命令であり、命令に/TXが記述されているため、前述したように実行コントロールフラグF0が1のとき命令280は有効になり、実行コントロールフラグF0が0のとき命令280は無効となる。実行コントロールフラグF1の値は考慮されない。
【0086】
命令280が有効のときには、命令291の汎用レジスタR4の値は、命令280の加算結果と一致し、命令280が無効のときは、命令291の汎用レジスタR4の値は、命令280を実行する以前の値と一致する。図14に示す命令280の加算結果は、ALU15から出力され、E1バスを介して命令200のE2期間内にE2レジスタ241内に格納される。E2レジスタ241からの出力は、E2バスを介して命令280のW1期間内にW1レジスタ243内に格納される。
【0087】
命令280の場合には、実行条件フィールド270はCC=001の値を持ち、条件実行判定部261は、実行コントロールフラグ271のF0フラグが1のとき命令280は有効であると判定し、F0フラグが0のとき命令280は無効であると判定し、判定結果を汎用レジスタ書き込み制御部262に出力するとともに、レジスタ出力制御部252に出力する。
【0088】
まず、命令280が有効であった場合、マイクロプロセッサ1が図10に示すプログラムを実行したときと同じ動作を行う。
次に、命令280が無効であったときの動作を説明する。
汎用レジスタ書き込み制御部262は、条件実行判定部261の判定結果に従って、書き込むことを許可しないことを指示する制御信号を汎用レジスタ5に対して出力する。W1レジスタ243内に格納されたデータは、汎用レジスタ書き込み制御部262の制御信号に従い、汎用レジスタ5への書き込みは行われない。命令290においてR4のデータは、汎用レジスタ5からS2バスを介して命令290のD2期間内にD2レジスタ242内に取り込まれる。
【0089】
バイパス判定部251は、命令210がデータ干渉を起こしていると判定し、判定結果をレジスタ出力制御部252へ出力する。レジスタ出力制御部252は、条件実行判定部261の判定結果に従って、バイパス判定部251の判定結果によらず、E2レジスタ241に対してバイパス経路B0を経由して行われるD2バスへの出力を許可しないことを意味する制御信号を出力する。さらに、レジスタ出力制御部252は、汎用レジスタ5のデータを保持するD2レジスタ242に、データ経路D0を経由したD2バスへのデータ出力を許可することを指示する制御信号を出力する。E2レジスタ241は、レジスタ出力制御部252から送信される制御信号に従って、保持したデータのバイパス経路B0を経由して行われるD2バスへの出力を実行しない。
【0090】
一方、D2レジスタ242は、レジスタ出力制御部252の制御信号に従って保持したデータのD2バスへの出力を行う。E1レジスタ240は、E2レジスタからの出力データをD2バスを介して命令210のE1期間内に取り込み、取り込まれたデータをALU15へ出力する。ALU15は、E1レジスタからの出力データをもとに命令280の加算演算を行う。
【0091】
以上のように、この実施の形態1によれば、条件実行命令を含む命令のパイプライン間でデータ干渉が発生しているか否かを判定し、バイパス判定部251での判定結果に基づいて行われるレジスタ出力制御部252の出力を、実行条件制御部260内の条件実行判定部261での判定結果に従って制御し、バイパス経路B0やデータ経路D0を介したデータ転送を制御するようにしたので、条件実行命令を実行するパイプラインにおいてデータ干渉が発生した場合でも、命令を効率良く実行し、データ干渉による誤動作を回避できる。
【0092】
実施の形態2.
図15は、この発明の実施の形態2におけるマイクロプロセッサで実行されるプログラム例を示す説明図である。実施の形態1のマイクロプロセッサの構成要素以外のこの実施の形態2のマイクロプロセッサの構成要素は、図17に示す説明図を用いて後述する。なお、図1および図12に示した実施の形態1のマイクロプロセッサの構成要素と同様のものについては、同一符号を用い、またそれらの説明を省略する。
【0093】
図15におけるLD2W命令300は、第2オペランド及び第3オペランドで指定された汎用レジスタに設定されている値の和で示されるメモリアドレスから8byteのデータを読み出し、第1オペランドで指定された汎用レジスタおよび、その汎用レジスタ内のレジスタ番号に1を加えた汎用レジスタ内に読み出したデータを書き込む命令である。また、図15において、第2オペランドのプラス(+)記号は、アドレッシングモードがポストインクリメントであることを示しており、メモリからデータを読み出した後、第2オペランドで指定されている汎用レジスタの値に8が加算される。
【0094】
図15に示すプログラムにおいて、命令300はレジスタR2およびR3の値の和で示されるメモリ内のメモリアドレスから8byteのデータを読み出し、読み出したデータをレジスタR10、R11へ書き込む命令である。また、レジスタR2へは、メモリからデータが読み出された後、8が加算される。
【0095】
命令310は条件実行命令である。命令310において記号/TXは、実行コントロールフラグF0が1のとき命令310は有効になり、実行コントロールフラグF0が0のとき命令310は無効となることを示している。実行コントロールフラグF1の値は考慮されない。命令310が有効のときは、命令300で更新されたレジスタR2の値およびR3の値の和で示されるメモリアドレスからデータが読み出され、読み出されたデータは、レジスタR12、R13内に書き込まれる。
【0096】
また、レジスタR2はメモリからデータが読み出された後、8が加算される。命令310が無効のときには、レジスタR12、R13および、R2の値は変化しない。
【0097】
命令320は、命令310が有効のときには、命令310で更新されたレジスタR2の値およびR3の値の和で示されるメモリ内のメモリアドレスからデータが読み出され、読み出されたデータはレジスタR14、R15へ書き込まれる。命令310が無効のときには、命令300で更新されたレジスタR2の値およびR3の値の加算で示されるメモリアドレスのデータが読み出され、読み出されたデータは、レジスタR14、R15内に書き込まれる。また、レジスタR2へは、メモリからデータが読み出された後、8が加算される。
【0098】
図16は、実施の形態2のマイクロプロセッサ1が、図15に示すプログラムを実行したときのパイプラインの動作を示した説明図であり、図において、命令300に対応したパイプラインが330であり、命令310に対応したパイプラインが340であり、命令320に対応したパイプラインが350である。
【0099】
図16において、パイプライン330、340および350で同じ列にあるステージがそれぞれ同時に実行されることを示している。命令300において、汎用レジスタR2に8が加算された値が書き戻されるのはW2期間であるため、命令310においてレジスタR2の値が読み出されるD1期間ではまだ更新されておらず、データ干渉が起こっている。そのため、矢印331に示すように命令300のD1期間で更新されたR2の値を、命令300のE1期間から命令310のD1期間に渡す。
【0100】
命令310において、命令が有効であるとき、レジスタR2の値に8が加算された値が書き戻されるのは、W2期間であるため、命令320においてレジスタR2の値が汎用レジスタ5から読み出されるD1期間では、レジスタR2の値はまだ更新されておらず、データ干渉が起こっている。そのため、矢印341に示すように、命令320のD1期間で更新されたレジスタR2の値を命令310のE1期間から命令320のD1期間に渡す。
【0101】
命令310が無効であるとき、命令300においてレジスタR2の値に8が加算された値が書き戻されるのはW2期間であるため、命令320においてレジスタR2が汎用レジスタ5から読み出されるD1期間ではまだ更新されておらず、データ干渉が起こっている。そのため、矢印332に示すように、命令300のD1期間で更新されたR2の値を命令300のW1期間から命令320のD1期間に渡す。
【0102】
図17は、図15に示すプログラムを実行するときの実施の形態2のマイクロプロセッサの動作を説明するためのブロック図である。図において、汎用レジスタ5、メモリアクセスユニット3、MUデコーダ8、データRAM7は、図1に示したものと同一の構成要素からなる。また、条件実行制御部260は、図12に示したものと同じ構成要素からなる。
【0103】
図17に示す命令実行ユニットとしてのメモリアクセスユニット3において、360はインクリメンタ370から得られる出力をD2期間内に取り込み、取り込んだデータをE1レジスタ361へ出力するD2レジスタである。361はD2レジスタ360から出力されたデータをE1期間内に取り込み、取り込んだデータをE2レジスタ362に出力するとともに、レジスタ出力制御部382から出力される制御信号に従って、バイパス経路B1を介してS1バスへ出力するE1レジスタである。
【0104】
363は加算器371からの出力データをD2期間内に取り込み、取り込んだデータをM1レジスタ364へ出力するD2レジスタである。364はD2レジスタ363の出力をE1期間内に取り込み、取り込んだデータをOAバスに出力するM1レジスタである。365はE2バスに出力されたデータをW1期間内に取り込み、取り込んだデータをW1バスに出力するとともに、レジスタ出力制御部382から出力される制御信号に従って、バイパス経路S2を介してS1バスへ出力するW1レジスタである。
【0105】
370はS1バスに出力されたデータに8を加算した値を出力するインクリメンタである。371はS1バスおよび、S2バスに出力されたデータを入力し、それらの加算結果をD2レジスタ363に出力する加算器である。MUデコーダ8において、380はバイパス制御を行うバイパス制御部である。
【0106】
バイパス制御部380において、381は命令を実行するパイプライン間でデータ干渉が発生しているか否かを判定し、さらにデータ干渉が発生している場合はどのように起こっているかを判定し、判定結果をレジスタ出力制御部382へ出力するバイパス判定部である。382はバイパス判定部381の判定結果および条件実行判定部261の判定結果に従って、バイパス経路B1を介したE1レジスタ361のデータ転送、バイパス経路B2を介したW1レジスタ365のデータ転送、およびデータ経路D1を介した汎用レジスタ5によるS1バスへのデータ転送を制御する制御信号を、これらのE1レジスタ361、W1レジスタ365および汎用レジスタ5へ出力するレジスタ出力制御部である。
【0107】
次に動作について説明する。
先ず、図15に示すプログラムを実施の形態2のマイクロプロセッサが実行したときの動作について説明する。
命令300において、汎用レジスタ5内のレジスタR2、R3のデータは、それぞれS1バス、S2バスを介して加算器371に出力されるとともに、レジスタR2のデータは、S1バスを介してインクリメンタ370にも出力される。加算器371から出力される加算結果は、D2レジスタ363、M1レジスタ364を経てOAバスへ出力され、データRAM7のメモリアドレスとして出力される。
【0108】
一方、インクリメンタ370では、汎用レジスタ5内のレジスタR2の値に8が加算され、その加算結果がD2レジスタ360を経てE1レジスタ361に出力される。E1レジスタ361に取り込まれたデータは、E2レジスタ362に取り込まれ、E2バスを介してW1レジスタに出力される。W1レジスタに取り込まれたデータは、W1バスを介して汎用レジスタ5内へ出力されレジスタR2の値が更新される。
【0109】
図15に示す命令310では、バイパス判定部381は、命令310のレジスタR2が命令300とデータ干渉を起こしていると判定し、判定結果をレジスタ出力制御部382に出力する。レジスタ出力制御部382では、バイパス判定部381の判定結果に従って、命令300のレジスタR2の加算結果を保持しているE1レジスタにS1バスへの出力を許可することを意味する制御信号を出力し、W1レジスタ365および汎用レジスタ5に対してS1バスへの出力を許可しないことを意味する制御信号を出力する。
【0110】
バイパス経路B1を介してS1バスへ出力されたE1レジスタ361からのデータは、加算器371へ入力されると同時に、インクリメンタ370内へ入力される。加算器371の加算結果は、D2レジスタ363、M1レジスタ364を経てOAバスに出力され、データRAM7に対するメモリアドレスとして出力される。また、インクリメンタ370での加算結果は、D2レジスタ360を経てE1レジスタ361に取り込まれる。E1レジスタ361に取り込まれたデータは、E2レジスタ362内へ取り込まれ、E2バスを介してW1レジスタ365へ出力される。W1レジスタ365に取り込まれたデータは、W1バスを介して汎用レジスタ5へ出力される。
【0111】
実行条件フィールド270はCC=001の値を持ち、条件実行判定部261は、実行コントロールフラグ271のF0フラグが1のとき命令310は有効であると判定し、F0フラグが0のとき命令310は無効であると判定し、判定結果を汎用レジスタ書き込み制御部262へ出力する同時に、レジスタ出力制御部382へ出力する。命令310が有効のときは、汎用レジスタ書き込み制御部262は、書き込みを許可することを指示する制御信号を汎用レジスタ5へ出力し、これにより汎用レジスタ5は、W1バスに出力されたR2の更新結果を書き込む。
【0112】
命令310が無効のときは、汎用レジスタ書き込み制御部262は、書き込みを許可しないことを指示する制御信号を汎用レジスタ5に対して出力し、これにより汎用レジスタ5は、W1バスに出力されたレジスタR2の更新結果の書き込みを実行しない。
【0113】
命令320では、バイパス判定部381は、命令320のレジスタR2が命令300および命令310とデータ干渉を起こしていると判定し、判定結果をレジスタ出力制御部382へ出力する。レジスタ出力制御部382は、条件実行判定部261から出力された命令310に対する判定結果に従って、命令310が有効のときには、命令310のレジスタR2の加算結果を保持しているE1レジスタ361に対し、バイパス経路B1を介したS1バスへのデータ転送を許可することを指示する制御信号を出力し、命令300のレジスタR2の加算結果を保持しているW1レジスタ365および、汎用レジスタ5に対しては、それぞれバイパス経路B2、データ経路D1を介したS1バスへの出力を許可しないことを指示する制御信号を出力する。
【0114】
命令310が無効のときには、レジスタ出力制御部382は、命令310のレジスタR2の加算結果を保持しているE1レジスタ361および汎用レジスタ5に対し、それぞれバイパス経路B1、データ経路D1を介したS1バスへのデータ転送を許可しないことを指示する制御信号を出力し、さらに命令300のレジスタR2への加算結果を保持しているW1レジスタ365に対し、バイパス経路B2を介したS1バスへデータ転送を許可することを指示する制御信号を出力する。
【0115】
インクリメンタ370および加算器371は、命令310が有効のとき、E1レジスタ361から出力されたデータをS1バスを介して入力する。一方、命令310が無効のときには、W1レジスタ365から出力されたデータをS1バスを介して入力する。加算器371の加算結果は、D2レジスタ363、M1レジスタ364を経てOAバスへ出力され、データRAM7のメモリアドレスとしてデータRAM7に出力される。
【0116】
インクリメンタ370の加算結果は、D2レジスタ360を経てE1レジスタ361へ出力される。E1レジスタ361に取り込まれたデータは、E2レジスタ362へ取り込まれ、E2バスを介してW1レジスタに出力される。W1レジスタに取り込まれたデータは、W1バスを介して汎用レジスタ5へ出力される。
【0117】
以上のように、この実施の形態2によれば、命令デコードユニット2内に設けられた条件実行制御部260内の条件実行判定部261が、データ干渉がどのように発生しているかを判定するバイパス制御部380内のバイパス判定部381の出力を制御し、レジスタ出力制御部382から出力される制御信号を制御して、バイパス経路B1、B2やデータ経路D1を選択してデータ転送を実行するように構成したので、条件実行命令を含む複数の命令のパイプラインにおいてデータ干渉が発生した場合でも、命令を効率良く実行でき、データ干渉による誤動作を回避できる。
【0118】
【発明の効果】
以上のように、請求項1記載の発明によれば、命令デコーダ内の条件実行判定部が、汎用フラグ内に設定された条件データと実行条件フィールド内に設定された条件とが合致しているか否かを判定し、バイパス制御部が条件実行判定部の判定結果に従って、バイパス経路を使用するか否かを制御するように構成したので、条件実行命令の後にバイパス経路を用いる命令が続いた場合でも、パイプラインのペナルティを課することなく効率良く、また誤動作なく命令を実行できる効果がある。
【0119】
請求項2記載の発明によれば、バイパス制御部内のバイパス判定部が、命令実行部で実行される命令のパイプラインでデータ干渉が発生しているか否かを判定し、レジスタ出力制御部が、バイパス判定部の判定結果に基づいて、バイパス経路を介した制御レジスタのデータ転送動作を制御し、また、条件実行制御部内の条件実行判定部が、実行しようとする条件実行命令が有効であるか無効であるかを判定し、汎用レジスタ書き込み制御部が条件実行判定部の判定結果に基づいて汎用レジスタへのデータの書き込みを制御し、バイパス判定部がデータ干渉の発生を判定した場合であっても、レジスタ出力制御部は、条件実行判定部から送信される判定結果に従ってレジスタの動作を停止し、また汎用レジスタ内のデータを使用するようにレジスタおよび汎用レジスタを制御するように構成したので、条件実行命令の後にバイパス経路を用いる命令が続いた場合でも、パイプラインのペナルティを課することなく効率良く、また誤動作なく命令を実行できる効果がある。
【0120】
請求項3記載の発明によれば、命令デコーダ内の条件実行制御部が、汎用フラグ内に設定された条件と実行条件フィールド内に設定された条件が合致しているか否かを判定し、バイパス制御部が条件実行判定部の判定に従って、複数のバイパス経路および汎用レジスタを経由するデータ経路のうちいずれかを介したデータ転送を制御するように構成したので、条件実行命令の後にバイパス経路を用いる命令が続いた場合でも、パイプラインのペナルティを課することなく効率良く、また誤動作なく命令を実行できる効果がある。
【0121】
請求項4記載の発明によれば、バイパス制御部内のバイパス判定部が、命令実行部で実行される命令のパイプラインでデータ干渉が発生しているか否かを判定し、レジスタ出力制御部がバイパス判定部の判定結果に基づいて、バイパス経路を介した制御レジスタのデータ転送動作を制御し、条件実行制御部内の条件実行判定部が、実行しようとする条件実行命令が有効であるか無効であるかを判定し、汎用レジスタ書き込み制御部が、条件実行判定部の判定結果に基づいて汎用レジスタへのデータの書き込みを制御し、バイパス判定部がデータ干渉の発生を判定した場合であっても、レジスタ出力制御部が条件実行判定部から送信される判定結果に従って、複数のバイパス経路およびデータ経路のいずれかを選択して複数のレジスタあるいは複数の汎用レジスタのいずれかを介したデータ転送を制御するように構成したので、条件実行命令の後にバイパス経路を用いる命令が続いた場合でも、パイプラインのペナルティを課することなく効率良く、また誤動作なく命令を実行できる効果がある。
【図面の簡単な説明】
【図1】この発明の実施の形態1における条件実行命令を有するマイクロプロセッサの基本構成を示すブロック図である。
【図2】図1に示したこの発明における条件実行命令を有するマイクロプロセッサで用いられる命令フォーマットを示す説明図である。
【図3】図1に示したこの発明における条件実行命令を有するマイクロプロセッサで用いられる命令フォーマットフィールドを示す説明図である。
【図4】図1に示したこの発明における条件実行命令を有するマイクロプロセッサで用いられる命令フォーマット内の実行条件フィールドの詳細な内容を示す説明図である。
【図5】図1に示したこの発明における条件実行命令を有するマイクロプロセッサで用いられる命令フォーマット内の演算フィールドを示す説明図である。
【図6】図1に示したこの発明における条件実行命令を有するマイクロプロセッサのレジスタの構成を示す説明図である。
【図7】図1に示したこの発明における条件実行命令を有するマイクロプロセッサのレジスタ内のPSWを示す説明図である。
【図8】図1に示したこの発明における条件実行命令を有するマイクロプロセッサのパイプライン動作を示す説明図である。
【図9】図1に示したこの発明における条件実行命令を有するマイクロプロセッサのパイプライン動作を示す説明図である。
【図10】この発明の一実施の形態におけるマイクロプロセッサのデータ干渉が起こる場合のプログラム例である。
【図11】図10に示すプログラムを実行したときのパイプラインの動作を示した説明図である。
【図12】図10に示すプログラムを実行するときのマイクロプロセッサの動作を説明するためのブロック図である。
【図13】条件実行判定部を示すブロック図である。
【図14】図10に示すプログラム内の命令が、条件実行命令である場合のデータ干渉の発生を示す説明図である。
【図15】この発明の実施の形態2におけるマイクロプロセッサで実行されるプログラム例を示す説明図である。
【図16】図15に示すプログラムを実行したときのパイプラインの動作を示す図である。
【図17】図15に示すプログラムを実行するときの実施の形態2のマイクロプロセッサの動作を説明するためのブロック図である。
【符号の説明】
2 命令デコードユニット(命令デコーダ)、3 メモリアクセスユニット(命令実行部)、5 汎用レジスタ(複数の汎用レジスタ)、241,242,361,365 複数のレジスタ、250,380 バイパス制御部、251,381 バイパス判定部、252,382 レジスタ出力制御部、260 条件実行制御部、261 条件実行判定部、262 汎用レジスタ書き込み制御部、B0,B1,B2 バイパス経路、D0,D1 データ経路。[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a microprocessor having a conditional execution instruction that controls execution of an instruction using an execution condition field included in a part of the instruction.
[0002]
[Prior art]
Conventionally, techniques such as conditional execution have been studied as techniques for reducing the penalty of branching and improving the performance of a microprocessor. In a conventional ARM microprocessor, as a flag to be used for determination of conditional execution, a dedicated flag set only by specific instructions such as a negative flag (N), a zero flag (Z), a carry flag (C), and an overflow flag (V) Using flags.
[0003]
As another conventional technique for improving the performance of a microprocessor, there is a technique using a bypass process of an operation result when the number of pipeline stages is increased for the purpose of increasing the operating frequency. In this method, for example, when an instruction for writing an operation result to a general-purpose register is executed, and then an instruction for referencing the register is executed, when the register is referred to by the latter instruction, the operation result of the former instruction is general-purpose. Since the instruction is not written in the register, the instruction is efficiently executed by directly referring to the operation result of the former instruction via a dedicated bypass path without passing through a general-purpose register.
[0004]
[Problems to be solved by the invention]
However, when a bypass path is used in a conventional microprocessor having a conditional execution instruction, for example, a conditional execution instruction for writing an operation result in a general-purpose register is executed, and then the general-purpose register in which the operation result is written is referred to. However, if an instruction using a bypass path is executed and the execution condition of the former instruction is not satisfied and the instruction becomes invalid, the latter instruction will bypass wrong data and cause a malfunction. There were challenges.
[0005]
SUMMARY OF THE INVENTION The present invention has been made to solve the above-described problems. In a microprocessor having a conditional execution instruction provided with a bypass path for directly transferring data, an instruction using a bypass path follows the conditional execution instruction. Even in such a case, it is an object of the present invention to obtain a microprocessor having a conditional execution instruction capable of executing an instruction efficiently without imposing a penalty on a pipeline and without malfunction.
[0006]
[Means for Solving the Problems]
A microprocessor having a conditional execution instruction according to the first aspect of the present invention includes an instruction decoder for decoding various instructions such as a conditional execution instruction including an execution condition field and an operation field. , An instruction execution unit that executes an instruction according to an output of the instruction decoder; Stores the operation result of the instruction executed by the instruction execution unit, conditions data Is included. Just Control register and instruction execution unit Of instructions executed in Store the result General Register and an instruction execution unit. , General registers Use the operation result stored in Without storing the operation result of the instruction executed immediately before control A bypass path for bypassing an operation result in the register. In particular, the condition execution determination unit in the instruction decoder determines whether the condition data set in the general-purpose flag and the condition set in the execution condition field match, and the bypass control unit determines whether the condition execution has been performed. Whether to use a bypass route according to the judgment result of the section Or use the operation result stored in the general-purpose register Is controlled, and even if an instruction using the bypass path follows the conditional execution instruction, the instruction is executed efficiently without imposing a penalty on the pipeline and without malfunction.
[0007]
In the microprocessor having the conditional execution instruction according to the second aspect of the present invention, the bypass determination unit in the bypass control unit determines whether data interference occurs in the pipeline of the instruction executed by the instruction execution unit. The register output control unit controls the data transfer operation of the control register via the bypass path based on the determination result of the bypass determination unit, and the condition execution determination unit in the condition execution control unit executes It is determined whether the execution instruction is valid or invalid, and the general-purpose register write control unit controls the writing of data to the general-purpose register based on the determination result of the condition execution determination unit. further, The control register obtains and stores the operation result of the instruction executed by the instruction execution unit, and obtains and stores the operation result from the general-purpose register, and transfers the operation result obtained via the general-purpose register to other than the bypass path. A register connected to a data transfer path for transferring data through the path of Even when the bypass determination unit determines the occurrence of data interference, the register output control unit stops the operation of the register according to the determination result transmitted from the condition execution determination unit, Of the operation result stored in Use data Control via a data transfer path other than the bypass path register Data transfer Is controlled, and even if an instruction using the bypass path follows the conditional execution instruction, the instruction is executed efficiently without imposing a penalty on the pipeline and without malfunction.
[0008]
A microprocessor having a conditional execution instruction according to the third aspect of the present invention is an instruction decoder for decoding various instructions such as a conditional execution instruction including an execution condition field and an operation field, and a control register including a general-purpose flag for setting a condition. An instruction execution unit that executes an instruction according to the output of the instruction decoder; a plurality of general-purpose registers that store the execution results of the instruction execution unit; and an instruction execution unit that is provided immediately before execution without passing through the general-purpose register. A plurality of bypass paths for bypassing the operation results in the plurality of registers storing the operation results of the instruction, and a data path for data transfer via general-purpose registers. In particular, the condition execution control unit in the instruction decoder determines whether the condition set in the general-purpose flag and the condition set in the execution condition field match, and the bypass control unit determines , The data transfer via one of the plurality of bypass paths and the data path passing through the general-purpose register is controlled. Therefore, even if an instruction using the bypass path follows the instruction that executes the condition, the penalty of the pipeline , And execute instructions efficiently and without malfunction.
[0009]
In the microprocessor having the conditional execution instruction according to the fourth aspect of the present invention, the bypass determination unit in the bypass control unit determines whether data interference occurs in the pipeline of the instruction executed by the instruction execution unit. The register output control unit controls the data transfer operation of the control register via the bypass path based on the determination result of the bypass determination unit, and the condition execution determination unit in the condition execution control unit executes a condition execution instruction to be executed. The general-purpose register write control unit controls whether data is written to the general-purpose register based on the determination result of the condition execution determination unit, and the bypass determination unit determines whether data interference occurs. Even in the case where the determination is made, the register output control unit determines the plurality of bypass paths and the data paths according to the determination result transmitted from the condition execution determination unit. Select one to control data transfer through either the plurality of registers or the plurality of general-purpose registers, so penalize the pipeline even if a condition execution instruction is followed by an instruction using a bypass path. The instruction is executed efficiently and without malfunction.
[0010]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, an embodiment of the present invention will be described.
First, a basic configuration of a microprocessor having a conditional execution instruction according to the present invention will be described.
[0011]
Microprocessor hardware configuration
FIG. 1 is a block diagram showing the overall configuration of a microprocessor having a conditional execution instruction according to the present invention, which is a 32-bit microprocessor having a 32-bit internal data bus. In the figure, 1 is a microprocessor core having a condition execution instruction, 2 is an instruction decode unit (instruction decoder) for decoding an instruction code inputted from the
[0012]
In the
[0013]
In the
[0014]
The
[0015]
It is possible to transfer 32-bit data four words at a time to the
[0016]
The
[0017]
In the
[0018]
In the
[0019]
FIG. 2 is an explanatory diagram showing an instruction format used in the
As instruction formats, there are a two-
[0020]
The
[0021]
FIG. 3 is an explanatory diagram showing an instruction format field used in the
[0022]
When the value of the format field is FM = 00, this instruction is a two-operation instruction. Then, the operation of operation_0 indicated by the
[0023]
When the value of the format field is FM = 01, it indicates that this instruction is a two-operation instruction. Then, the operation of operation_0 is executed in the clock cycle immediately after decoding, and the operation of operation_1 is executed one clock cycle later than the operation of operation_0.
[0024]
When the value of the format field is FM = 10, it indicates that this instruction is a two-operation instruction. Then, the operation of operation_1 is executed in the clock cycle immediately after decoding, and the operation of operation_0 is executed one clock cycle later than the operation_1.
[0025]
If the value of the format field is FM = 11, it indicates that this instruction is a one-operation instruction. Then, one operation specified in the operation field including the
[0026]
FIG. 4 is an explanatory diagram showing the detailed contents of the
In the
[0027]
That the operation is valid means that the operation result is reflected in the register, the memory, and the flag, and the result of the operation by the operation remains. An invalid operation means that the operation result is not reflected in the register, the memory, and the flag, and an operation result as if an invalid operation (NOP) was executed remains.
[0028]
When the value of the
[0029]
When the value of the
[0030]
When the value of the
[0031]
When the value of the
[0032]
When the value of the
[0033]
The operation when the value of the
[0034]
FIG. 5 is an explanatory diagram showing operation fields in the instruction format used in the microprocessor having the conditional execution instruction according to the present invention shown in FIG. In the figure, formats 111 to 117 are based on a short
[0035]
As shown in the explanatory diagram of FIG. 5, when the value X of the field 124 is “00”, “01” or “11”, it indicates that the
[0036]
The format 112 (Short_A) includes a
[0037]
As shown in the explanatory diagram of FIG. 5, when the value X of the
[0038]
The format 113 (Short_B1) includes a
[0039]
The format 114 (Short_B2) includes a
[0040]
The format 115 (Short_B3) includes a
[0041]
The format 116 (Short_D1) includes a
[0042]
The format 117 (Short_D2) includes a
[0043]
The format 118 (Long1) is composed of a
[0044]
The format 119 (Long2) is a conditional jump based on a
[0045]
This format 119 is used for a conditional jump or conditional branch instruction having a large branch displacement.
[0046]
FIG. 6 is an explanatory diagram showing a configuration of a register of a microprocessor having a conditional execution instruction according to the present invention shown in FIG.
The
[0047]
In the calculation using the format 112 shown in FIG. 5, each of the 64 general-
[0048]
FIG. 7 is an explanatory diagram showing the PSW in the register of the microprocessor having the conditional execution instruction according to the present invention shown in FIG.
The upper 16 bits of the
[0049]
The lower 16 bits are a
[0050]
Hereinafter, a list of instructions of the
[0051]
[0052]
[0053]
[0054]
reserved
[0055]
[0056]
[0057]
[0058]
[0059]
[0060]
[0061]
[0062]
[0063]
FIG. 8 is an explanatory diagram showing a pipeline operation when the
This operation is executed when the value of the format field of the instruction is FM = 00. Each of the
[0064]
FIG. 9 is an explanatory diagram showing the pipeline operation of the microprocessor having the conditional execution instruction according to the present invention shown in FIG. 1. In the figure, each stage is synchronized with the clock, and the high period of the clock and the low period are shown. Is divided into two periods.
[0065]
When the clock of the IF stage is High for the I1 period, when it is Low, the I2 period, when the clock of the D / A stage is High, the D1 period, when it is Low, it is the D2 period, and when the clock of the E / M stage is High. Is the E1 period, when it is low, it is the E2 period, when the clock of the IF stage is high, it is the W1 period, and when it is low, it is the W2 period.
[0066]
At the IF stage, an instruction is fetched. At the D / A stage, the instruction is decoded and the general-purpose register is read within the period D1, and the memory address is calculated within the period D2. In the W1 period of the E / M stage and the W stage, execution of operations and access to the memory are performed, and writing to the general-purpose register is performed in the W2 period of the W stage.
[0067]
FIG. 10 is an example of a program when data interference occurs in the
[0068]
In the figure, the ADD instruction is an instruction for adding the values of the general-purpose registers specified by the second operand and the third operand, and writing the operation result to the general-purpose register specified by the first operand. In the
[0069]
In the
[0070]
In the
[0071]
FIG. 11 is an explanatory diagram showing the operation of the pipeline when the program of FIG. 10 is executed. In FIG. 11,
[0072]
FIG. 12 is a block diagram for explaining the operation of the
[0073]
In the
[0074]
In the
[0075]
In the
[0076]
In the condition
[0077]
FIG. 13 is a block diagram showing the condition
[0078]
Next, the operation will be described.
First, the operation when the
[0079]
The addition result obtained by executing the
[0080]
When the
[0081]
The data stored in the
[0082]
The
[0083]
The
[0084]
Next, the operation of the
[0085]
FIG. 14 is an explanatory diagram showing the occurrence of data interference when the
[0086]
When the
[0087]
In the case of the
[0088]
First, when the
Next, the operation when the
The general-purpose register
[0089]
The
[0090]
On the other hand, the
[0091]
As described above, according to the first embodiment, it is determined whether or not data interference has occurred between the pipelines of the instructions including the conditional execution instructions, and the execution is performed based on the determination result of the
[0092]
FIG. 15 is an explanatory diagram showing an example of a program executed by the microprocessor according to the second embodiment of the present invention. Components of the microprocessor according to the second embodiment other than the components of the microprocessor according to the first embodiment will be described later with reference to an explanatory diagram shown in FIG. Note that the same components as those of the microprocessor of the first embodiment shown in FIGS. 1 and 12 are denoted by the same reference numerals, and description thereof is omitted.
[0093]
The LD2W instruction 300 in FIG. 15 reads 8-byte data from the memory address indicated by the sum of the values set in the general-purpose registers specified by the second operand and the third operand, and reads the general-purpose register specified by the first operand. And an instruction to write the read data in the general-purpose register obtained by adding 1 to the register number in the general-purpose register. In FIG. 15, the plus (+) sign of the second operand indicates that the addressing mode is post-increment, and after reading data from the memory, the value of the general-purpose register specified by the second operand Is added to.
[0094]
In the program shown in FIG. 15, an instruction 300 is an instruction for reading 8-byte data from a memory address in the memory indicated by the sum of the values of the registers R2 and R3, and writing the read data to the registers R10 and R11. After data is read from the memory, 8 is added to the register R2.
[0095]
[0096]
In addition, 8 is added to the register R2 after the data is read from the memory. When the
[0097]
When the
[0098]
FIG. 16 is an explanatory diagram showing the operation of the pipeline when the
[0099]
FIG. 16 shows that the stages in the same column in the
[0100]
In the
[0101]
When the
[0102]
FIG. 17 is a block diagram for explaining an operation of the microprocessor according to the second embodiment when executing the program shown in FIG. In the figure, a general-
[0103]
In the
[0104]
A D2 register 363 captures output data from the adder 371 during the D2 period and outputs the captured data to the
[0105]
An
[0106]
In the
[0107]
Next, the operation will be described.
First, the operation when the microprocessor of the second embodiment executes the program shown in FIG. 15 will be described.
In the instruction 300, the data of the registers R2 and R3 in the general-
[0108]
On the other hand, in the
[0109]
In the
[0110]
The data from the E1 register 361 output to the S1 bus via the bypass path B1 is input to the adder 371 and at the same time to the
[0111]
The
[0112]
When the
[0113]
In the instruction 320, the bypass determination unit 381 determines that the register R2 of the instruction 320 causes data interference with the instruction 300 and the
[0114]
When the
[0115]
When the
[0116]
The addition result of the
[0117]
As described above, according to the second embodiment, condition
[0118]
【The invention's effect】
As described above, according to the first aspect of the present invention, the condition execution determination unit in the instruction decoder determines whether the condition data set in the general-purpose flag matches the condition set in the execution condition field. The bypass control unit is configured to determine whether or not to use the bypass route according to the determination result of the condition execution determination unit. However, there is an effect that instructions can be executed efficiently without imposing a penalty on the pipeline and without malfunction.
[0119]
According to the second aspect of the present invention, the bypass determination unit in the bypass control unit determines whether data interference occurs in the pipeline of the instruction executed by the instruction execution unit, and the register output control unit The data transfer operation of the control register via the bypass path is controlled based on the determination result of the bypass determination unit, and the condition execution instruction to be executed by the condition execution determination unit in the condition execution control unit is valid. In this case, the general-purpose register write control unit controls data writing to the general-purpose register based on the determination result of the condition execution determination unit, and the bypass determination unit determines that data interference has occurred. Also, the register output control unit stops the operation of the register according to the judgment result transmitted from the condition execution judgment unit, and sets the register to use the data in the general-purpose register. And the general-purpose registers are controlled, so that even if a condition execution instruction is followed by an instruction using a bypass path, the effect is that the instruction can be executed efficiently without imposing a penalty on the pipeline and without malfunction. is there.
[0120]
According to the third aspect of the present invention, the condition execution control unit in the instruction decoder determines whether the condition set in the general-purpose flag and the condition set in the execution condition field match, and The control unit is configured to control the data transfer via one of the plurality of bypass paths and the data path passing through the general-purpose register according to the determination of the condition execution determination unit, so that the bypass path is used after the condition execution instruction. Even if the instruction continues, there is an effect that the instruction can be executed efficiently without imposing a penalty on the pipeline and without malfunction.
[0121]
According to the fourth aspect of the present invention, the bypass determination unit in the bypass control unit determines whether data interference has occurred in the pipeline of the instruction executed by the instruction execution unit, and the register output control unit determines The data transfer operation of the control register via the bypass path is controlled based on the determination result of the determination unit, and the condition execution determination unit in the condition execution control unit determines whether the condition execution instruction to be executed is valid or invalid. Whether the general-purpose register write control unit controls the writing of data to the general-purpose register based on the determination result of the condition execution determination unit, even if the bypass determination unit determines the occurrence of data interference, The register output control unit selects one of a plurality of bypass paths and a data path according to the determination result transmitted from the condition execution determination unit, and selects a plurality of registers or Is configured to control data transfer via any of the general-purpose registers, so that even when a condition execution instruction is followed by an instruction using a bypass path, it is efficient without imposing a pipeline penalty, and There is an effect that the instruction can be executed without malfunction.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a basic configuration of a microprocessor having a conditional execution instruction according to
FIG. 2 is an explanatory diagram showing an instruction format used in a microprocessor having a conditional execution instruction according to the present invention shown in FIG. 1;
FIG. 3 is an explanatory diagram showing an instruction format field used in a microprocessor having a conditional execution instruction according to the present invention shown in FIG. 1;
FIG. 4 is an explanatory diagram showing detailed contents of an execution condition field in an instruction format used in a microprocessor having a conditional execution instruction in the present invention shown in FIG. 1;
FIG. 5 is an explanatory diagram showing an operation field in an instruction format used in a microprocessor having a conditional execution instruction according to the present invention shown in FIG. 1;
FIG. 6 is an explanatory diagram showing a configuration of a register of a microprocessor having a conditional execution instruction in the present invention shown in FIG. 1;
7 is an explanatory diagram showing a PSW in a register of the microprocessor having the conditional execution instruction according to the present invention shown in FIG. 1;
FIG. 8 is an explanatory diagram showing a pipeline operation of a microprocessor having a conditional execution instruction according to the present invention shown in FIG. 1;
FIG. 9 is an explanatory diagram showing a pipeline operation of a microprocessor having a conditional execution instruction in the present invention shown in FIG. 1;
FIG. 10 is an example of a program when data interference of a microprocessor occurs in one embodiment of the present invention.
FIG. 11 is an explanatory diagram showing an operation of the pipeline when the program shown in FIG. 10 is executed.
FIG. 12 is a block diagram for explaining the operation of the microprocessor when executing the program shown in FIG. 10;
FIG. 13 is a block diagram illustrating a condition execution determination unit.
FIG. 14 is an explanatory diagram showing occurrence of data interference when an instruction in the program shown in FIG. 10 is a condition execution instruction.
FIG. 15 is an explanatory diagram illustrating an example of a program executed by a microprocessor according to
FIG. 16 is a diagram showing an operation of the pipeline when the program shown in FIG. 15 is executed.
17 is a block diagram for explaining an operation of the microprocessor according to the second embodiment when executing the program shown in FIG.
[Explanation of symbols]
2 instruction decode unit (instruction decoder), 3 memory access unit (instruction execution unit), 5 general registers (plural general registers), 241, 242, 361, 365 plural registers, 250, 380 bypass control unit, 251, 381 Bypass determination section, 252, 382 register output control section, 260 condition execution control section, 261 condition execution determination section, 262 general-purpose register write control section, B0, B1, B2 bypass path, D0, D1 data path.
Claims (4)
前記命令デコーダの出力に従って命令を実行する命令実行部と、
前記命令実行部で実行された命令の演算結果を格納すると共に、条件データが設定される汎用フラグを含んでなる制御レジスタと、
前記命令実行部で実行された命令の演算結果を格納する汎用レジスタと、
前記命令実行部に設けられ、前記汎用レジスタに格納した前記演算結果を用いることなく、直前に実行された命令の演算結果を格納している前記制御レジスタ内の前記演算結果をバイパスするためのバイパス経路とを備え、
前記命令デコーダは、
前記汎用フラグ内に設定された条件データと前記実行条件フィールド内に設定された条件とが合致しているか否かを判定する条件実行判定部と、
前記条件実行判定部の判定結果に従って、前記バイパス経路を使用するか、若しくは、前記汎用レジスタに格納した前記演算結果を使用するかを制御するバイパス制御部と
を有することを特徴とする条件実行命令を有するマイクロプロセッサ。An instruction decoder for decoding various instructions such as a conditional execution instruction including an execution condition field and an operation field;
An instruction execution unit that executes an instruction according to an output of the instruction decoder;
Stores the operation result of the instruction executed by the instruction execution unit, and a control register comprising Nde contains generic flag condition data is set,
A general register that stores the operation result of the instruction executed by the instruction execution unit,
Provided in the instruction execution unit, wherein without using the operation result stored in general registers, a bypass for bypassing the calculation result of the control register that stores the operation result of the instruction executed immediately before With a route,
The instruction decoder comprises:
A condition execution determination unit that determines whether the condition data set in the general-purpose flag and the condition set in the execution condition field match each other ,
A bypass control unit for controlling whether to use the bypass path or to use the operation result stored in the general-purpose register according to a determination result of the condition execution determination unit. A microprocessor having:
命令実行部で実行される命令のパイプラインでデータ干渉が発生しているか否かを判定するバイパス判定部と、
前記バイパス判定部の判定結果に基づいて、バイパス経路を介した制御レジスタのデータ転送動作を制御するレジスタ出力制御部とを有し、
条件実行制御部は、
実行しようとする条件実行命令が有効であるか無効であるかを判定する条件実行判定部と、
前記条件実行判定部の判定結果に基づいて汎用レジスタへのデータの書き込みを制御する汎用レジスタ書き込み制御部とを有し、
前記制御レジスタは、
前記命令実行部で実行された命令の演算結果を取得して格納するレジスタと、前記汎用レジスタから前記演算結果を取得して格納すると共に、前記汎用レジスタを介して取得した前記演算結果を前記バイパス経路以外の経路でデータ転送するためのデータ転送経路に接続するレジスタとを有してなり、
前記レジスタ出力制御部は、
前記バイパス判定部がデータ干渉の発生を判定した場合であっても、前記条件実行判定部から送信される判定結果に従って、前記制御レジスタとバイパス経路を経由するデータ転送を停止し、前記汎用レジスタに格納していた前記演算結果のデータを使用するように前記バイパス経路以外のデータ転送経路を介した前記制御レジスタのデータ転送を制御することを特徴とする請求項1記載の条件実行命令を有するマイクロプロセッサ。The bypass control unit
A bypass determination unit that determines whether or not data interference has occurred in a pipeline of instructions executed by the instruction execution unit;
A register output control unit that controls a data transfer operation of a control register via a bypass path based on a determination result of the bypass determination unit,
The conditional execution control unit
A condition execution determination unit that determines whether a condition execution instruction to be executed is valid or invalid;
A general-purpose register write control unit that controls writing of data to a general-purpose register based on a determination result of the condition execution determination unit,
The control register includes:
A register for acquiring and storing the operation result of the instruction executed by the instruction execution unit, and obtaining and storing the operation result from the general-purpose register; and bypassing the operation result obtained via the general-purpose register. A register connected to a data transfer path for transferring data through a path other than the path,
The register output control unit includes:
Also the bypass determination unit is a case where it is determined the occurrence of data interference, in accordance with the determination result transmitted from said condition execution determination unit, to stop the data transfer via the control register and the bypass path, the general purpose register 2. The microcontroller having a conditional execution instruction according to claim 1 , wherein data transfer of the control register via a data transfer path other than the bypass path is controlled so as to use the stored data of the operation result. Processor.
条件が設定される汎用フラグを含む制御レジスタと、
前記命令デコーダの出力に従って命令を実行する命令実行部と、
前記命令実行部の実行結果を格納する複数の汎用レジスタと、
前記命令実行部に設けられ、前記汎用レジスタを経由することなく、直前に実行された命令の演算結果を格納している複数のレジスタ内の前記演算結果をバイパスするための複数のバイパス経路と、
前記汎用レジスタを経由するデータ転送のためのデータ経路とを備え、
前記命令デコーダは、
前記汎用フラグ内に設定された条件と前記実行条件フィールド内に設定された条件が合致しているか否かを判定する条件実行制御部と、前記条件実行判定部の判定に従って、前記複数のバイパス経路および前記汎用レジスタを経由する前記データ経路のうちいずれかを介したデータ転送を制御するバイパス制御部とを有することを特徴とする条件実行命令を有するマイクロプロセッサ。An instruction decoder for decoding various instructions such as a conditional execution instruction including an execution condition field and an operation field;
A control register including a general purpose flag for which a condition is set;
An instruction execution unit that executes an instruction according to an output of the instruction decoder;
A plurality of general-purpose registers for storing execution results of the instruction execution unit;
A plurality of bypass paths provided in the instruction execution unit, for bypassing the operation result in a plurality of registers storing the operation result of the instruction executed immediately before, without passing through the general-purpose register ;
A data path for data transfer via the general-purpose register,
The instruction decoder comprises:
Wherein the determining whether or not conditional execution control unit sets conditions to the conditions set in the general purpose flags said execution condition field is matched, according to the determination of the condition execution determination unit, the plurality of bypass paths And a bypass control unit for controlling data transfer via any of the data paths passing through the general-purpose register.
命令実行部で実行される命令のパイプラインでデータ干渉が発生しているか否かを判定するバイパス判定部と、
前記バイパス判定部の判定結果に基づいて、バイパス経路を介した制御レジスタのデータ転送動作を制御するレジスタ出力制御部とを有し、
条件実行制御部は、
実行しようとする条件実行命令が有効であるか無効であるかを判定する条件実行判定部と、
前記条件実行判定部の判定結果に基づいて汎用レジスタへのデータの書き込みを制御する汎用レジスタ書き込み制御部とを有し、
前記バイパス判定部がデータ干渉の発生を判定した場合であっても、前記レジスタ出力制御部は、前記条件実行判定部から送信される判定結果に従って、前記複数のバイパス経路および前記データ経路のいずれかを選択して前記複数のレジスタあるいは前記複数の汎用レジスタのいずれかを介したデータ転送を制御することを特徴とする請求項3記載の条件実行命令を有するマイクロプロセッサ。The bypass control unit
A bypass determination unit that determines whether or not data interference has occurred in a pipeline of instructions executed by the instruction execution unit;
A register output control unit that controls a data transfer operation of a control register via a bypass path based on a determination result of the bypass determination unit,
The conditional execution control unit
A condition execution determination unit that determines whether a condition execution instruction to be executed is valid or invalid;
A general-purpose register write control unit that controls writing of data to a general-purpose register based on a determination result of the condition execution determination unit,
Even when the bypass determination unit determines the occurrence of data interference, the register output control unit is configured to output one of the plurality of bypass paths and the data path according to a determination result transmitted from the condition execution determination unit. 4. The microprocessor having a conditional execution instruction according to claim 3, wherein the microprocessor controls the data transfer via one of the plurality of registers or the plurality of general-purpose registers.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP12452597A JP3547585B2 (en) | 1997-05-14 | 1997-05-14 | Microprocessor having conditional execution instruction |
US08/942,295 US6016543A (en) | 1997-05-14 | 1997-10-01 | Microprocessor for controlling the conditional execution of instructions |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP12452597A JP3547585B2 (en) | 1997-05-14 | 1997-05-14 | Microprocessor having conditional execution instruction |
Publications (2)
Publication Number | Publication Date |
---|---|
JPH10320199A JPH10320199A (en) | 1998-12-04 |
JP3547585B2 true JP3547585B2 (en) | 2004-07-28 |
Family
ID=14887650
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP12452597A Expired - Fee Related JP3547585B2 (en) | 1997-05-14 | 1997-05-14 | Microprocessor having conditional execution instruction |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP3547585B2 (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060200654A1 (en) * | 2005-03-04 | 2006-09-07 | Dieffenderfer James N | Stop waiting for source operand when conditional instruction will not execute |
JP5326314B2 (en) * | 2008-03-21 | 2013-10-30 | 富士通株式会社 | Processor and information processing device |
-
1997
- 1997-05-14 JP JP12452597A patent/JP3547585B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JPH10320199A (en) | 1998-12-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US6560697B2 (en) | Data processor having repeat instruction processing using executed instruction number counter | |
US6327647B1 (en) | Method and apparatus for interfacing a processor to a coprocessor | |
EP0789297B1 (en) | Data processor loading data and performing multiply-add operation in parallel | |
JP3881763B2 (en) | Data processing device | |
US6016543A (en) | Microprocessor for controlling the conditional execution of instructions | |
JP3745039B2 (en) | Microprocessor with delayed instructions | |
US20010010072A1 (en) | Instruction translator translating non-native instructions for a processor into native instructions therefor, instruction memory with such translator, and data processing apparatus using them | |
JP2507638B2 (en) | Data processing device | |
JPH0766324B2 (en) | Data processing device | |
EP0855648A2 (en) | Data processing with parallel or sequential execution of program instructions | |
US5983338A (en) | Method and apparatus for interfacing a processor to a coprocessor for communicating register write information | |
JPH1049368A (en) | Microporcessor having condition execution instruction | |
JP3578883B2 (en) | Data processing device | |
JPH01214932A (en) | Data processor | |
JP2001034471A (en) | Vliw system processor | |
US6055628A (en) | Microprocessor with a nestable delayed branch instruction without branch related pipeline interlocks | |
JP2002215387A (en) | Data processor provided with instruction translator, and memory interface device | |
JPH07120284B2 (en) | Data processing device | |
JP3841967B2 (en) | Microprocessor | |
JP3547585B2 (en) | Microprocessor having conditional execution instruction | |
JP3182591B2 (en) | Microprocessor | |
JP3568737B2 (en) | Microprocessor with conditional execution instruction | |
EP1050800A1 (en) | A pipelined execution unit | |
JP2522048B2 (en) | Microprocessor and data processing device using the same | |
JPH0997180A (en) | Programmable controller |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20031224 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20040220 |
|
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: 20040316 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20040414 |
|
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: 20080423 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20090423 Year of fee payment: 5 |
|
LAPS | Cancellation because of no payment of annual fees |