JP2006171827A - Processor and processing program - Google Patents
Processor and processing program Download PDFInfo
- Publication number
- JP2006171827A JP2006171827A JP2004359553A JP2004359553A JP2006171827A JP 2006171827 A JP2006171827 A JP 2006171827A JP 2004359553 A JP2004359553 A JP 2004359553A JP 2004359553 A JP2004359553 A JP 2004359553A JP 2006171827 A JP2006171827 A JP 2006171827A
- Authority
- JP
- Japan
- Prior art keywords
- vector
- saturation
- shift
- addition
- unit
- 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.)
- Pending
Links
Images
Abstract
Description
本発明は、演算処理装置および演算処理プログラムに関し、特に、AMR−NB(Adaptive Multi−Rate Narrow Band)コーディック(以下、AMRコーディックと称す)などに用いられるベクトルパイプラインプロセッサに適用して好適なものである。 The present invention relates to an arithmetic processing unit and an arithmetic processing program, and in particular, is suitably applied to a vector pipeline processor used in an AMR-NB (Adaptive Multi-Rate Narrow Band) codec (hereinafter referred to as an AMR codec). It is.
AMRコーディックは、3GPP(3rd Generation Partnership Project)の提案する音声コーディックの1つであり、人間の音声を効率的に圧縮符号化することができるという特徴があり、16bit精度での飽和処理や積和演算などが頻繁に行われる。特に、AMRディコーダでコール回数が多い関数として、L_MAC()という積和演算関数がある。このL_MAC()関数では、L_mult()関数とL_add()関数を呼び出すことにより、積和演算が行われるとともに、オーバーフローの有無に応じて飽和処理が行われる。 The AMR codec is one of the speech codecs proposed by 3GPP (3rd Generation Partnership Project), and is characterized by the ability to efficiently compress and encode human speech, with saturation processing and sum of products with 16-bit accuracy. Arithmetic etc. are frequently performed. In particular, as a function having a large number of calls in an AMR decoder, there is a product-sum operation function called L_MAC (). In this L_MAC () function, a product-sum operation is performed by calling the L_mult () function and the L_add () function, and saturation processing is performed depending on whether there is an overflow.
図17はL_MAC()関数のソースコードの一例を示す図、図18は、図17のソースコードのコンパイル例を示す図である。
図17において、L_MAC()関数を実行されると、L_mult()関数が呼び出され、通常の乗算が行われる。そして、乗算結果を左1ビットシフトしたときにオーバーフローしない時は、乗算結果の左1ビットシフトが行われ、オーバーフローする時は、オーバーフローフラグが立てられるとともに、乗算結果として飽和値が代入される。
FIG. 17 is a diagram illustrating an example of the source code of the L_MAC () function, and FIG. 18 is a diagram illustrating a compilation example of the source code of FIG.
In FIG. 17, when the L_MAC () function is executed, the L_multi () function is called and normal multiplication is performed. When the multiplication result does not overflow when shifted by 1 bit to the left, the multiplication result is shifted by 1 bit to the left. When overflow occurs, an overflow flag is set and a saturation value is substituted as the multiplication result.
次に、L_add()関数が呼び出され、通常の加算が行われる。そして、加算結果がオーバーフローしているかどうかが判断され、オーバーフローしている時は、オーバーフローフラグが立てられるとともに、加算結果として飽和値が代入される。
このように、図17のL_MAC()関数では複雑な処理が行われるため、図17のソースコードのコンパイルすると、図18に示すように、36行にも及ぶ膨大な関数になる。
Next, the L_add () function is called and normal addition is performed. Then, it is determined whether or not the addition result has overflowed, and when it has overflowed, an overflow flag is set and a saturation value is substituted as the addition result.
As described above, since complicated processing is performed in the L_MAC () function in FIG. 17, when the source code in FIG. 17 is compiled, as shown in FIG.
また、特許文献1には、MAC(Multiply and Accumulate)命令において、汎用レジスタRmとRnの内容をアドレスとする16ビットオペランドを符号付きで乗算し、乗算結果の32ビットとMACレジスタの内容とを加算し、加算結果をMACレジスタに格納するとともに、Sビットが1のときはMACレジスタとの加算を飽和演算とする方法が開示されている。この飽和演算においては、オーバーフローが発生すると、MACHレジスタのLSBが1にセットされ、加算結果が負の方向にオーバーフローした時は、H”80000000(最小値)がMACレジスタに格納され、加算結果が正の方向にオーバーフローした時は、H”7FFFFFFF(最大値)がMACレジスタに格納される。Sビットが0のときは、連結されたMACH/Lレジスタに加算結果の42ビットが格納される。
しかしながら、L_MAC()関数では飽和機能が実装されているため、1回分の演算を行うごとにオーバーフローの有無を判断し、その判断結果に従って分岐処理を行う必要がある。このため、1命令分の演算ごとにサイクル数が変動し、L_MAC()関数をベクトル命令化することができず、演算速度の高速化に支障をきたすという問題があった。
また、特許文献1に開示された方法では、Sビットを参照しながらMAC命令における飽和演算が実行されるが、MAC命令を高速に処理できるようにするため、MAC命令に専用のハードウェアを追加すると、回路規模の増大を招くという問題があった。
However, since the saturation function is implemented in the L_MAC () function, it is necessary to determine whether or not there is an overflow every time one calculation is performed, and to perform branch processing according to the determination result. For this reason, the number of cycles fluctuates for each operation for one instruction, and the L_MAC () function cannot be converted into a vector instruction, which hinders the increase in the operation speed.
In addition, in the method disclosed in
そこで、本発明の目的は、回路規模の増大を抑制しつつ、飽和機能を持つ命令を高速に処理することが可能な演算処理装置および演算処理プログラムを提供することである。 Accordingly, an object of the present invention is to provide an arithmetic processing device and an arithmetic processing program capable of processing an instruction having a saturation function at high speed while suppressing an increase in circuit scale.
上述した課題を解決するために、本発明の一態様に係る演算処理装置によれば、ベクトル加算処理を行うベクトル加算器と、前記ベクトル加算器に搭載され、前記ベクトル加算器にて得られた加算結果に基づいて飽和処理を行う飽和処理部とを備えることを特徴とする。
これにより、加算演算に伴う飽和処理をハードウェア上で行わせることが可能となり、オーバーフローの有無の判断およびその判断結果に従った分岐処理をプログラムに記述することなく、飽和処理を実行させることが可能となる。このため、加算命令に飽和機能が実装された場合においても、1命令分の演算を1サイクルで実行させることが可能となり、飽和機能が実装された加算命令のベクトル化ができるようにして、飽和機能が実装された加算処理の高速化を図ることができる。
In order to solve the above-described problem, according to an arithmetic processing device according to one aspect of the present invention, a vector adder that performs vector addition processing and the vector adder are mounted on the vector adder and obtained by the vector adder. And a saturation processing unit that performs saturation processing based on the addition result.
As a result, the saturation processing associated with the addition operation can be performed on the hardware, and the saturation processing can be executed without describing the determination of the presence or absence of overflow and the branch processing according to the determination result in the program. It becomes possible. For this reason, even when the saturation function is implemented in the addition instruction, it is possible to execute the operation for one instruction in one cycle, and the vectorization of the addition instruction in which the saturation function is implemented can be performed. It is possible to speed up the addition processing in which the function is implemented.
また、本発明の一態様に係る演算処理装置によれば、前記飽和処理を有効化するための飽和指定フラグを格納するステータスレジスタをさらに備え、前記飽和処理部は、前記飽和指定フラグの参照結果に基づいて飽和処理を行うことを特徴とする。
これにより、飽和処理を実行させるかどうかをプログラムから指定することが可能となる。このため、加算演算に伴う飽和処理のハードウェア化を行った場合においても、加算結果に対して飽和処理が一律に行われることを防止することが可能となり、一つの加算命令を用意することで、飽和機能が実装された加算処理と飽和機能が実装されていない加算処理とを実現することができる。
The arithmetic processing device according to an aspect of the present invention further includes a status register that stores a saturation designation flag for enabling the saturation processing, and the saturation processing unit includes a reference result of the saturation designation flag. Based on the above, saturation processing is performed.
This makes it possible to specify from the program whether or not to execute saturation processing. This makes it possible to prevent the saturation process from being uniformly performed on the addition result even when the saturation process associated with the addition operation is implemented by hardware, and by preparing one addition instruction. Thus, it is possible to realize an addition process in which the saturation function is implemented and an addition process in which the saturation function is not implemented.
また、本発明の一態様に係る演算処理装置によれば、ベクトルシフト演算処理を行うベクトルシフト演算器と、前記ベクトルシフト演算器に搭載され、前記ベクトルシフト演算器にて得られたシフト演算結果に基づいて飽和処理を行う飽和処理部とを備えることを特徴とする。
これにより、シフト演算に伴う飽和処理をハードウェア上で行わせることが可能となり、オーバーフローの有無の判断およびその判断結果に従った分岐処理をプログラムに記述することなく、飽和処理を実行させることが可能となる。このため、シフト演算命令に飽和機能が実装された場合においても、1命令分の演算を1サイクルで実行させることが可能となり、飽和機能が実装されたシフト演算命令のベクトル化ができるようにして、飽和機能が実装されたシフト演算処理の高速化を図ることができる。
Further, according to the arithmetic processing device according to one aspect of the present invention, a vector shift arithmetic unit that performs vector shift arithmetic processing, and a shift arithmetic result that is mounted on the vector shift arithmetic unit and obtained by the vector shift arithmetic unit And a saturation processing unit that performs saturation processing based on the above.
As a result, the saturation processing associated with the shift operation can be performed on the hardware, and the saturation processing can be executed without describing the determination of the presence of overflow and the branch processing according to the determination result in the program. It becomes possible. For this reason, even when the saturation function is implemented in the shift operation instruction, it is possible to execute the operation for one instruction in one cycle, and to enable vectorization of the shift operation instruction in which the saturation function is implemented. Therefore, it is possible to increase the speed of the shift operation processing in which the saturation function is implemented.
また、本発明の一態様に係る演算処理装置によれば、前記飽和処理部は、前記ベクトルシフト演算器にて行われるシフト演算が算術シフトの場合、前記ベクトルシフト演算器にて得られたシフト演算結果に応じて飽和処理を無条件に実行し、前記ベクトルシフト演算器にて行われるシフト演算が論理シフトの場合、前記ベクトルシフト演算器にて得られたシフト演算結果のオーバーフローの有無に関わらず飽和処理を実行しないようにすることを特徴とする。 Moreover, according to the arithmetic processing device which concerns on 1 aspect of this invention, the said saturation process part is the shift obtained by the said vector shift computing unit, when the shift operation performed by the said vector shift computing unit is an arithmetic shift When saturation processing is unconditionally executed in accordance with the operation result and the shift operation performed by the vector shift operator is a logical shift, whether or not the shift operation result obtained by the vector shift operator has overflowed. This is characterized in that saturation processing is not executed.
これにより、算術シフト命令をプログラム上に記述することで、飽和機能が実装された左シフト演算処理を実現することが可能となるとともに、論理シフト命令をプログラム上に記述することで、飽和機能が実装されていない左シフト演算処理を実現することが可能となる。このため、シフト演算に伴う飽和処理のハードウェア化を行った場合においても、シフト演算結果に対して飽和処理が一律に行われることを防止することが可能となり、左シフトに対して等しい演算結果が得られる2種類の冗長な左右シフト演算命令を使い分けることで、飽和機能が実装されたシフト演算処理と飽和機能が実装されていないシフト演算処理とを実現することができる。 As a result, it is possible to realize the left shift operation processing in which the saturation function is implemented by describing the arithmetic shift instruction on the program, and it is possible to realize the saturation function by describing the logical shift instruction on the program. It is possible to realize left shift calculation processing that is not implemented. This makes it possible to prevent the saturation processing from being uniformly performed on the shift operation result even when the saturation processing associated with the shift operation is implemented in hardware, and the same operation result for the left shift. By properly using the two types of redundant left and right shift operation instructions that can be obtained, it is possible to realize shift operation processing in which the saturation function is implemented and shift operation processing in which the saturation function is not implemented.
また、本発明の一態様に係る演算処理装置によれば、ベクトル乗算処理を行うベクトル乗算器と、ベクトル加算処理を行うベクトル加算器と、前記ベクトル加算器に搭載され、前記ベクトル加算器にて得られた加算結果に基づいて飽和処理を行う第1飽和処理部と、ベクトルシフト演算処理を行うベクトルシフト演算器と、前記ベクトルシフト演算器に搭載され、前記ベクトルシフト演算器にて得られたシフト結果に基づいて飽和処理を行う第2飽和処理部とを備えることを特徴とする。 In addition, according to the arithmetic processing device according to an aspect of the present invention, a vector multiplier that performs vector multiplication processing, a vector adder that performs vector addition processing, and the vector adder are mounted on the vector adder. The first saturation processing unit that performs saturation processing based on the obtained addition result, the vector shift arithmetic unit that performs vector shift arithmetic processing, and the vector shift arithmetic unit are obtained by the vector shift arithmetic unit. And a second saturation processing unit that performs saturation processing based on the shift result.
これにより、乗算命令とシフト演算命令と加算命令とを含む3つの命令を実行させることでL_MAC()関数を実行させることが可能となり、オーバーフローの有無の判断およびその判断結果に従った分岐処理をプログラムに記述することなく、L_MAC()関数を実行させることが可能となる。このため、L_MAC()関数に専用のハードウェアを追加することなく、L_MAC()関数をベクトル命令化することが可能となり、回路規模の増大を抑制しつつ、L_MAC()関数を高速に実行させることが可能となる。 As a result, the L_MAC () function can be executed by executing three instructions including a multiplication instruction, a shift operation instruction, and an addition instruction. It is possible to execute the L_MAC () function without describing it in the program. Therefore, the L_MAC () function can be converted into a vector instruction without adding dedicated hardware to the L_MAC () function, and the L_MAC () function is executed at high speed while suppressing an increase in circuit scale. It becomes possible.
また、本発明の一態様に係る演算処理装置によれば、前記飽和処理部は、前記飽和処理の有無に基づいてオーバーフローフラグを前記ステータスレジスタに設定することを特徴とする。
これにより、ステータスレジスタに設定されたオーバーフローフラグの値を参照することで、演算終了後に飽和の有無を検知することが可能となり、飽和の有無による処理の分岐を可能にする。
Further, according to the arithmetic processing device according to one aspect of the present invention, the saturation processing unit sets an overflow flag in the status register based on the presence or absence of the saturation processing.
As a result, by referring to the value of the overflow flag set in the status register, it is possible to detect the presence or absence of saturation after the calculation is completed, and to enable branching of processing depending on the presence or absence of saturation.
また、本発明の一態様に係る演算処理プログラムによれば、飽和機能が実装されていないベクトル乗算命令と、飽和機能が実装されたベクトル加算命令と、飽和機能が実装されたベクトルシフト命令とをコンピュータに実行させることを特徴とする。
これにより、オーバーフローの有無の判断およびその判断結果に従った分岐処理をプログラムに記述することなく、L_MAC()関数を実行させることが可能となる。このため、L_MAC()関数に専用のハードウェアを追加することなく、L_MAC()関数をベクトル命令化することが可能となり、回路規模の増大を抑制しつつ、L_MAC()関数を高速に実行させることが可能となる。
In addition, according to the arithmetic processing program according to one aspect of the present invention, a vector multiplication instruction in which the saturation function is not implemented, a vector addition instruction in which the saturation function is implemented, and a vector shift instruction in which the saturation function is implemented The computer is executed.
This makes it possible to execute the L_MAC () function without describing in the program the determination of whether or not there is an overflow and the branch process according to the determination result. Therefore, the L_MAC () function can be converted into a vector instruction without adding dedicated hardware to the L_MAC () function, and the L_MAC () function is executed at high speed while suppressing an increase in circuit scale. It becomes possible.
また、本発明の一態様に係る演算処理プログラムによれば、前記ベクトル加算命令の飽和機能のオン/オフを指定する命令をコンピュータに実行させることを特徴とする。
これにより、飽和処理を実行させるかどうかをプログラムから指定することが可能となる。このため、加算演算に伴う飽和処理のハードウェア化を行った場合においても、加算結果に対して飽和処理が一律に行われることを防止することが可能となり、一つの加算命令を用意することで、飽和機能が実装された加算処理と飽和機能が実装されていない加算処理とを実現することができる。
The arithmetic processing program according to one aspect of the present invention causes a computer to execute an instruction that specifies on / off of the saturation function of the vector addition instruction.
This makes it possible to specify from the program whether or not to execute saturation processing. This makes it possible to prevent the saturation process from being uniformly performed on the addition result even when the saturation process associated with the addition operation is implemented by hardware, and by preparing one addition instruction. Thus, it is possible to realize an addition process in which the saturation function is implemented and an addition process in which the saturation function is not implemented.
また、本発明の一態様に係る演算処理プログラムによれば、前記ベクトル加算命令による加算結果または前記ベクトルシフト命令によるシフト演算結果のオーバーフローの有無を検出する検出関数をコンピュータに実行させることを特徴とする。
これにより、検出関数をプログラムに記述することで、演算終了後に飽和の有無を検知することが可能となり、飽和の有無による処理の分岐を可能にする。
According to the arithmetic processing program of one aspect of the present invention, the computer is caused to execute a detection function for detecting the presence or absence of overflow of the addition result by the vector addition instruction or the shift operation result by the vector shift instruction. To do.
Thus, by describing the detection function in the program, it is possible to detect the presence or absence of saturation after the calculation is completed, and to enable branching of processing depending on the presence or absence of saturation.
以下、本発明の実施形態に係る演算処理装置について図面を参照しながら説明する。なお、以下の実施形態では、図1のコンピュータシステムにおいて、図2のベクトルプロセッサ100の各演算器を動作させることによりベクトルパイプライン処理を行う場合を例にとって説明する。
図1は、本発明の一実施形態に係るコンピュータシステムの概略構成を示すブロック図である。
Hereinafter, an arithmetic processing apparatus according to an embodiment of the present invention will be described with reference to the drawings. In the following embodiment, a case where vector pipeline processing is performed by operating each arithmetic unit of the
FIG. 1 is a block diagram showing a schematic configuration of a computer system according to an embodiment of the present invention.
図1において、コンピュータシステムには、ベクトル演算器を備えるベクトルプロセッサ100、所定領域にあらかじめベクトルプロセッサ100の制御プログラム等を格納するメインメモリ110、データを入力可能なヒューマンインターフェースとしての入力部120、ディスプレイ等のデータを出力可能な出力部130、ネットワーク等を介して外部との通信を行う通信部140が設けられている。
In FIG. 1, a computer system includes a
ここで、メインメモリ110には、プログラムを格納するプログラム・テキスト領域111、定数などのデータを予め格納する初期化済みデータ領域112、定数などのデータを格納するための事前に確保された未初期化データ領域113、プログラム実行時に動的に確保されるヒープ領域114およびスタック領域115ならびにその他論理的に区分された記憶領域を有している。
Here, in the
そして、制御プログラムは、ベクトルプロセッサ100が直接実行可能な低水準言語(例えば、機械語)で構成されており、高水準言語(例えば、C言語)により記述されたアセンブリソースコード200を、アセンブラ210およびリンカ220からなる命令コード生成系により低水準言語にコンパイルし、実行プログラム230として生成される。そして、生成された制御プログラムは、ハードディスク等の補助記憶装置に格納されるが、ベクトルプロセッサ100が実行するときは、プログラムローダ240によりメインメモリ110の記憶領域のうちプログラム・テキスト領域111に配置され、実行可能な状態に置かれる。なお、アセンブラ210、リンカ220およびプログラムローダ240は、一般にソフトウェアにより構成することができる。
The control program is composed of a low-level language (for example, machine language) that can be directly executed by the
図2は、図1のベクトルプロセッサ100の概略構成を示すブロック図である。
図2において、ベクトルプロセッサ100には、メインメモリ110から読み出された命令の内容を解読する命令ディコーダ21、ベクトルプロセッサ100のステータスに関する情報を記憶するステータスレジスタ22、スカラー演算に利用するスカラーレジスタレジスタおよびベクトル演算に利用するベクトルレジスタが配置されたレジスタファイル23、乗算を行う乗算ユニット24、加減算およびシフト演算を行う加減算/シフトユニットA25、加減算およびシフト演算を行う加減算/シフトユニットB26、シフト、アンドおよびオアなどの論理演算を行うMOVEユニットA27、シフト、アンドおよびオアなどの論理演算を行うMOVEユニットB28、演算処理を行うALU29、ロード用のアドレスを生成するアドレス生成ユニットX30、ロード用のアドレスを生成するアドレス生成ユニットY31、ストア用のアドレスを生成するアドレス生成ユニットZ32が設けられている。
FIG. 2 is a block diagram showing a schematic configuration of the
In FIG. 2, the
ここで、命令ディコーダ21には分岐制御を行う分岐制御部21aが設けられている。また、ステータスレジスタ22には、加減算処理時の飽和処理を有効化するための飽和指定フラグを格納するSビットが割り当てられるとともに、加減算処理およびシフト演算時のオーバーフローフラグを格納するVVビットが割り当てられている。さらに、加減算/シフトユニットA25、加減算/シフトユニットB26、MOVEユニットA27およびMOVEユニットB28には、飽和処理部25a〜28aがそれぞれ搭載されている。
Here, the
ここで、飽和処理部25aは、ステータスレジスタ22のSビットを参照し、Sビットが“1”の時、加減算/シフトユニットA25で得られた加減算結果に応じて飽和処理を実行するとともに、飽和処理を実行した場合には、ステータスレジスタ22のVVビットに“1”を設定する。また、飽和処理部26aは、ステータスレジスタ22のSビットを参照し、Sビットが“1”の時、加減算/シフトユニットB26で得られた加減算結果に応じて飽和処理を実行するとともに、飽和処理を実行した場合には、ステータスレジスタ22のVVビットに“1”を設定する。
Here, the
また、飽和処理部27aは、MOVEユニットA27で行われるシフト演算が算術シフトの場合、MOVEユニットA27にて得られたシフト演算結果に応じて飽和処理を無条件に実行するとともに、ステータスレジスタ22のVVビットに“1”を設定し、MOVEユニットA27にて行われるシフト演算が論理シフトの場合、MOVEユニットA27にて得られたシフト演算結果のオーバーフローの有無に関わらず飽和処理を実行しないようにする。また、飽和処理部28aは、MOVEユニットB28で行われるシフト演算が算術シフトの場合、MOVEユニットB28にて得られたシフト演算結果に応じて飽和処理を無条件に実行するとともに、ステータスレジスタ22のVVビットに“1”を設定し、MOVEユニットB28にて行われるシフト演算が論理シフトの場合、MOVEユニットB28にて得られたシフト演算結果のオーバーフローの有無に関わらず飽和処理を実行しないようにする。
Further, when the shift operation performed in the MOVE unit A27 is an arithmetic shift, the
そして、命令ディコーダ21は、プログラムバスPBおよびプログラムアドレスバスPABに接続されるとともに、バスB1〜B3をそれぞれ介してレジスタファイル23、乗算ユニット24、加減算/シフトユニットA25、加減算/シフトユニットB26、MOVEユニットA27、MOVEユニットB28、ALU29、アドレス生成ユニットX30、アドレス生成ユニットY31およびアドレス生成ユニットZ32に接続されている。また、レジスタファイル23は、X−バスXB、Y−バスXY、ZX−バスZXBおよびZY−バスZYBに接続されるとともに、バスB4を介して乗算ユニット24、加減算/シフトユニットA25、加減算/シフトユニットB26、MOVEユニットA27、MOVEユニットB28、ALU29、アドレス生成ユニットX30、アドレス生成ユニットY31およびアドレス生成ユニットZ32に接続されている。また、アドレス生成ユニットX30はX−アドレスバスXABに接続され、アドレス生成ユニットY31はY−アドレスバスYABに接続され、アドレス生成ユニットZ32はZX−アドレスバスZXABおよびZY−アドレスバスZYABに接続されている。
The
図3は、図2のレジスタファイル23の概略構成を示すブロック図である。
図3において、レジスタファイル23にはスカラーレジスタおよびベクトルレジスタが配置されている。ここで、スカラーレジスタには、例えば、32ビット分のデータをそれぞれ記憶する記憶領域SR0〜SR15を16本だけ設けることができる。
また、例えば、ベクトルの要素数が8であるとすると、32ビット分のデータをそれぞれ記憶する8個の記憶領域VR0[0]〜VR0[7]で1本分のベクトルレジスタを構成することができる。そして、例えば、32ビット分のデータをそれぞれ記憶する64個の記憶領域VR0[0]〜VR0[7]、VR1[0]〜VR1[7]、VR2[0]〜VR2[7]、VR3[0]〜VR3[7]、VR4[0]〜VR4[7]、VR5[0]〜VR5[7]、VR6[0]〜VR6[7]、VR7[0]〜VR7[7]を設けることで、8本分のベクトルレジスタを設けることができる。
FIG. 3 is a block diagram showing a schematic configuration of the
In FIG. 3, the
For example, assuming that the number of elements of a vector is 8, one vector register can be configured by eight storage areas VR0 [0] to VR0 [7] each storing 32-bit data. it can. Then, for example, 64 storage areas VR0 [0] to VR0 [7], VR1 [0] to VR1 [7], VR2 [0] to VR2 [7], VR3 [ 0] to VR3 [7], VR4 [0] to VR4 [7], VR5 [0] to VR5 [7], VR6 [0] to VR6 [7], VR7 [0] to VR7 [7] are provided. Thus, eight vector registers can be provided.
図4は、ベクトル命令のデータ構造を示す図である。
図4において、ベクトル命令には、乗算や加算などの命令の種類を定義するオペコードopecodeおよびベクトル演算の実行回数を定義するリピートアマウントrptamtが設けられている。また、ベクトル命令では、書き込み先のディスティネーションレジスタdstおよび読み出し先のソースレジスタsrc1、src2を指定することができる。また、図4のデータ構造において、リピートアマウントrptamを0にした場合、同じデータ構造を用いてスカラー命令、ベクトル命令を格納することができる。
FIG. 4 is a diagram illustrating the data structure of a vector instruction.
In FIG. 4, the vector instruction is provided with an opcode opecode that defines the type of instruction such as multiplication and addition, and a repeat amount rptamt that defines the number of executions of the vector operation. In the vector instruction, the destination register dst to be written and the source registers src1 and src2 to be read can be designated. Also, in the data structure of FIG. 4, when the repeat amount rptam is set to 0, scalar instructions and vector instructions can be stored using the same data structure.
図5は、図2のベクトルプロセッサ100のベクトル加算処理を示す図である。
図5において、ベクトル命令において、例えば、オペコードopecodeにて加算が指定され、リピートアマウントrptamtで8が指定され、ディスティネーションレジスタdstとして図3のベクトルレジスタVR0が指定され、ソースレジスタsrc1、src2として図3のベクトルレジスタVR1、VR2がそれぞれ指定されていたものとする。この場合、図2の加減算/シフトユニットA25または加減算/シフトユニットB26が加算器A1として選択され、ベクトルレジスタVR1に格納されている要素a0〜a7およびベクトルレジスタVR2に格納されている要素x0〜x7が加算器A1に順次送られる。そして、加算器A1にて各要素ごとに加算が行われた後、その加算結果がベクトルレジスタVR0に格納される。
FIG. 5 is a diagram showing vector addition processing of the
In FIG. 5, in the vector instruction, for example, addition is designated by the operation code opecode, 8 is designated by the repeat amount rptamt, the vector register VR0 of FIG. 3 is designated as the destination register dst, and the source registers src1, src2 are shown. 3 vector registers VR1 and VR2 are respectively designated. In this case, the addition / subtraction / shift unit A25 or the addition / subtraction / shift unit B26 of FIG. 2 is selected as the adder A1, and the elements a0 to a7 stored in the vector register VR1 and the elements x0 to x7 stored in the vector register VR2 are selected. Are sequentially sent to the adder A1. Then, after addition is performed for each element by the adder A1, the addition result is stored in the vector register VR0.
図6は、図2の飽和処理部25a、26aの概略構成を示すブロック図である。
図6において、飽和処理部25a、26aは、ステータスレジスタ22のSビットおよびVVビットに接続することができる。また、オーバーフローした時の飽和値として“0x7FFFFFFF”が設定され、アンダーフローした時の飽和値として“0x80000000”が設定されているものとする。そして、加減算/シフトユニットA25または加減算/シフトユニットB26で加算処理がそれぞれ行われる時に、飽和処理部25a、26aは、ステータスレジスタ22のSビットを参照し、Sビットが“1”の時、加減算/シフトユニットA25または加減算/シフトユニットB26にて得られた加算結果がオーバーフローまたはアンダーフローしているかどうかをそれぞれ判断する。
FIG. 6 is a block diagram showing a schematic configuration of the
In FIG. 6, the
そして、加減算/シフトユニットA25または加減算/シフトユニットB26にて得られた加算結果がオーバーフローまたはアンダーフローしていない場合、加減算/シフトユニットA25または加減算/シフトユニットB26にて得られた加算結果をそのまま出力する。一方、加減算/シフトユニットA25または加減算/シフトユニットB26にて得られた加算結果がオーバーフローしている場合、その加算結果として“0x7FFFFFFF”を出力し、ステータスレジスタ22のVVビットに“1”を設定する。また、加減算/シフトユニットA25または加減算/シフトユニットB26にて得られた加算結果がアンダーフローしている場合、その加算結果として“0x80000000”を出力し、ステータスレジスタ22のVVビットに“1”を設定する。
When the addition result obtained by the addition / subtraction / shift unit A25 or the addition / subtraction / shift unit B26 does not overflow or underflow, the addition result obtained by the addition / subtraction / shift unit A25 or the addition / subtraction / shift unit B26 is used as it is. Output. On the other hand, when the addition result obtained by the addition / subtraction / shift unit A25 or the addition / subtraction / shift unit B26 overflows, “0x7FFFFFFF” is output as the addition result, and “1” is set to the VV bit of the
一方、飽和処理部25a、26aは、ステータスレジスタ22のSビットを参照した結果、Sビットが“0”の時、加減算/シフトユニットA25または加減算/シフトユニットB26にてそれぞれ得られた加算結果をそのまま出力する。
これにより、加減算/シフトユニットA25または加減算/シフトユニットB26の加算演算に伴う飽和処理をハードウェア上で行わせることが可能となり、オーバーフローまたはアンダーフローの有無の判断およびその判断結果に従った分岐処理をプログラムに記述することなく、飽和処理を実行させることが可能となる。このため、加算命令に飽和機能が実装された場合においても、1命令分の演算を1サイクルで実行させることが可能となり、飽和機能が実装された加算命令のベクトル化ができるようにして、飽和機能が実装された加算処理の高速化を図ることができる。
On the other hand, as a result of referring to the S bit of the
As a result, the saturation processing associated with the addition operation of the addition / subtraction / shift unit A25 or the addition / subtraction / shift unit B26 can be performed on the hardware, and it is determined whether there is an overflow or underflow, and branch processing according to the determination result. It is possible to execute saturation processing without describing the above in the program. For this reason, even when the saturation function is implemented in the addition instruction, it is possible to execute the operation for one instruction in one cycle, and the vectorization of the addition instruction in which the saturation function is implemented can be performed. It is possible to speed up the addition processing in which the function is implemented.
また、ステータスレジスタ22にSビットを割り当てることにより、飽和処理を実行させるかどうかをプログラムから指定することが可能となる。このため、加算演算に伴う飽和処理のハードウェア化を行った場合においても、加算結果に対して飽和処理が一律に行われることを防止することが可能となり、一つの加算命令を用意することで、飽和機能が実装された加算処理と飽和機能が実装されていない加算処理とを実現することができる。
Further, by assigning the S bit to the
さらに、ステータスレジスタ22にVVビットを割り当てることにより、ステータスレジスタ22に設定されたVVビットの値を参照することで、演算終了後にプログラマが飽和の有無を検知することが可能となり、デバッグなどの作業に役立てることができる。
図7は、図2の飽和処理部27a、28aの概略構成を示すブロック図である。
図7において、飽和処理部27a、28aは、ステータスレジスタ22のVVビットに接続することができる。また、オーバーフローした時の飽和値として“0x7FFFFFFF”が設定され、アンダーフローした時の飽和値として“0x80000000”が設定されているものとする。そして、飽和処理部27a、28aは、MOVEユニットA27およびMOVEユニットB28でそれぞれ行われるシフト演算が算術シフトの場合、MOVEユニットA27またはMOVEユニットB28にて得られた左シフト演算結果がオーバーフローまたはアンダーフローしているかどうかをそれぞれ判断する。
Further, by assigning the VV bit to the
FIG. 7 is a block diagram showing a schematic configuration of the
In FIG. 7, the
そして、MOVEユニットA27またはMOVEユニットB28にて得られた左シフト演算結果がオーバーフローまたはアンダーフローしていない場合、MOVEユニットA27またはMOVEユニットB28にて得られた左シフト演算結果をそのまま出力する。一方、MOVEユニットA27またはMOVEユニットB28にて得られた左シフト演算結果がオーバーフローしている場合、その左シフト演算結果として“0x7FFFFFFF”を出力し、ステータスレジスタ22のVVビットに“1”を設定する。また、MOVEユニットA27またはMOVEユニットB28にて得られた左シフト演算結果がアンダーフローしている場合、その左シフト演算結果として“0x80000000”を出力し、ステータスレジスタ22のVVビットに“1”を設定する。
If the left shift calculation result obtained by the MOVE unit A27 or the MOVE unit B28 does not overflow or underflow, the left shift calculation result obtained by the MOVE unit A27 or the MOVE unit B28 is output as it is. On the other hand, if the left shift calculation result obtained by MOVE unit A27 or MOVE unit B28 overflows, “0x7FFFFFFF” is output as the left shift calculation result, and “1” is set to the VV bit of status register 22 To do. If the left shift operation result obtained by the MOVE unit A27 or the MOVE unit B28 is underflowing, “0x80000000” is output as the left shift operation result, and “1” is output to the VV bit of the
一方、飽和処理部27a、28aは、MOVEユニットA27およびMOVEユニットB28でそれぞれ行われるシフト演算が論理シフトの場合、MOVEユニットA27およびMOVEユニットB28にてそれぞれ得られたシフト演算結果をそのまま出力する。
これにより、MOVEユニットA27およびMOVEユニットB28のシフト演算に伴う飽和処理をハードウェア上で行わせることが可能となり、オーバーフローの有無の判断およびその判断結果に従った分岐処理をプログラムに記述することなく、飽和処理を実行させることが可能となる。このため、シフト演算命令に飽和機能が実装された場合においても、1命令分の演算を1サイクルで実行させることが可能となり、飽和機能が実装されたシフト演算命令のベクトル化ができるようにして、飽和機能が実装されたシフト演算処理の高速化を図ることができる。
On the other hand, when the shift operations performed in MOVE unit A27 and MOVE unit B28 are logical shifts,
As a result, the saturation processing associated with the shift operation of the MOVE unit A27 and the MOVE unit B28 can be performed on the hardware, and the determination of the presence or absence of overflow and the branch processing according to the determination result are not described in the program. The saturation process can be executed. For this reason, even when the saturation function is implemented in the shift operation instruction, it is possible to execute the operation for one instruction in one cycle, and to enable vectorization of the shift operation instruction in which the saturation function is implemented. Therefore, it is possible to increase the speed of the shift operation processing in which the saturation function is implemented.
また、算術シフト命令をプログラム上に記述することで、飽和機能が実装されたシフト演算処理を実現することが可能となるとともに、論理シフト命令をプログラム上に記述することで、飽和機能が実装されていないシフト演算処理を実現することが可能となる。このため、シフト演算に伴う飽和処理のハードウェア化を行った場合においても、シフト演算結果に対して飽和処理が一律に行われることを防止することが可能となり、等しい演算結果が得られる2種類の冗長なシフト演算命令を使い分けることで、飽和機能が実装されたシフト演算処理と飽和機能が実装されていないシフト演算処理とを実現することができる。 In addition, by describing the arithmetic shift instruction on the program, it is possible to realize the shift operation processing in which the saturation function is implemented, and the saturation function is implemented by describing the logical shift instruction on the program. It is possible to realize shift operation processing that is not performed. For this reason, even when the hardware of the saturation processing associated with the shift operation is performed, it is possible to prevent the saturation processing from being uniformly performed on the shift operation result, and two types that can obtain the same operation result. By using different redundant shift operation instructions, it is possible to realize shift operation processing in which the saturation function is implemented and shift operation processing in which the saturation function is not implemented.
さらに、ステータスレジスタ22にVVビットを割り当てることにより、ステータスレジスタ22に設定されたVVビットの値を参照することで、演算終了後にプログラマが飽和の有無を検知することが可能となり、デバッグなどの作業に役立てることができる。
図8は、図2のベクトルプロセッサ100のパイプライン処理を示すブロック図である。
Further, by assigning the VV bit to the
FIG. 8 is a block diagram showing pipeline processing of the
図8のサイクルC1において、ベクトル命令のインストラクションフェッチIFが行われると、そのベクトル命令が図2の命令ディコーダ21に送られる。そして、インストラクションフェッチIFが行われたベクトル命令が図2の命令ディコーダ21に送られると、サイクルC2において、デコードRDが命令ディコーダ21にて行われ、ベクトル命令の解読が行われる。そして、命令ディコーダ21にてベクトル命令を解読することにより、オペコードopecodeおよびリピートアマウントrptamtが抽出され、そのベクトル命令では、どのような種類のベクトル演算が何回分だけ行われるかを判別することができる。
When the instruction fetch IF of a vector instruction is performed in cycle C1 in FIG. 8, the vector instruction is sent to the
ここで、ベクトル命令のオペコードopecodeで加算が指定され、リピートアマウントrptamtに4が設定されているものとすると、サイクルC3において、ベクトル命令の1回目の加算に対応した実行EXEが、加減算/シフトユニットA25または加減算/シフトユニットB26にて行われる。そして、飽和処理部25a、26aは、加減算/シフトユニットA25または加減算/シフトユニットB26にて実行EXEが行われる時に、ステータスレジスタ22のSビットを参照し、Sビットが“1”の時、加減算/シフトユニットA25または加減算/シフトユニットB26にて得られた加算結果がオーバーフローまたはアンダーフローしているかどうかをそれぞれ判断する。
Here, assuming that addition is specified by the opcode opecode of the vector instruction and 4 is set in the repeat amount rptamt, the execution EXE corresponding to the first addition of the vector instruction is added / subtracted / shifted in cycle C3. This is performed by A25 or addition / subtraction / shift unit B26. The
そして、加減算/シフトユニットA25または加減算/シフトユニットB26にて得られた加算結果がオーバーフローまたはアンダーフローしている場合、その加算結果として飽和値を出力し、ステータスレジスタ22のVVビットに“1”を設定する。
次に、サイクルC4において、ベクトル命令の1回目の加算結果の記憶MEMがベクトルレジスタに行われるとともに、ベクトル命令の2回目の加算に対応した実行EXEが行われる。そして、飽和処理部25a、26aは、加減算/シフトユニットA25または加減算/シフトユニットB26にて実行EXEが行われる時に、ステータスレジスタ22のSビットを参照し、Sビットが“1”の時、加減算/シフトユニットA25または加減算/シフトユニットB26にて得られた加算結果がオーバーフローまたはアンダーフローしているかどうかをそれぞれ判断する。
If the addition result obtained by the addition / subtraction / shift unit A25 or the addition / subtraction / shift unit B26 overflows or underflows, a saturation value is output as the addition result, and “1” is output to the VV bit of the
Next, in cycle C4, storage MEM of the first addition result of the vector instruction is performed in the vector register, and execution EXE corresponding to the second addition of the vector instruction is performed. The
そして、加減算/シフトユニットA25または加減算/シフトユニットB26にて得られた加算結果がオーバーフローまたはアンダーフローしている場合、その加算結果として飽和値を出力し、ステータスレジスタ22のVVビットに“1”を設定する。
次に、サイクルC5おいて、ベクトル命令の2回目の加算結果の記憶MEMがベクトルレジスタに行われるとともに、ベクトル命令の3回目の加算に対応した実行EXEが行われる。そして、飽和処理部25a、26aは、加減算/シフトユニットA25または加減算/シフトユニットB26にて実行EXEが行われる時に、ステータスレジスタ22のSビットを参照し、Sビットが“1”の時、加減算/シフトユニットA25または加減算/シフトユニットB26にて得られた加算結果がオーバーフローまたはアンダーフローしているかどうかをそれぞれ判断する。
If the addition result obtained by the addition / subtraction / shift unit A25 or the addition / subtraction / shift unit B26 overflows or underflows, a saturation value is output as the addition result, and “1” is output to the VV bit of the
Next, in cycle C5, storage MEM of the second addition result of the vector instruction is performed in the vector register, and execution EXE corresponding to the third addition of the vector instruction is performed. The
そして、加減算/シフトユニットA25または加減算/シフトユニットB26にて得られた加算結果がオーバーフローまたはアンダーフローしている場合、その加算結果として飽和値を出力し、ステータスレジスタ22のVVビットに“1”を設定する。
次に、サイクルC6おいて、ベクトル命令の3回目の加算結果の記憶MEMがベクトルレジスタに行われるとともに、ベクトル命令の4回目の加算に対応した実行EXEが行われる。そして、飽和処理部25a、26aは、加減算/シフトユニットA25または加減算/シフトユニットB26にて実行EXEが行われる時に、ステータスレジスタ22のSビットを参照し、Sビットが“1”の時、加減算/シフトユニットA25または加減算/シフトユニットB26にて得られた加算結果がオーバーフローまたはアンダーフローしているかどうかをそれぞれ判断する。
If the addition result obtained by the addition / subtraction / shift unit A25 or the addition / subtraction / shift unit B26 overflows or underflows, a saturation value is output as the addition result, and “1” is output to the VV bit of the
Next, in cycle C6, the storage MEM of the third addition result of the vector instruction is performed in the vector register, and the execution EXE corresponding to the fourth addition of the vector instruction is performed. The
そして、加減算/シフトユニットA25または加減算/シフトユニットB26にて得られた加算結果がオーバーフローまたはアンダーフローしている場合、その加算結果として飽和値を出力し、ステータスレジスタ22のVVビットに“1”を設定する。
次に、サイクルC7おいて、ベクトル命令の4回目の加算結果の記憶MEMがベクトルレジスタに行われ、今回インストラクションフェッチIFが行われたベクトル命令の処理が完了する。
If the addition result obtained by the addition / subtraction / shift unit A25 or the addition / subtraction / shift unit B26 overflows or underflows, a saturation value is output as the addition result, and “1” is output to the VV bit of the
Next, in cycle C7, the storage MEM of the fourth addition result of the vector instruction is performed in the vector register, and the processing of the vector instruction for which the instruction fetch IF has been performed this time is completed.
図9は、本発明の一実施形態に係るL_MAC()関数のハンドアセンブル例を示す図である。
加減算/シフトユニットA25、加減算/シフトユニットB26、MOVEユニットA27およびMOVEユニットB28に飽和処理部25a〜28aがそれぞれ搭載されない場合には、1回分の演算を行うごとにオーバーフローの有無を判断し、その判断結果に従って分岐処理を行う必要がある。このため、L_MAC関数のソースコードには、図17に示したように、条件分岐などの命令を挿入する必要があり、図17のソースコードのコンパイル例は、図18に示すように、36行にも及ぶ膨大な関数になる。
FIG. 9 is a diagram illustrating an example of hand assembly of the L_MAC () function according to an embodiment of the present invention.
When the addition / subtraction / shift unit A25, the addition / subtraction / shift unit B26, the MOVE unit A27, and the MOVE unit B28 are not equipped with the
これに対して、加減算/シフトユニットA25、加減算/シフトユニットB26、MOVEユニットA27およびMOVEユニットB28に飽和処理部25a〜28aをそれぞれ搭載することにより、図9に示すように、乗算を行わせるMPH命令、飽和機能付きシフト演算を行わせるSAW命令および飽和機能付き加算を行わせるADDW命令の3個の命令でL_MAC()関数を実現することができる。
On the other hand, by adding
図10は、本発明の一実施形態に係るベクトル命令化されたL_MAC()関数の使用例を示す図、図11は、図10のソースコードのハンドアセンブル例を示す図である。
加減算/シフトユニットA25、加減算/シフトユニットB26、MOVEユニットA27およびMOVEユニットB28に飽和処理部25a〜28aがそれぞれ搭載されない場合、ベクトル命令を使うことができないので、例えば、L_MAC()関数を40回だけ実行させるには、図18に示した36行にも及ぶ膨大な関数を40回も繰り返す必要がある。
FIG. 10 is a diagram illustrating a usage example of the L_MAC () function converted into a vector instruction according to an embodiment of the present invention, and FIG. 11 is a diagram illustrating a hand assembly example of the source code of FIG.
When the addition / subtraction / shift unit A25, addition / subtraction / shift unit B26, MOVE unit A27, and MOVE unit B28 are not equipped with the
これに対して、加減算/シフトユニットA25、加減算/シフトユニットB26、MOVEユニットA27およびMOVEユニットB28に飽和処理部25a〜28aをそれぞれ搭載することにより、図8に示したように、飽和機能付き加算の実行および飽和機能付きシフト演算の実行をそれぞれ1サイクルで行わせることができる。このため、図10に示すように、L_MAC()関数をベクトル命令化することが可能となり、例えば、L_MAC()関数を40回実行させる場合においても、図11に示すように、長さ8のベクトル命令を5回発行すればよい。この結果、図10の例では、ベクトル命令を使わないでL_MAC()関数を実行させた場合に比べて、約20倍の速度向上が見られた。
On the other hand, by adding
これにより、既存のベクトルプロセッサの命令セットとの整合性を保ちつつ、命令の変更量を極力少なくしてL_MAC()関数の高速化を図ることができ、AMRコーディックのベクトルプロセッサ100上で実現することが可能となる。
なお、図11の例では、コメントアウトしたNOPが1回につき4度書かれているが、インターロックがかからないユニットなら、ここに他の命令を書くこともできる。例えば、積和演算中に絶えず積和値を確認し、その値が飽和していたら、即座に別の処理に移行させるようにしてもよい。
As a result, while maintaining consistency with the instruction set of an existing vector processor, the amount of instruction change can be reduced as much as possible to increase the speed of the L_MAC () function, which is realized on the
In the example of FIG. 11, the commented-out NOP is written four times at a time. However, other instructions can be written here if the unit does not require interlock. For example, the product-sum value may be constantly checked during the product-sum operation, and if the value is saturated, the processing may be immediately shifted to another process.
図12は、本発明の一実施形態に係るステータスレジスタの飽和機能の指定方法の一例を示す図である。
飽和機能をオン/オフする場合、例えば、図12に示すような命令をソースコードに挿入することができる。これにより、ソースコード中で飽和機能のオン/オフを指定することができ、プログラマが飽和機能のオン/オフを指定することができる。なお、図12の例では、インラインアセンブラであるが、アセンブラファイルに直接記述するようにしてもよい。
FIG. 12 is a diagram showing an example of a method for specifying the saturation function of the status register according to an embodiment of the present invention.
When the saturation function is turned on / off, for example, an instruction as shown in FIG. 12 can be inserted into the source code. Thereby, on / off of the saturation function can be designated in the source code, and the programmer can designate on / off of the saturation function. In the example of FIG. 12, an inline assembler is used, but it may be described directly in an assembler file.
図13は、本発明の一実施形態に係るVVビットの検出関数の一例を示す図、図14は、本発明の一実施形態に係るオーバーフローの検出方法の一例を示す図である。
図13において、オーバーフローの有無を確認するために、Test_Overflow()という命令を定義するソースコードをヘッダファイルに書いておく。そして、図14に示すように、オーバーフローを調べたい箇所で、図13のインラインアセンブラを呼び出せばよい。この方法では、global変数“Overflow”が既に1の時かVVビットが1の時、“Overflow”を1にできるため、オリジナルソースコードの変数Overflowと競合することなく、オーバーフローの検出ができる。
FIG. 13 is a diagram illustrating an example of a VV bit detection function according to an embodiment of the present invention, and FIG. 14 is a diagram illustrating an example of an overflow detection method according to an embodiment of the present invention.
In FIG. 13, in order to confirm the presence or absence of overflow, source code defining an instruction Test_Overflow () is written in a header file. Then, as shown in FIG. 14, the inline assembler shown in FIG. In this method, when the global variable “Overflow” is already 1 or the VV bit is 1, “Overflow” can be set to 1, so that overflow can be detected without conflicting with the variable Overflow of the original source code.
図15は、図2の加減算/シフトユニットA25および加減算/シフトユニットB26でそれぞれ実行可能な飽和機能付き加減算命令の一覧を示す図である。
図15において、ADDW命令では、レジスタsrc1とレジスタsrc2のワードの加算が行われる。なお、ADDW命令では、shamtで指定されたビット数分だけ加算結果の算術右シフトができる。ADD2H命令では、レジスタsrc1とレジスタsrc2の上位と下位のハーフワードごとに加算が行われる。なお、ADD2H命令では、shamtで指定されたビット数分だけ加算結果の算術右シフトができる。
FIG. 15 is a diagram showing a list of addition / subtraction instructions with a saturation function that can be executed by the addition / subtraction / shift unit A25 and the addition / subtraction / shift unit B26 of FIG.
In FIG. 15, in the ADDW instruction, the words of the registers src1 and src2 are added. In the ADDW instruction, the addition result can be arithmetically shifted to the right by the number of bits specified by shamt. In the ADD2H instruction, addition is performed for each of the upper and lower halfwords of the registers src1 and src2. In the ADD2H instruction, the addition result can be arithmetically shifted to the right by the number of bits specified by the shamt.
SUBW命令では、レジスタsrc1からレジスタsrc2のワードの減算が行われる。なお、SUBW命令では、shamtで指定されたビット数分だけ加算結果の算術右シフトができる。SUB2H命令では、レジスタsrc1からレジスタsrc2の上位と下位のハーフワードごとに減算が行われる。なお、SUB2H命令では、shamtで指定されたビット数分だけ減算結果の算術右シフトができる。 In the SUBW instruction, the word of the register src2 is subtracted from the register src1. In the SUBW instruction, the addition result can be arithmetically shifted to the right by the number of bits specified by shamt. In the SUB2H instruction, subtraction is performed from the register src1 for each of the upper and lower halfwords of the register src2. In the SUB2H instruction, the subtraction result can be arithmetically shifted to the right by the number of bits specified by shamt.
ADSB2H命令では、レジスタsrc1とレジスタsrc2の上位と下位のハーフワードごとに加減算が行われる。ここで、下位のハーフワードに対しては加算が行われ、上位のハーフワードに対しては減算が行われる。なお、ADSB2H命令では、shamtで指定されたビット数分だけ加減算結果の算術右シフトができる。SBAD2H命令では、レジスタsrc1とレジスタsrc2の上位と下位のハーフワードごとに加減算が行われる。ここで、下位のハーフワードに対しては減算が行われ、上位のハーフワードに対しては加算が行われる。なお、SBAD2H命令では、shamtで指定されたビット数分だけ加減算結果の算術右シフトができる。 In the ADSB2H instruction, addition / subtraction is performed for each of the upper and lower halfwords of the register src1 and the register src2. Here, addition is performed on the lower halfword and subtraction is performed on the upper halfword. In the ADSB2H instruction, the arithmetic right shift of the addition / subtraction result can be performed by the number of bits specified by shamt. In the SBAD2H instruction, addition / subtraction is performed for each of the upper and lower halfwords of the registers src1 and src2. Here, subtraction is performed on the lower halfword and addition is performed on the upper halfword. In the SBAD2H instruction, the arithmetic right shift of the addition / subtraction result can be performed by the number of bits specified by the shamt.
ADDWI命令では、レジスタsrc1と10ビットの拡張符号immediateのワードの加算が行われる。ADD2HI命令では、レジスタsrc1の上位と下位の各々のハーフワードに対して10ビットの拡張符号immediateの加算が行われる。
ADD2W命令では、ADDW命令のデュアル・ユニット命令が発行される。ADD4H命令では、ADD2H命令のデュアル・ユニット命令が発行される。SUB2W命令では、SUBW命令のデュアル・ユニット命令が発行される。SUB4H命令では、SUB2H命令のデュアル・ユニット命令が発行される。ADSB4H命令では、ADSB2H命令のデュアル・ユニット命令が発行される。SBAD4H命令では、SBAD2H命令のデュアル・ユニット命令が発行される。ADD2WI命令では、ADDWI命令のデュアル・ユニット命令が発行される。ADD4HI命令では、ADD2HI命令のデュアル・ユニット命令が発行される。
In the ADDWI instruction, the word of the register src1 and the 10-bit extension code immediate is added. In the ADD2HI instruction, the 10-bit extension code “immediate” is added to the upper and lower halfwords of the register src1.
In the ADD2W instruction, a dual unit instruction of the ADDW instruction is issued. In the ADD4H instruction, a dual unit instruction of the ADD2H instruction is issued. In the SUB2W instruction, a dual unit instruction of the SUBW instruction is issued. In the SUB4H instruction, a dual unit instruction of the SUB2H instruction is issued. In the ADSB4H instruction, a dual unit instruction of the ADSB2H instruction is issued. In the SBAD4H instruction, a dual unit instruction of the SBAD2H instruction is issued. In the ADD2WI instruction, a dual unit instruction of the ADDWI instruction is issued. In the ADD4HI instruction, a dual unit instruction of the ADD2HI instruction is issued.
ここで、1)の命令では、ステータスレジスタ22のSビットが“1”の時、加減算/シフトユニットA25または加減算/シフトユニットB26にて得られたシフト前の演算結果を符号付き32ビットの値と解釈する。そして、加減算/シフトユニットA25または加減算/シフトユニットB26にて得られたシフト前の演算結果がオーバーフローオーバーフローしている場合、“0x7FFFFFFF”に飽和し、加減算/シフトユニットA25または加減算/シフトユニットB26にて得られたシフト前の演算結果がアンダーフローしている場合、“0x80000000”に飽和する。そして、飽和処理した場合には、ステータスレジスタ22のVVビットに“1”を設定する。なお、1)´の命令ではシフトは行わない。
Here, in the instruction 1), when the S bit of the
また、2)の命令では、ステータスレジスタ22のSビットが“1”の時、加減算/シフトユニットA25または加減算/シフトユニットB26にて得られたシフト前の演算結果を上位および下位とも符号付き16ビットの値と解釈する。そして、加減算/シフトユニットA25または加減算/シフトユニットB26にて得られたシフト前の演算結果がオーバーフローオーバーフローしている場合、“0x7FFF”に飽和し、加減算/シフトユニットA25または加減算/シフトユニットB26にて得られたシフト前の演算結果がアンダーフローしている場合、“0x8000”に飽和する。そして、飽和処理した場合には、ステータスレジスタ22のVVビットに“1”を設定する。なお、2)´の命令ではシフトは行わない。
Further, in the instruction 2), when the S bit of the
図16は、図2のMOVEユニットA27およびMOVEユニットB28でそれぞれ実行可能な飽和機能付きシフト命令の一覧を示す図である。
図16において、SAW命令では、レジスタsrc1のワードをshamtで指定されたビット数分だけ算術シフトする。SA2H命令では、レジスタsrc1の上位と下位のハーフワードごとにshamtで指定されたビット数分だけ算術シフトする。SAVW命令では、レジスタsrc1のワードをレジスタsrc2で指定されたビット数分だけ算術シフトする。SA2W命令では、2つのレジスタの2ワードを各々shamtで指定されたビット数分だけ算術シフトする。SA4H命令では、2つのレジスタの上位と下位のハーフワードを、各々shamtで指定されたビット数分だけ算術シフトする。SAV2W命令では、2並列でレジスタsrc1のワードをレジスタsrc2で指定されたビット数分だけ算術シフトする。
FIG. 16 is a diagram showing a list of shift instructions with a saturation function that can be executed by the MOVE unit A27 and the MOVE unit B28 of FIG.
In FIG. 16, in the SAW instruction, the word of the register src1 is arithmetically shifted by the number of bits specified by shamt. In the SA2H instruction, an arithmetic shift is performed by the number of bits specified by shamt for each of the upper and lower halfwords of the register src1. In the SAVW instruction, the word of the register src1 is arithmetically shifted by the number of bits specified by the register src2. In the SA2W instruction, the two words of the two registers are arithmetically shifted by the number of bits specified by the shamt. In the SA4H instruction, the upper and lower halfwords of the two registers are arithmetically shifted by the number of bits specified by shamt. In the SAV2W instruction, the word of the register src1 is arithmetically shifted by the number of bits designated by the register src2 in two parallel.
ここで、1)の命令では、左シフトの場合、MOVEユニットA27またはMOVEユニットB28で得られた演算結果の32ビットの値がオーバーフローしている場合、“0x7FFFFFFF”に飽和し、MOVEユニットA27またはMOVEユニットB28で得られた演算結果の32ビットの値がアンダーフローしている場合、“0x80000000”に飽和する。そして、飽和処理した場合には、ステータスレジスタ22のVVビットに“1”を設定する。
Here, in the instruction 1), in the case of left shift, when the 32-bit value of the operation result obtained by the MOVE unit A27 or the MOVE unit B28 overflows, it is saturated to “0x7FFFFFFF”, and the MOVE unit A27 or When the 32-bit value of the calculation result obtained by the MOVE unit B28 is underflowing, it is saturated to “0x80000000”. When the saturation processing is performed, “1” is set to the VV bit of the
また、2)の命令では、左シフトの場合、MOVEユニットA27またはMOVEユニットB28で得られた演算結果の上位または下位の16ビットの値がオーバーフローしている場合、“0x7FFF”に飽和し、MOVEユニットA27またはMOVEユニットB28で得られた上位または下位の16ビットの値がアンダーフローしている場合、“0x8000”に飽和する。そして、飽和処理した場合には、ステータスレジスタ22のVVビットに“1”を設定する。
In the case of the instruction 2), in the case of left shift, if the upper or lower 16-bit value of the operation result obtained by the MOVE unit A27 or the MOVE unit B28 overflows, it is saturated to “0x7FFF”, and the MOVE When the upper or lower 16-bit value obtained by the unit A27 or the MOVE unit B28 is underflowing, it is saturated to “0x8000”. When the saturation processing is performed, “1” is set to the VV bit of the
100 ベクトルプロセッサ、21 命令デコータ、21a 分岐制御部、22 ステータスレジスタ、23 レジスタファイル、24 乗算ユニット、25 加減算/シフトユニットA、26 加減算/シフトユニットB、27 MOVEユニットA、28 MOVEユニットB、25a〜28a 飽和処理部、29 ALU、30、アドレス生成ユニットX、31、アドレス生成ユニットY、32、アドレス生成ユニットZ、B1〜B4 バス、110 メインメモリ、111 プログラムテキスト領域、112 初期化済みデータ領域、113 未初期化データ領域、114 ヒープ領域、115 スタック領域、120 入力部、130 出力部、140 通信部、200 アセンブリソースコード、210 アセンブラ、220 リンカ、230 実行プログラム、240 プログラムローダ、A1 加算器、VR0〜VR2 ベクトルレジスタ 100 vector processor, 21 instruction decoder, 21a branch control unit, 22 status register, 23 register file, 24 multiplication unit, 25 addition / subtraction / shift unit A, 26 addition / subtraction / shift unit B, 27 MOVE unit A, 28 MOVE unit B, 25a ˜28a Saturation processing unit, 29 ALU, 30, address generation unit X, 31, address generation unit Y, 32, address generation unit Z, B1-B4 bus, 110 main memory, 111 program text area, 112 initialized data area , 113 Uninitialized data area, 114 heap area, 115 stack area, 120 input section, 130 output section, 140 communication section, 200 assembly source code, 210 assembler, 220 linker, 230 Line program, 240 program loader, A1 adder, VR0-VR2 vector register
Claims (9)
前記ベクトル加算器に搭載され、前記ベクトル加算器にて得られた加算結果に基づいて飽和処理を行う飽和処理部とを備えることを特徴とする演算処理装置。 A vector adder for performing vector addition processing;
An arithmetic processing apparatus, comprising: a saturation processing unit that is mounted on the vector adder and performs a saturation process based on an addition result obtained by the vector adder.
前記飽和処理部は、前記飽和指定フラグの参照結果に基づいて飽和処理を行うことを特徴とする請求項1記載の演算処理装置。 A status register for storing a saturation designation flag for enabling the saturation processing;
The arithmetic processing apparatus according to claim 1, wherein the saturation processing unit performs saturation processing based on a reference result of the saturation designation flag.
前記ベクトルシフト演算器に搭載され、前記ベクトルシフト演算器にて得られたシフト演算結果に基づいて飽和処理を行う飽和処理部とを備えることを特徴とする演算処理装置。 A vector shift computing unit for performing vector shift computing processing;
An arithmetic processing apparatus, comprising: a saturation processing unit mounted on the vector shift computing unit and performing a saturation processing based on a shift computation result obtained by the vector shift computing unit.
ベクトル加算処理を行うベクトル加算器と、
前記ベクトル加算器に搭載され、前記ベクトル加算器にて得られた加算結果に基づいて飽和処理を行う第1飽和処理部と、
ベクトルシフト演算処理を行うベクトルシフト演算器と、
前記ベクトルシフト演算器に搭載され、前記ベクトルシフト演算器にて得られたシフト結果に基づいて飽和処理を行う第2飽和処理部とを備えることを特徴とする演算処理装置。 A vector multiplier for performing vector multiplication processing;
A vector adder for performing vector addition processing;
A first saturation processing unit mounted on the vector adder and performing saturation processing based on the addition result obtained by the vector adder;
A vector shift computing unit for performing vector shift computing processing;
An arithmetic processing apparatus, comprising: a second saturation processing unit that is mounted on the vector shift computing unit and performs saturation processing based on a shift result obtained by the vector shift computing unit.
飽和機能が実装されたベクトル加算命令と、
飽和機能が実装されたベクトルシフト命令とをコンピュータに実行させることを特徴とする演算処理プログラム。 A vector multiply instruction that does not implement the saturation function;
A vector addition instruction with a saturation function implemented;
An arithmetic processing program for causing a computer to execute a vector shift instruction in which a saturation function is implemented.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004359553A JP2006171827A (en) | 2004-12-13 | 2004-12-13 | Processor and processing program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2004359553A JP2006171827A (en) | 2004-12-13 | 2004-12-13 | Processor and processing program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2006171827A true JP2006171827A (en) | 2006-06-29 |
Family
ID=36672544
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2004359553A Pending JP2006171827A (en) | 2004-12-13 | 2004-12-13 | Processor and processing program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2006171827A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP3238031A4 (en) * | 2014-12-23 | 2018-06-27 | Intel Corporation | Instruction and logic to perform a vector saturated doubleword/quadword add |
JP2019526866A (en) * | 2016-09-13 | 2019-09-19 | エイアールエム リミテッド | Vector multiply-add instruction |
-
2004
- 2004-12-13 JP JP2004359553A patent/JP2006171827A/en active Pending
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP3238031A4 (en) * | 2014-12-23 | 2018-06-27 | Intel Corporation | Instruction and logic to perform a vector saturated doubleword/quadword add |
JP2019526866A (en) * | 2016-09-13 | 2019-09-19 | エイアールエム リミテッド | Vector multiply-add instruction |
US11188330B2 (en) | 2016-09-13 | 2021-11-30 | Arm Limited | Vector multiply-add instruction |
JP7203016B2 (en) | 2016-09-13 | 2023-01-12 | アーム・リミテッド | Vector multiply-accumulate instruction |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7945607B2 (en) | Data processing apparatus and method for converting a number between fixed-point and floating-point representations | |
US7555514B2 (en) | Packed add-subtract operation in a microprocessor | |
JP7203016B2 (en) | Vector multiply-accumulate instruction | |
US7487338B2 (en) | Data processor for modifying and executing operation of instruction code according to the indication of other instruction code | |
KR100705507B1 (en) | Method and apparatus for adding advanced instructions in an extensible processor architecture | |
US20190347099A1 (en) | Arithmetic operation with shift | |
JP2009271598A (en) | Processor | |
JPH081602B2 (en) | Data processing device | |
KR101016257B1 (en) | Processor and information processing apparatus | |
JP3578883B2 (en) | Data processing device | |
US20030037085A1 (en) | Field processing unit | |
US20060218380A1 (en) | Add-shift-round instruction with dual-use source operand for DSP | |
US20060218377A1 (en) | Instruction with dual-use source providing both an operand value and a control value | |
JP2006171827A (en) | Processor and processing program | |
KR100231852B1 (en) | Parallel execution device of load instruction for dual pipeline processor | |
Johnsen | Implementing a MIPS processor using SME | |
JP2006302324A (en) | Data processor | |
JP4645369B2 (en) | CPU | |
JPH1196001A (en) | Device for executing program and method for converting program | |
JPH1115660A (en) | Micro processor | |
JP5263497B2 (en) | Signal processor and semiconductor device | |
Owen et al. | A uniform analysis method for DSP architectures and instruction sets with a comprehensive example | |
Bletsch et al. | ECE 550D | |
JP2003044272A (en) | Processor, data type specifying method, data loading method, computing method, data type updating method and instruction program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
RD04 | Notification of resignation of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7424 Effective date: 20070404 |
|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20071120 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20090219 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20090224 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20090417 |
|
A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20090630 |