JP3710193B2 - Multiply and accumulate circuit - Google Patents

Multiply and accumulate circuit Download PDF

Info

Publication number
JP3710193B2
JP3710193B2 JP05303896A JP5303896A JP3710193B2 JP 3710193 B2 JP3710193 B2 JP 3710193B2 JP 05303896 A JP05303896 A JP 05303896A JP 5303896 A JP5303896 A JP 5303896A JP 3710193 B2 JP3710193 B2 JP 3710193B2
Authority
JP
Japan
Prior art keywords
overflow
output
booth
circuit
input
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
Application number
JP05303896A
Other languages
Japanese (ja)
Other versions
JPH09245019A (en
Inventor
巳季彦 小高
光晴 馬場
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Oki Electric Industry Co Ltd
Original Assignee
Oki Electric Industry Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oki Electric Industry Co Ltd filed Critical Oki Electric Industry Co Ltd
Priority to JP05303896A priority Critical patent/JP3710193B2/en
Publication of JPH09245019A publication Critical patent/JPH09245019A/en
Application granted granted Critical
Publication of JP3710193B2 publication Critical patent/JP3710193B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Complex Calculations (AREA)

Description

【0001】
【発明の属する技術分野】
本発明は、並列乗算器等に用いられる積和演算回路に係り、詳細には、例えば2次ブース(Booth)理論及び符号拡張方式の乗算器を用いた積和演算回路に関する。
【0002】
【従来の技術】
乗算器はディジタル演算処理装置において加算器、遅延回路とともに最も基本的な回路の1つであり、集積度の向上によりMbit×Nbit乗算を一気に実行する並列乗算器も既にオンチップ化されている。並列乗算器の基本的な構造は、被乗数に乗数の1bitを掛け合わせた結果得られる部分積生成と、生成された部分積を乗数bitの重みに従って桁を合わせ加算する積和演算回路からなる。
【0003】
従来のこの種の積和演算回路としては、例えば「ディジタルCMOSの回路設計」コロナ社,p184〜p191に記載されたものがある。
【0004】
乗算アレイの構造を符号拡張の扱いの差により、主に3パターンの区分が広く知られており、最も単純な構造の符号拡張方式と、上記文献による符号伝搬方式及び符号生成方式(符号不拡張方式)である。
【0005】
従来、乗算器を用いた積和演算器では累積を計算する際のオーバーフローを検出することが困難であった。累積計算時のオーバーフロー発生は後のデータの値が全く不正確となるため、信号処理等の処理ではオーバーフローは避けなければならない。これを避けるには演算実行毎にオーバーフローの発生の有無をチェックする必要がある。さらには、オーバーフローが発生した時には、計算結果を正又は負の最大値に抑える飽和演算を行う場合もある。何れにしても積和演算においてオーバーフローの検出を行うということは極めて重要なことであり、この処理を高速かつハード量を少なく実行することが望まれる。
【0006】
本来、(Mbit×Nbit)の乗算を行い、(M+N)bitの積を得る場合、(M+N)bitを超えるオーバーフローを発生することはない。しかし、符号拡張方式の乗算アレイ部において、2次のブース(Booth)理論を用いた場合、部分積加算時に符号拡張部の加算によりキャリーアウトが発生することがある。これは2次のブース理論により、「−1」あるいは「−2」とエンコードされた場合の部分積は、被乗数の2の補数を(M+N)bitに符号(この場合、1)拡張するためである。ちなみに、更に「−2」にエンコードされた場合は1bit上位側にシフトする。
【0007】
この場合、出力される桁上げ出力を無視するために、乗算アレイ部では、(M/2)個の部分積を2個の中間積に圧縮し、それらを2入力桁上げ伝搬加算器に入力し、その加算和を積として得ておき、2入力桁上げ伝搬加算器によって得た積と累積データを加算するためにはもう1つ別の2入力桁上げ伝搬加算器を用意し、その加算器に積と累積データを入力していた。
【0008】
図4は上述した飽和演算機能付き積和演算回路の回路構成図である。
【0009】
図4において、積和演算回路10は、ブースエンコーダ11、乗算アレイ12及び2入力加算器13,14から構成される。
【0010】
上記ブースエンコーダ11は、2次のブース(Booth)理論を用いるために、乗数のうち隣り合う3bitを選択条件とするブースエンコードを行うためのものである。
【0011】
上記乗算アレイ12は、被乗数にブースエンコーダ11によりエンコードされた乗数を掛け合わせて部分積を生成する。
【0012】
上記2入力加算器13は、乗算アレイ12からの部分積を加算するための加算器である。
【0013】
上記2入力加算器14は、2入力加算器13からの積に累積データを加算するための加算器である。
【0014】
このように、積和演算回路10では、累積の計算を2入力加算器13,14を2段直列接続し、後段の2入力加算器14で累積データを加算し出力された積和演算結果からオーバーフローの判定を行っていた。
【0015】
【発明が解決しようとする課題】
しかしながら、このような従来の積和演算回路10にあっては、累積データを加算するために2つの2入力加算器13,14を備えた構成となっていたため、回路規模が大きくなり、かつ遅延性能への影響も大きく動作周波数の改善が難しいという問題点があった。
【0016】
この問題を改善するためには、2入力加算器の入力側に全加算器を設け、この全加算器で2個の中間積と累積データを加算して出力を2本に絞り、この出力を加算する方法を用いればよい。ところが、これまでは積和演算時に発生する桁上げ出力が、積生成時に生じる無視するべきオーバーフロー発生の要素を2個の中間積が含んでいるため、オーバーフロー出力が不正確となりそのまま全加算器に入力することはできなかった。
【0017】
本発明は、積生成時の不要なオーバーフロー発生を予測することができ、飽和演算機能付き符号拡張方式の積和演算回路においても2入力加算器を2つ別々の回路で必要とせず、遅延性能及び積和演算のスループットを高めることができる積和演算回路を提供することを目的とする。
【0018】
【課題を解決するための手段】
本発明に係る積和演算回路は、2進数Nビット(Nは任意のビット数)の乗数から2次のブースエンコード結果を生成するブースエンコーダと、2次のブース理論及び符号拡張方式を用いて、2進数Mビット(Mは任意のビット数)の被乗数及び前記ブースエンコード結果から部分積を生成・加算し、2個の中間積に圧縮して出力する乗算アレイと、前記2個の中間積と前記累積データとを加算して2個の出力に絞る桁上げ保存加算器と、前記桁上げ保存加算器からの前記2個の出力を加算して(M+N)ビットの積和演算結果及びキャリーアウトを生成する桁上げ伝搬加算器と、前記被乗数及び前記乗数から前記積を生成するときに(M+N)ビットを超えるオーバーフローが発生するか否かを予測するオーバーフロー予測回路と、前記オーバーフロー予測回路が、オーバーフローが発生しないと予測したときに前記桁上げ伝搬加算器で生成されたキャリーアウトをそのまま出力し、オーバーフローが発生すると予測したときに前記桁上げ伝搬加算器で生成されたキャリーアウトを出力させない飽和処理手段とを有するものである。
【0019】
また、前記オーバーフロー予測回路が、前記被乗数がすべて0の場合を検出するオールゼロ検出部と、前記乗数から2次のブースエンコード結果を生成する予測用ブースエンコード部とを有し、前記被乗数がすべて0の時にはオーバーフローが発生しないと予測し、前記被乗数がすべて0の時以外で、且つ、前記予測用ブースエンコード部によるブースエンコード結果が−1又は−2の出力を含まないときには、オーバーフローが発生しないと予測し、前記被乗数がすべて0の時以外で、且つ、前記予測用ブースエンコード部によるブースエンコード結果が−1又は−2の出力を複数個含むときには、オーバーフローが発生すると予測し、前記被乗数がすべて0の時以外で、且つ、前記予測用ブースエンコード部によるブースエンコード結果が−1又は−2の出力を1個のみ含むときにおいて、−1又は−2の出力が最上位で出力される第1の場合にはオーバーフローが発生しないと予測し、−1又は−2の出力よりも上位の出力がすべて0で出力される第2の場合にはオーバーフローが発生しないと予測し、前記第1及び第2の場合以外の第3の場合にはオーバーフローが発生すると予測する構成としてもよい。
【0020】
また、前記オーバーフロー予測回路が、オーバーフローが発生すると予測したときに1を出力し、オーバーフローが発生しないと予測したときに0を出力し、前記飽和処理手段は、前記オーバーフロー予測回路の出力と前記桁上げ伝搬加算器で生成されたキャリーアウトとを入力とする排他的論理和素子である構成としてもよい。
【0023】
【発明の実施の形態】
本発明に係る積和演算回路は、2次ブース(Booth)理論及び符号拡張方式の乗算器を用いた(Mbit×Nbit)+(M+N)bitの積和演算回路に適用することができる。
【0024】
図1は本発明の第1の実施形態に係る積和演算回路の構成図である。図1に示す積和演算回路は符号拡張方式の乗算アレイを用いた積和演算回路に適用した例である。
【0025】
図1において、積和演算回路100は、入力端子101,102,103、ブースエンコーダ104、オーバーフロー予測回路105(オーバーフロー予測手段)、乗算アレイ106、桁上げ保存加算器107、2入力加算器108、排他的論理和ゲート109及び出力端子110,111から構成される。入力端子101には被乗数が、入力端子102には乗数が、入力端子103には累積データがそれぞれ入力され、出力端子110から積和演算結果が、出力端子111からオーバーフローが出力される。
【0026】
上記桁上げ保存加算器107及び2入力加算器108は、全体として加算手段112を構成する。
【0027】
上記ブースエンコーダ104は、入力された乗数により2次ブースエンコードを行い、エンコード結果(+2,+1,0,−1,−2)を出力する。
【0028】
上記オーバーフロー予測回路105は、被乗数及び乗数に基づいて積生成時に不要なオーバーフローが発生するか否かを予測し、不要なオーバーフローが発生するときは「1」を、発生しないときは「0」を出力する。
【0029】
上記乗算アレイ106は、符号拡張方式の乗算アレイ部であり、被乗数とブースエンコーダ104からの出力により(M/2)個の部分積を生成・加算し、2個の中間積に圧縮して出力する。
【0030】
上記桁上げ保存加算器107は、乗算アレイ106から出力された2個の中間積と累積データを加算して出力を2本に絞る。
【0031】
上記2入力加算器108は、桁上げ保存加算器107からの2本の出力を加算する(M+N)bitの最終桁上げ伝搬加算器であり、加算和を積和演算結果として出力し、(M+N)bitを超えるキャリーアウトも出力する。
【0032】
上記排他的論理和ゲート109は、オーバーフロー予測回路105からの出力と2入力加算器108のキャリーアウト出力との排他的論理和をとりその排他的論理和出力をオーバーフローとして出力する。
【0033】
このように、積和演算回路100は、2次のブース理論を用いてブースエンコードを行うブースエンコーダ104と、被乗数とブースエンコーダ104からの出力により(M/2)個の部分積を生成・加算し、2個の中間積に圧縮して出力する乗算アレイと106と、被乗数及び乗数に基づいて積生成時に不要なオーバーフローが発生するか否かを予測するオーバーフロー予測回路105と、乗算アレイ106から出力された2個の中間積と累積データを加算して出力を2本に絞る桁上げ保存加算器107と、桁上げ保存加算器107からの2本の出力を加算し、加算和を積和演算結果として出力し、(M+N)bitを超えるキャリーアウトも出力する2入力加算器108と、オーバーフロー予測回路105からの出力と2入力加算器108のキャリーアウト出力との排他的論理和をとる排他的論理和ゲート109とを備えて構成する。
【0034】
図2は上記オーバーフロー予測回路105の回路構成を示す図であり、このオーバーフロー予測回路105の回路動作は後述する図3のフローで示される。
【0035】
図2において、オーバーフロー予測回路105は、入力端子201,202、ALL0検出回路203(ALL0検出手段)、ブースマイナス判定回路204、2進木・逆2進木AND回路205、ブースマイナス・1連続性判定回路206、ブースマイナスカウンタ207、2入力AND回路208,209、4入力OR回路210、AND回路211及び出力端子212から構成される。入力端子201には被乗数が、入力端子202には乗数がそれぞれ入力され、出力端子212からはオーバーフローが出力される。
【0036】
上記ブースマイナス判定回路204、2進木・逆2進木AND回路205、ブースマイナス・1連続性判定回路206、ブースマイナスカウンタ207、2入力AND回路208,209、4入力OR回路210及びAND回路211は、全体として判定手段213を構成する。
【0037】
上記ALL0検出回路203は、入力された被乗数がALL0の場合は「1」を出力し、ALL0でない場合は「0」を出力する。
【0038】
上記ブースマイナス判定回路204は、N/2組のANDNRとインバータから構成され、該当する入力3bitをブースエンコーダ104に入力した際に「−1」あるいは「−2」がブースエンコーダ104から出力される場合に「1」を出力する。
【0039】
上記2進木・逆2進木AND回路205は、入力された乗数において最上位bitから各奇数bitまでの「1」の連続性の判定を行う。論理的には、最上位bitから各奇数bitまでの乗数を入力とする(N/2−1)出力の多入力AND回路となるが、2進木・逆2進木構造を採用することにより、効率的に実現することが可能である。また、乗数入力は最上位bit(ここでは、0)から最下位から2bit目(ここでは、N−3)までである。
【0040】
上記ブースマイナス・1連続性判定回路206は、ブースマイナス判定回路204のN/2本の出力のうち最上位の出力を除いた(N/2−1)本とブースマイナス判定回路204からの(N/2−1)本の出力を入力とし、それぞれの入力を上位側から2入力ANDに入力し、出力される(N/2−1)本の信号のOR論理をとることでブースマイナスを出力したエンコーダ入力より上位の乗数がALL1である場合を検出する。
【0041】
上記ブースマイナスカウンタ207は、ブースマイナス判定回路204の出力するN/2bitの信号に含まれる「1」の個数をカウントし、0個、1個、複数個の3つのパターンに分類し、それぞれに対応する端子に「1」を出力し、他の端子には「0」を出力する。
【0042】
上記2入力AND回路208は、ブースマイナスカウンタ207の「=1」出力を入力とブースマイナス・1連続性判定回路206の出力を入力とし、ブースマイナスが1個であり、ブースマイナスを出力したエンコーダ入力より上位の乗数がALL1である場合を検出する。
【0043】
上記2入力AND回路209は、ブースマイナスカウンタ207の「=1」出力を入力とブースマイナス・1連続性判定回路206の出力を入力とし、ブースマイナスが1個であり、ブースマイナスを出力したエンコーダが最上位のエンコーダである場合を検出する。
【0044】
上記4入力OR回路210は、ブースマイナスカウンタ207の「≧2」出力と2入力AND回路208の否定及び2入力AND回路209の否定を入力とし、被乗数がALL0ではない時のオーバーフローを検出する。
【0045】
上記AND回路211は、ALL0検出回路203の出力の否定と4入力OR回路210の出力を入力とし、積生成時に発生する不要なオーバーフローを出力する。
【0046】
次に、上述のように構成された積和演算回路100の動作を説明する。
【0047】
本積和演算回路100は、乗算には2次ブース理論と符号拡張方式を採用した乗算アレイを用い、かつ積結果と累積結果の加算器に対し、オーバーフロー予測回路105を設け、累積計算時に発生するオーバーフロー検出を行うことにより累積用3入力加算器を桁上げ保存加算器と2入力加算器で構成可能にしたことを特徴としている。
【0048】
まず、積和演算回路100の全体動作を説明し、次いで図3のフローチャートを参照しながらオーバーフロー予測回路105の動作について説明する。
【0049】
図1に示すように、入力端子101に被乗数、入力端子102に乗数、入力端子103に累積データがそれぞれ入力されると、
ブースエンコーダ104は、入力された乗数により2次ブースエンコードを行い、エンコード結果(+2,+1,0,−1,−2)を乗算アレイ106に出力する。
【0050】
一方、入力端子101,102に入力された被乗数、乗数はオーバーフロー予測回路105にも入力され、オーバーフロー予測回路105は、後述するように被乗数及び乗数に基づいて積生成時に不要なオーバーフローが発生するか否かを予測し、不要なオーバーフローが発生するときは「1」を、発生しないときは「0」を出力する。
【0051】
乗算アレイ106では、符号拡張方式により、被乗数とブースエンコーダ104からの出力により(M/2)個の部分積を生成・加算し、2個の中間積に圧縮して桁上げ保存加算器107に出力する。桁上げ保存加算器107では、乗算アレイ106から出力された2個の中間積に、入力端子103から入力された累積データを加算して出力を2本に絞り2入力加算器108に出力する。
【0052】
2入力加算器108では、桁上げ保存加算器107からの2本の出力を桁上げ加算し、積和演算結果(M+N)bitを出力端子110から出力するとともに、(M+N)bitを超えるキャリーアウトを排他的論理和ゲート109に出力する。排他的論理和ゲート109は、オーバーフロー予測回路105からの出力と2入力加算器108のキャリーアウト出力との排他的論理和をとりその排他的論理和出力をオーバーフローとして出力する。
【0053】
以下、図3のフローチャートを参照しながらオーバーフロー予測回路105の動作を説明する。
【0054】
図3はオーバーフロー予測回路105の動作を示すフローチャートであり、図2に示すオーバーフロー予測回路105の各部に対応する動作部分は破線で囲んでいる。
【0055】
図3に示すフローチャートは、以下1.及び2.のような判定を段階的に行っていることを示している。なお、図中、STはフローの各ステップを示す。
【0056】
1.被乗数がALL0の時
オーバーフローが発生することはない。
【0057】
2.被乗数がALL0ではない時
(1)乗数をブースエンコードした結果、−1、−2を出力するエンコーダがない場合
オーバーフローが発生することはない。
【0058】
(2)乗数をブースエンコードした結果、−1、−2を出力するエンコーダが複数個ある場合
オーバーフローが発生する。
【0059】
(3)乗数をブースエンコードした結果、−1、−2を出力するエンコーダが1個のみの場合
・−1、−2が最上位で出力される時は、オーバーフローが発生することはない。
【0060】
・−1、−2を出力するエンコーダよりも上位のエンコーダが全て「0」の時は、オーバーフローが発生することはない。なお、この場合、−1、−2を出力したエンコーダよりも上位のエンコーダの入力は、全て「1」でなければならない。エンコーダ出力が「0」となるケースはエンコーダの全出力が「0」の場合とエンコーダの全出力が「1」の場合があるが、全入力が「0」の場合は−1、−2を出力するエンコーダの1つ上位のエンコーダ出力が「0」とはなり得ないためである。
【0061】
・上記以外の場合、オーバーフローが発生する。
【0062】
具体的には、図3において、まず、ステップST1で入力端子201からALL0検出回路203に被乗数B=b0,b1,…,bn-1(但し、bn=0。また、nは語長を表す。)1.被乗数がALL0の時を入力し、ステップST2で数1に示す式に従って入力された被乗数BのALL0をとり、ステップST3でALL0か(Z=1か)否かを判別する。上記ステップST2及びステップST3の処理は図2のALL0検出回路203に相当し、入力された被乗数BがALL0の場合は「1」を出力し、ALL0でない場合は「0」を出力することになる。
【0063】
【数1】

Figure 0003710193
【0064】
ステップST3でZ=1と判別したときは被乗数BがALL0であるからオーバーフローが発生することはないと判断しステップST4に進んでオーバーフロー予測回路105の処理を終える。
【0065】
ステップST3でZ=0と判別したときは被乗数BがALL0でない時であるから上述したように乗数のブースエンコードの結果として、オーバーフローが発生する可能性があると判断してステップST5に進む。ステップST5では、入力端子202からブースマイナス判定回路204に乗数A=a0,a1,…,an-1(但し、an=0。また、nは語長を表す。)を入力し、ステップST6でステップST7のブースマイナス判定をi≦n/2−1(nは語長)になるまでループさせる。
【0066】
すなわち、ステップST7で数2に示す式に従って、入力された乗数Aについて入力3bitをブースエンコーダ104に入力した際に「−1」あるいは「−2」がブースエンコーダ104から出力される計算を行い、「−1」あるいは「−2」が出力される時の個数yiをi≦n/2−1の各奇数bitまで繰り返す。
【0067】
上記ステップST6及びステップST7の処理は図2のブースマイナス判定回路204に相当し、該当する乗数入力3bitをブースエンコーダ104に入力した際に「−1」あるいは「−2」がブースエンコーダ104から出力される場合に「1」を出力することになる。ここで、ブースエンコーダ104は、入力された乗数により2次ブースエンコードを行い、エンコード結果(+2,+1,0,−1,−2)を乗算アレイ106に出力している。
【0068】
【数2】
Figure 0003710193
【0069】
ステップST8では、数3に示す式に従って、入力3bitをブースエンコーダ104に入力した際に「−1」あるいは「−2」がブースエンコーダ104から出力される場合に「1」を出力する際の個数yiをカウントし、ステップST9でこのカウントをn/2−1になるまで繰り返す。
【0070】
【数3】
Figure 0003710193
【0071】
ステップST10で上記個数yiをn/2−1になるまで繰り返した結果の総数xが0か(x=0か)、1か(x=1か)、複数か(x≧2か)を判別する。上記ステップST8〜ステップST10の処理は図2のブースマイナスカウンタ207に相当し、ブースマイナス判定回路204の出力するN/2bitの信号に含まれる「1」の個数をカウントし、0個、1個、複数個の3つのパターンに分類し、それぞれに対応する端子に「1」を出力し、他の端子には「0」を出力する。ここで、0個、1個、複数個の3つのパターンに分類しているのは、上述したように、被乗数がALL0ではない時において、乗数をブースエンコードした結果、−1、−2を出力するエンコーダの有無、又はその個数によってオーバーフローが発生する、若しくは発生しないことを判別するためである。
【0072】
ステップST10でx=0と判別したときには、被乗数がALL0ではないが−1、−2を出力するエンコーダがない場合であるからオーバーフローが発生することはないと判断してステップST4に進んでオーバーフロー予測回路105の処理を終える。
【0073】
ステップST10でx=0と判別したときには、ステップST11でブースエンコーダ104の「−1」あるいは「−2」の最初の個数y0が「1」であるか(y0=1か)否かを判別し、y0=1のときは−1、−2を出力するエンコーダが1個のみの場合であるが−1、−2が最上位で出力される時であるからオーバーフローが発生することはないと判断してステップST4に進んでオーバーフロー予測回路105の処理を終える。上記ステップST11の処理は図2のブースマイナス・1連続性判定回路206に相当する。
【0074】
ここで、図2に示すように、2進木・逆2進木AND回路205の2進木・逆2進木構造により、最上位bit(ここでは、0)から最下位から各奇数bitまでの「1」の連続性が判定され、ブースマイナス・1連続性判定回路206が、ブースマイナス判定回路204のN/2本の出力のうち最上位の出力を除いた(N/2−1)本とブースマイナス判定回路204からの(N/2−1)本の出力を入力とし、それぞれの入力を上位側から2入力AND208,209に入力し、出力される(N/2−1)本の信号のOR論理をとることでブースマイナスを出力したエンコーダ入力より上位の乗数がALL1である場合を検出するようにする。
【0075】
図3のフローに戻って、ステップST11でy0=1でないと判別したときは、ブースマイナスの個数y1,y2,…,y(n/2)-1が1(y1,y2,…,y(n/2)-1=1)の該当するステップST12〜ステップST14に分岐する。
【0076】
y1=1のときはステップST12で乗数a0とa1が「0」か「1」かを判別し、a0とa1が「0」のときは−1、−2を出力するエンコーダよりも上位のエンコーダが全て「0」の時であるからオーバーフローが発生することはないと判断してステップST4に進んでオーバーフロー予測回路105の処理を終え、a0とa1が「1」のときはオーバーフローが発生すると判断してステップST15に進んでオーバーフロー予測回路105の処理を終える。
【0077】
y2=1のときはステップST13で乗数a0,a1,a2及び3aが「0」か「1」かを判別し、a0,a1,a2及びa3が「0」のときは−1、−2を出力するエンコーダよりも上位のエンコーダが全て「0」の時であるからオーバーフローが発生することはないと判断してステップST4に進んでオーバーフロー予測回路105の処理を終え、a0,a1,a2及びa3が「1」のときはオーバーフローが発生すると判断してステップST15に進んでオーバーフロー予測回路105の処理を終える。
【0078】
y(n/2)-1=1のときはステップST14で乗数a0,a1,a2及びan-3が「0」か「1」かを判別し、a0,a1,a2及びan-3が「0」のときは−1、−2を出力するエンコーダよりも上位のエンコーダが全て「0」の時であるからオーバーフローが発生することはないと判断してステップST4に進んでオーバーフロー予測回路105の処理を終え、a0,a1,a2及びan-3が「1」のときはオーバーフローが発生すると判断してステップST15に進んでオーバーフロー予測回路105の処理を終える。
【0079】
上記ステップST12〜ステップST14の処理は全体として図2のブースマイナス・1連続性判定回路206、ブースマイナスカウンタ207、2入力AND回路208,209、4入力OR回路210及びAND回路211に相当する。すなわち、2入力AND回路208が、ブースマイナスカウンタ207の「=1」出力を入力とブースマイナス・1連続性判定回路206の出力を入力とし、ブースマイナスが1個であり、ブースマイナスを出力したエンコーダ入力より上位の乗数がALL1である場合を検出し、また2入力AND回路209が、ブースマイナスカウンタ207の「=1」出力を入力とブースマイナス・1連続性判定回路206の出力を入力とし、ブースマイナスが1個であり、ブースマイナスを出力したエンコーダが最上位のエンコーダである場合を検出し、さらに4入力OR回路210が、ブースマイナスカウンタ207の「≧2」出力と2入力AND回路208の否定及び2入力AND回路209の否定を入力とし、被乗数がALL0ではない時のオーバーフローを検出するものである。
【0080】
そして、AND回路211が、ALL0検出回路203の出力の否定と4入力OR回路210の出力を入力とし、積生成時に発生する不要なオーバーフローを出力する。
【0081】
以上説明したように、本実施形態に係る積和演算回路100は、2次のブース理論を用いてブースエンコードを行うブースエンコーダ104と、被乗数とブースエンコーダ104からの出力により(M/2)個の部分積を生成・加算し、2個の中間積に圧縮して出力する乗算アレイと106と、被乗数及び乗数に基づいて積生成時に不要なオーバーフローが発生するか否かを予測するオーバーフロー予測回路105と、乗算アレイ106から出力された2個の中間積と累積データを加算して出力を2本に絞る桁上げ保存加算器107と、桁上げ保存加算器107からの2本の出力を加算し、加算和を積和演算結果として出力し、(M+N)bitを超えるキャリーアウトも出力する2入力加算器108と、オーバーフロー予測回路105からの出力と2入力加算器108のキャリーアウト出力との排他的論理和をとる排他的論理和ゲート109とを備え、オーバーフロー予測回路105が、入力された被乗数がALL0であること、及び乗数のブースエンコード結果について、−1、−2を出力するエンコーダの数、若しくは−1、−2を出力する場合のビット位置を基にオーバーフローを予測する構成となっているので、積生成時の不要なオーバーフロー発生を予測することができ、飽和演算機能付き符号拡張方式の積和演算回路100において、従来例のように2入力加算器を2つ別々の回路で必要とせず、遅延性能及び積和演算のスループットを高めることができる。
【0082】
すなわち、従来例では累積データを加算するための2つの2入力加算器13,14が必要であり、回路規模が大きくなり、かつ遅延性能への影響も大きく動作周波数の改善が難しく、また、これを回避するための2入力加算器の入力側に全加算器を設ける方法も2次のブース理論を用いることからオーバーフロー発生が発生する可能性があり出力が不正確となりそのまま全加算器に入力することはできなかった。これに対し、本実施形態に係る積和演算回路100では、オーバーフロー予測回路105によって、積生成時の不要なオーバーフロー発生を予測することができ、飽和演算機能付き符号拡張方式の積和演算回路100においても2入力加算器108は1個で済み、遅延性能及び積和演算のスループットを高めることができる。
【0083】
なお、上述の実施形態では、2次ブース理論及び符号拡張方式の乗算器を用いた(Mbit×Nbit)+(M+N)bitの積和演算回路に適用した例であるが、加算手段の累積計算時にオーバーフローの発生予測を行い得るオーバーフロー予測手段を備えるものであればどのような積和演算回路に適用してもよい。例えば、部分積の生成に2次のブース理論を用いない並列乗算器に用いることもできる。
【0084】
また、上記積和演算回路100及びオーバーフロー予測回路105を構成する各種回路及びゲート回路の種類や数、種類接続状態などは前述した上述の実施形態に限られないことは言うまでもなく、積和演算回路100全体がDSP等を構成する算術回路の一部であってもよい。
【0085】
さらに、上述の各実施形態では、並列乗算器等に用いられる積和演算回路に適用しているが、(Mbit×Nbit)+(M+N)bitの積和演算を行う回路であればどのような装置にも適用することもできる。
【0086】
【発明の効果】
本発明に係る積和演算回路では、被乗数と乗数から部分積を生成・加算し、中間積に圧縮して出力する乗算アレイと、被乗数及び乗数に基づいて積生成時にオーバーフローが発生することを予測するオーバーフロー予測手段と、乗算アレイから出力された中間積と累積データを加算し、該加算和を積和演算結果として出力するとともに、(M+N)ビットを超えるキャリーアウトも出力する加算手段とを備えて構成しているので、積生成時の不要なオーバーフロー発生を予測することができ、飽和演算機能付き符号拡張方式の積和演算回路においても2入力加算器を2つ別々の回路で必要とせず、遅延性能及び積和演算のスループットを高めることができる。
【図面の簡単な説明】
【図1】本発明を適用した実施形態に係る積和演算回路の構成図である。
【図2】上記積和演算回路のオーバーフロー予測回路の回路構成図である。
【図3】上記積和演算回路のオーバーフロー予測回路の動作を説明するためのタイミングチャートである。
【図4】従来の積和演算回路の構成図である。
【符号の説明】
100 積和演算回路、101,102,103,201,202 入力端子、104 ブースエンコーダ、105 オーバーフロー予測回路(オーバーフロー予測手段)、106 乗算アレイ、107 桁上げ保存加算器、108 2入力加算器、109 排他的論理和ゲート、110,111,212 出力端子、112 加算手段112、203 ALL0検出回路(ALL0検出手段)、204 ブースマイナス判定回路、205 2進木・逆2進木AND回路、206 ブースマイナス・1連続性判定回路、207 ブースマイナスカウンタ、208,209 2入力AND回路、210 4入力OR回路、211 AND回路、213 判定手段[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a product-sum operation circuit used for a parallel multiplier or the like, and more particularly to a product-sum operation circuit using, for example, a second booth theory and a sign extension type multiplier.
[0002]
[Prior art]
A multiplier is one of the most basic circuits together with an adder and a delay circuit in a digital arithmetic processing unit, and a parallel multiplier for executing Mbit × Nbit multiplication at once is already on-chip due to an improvement in the degree of integration. The basic structure of the parallel multiplier includes a partial product generation obtained as a result of multiplying a multiplicand by 1 bit of a multiplier, and a product-sum operation circuit that adds and adds digits to the generated partial product according to the weight of the multiplier bit.
[0003]
As this type of conventional product-sum operation circuit, for example, there is a circuit described in "Digital CMOS circuit design" Corona, p.
[0004]
Due to the difference in the handling of code extension, the structure of the multiplication array is mainly known to be divided into three patterns. The code extension method with the simplest structure, the code propagation method and the code generation method (code non-extension) according to the above document Method).
[0005]
Conventionally, it has been difficult for a product-sum operation unit using a multiplier to detect an overflow when calculating the accumulation. When overflow occurs at the time of cumulative calculation, the value of the subsequent data becomes completely inaccurate, so overflow must be avoided in processing such as signal processing. In order to avoid this, it is necessary to check for the occurrence of overflow every time the operation is executed. Furthermore, when an overflow occurs, a saturation operation may be performed to suppress the calculation result to a positive or negative maximum value. In any case, it is extremely important to detect overflow in the product-sum operation, and it is desirable to execute this processing at high speed and with a small amount of hardware.
[0006]
Originally, when multiplication of (Mbit × Nbit) is performed to obtain a product of (M + N) bit, an overflow exceeding (M + N) bit does not occur. However, when the second booth theory is used in the multiplication array unit of the sign extension method, a carry-out may occur due to the addition of the sign extension part at the time of partial product addition. This is because the partial product when "-1" or "-2" is encoded by the second-order booth theory is to extend the 2's complement of the multiplicand to (M + N) bits (in this case, 1). is there. Incidentally, when it is further encoded to “−2”, it is shifted to the upper side by 1 bit.
[0007]
In this case, in order to ignore the output of the carry, the multiplication array unit compresses (M / 2) partial products into two intermediate products and inputs them to the 2-input carry propagation adder. In order to add the product sum as a product and add the product obtained by the 2-input carry propagation adder and the accumulated data, another 2-input carry propagation adder is prepared. The product and cumulative data were input to the vessel.
[0008]
FIG. 4 is a circuit configuration diagram of the product-sum operation circuit with the saturation operation function described above.
[0009]
In FIG. 4, the product-sum operation circuit 10 includes a booth encoder 11, a multiplication array 12, and 2-input adders 13 and 14.
[0010]
The booth encoder 11 is for performing booth encoding using the adjacent 3 bits of the multiplier as a selection condition in order to use the second-order booth theory.
[0011]
The multiplication array 12 generates a partial product by multiplying the multiplicand by the multiplier encoded by the Booth encoder 11.
[0012]
The 2-input adder 13 is an adder for adding the partial products from the multiplication array 12.
[0013]
The 2-input adder 14 is an adder for adding accumulated data to the product from the 2-input adder 13.
[0014]
In this way, in the product-sum operation circuit 10, the two-input adders 13 and 14 are connected in series in the accumulation calculation, and the accumulated data is added by the subsequent two-input adder 14 and output from the product-sum operation result output. An overflow was being judged.
[0015]
[Problems to be solved by the invention]
However, such a conventional product-sum operation circuit 10 has a configuration including two two-input adders 13 and 14 for adding accumulated data. There was a problem that it was difficult to improve the operating frequency because the performance was greatly affected.
[0016]
In order to remedy this problem, a full adder is provided on the input side of the two-input adder, and this full adder adds two intermediate products and accumulated data to reduce the output to two. An adding method may be used. However, up to now, the carry output generated during the product-sum operation contains two intermediate products containing overflow elements that should be ignored when generating the product. I couldn't enter it.
[0017]
According to the present invention, it is possible to predict the occurrence of an unnecessary overflow at the time of product generation. Even in a sign extension type product-sum operation circuit with a saturation operation function, two separate input circuits are not required, and delay performance is improved. An object of the present invention is to provide a product-sum operation circuit capable of increasing the throughput of product-sum operation.
[0018]
[Means for Solving the Problems]
  The product-sum operation circuit according to the present invention includes:Using a Booth encoder that generates a second-order Booth encoding result from a multiplier of binary N bits (N is an arbitrary number of bits), and a second-order Booth theory and sign extension method, a binary number M bits (M is an arbitrary number) (Multiple bit number) and the Booth encoding result, a partial product is generated and added, and is compressed into two intermediate products and output, and the two intermediate products and the accumulated data are added to obtain 2 A carry save adder for reducing the number of outputs, and a carry propagation adder for adding the two outputs from the carry save adder to generate a product-sum operation result and carry-out of (M + N) bits. An overflow prediction circuit that predicts whether or not an overflow exceeding (M + N) bits occurs when the product is generated from the multiplicand and the multiplier, and the overflow prediction circuit includes: -Saturation that does not output the carry-out generated by the carry propagation adder when it is predicted that no flow will occur and outputs the carry-out generated by the carry propagation adder when it is predicted that an overflow will occur And a processing means.
[0019]
  The overflow prediction circuit includes an all-zero detection unit that detects a case where the multiplicand is all zero and a prediction booth encoding unit that generates a second-order booth encoding result from the multiplier, and the multiplicand is all zero. It is predicted that no overflow occurs when the multiplicand is all zero, and when the booth encoding result by the prediction booth encoding unit does not include an output of −1 or −2, no overflow occurs. Predicting that when all the multiplicands are not 0 and the booth encoding result by the prediction booth encoding unit includes a plurality of outputs of -1 or -2, it is predicted that an overflow will occur, and all the multiplicands are Booth encoding result other than 0 and by the prediction booth encoding unit When only one output of -1 or -2 is included, in the first case where the output of -1 or -2 is output at the highest level, it is predicted that no overflow will occur, and the output of -1 or -2 In the second case where all the higher-order outputs are output as 0, it is predicted that no overflow occurs, and in the third case other than the first and second cases, an overflow is predicted to occur. Also good.
[0020]
  The overflow prediction circuit outputs 1 when it is predicted that an overflow will occur, and outputs 0 when it is predicted that no overflow will occur. The saturation processing means outputs the output of the overflow prediction circuit and the digit. An exclusive OR element having the carry-out generated by the up-propagating adder as an input may be used.
[0023]
DETAILED DESCRIPTION OF THE INVENTION
The product-sum operation circuit according to the present invention can be applied to a product-sum operation circuit of (Mbit × Nbit) + (M + N) bit using a second Booth theory and sign extension type multiplier.
[0024]
FIG. 1 is a configuration diagram of a product-sum operation circuit according to the first embodiment of the present invention. The product-sum operation circuit shown in FIG. 1 is an example applied to a product-sum operation circuit using a sign extension type multiplication array.
[0025]
In FIG. 1, a product-sum operation circuit 100 includes input terminals 101, 102, 103, a booth encoder 104, an overflow prediction circuit 105 (overflow prediction means), a multiplication array 106, a carry save adder 107, a two-input adder 108, It consists of an exclusive OR gate 109 and output terminals 110 and 111. A multiplicand is input to the input terminal 101, a multiplier is input to the input terminal 102, and accumulated data is input to the input terminal 103, a product-sum operation result is output from the output terminal 110, and an overflow is output from the output terminal 111.
[0026]
The carry save adder 107 and the two-input adder 108 constitute an adding means 112 as a whole.
[0027]
The booth encoder 104 performs secondary booth encoding using the input multiplier, and outputs an encoding result (+2, +1, 0, −1, −2).
[0028]
The overflow prediction circuit 105 predicts whether or not an unnecessary overflow occurs at the time of product generation based on the multiplicand and the multiplier, and sets “1” when an unnecessary overflow occurs and “0” when it does not occur. Output.
[0029]
The multiplication array 106 is a multiplication array unit of the sign extension method, generates (M / 2) partial products based on the multiplicand and the output from the Booth encoder 104, adds them, compresses them into two intermediate products, and outputs them. To do.
[0030]
The carry save adder 107 adds the two intermediate products output from the multiplication array 106 and the accumulated data, and narrows the output to two.
[0031]
The 2-input adder 108 is a final carry propagation adder of (M + N) bits that adds the two outputs from the carry save adder 107, and outputs the addition sum as a product-sum operation result. ) Outputs carry-out exceeding bit.
[0032]
The exclusive OR gate 109 takes the exclusive OR of the output from the overflow prediction circuit 105 and the carry-out output of the 2-input adder 108 and outputs the exclusive OR output as an overflow.
[0033]
In this manner, the product-sum operation circuit 100 generates and adds (M / 2) partial products by the booth encoder 104 that performs booth encoding using the second-order booth theory and the output from the multiplicand and the booth encoder 104. A multiplication array 106 that compresses and outputs two intermediate products, an overflow prediction circuit 105 that predicts whether or not an unnecessary overflow occurs during product generation based on the multiplicand and multiplier, and a multiplication array 106 Carry-save adder 107 that adds the two intermediate products and accumulated data to reduce the output to two, and the two outputs from carry-save adder 107 are added, and the sum is summed A 2-input adder 108 that outputs as a calculation result and also outputs a carry-out exceeding (M + N) bits, and an output from the overflow prediction circuit 105 and a 2-input adder 10 Configure a exclusive OR gate 109 for taking an exclusive OR of the carry-out output.
[0034]
FIG. 2 is a diagram showing the circuit configuration of the overflow prediction circuit 105, and the circuit operation of the overflow prediction circuit 105 is shown in the flow of FIG. 3 to be described later.
[0035]
In FIG. 2, an overflow prediction circuit 105 includes input terminals 201 and 202, an ALL0 detection circuit 203 (ALL0 detection means), a booth minus determination circuit 204, a binary tree / inverse binary tree AND circuit 205, a booth minus minus 1 continuity. The circuit includes a determination circuit 206, a booth minus counter 207, two-input AND circuits 208 and 209, a four-input OR circuit 210, an AND circuit 211, and an output terminal 212. A multiplicand is input to the input terminal 201, a multiplier is input to the input terminal 202, and an overflow is output from the output terminal 212.
[0036]
Booth minus determination circuit 204, binary tree / inverse binary tree AND circuit 205, Booth minus / one continuity determination circuit 206, Booth minus counter 207, two-input AND circuits 208 and 209, four-input OR circuit 210 and AND circuit 211 comprises the determination means 213 as a whole.
[0037]
The ALL0 detection circuit 203 outputs “1” when the input multiplicand is ALL0, and outputs “0” when it is not ALL0.
[0038]
The booth minus determination circuit 204 is composed of N / 2 sets of ANDNRs and inverters, and “−1” or “−2” is output from the booth encoder 104 when the corresponding input 3 bits is input to the booth encoder 104. In this case, “1” is output.
[0039]
The binary tree / inverse binary tree AND circuit 205 determines the continuity of “1” from the most significant bit to each odd bit in the input multiplier. Logically, it is a (N / 2-1) output multi-input AND circuit that takes a multiplier from the most significant bit to each odd bit as an input, but by adopting a binary tree / inverse binary tree structure. Can be realized efficiently. The multiplier input is from the most significant bit (here, 0) to the second least significant bit (here, N-3).
[0040]
The booth minus-1 continuity determining circuit 206 excludes (N / 2-1) of the N / 2 outputs of the booth minus determining circuit 204 from the (N / 2-1) output and the booth minus determining circuit 204 ( N / 2-1) inputs are input, and each input is input to the 2-input AND from the upper side, and the output of (N / 2-1) signals is ORed to obtain a booth minus. A case where the multiplier higher than the output encoder input is ALL1 is detected.
[0041]
The booth minus counter 207 counts the number of “1” included in the N / 2-bit signal output from the booth minus determination circuit 204, classifies it into three patterns of 0, 1, and a plurality of patterns. “1” is output to the corresponding terminal, and “0” is output to the other terminals.
[0042]
The two-input AND circuit 208 receives the output of the booth minus counter 207 as “= 1” and the output of the booth minus / one continuity determination circuit 206 as an input. A case where the multiplier higher than the input is ALL1 is detected.
[0043]
The two-input AND circuit 209 receives the “= 1” output of the booth minus counter 207 and the output of the booth minus 1 continuity determination circuit 206 as input, and has one booth minus and outputs the booth minus. Detect if is the highest encoder.
[0044]
The 4-input OR circuit 210 receives the “≧ 2” output of the booth minus counter 207, the negation of the 2-input AND circuit 208, and the negation of the 2-input AND circuit 209, and detects an overflow when the multiplicand is not ALL0.
[0045]
The AND circuit 211 receives the negation of the output of the ALL0 detection circuit 203 and the output of the 4-input OR circuit 210 as inputs, and outputs an unnecessary overflow that occurs during product generation.
[0046]
Next, the operation of the product-sum operation circuit 100 configured as described above will be described.
[0047]
This product-sum operation circuit 100 uses a multiplication array that employs the secondary Booth theory and the sign extension method for multiplication, and provides an overflow prediction circuit 105 for the adder of the product result and the cumulative result, and is generated during the cumulative calculation. By performing overflow detection, the accumulation 3-input adder can be constituted by a carry save adder and a 2-input adder.
[0048]
First, the overall operation of the product-sum operation circuit 100 will be described, and then the operation of the overflow prediction circuit 105 will be described with reference to the flowchart of FIG.
[0049]
As shown in FIG. 1, when the multiplicand is input to the input terminal 101, the multiplier is input to the input terminal 102, and the accumulated data is input to the input terminal 103,
Booth encoder 104 performs secondary Booth encoding using the input multiplier, and outputs the encoding result (+2, +1, 0, −1, −2) to multiplication array 106.
[0050]
On the other hand, the multiplicand and multiplier input to the input terminals 101 and 102 are also input to the overflow prediction circuit 105. Does the overflow prediction circuit 105 generate unnecessary overflow during product generation based on the multiplicand and multiplier as described later? Whether or not an unnecessary overflow occurs, “1” is output, and when it does not occur, “0” is output.
[0051]
The multiplication array 106 generates and adds (M / 2) partial products based on the multiplicand and the output from the Booth encoder 104 by the sign extension method, compresses them into two intermediate products, and stores them in the carry save adder 107. Output. The carry save adder 107 adds the accumulated data input from the input terminal 103 to the two intermediate products output from the multiplication array 106, and outputs the result to the two-input adder 108.
[0052]
The 2-input adder 108 carries and adds the two outputs from the carry save adder 107, outputs the product-sum operation result (M + N) bit from the output terminal 110, and carries out more than (M + N) bit. Is output to the exclusive OR gate 109. The exclusive OR gate 109 takes the exclusive OR of the output from the overflow prediction circuit 105 and the carry-out output of the 2-input adder 108 and outputs the exclusive OR output as an overflow.
[0053]
Hereinafter, the operation of the overflow prediction circuit 105 will be described with reference to the flowchart of FIG.
[0054]
FIG. 3 is a flowchart showing the operation of the overflow prediction circuit 105. The operation parts corresponding to the respective parts of the overflow prediction circuit 105 shown in FIG. 2 are surrounded by broken lines.
[0055]
The flowchart shown in FIG. And 2. It is shown that such a determination is performed step by step. In the figure, ST indicates each step of the flow.
[0056]
1. When multiplicand is ALL0
There is no overflow.
[0057]
2. When multiplicand is not ALL0
(1) When there is no encoder that outputs -1 or -2 as a result of booth encoding the multiplier
There is no overflow.
[0058]
(2) When there are multiple encoders that output -1 and -2 as a result of booth encoding the multiplier
Overflow occurs.
[0059]
(3) When only one encoder outputs -1 and -2 as a result of booth encoding the multiplier
• When -1 and -2 are output at the highest level, overflow does not occur.
[0060]
• When all the encoders higher than the encoders that output -1 and -2 are "0", no overflow occurs. In this case, all the inputs of the encoders higher than the encoders that output −1 and −2 must be “1”. The encoder output is “0” when the encoder output is “0” or the encoder output is “1”. When all the inputs are “0”, −1 and −2 are set. This is because the encoder output that is one level higher than the output encoder cannot be “0”.
[0061]
・ Overflow occurs in cases other than the above.
[0062]
Specifically, in FIG. 3, first, in step ST1, the multiplicand B = b0, b1,..., Bn-1 (where bn = 0. N represents the word length) from the input terminal 201 to the ALL0 detection circuit 203. .) 1. The time when the multiplicand is ALL0 is input, and ALL0 of the multiplicand B input according to the equation shown in Equation 1 is taken in Step ST2, and whether or not ALL0 (Z = 1) is determined in Step ST3. The processing in steps ST2 and ST3 corresponds to the ALL0 detection circuit 203 in FIG. 2, and outputs “1” when the input multiplicand B is ALL0, and outputs “0” when it is not ALL0. .
[0063]
[Expression 1]
Figure 0003710193
[0064]
When it is determined in step ST3 that Z = 1, since the multiplicand B is ALL0, it is determined that no overflow occurs, the process proceeds to step ST4, and the processing of the overflow prediction circuit 105 is completed.
[0065]
If it is determined in step ST3 that Z = 0, the multiplicand B is not ALL0, it is determined that overflow may occur as a result of the booth encoding of the multiplier as described above, and the process proceeds to step ST5. In step ST5, multipliers A = a0, a1,..., An-1 (where an = 0, and n represents the word length) are input from the input terminal 202 to the booth minus determination circuit 204, and in step ST6. The booth minus determination in step ST7 is looped until i ≦ n / 2-1 (n is the word length).
[0066]
That is, according to the equation shown in Formula 2 in step ST7, when input 3 bits are input to the booth encoder 104 for the input multiplier A, calculation is performed such that “−1” or “−2” is output from the booth encoder 104, The number y i when “−1” or “−2” is output is repeated until each odd bit of i ≦ n / 2-1.
[0067]
The processes in steps ST6 and ST7 correspond to the booth minus determination circuit 204 in FIG. 2, and “−1” or “−2” is output from the booth encoder 104 when the corresponding multiplier input 3 bits is input to the booth encoder 104. In this case, “1” is output. Here, the booth encoder 104 performs secondary booth encoding using the input multiplier, and outputs the encoding result (+2, +1, 0, −1, −2) to the multiplication array 106.
[0068]
[Expression 2]
Figure 0003710193
[0069]
In step ST8, when “-3” or “−2” is output from the booth encoder 104 when the input 3 bits are input to the booth encoder 104 according to the equation shown in Equation 3, the number when “1” is output. yi is counted, and this count is repeated until it reaches n / 2-1 in step ST9.
[0070]
[Equation 3]
Figure 0003710193
[0071]
In step ST10, it is determined whether the total number x is 0 (x = 0), 1 (x = 1), or plural (x ≧ 2) by repeating the number yi until n / 2-1. To do. The processes in steps ST8 to ST10 correspond to the booth minus counter 207 in FIG. 2, and the number of “1” included in the N / 2-bit signal output from the booth minus determination circuit 204 is counted. These are classified into a plurality of three patterns, “1” is output to the corresponding terminals, and “0” is output to the other terminals. Here, as described above, when the multiplicand is not ALL0, -1 and -2 are output as the result of classifying the multiplier into three patterns of 0, 1, and plural as described above. This is to determine whether overflow occurs or does not occur depending on the presence or absence of encoders or the number of encoders.
[0072]
When x = 0 is determined in step ST10, since the multiplicand is not ALL0 but there is no encoder that outputs -1, 2, it is determined that no overflow occurs, and the process proceeds to step ST4 to predict overflow. The processing of the circuit 105 is finished.
[0073]
When x = 0 is determined in step ST10, it is determined in step ST11 whether the initial number y0 of “−1” or “−2” of the booth encoder 104 is “1” (y0 = 1). , Y0 = 1 is a case where only one encoder outputs -1 and -2, but since -1 and -2 are output at the highest order, it is determined that no overflow occurs. Then, the process proceeds to step ST4 and the process of the overflow prediction circuit 105 is finished. The process of step ST11 corresponds to the booth minus-1 continuity determining circuit 206 in FIG.
[0074]
Here, as shown in FIG. 2, the binary tree / inverse binary tree AND circuit 205 has a binary tree / inverse binary tree structure, from the most significant bit (in this case, 0) to the least significant bit to each odd bit. The booth minus 1 continuity judging circuit 206 removes the highest output from the N / 2 outputs of the booth minus judging circuit 204 (N / 2-1). And (N / 2-1) outputs from the booth minus determination circuit 204 are input, and the respective inputs are input to the 2-input ANDs 208 and 209 from the upper side and output (N / 2-1). The case where the multiplier higher than the encoder input that outputs the booth minus is ALL1 is detected by taking the OR logic of the above signal.
[0075]
Returning to the flow of FIG. 3, when it is determined in step ST11 that y0 = 1 is not satisfied, the number of booth negatives y1, y2,..., Y (n / 2) -1 is 1 (y1, y2,..., Y ( Branches to step ST12 to step ST14 corresponding to n / 2) -1 = 1).
[0076]
When y1 = 1, it is determined at step ST12 whether the multipliers a0 and a1 are "0" or "1". When a0 and a1 are "0", the encoder is higher than the encoder that outputs -1 and -2. Is all “0”, it is determined that no overflow occurs and the process proceeds to step ST4 to finish the processing of the overflow prediction circuit 105. When a0 and a1 are “1”, it is determined that an overflow occurs. Then, the process proceeds to step ST15 and the processing of the overflow prediction circuit 105 is finished.
[0077]
When y2 = 1, it is determined at step ST13 whether the multipliers a0, a1, a2 and 3a are "0" or "1". When a0, a1, a2 and a3 are "0", -1 and -2 are determined. Since all the encoders higher than the encoder to be output are “0”, it is determined that no overflow occurs, the process proceeds to step ST4, the process of the overflow prediction circuit 105 is finished, and a0, a1, a2, and a3 When “1” is “1”, it is determined that an overflow occurs, and the process proceeds to step ST15 to finish the processing of the overflow prediction circuit 105.
[0078]
When y (n / 2) -1 = 1, it is determined in step ST14 whether the multipliers a0, a1, a2, and an-3 are "0" or "1", and a0, a1, a2, and an-3 are " "0" is the time when all the encoders higher than the encoders that output -1 and -2 are "0", so it is determined that no overflow will occur and the process proceeds to step ST4 and the overflow prediction circuit 105 When a0, a1, a2, and an-3 are “1”, it is determined that an overflow occurs, and the process proceeds to step ST15 to finish the overflow prediction circuit 105.
[0079]
The processes in steps ST12 to ST14 correspond to the booth minus / one continuity determination circuit 206, the booth minus counter 207, the 2-input AND circuits 208 and 209, the 4-input OR circuit 210 and the AND circuit 211 shown in FIG. That is, the 2-input AND circuit 208 receives the output of the booth minus minus counter 207 as “= 1” and the output of the booth minus minus 1 continuity determining circuit 206 as input, and outputs one booth minus and booth minus. The case where the multiplier higher than the encoder input is ALL1 is detected, and the 2-input AND circuit 209 receives the “= 1” output of the booth minus counter 207 and the output of the booth minus 1 continuity determination circuit 206 as inputs. , The case where the number of booth minuses is one and the encoder that outputs the booth minus is the highest-order encoder is detected, and the 4-input OR circuit 210 further outputs the “≧ 2” output of the booth minus counter 207 and the 2-input AND circuit. When the negation of 208 and the negation of the 2-input AND circuit 209 are input, the multiplicand is not ALL0. And it detects a bar flow.
[0080]
Then, the AND circuit 211 receives the negation of the output of the ALL0 detection circuit 203 and the output of the 4-input OR circuit 210 as inputs, and outputs an unnecessary overflow that occurs during product generation.
[0081]
As described above, the product-sum operation circuit 100 according to the present embodiment includes the Booth encoder 104 that performs the Booth encoding using the second-order Booth theory, the (M / 2) units by the multiplicand and the output from the Booth encoder 104. A multiplication array 106 that generates and adds the partial products of the two, compresses them into two intermediate products and outputs them, and an overflow prediction circuit that predicts whether or not an unnecessary overflow occurs during product generation based on the multiplicand and multiplier 105, the carry storage adder 107 that adds the two intermediate products output from the multiplication array 106 and the accumulated data and narrows the output to two, and the two outputs from the carry storage adder 107 are added. From the overflow prediction circuit 105, the 2-input adder 108 that outputs the addition sum as a product-sum operation result and also outputs a carry-out exceeding (M + N) bits. And an exclusive OR gate 109 that performs an exclusive OR of the output and the carry-out output of the 2-input adder 108, and the overflow prediction circuit 105 confirms that the input multiplicand is ALL0 and that the multiplier is booth encoded. As a result, an overflow is predicted based on the number of encoders that output -1 and -2 or the bit position when -1 and -2 are output, so unnecessary overflow occurs during product generation. In the multiply-accumulate product-sum operation circuit 100 with the saturation operation function, the two-input adder is not required as two separate circuits as in the conventional example, and the delay performance and the product-sum operation throughput are not required. Can be increased.
[0082]
In other words, the conventional example requires two two-input adders 13 and 14 for adding accumulated data, which increases the circuit scale and greatly affects the delay performance, and it is difficult to improve the operating frequency. The method of providing a full adder on the input side of the two-input adder to avoid the occurrence of overflow is likely to generate overflow because of the use of the second-order Booth theory, and the output becomes inaccurate and is directly input to the full adder. I couldn't. On the other hand, in the product-sum operation circuit 100 according to the present embodiment, the overflow prediction circuit 105 can predict the occurrence of an unnecessary overflow during product generation, and the sign-extension-type product-sum operation circuit 100 with a saturation operation function. In this case, only one two-input adder 108 is required, and the delay performance and the product-sum operation throughput can be improved.
[0083]
In the above-described embodiment, an example is applied to a product-sum operation circuit of (Mbit × Nbit) + (M + N) bit using a secondary Booth theory and sign extension type multiplier. The present invention may be applied to any product-sum operation circuit as long as it is provided with overflow prediction means capable of predicting the occurrence of overflow. For example, it can be used for a parallel multiplier that does not use the second-order Booth theory for generating a partial product.
[0084]
In addition, it goes without saying that the types and number of various circuits and gate circuits constituting the product-sum operation circuit 100 and the overflow prediction circuit 105, the type connection state, and the like are not limited to the above-described embodiment. The whole 100 may be a part of an arithmetic circuit constituting a DSP or the like.
[0085]
Furthermore, in each of the embodiments described above, the present invention is applied to a product-sum operation circuit used for a parallel multiplier or the like, but any circuit that performs a product-sum operation of (Mbit × Nbit) + (M + N) bit can be used. It can also be applied to devices.
[0086]
【The invention's effect】
The product-sum operation circuit according to the present invention generates and adds partial products from the multiplicand and multiplier, compresses them into intermediate products and outputs them, and predicts that overflow will occur during product generation based on the multiplicand and multiplier An overflow prediction means for adding the intermediate product output from the multiplication array and the accumulated data, outputting the sum as a product-sum operation result, and outputting a carry-out exceeding (M + N) bits. Therefore, it is possible to predict the occurrence of unnecessary overflow at the time of product generation, and the two-input adder is not required in two separate circuits even in the sign-extension-type product-sum operation circuit with a saturation operation function. In addition, the delay performance and the product-sum operation throughput can be increased.
[Brief description of the drawings]
FIG. 1 is a configuration diagram of a product-sum operation circuit according to an embodiment to which the present invention is applied.
FIG. 2 is a circuit configuration diagram of an overflow prediction circuit of the product-sum operation circuit.
FIG. 3 is a timing chart for explaining the operation of the overflow prediction circuit of the product-sum operation circuit.
FIG. 4 is a configuration diagram of a conventional product-sum operation circuit.
[Explanation of symbols]
100 product-sum operation circuit, 101, 102, 103, 201, 202 input terminal, 104 booth encoder, 105 overflow prediction circuit (overflow prediction means), 106 multiplication array, 107 carry save adder, 108 2-input adder, 109 Exclusive OR gate, 110, 111, 212 output terminal, 112 addition means 112, 203 ALL0 detection circuit (ALL0 detection means), 204 booth minus determination circuit, 205 binary tree / inverse binary tree AND circuit, 206 booth minus 1 continuity determination circuit, 207 Booth minus counter, 208, 209 2-input AND circuit, 2104 input OR circuit, 211 AND circuit, 213 determination means

Claims (3)

2進数Nビット(Nは任意のビット数)の乗数から2次のブースエンコード結果を生成するブースエンコーダと、A Booth encoder that generates a secondary Booth encoding result from a multiplier of binary N bits (N is an arbitrary number of bits);
2次のブース理論及び符号拡張方式を用いて、2進数Mビット(Mは任意のビット数)の被乗数及び前記ブースエンコード結果から部分積を生成・加算し、2個の中間積に圧縮して出力する乗算アレイと、Using quadratic Booth theory and sign extension method, a partial product is generated and added from a multiplicand of binary M bits (M is an arbitrary number of bits) and the Booth encoding result, and compressed into two intermediate products. An output multiplication array;
前記2個の中間積と前記累積データとを加算して2個の出力に絞る桁上げ保存加算器と、A carry save adder that sums the two intermediate products and the accumulated data to reduce to two outputs;
前記桁上げ保存加算器からの前記2個の出力を加算して(M+N)ビットの積和演算結果及びキャリーアウトを生成する桁上げ伝搬加算器と、A carry propagation adder that adds the two outputs from the carry save adder to generate a product-sum operation result and carry-out of (M + N) bits;
前記被乗数及び前記乗数から前記積を生成するときに(M+N)ビットを超えるオーバーフローが発生するか否かを予測するオーバーフロー予測回路と、An overflow prediction circuit for predicting whether or not an overflow exceeding (M + N) bits occurs when generating the product from the multiplicand and the multiplier;
前記オーバーフロー予測回路が、オーバーフローが発生しないと予測したときに前記桁上げ伝搬加算器で生成されたキャリーアウトをそのまま出力し、オーバーフローが発生すると予測したときに前記桁上げ伝搬加算器で生成されたキャリーアウトを出力させない飽和処理手段とWhen the overflow prediction circuit predicts that no overflow will occur, the carry-out generated by the carry propagation adder is output as it is, and when it is predicted that an overflow will occur, it is generated by the carry propagation adder. Saturation processing means that does not output carry-out and
を有することを特徴とする積和演算回路。A product-sum operation circuit comprising:
前記オーバーフロー予測回路は、The overflow prediction circuit includes:
前記被乗数がすべて0の場合を検出するオールゼロ検出部と、An all-zero detector that detects when the multiplicands are all zero;
前記乗数から2次のブースエンコード結果を生成する予測用ブースエンコード部とを有し、A booth encoding unit for prediction that generates a secondary booth encoding result from the multiplier,
前記被乗数がすべて0の時にはオーバーフローが発生しないと予測し、When the multiplicand is all 0, it is predicted that no overflow will occur,
前記被乗数がすべて0の時以外で、且つ、前記予測用ブースエンコード部によるブースエンコード結果が−1又は−2の出力を含まないときには、オーバーフローが発生しないと予測し、When the multiplicands are all other than 0, and the booth encoding result by the prediction booth encoding unit does not include the output of −1 or −2, it is predicted that no overflow occurs,
前記被乗数がすべて0の時以外で、且つ、前記予測用ブースエンコード部によるブースエンコード結果が−1又は−2の出力を複数個含むときには、オーバーフローが発生すると予測し、When the multiplicands are all other than 0, and the booth encoding result by the prediction booth encoding unit includes a plurality of outputs of -1 or -2, it is predicted that an overflow will occur.
前記被乗数がすべて0の時以外で、且つ、前記予測用ブースエンコード部によるブースエンコード結果が−1又は−2の出力を1個のみ含むときにおいて、−1又は−2の出力が最上位で出力される第1の場合にはオーバーフローが発生しないと予測し、−1又は−2の出力よりも上位の出力がすべて0で出力される第2の場合にはオーバーフローが発生しないと予測し、前記第1及び第2の場合以外の第3の場合にはオーバーフローが発生すると予測するWhen the multiplicand is not all 0 and when the booth encoding result by the prediction booth encoding unit includes only one output of -1 or -2, the output of -1 or -2 is output at the highest level. In the first case, it is predicted that no overflow will occur, and in the second case where all outputs higher than the output of -1 or -2 are output as 0, it is predicted that no overflow will occur. Predict that an overflow will occur in the third case other than the first and second cases
ことを特徴とする請求項1に記載の積和演算回路。The product-sum operation circuit according to claim 1.
前記オーバーフロー予測回路は、オーバーフローが発生すると予測したときに1を出力し、オーバーフローが発生しないと予測したときに0を出力し、The overflow prediction circuit outputs 1 when it is predicted that an overflow will occur, and outputs 0 when it is predicted that no overflow will occur,
前記飽和処理手段は、前記オーバーフロー予測回路の出力と前記桁上げ伝搬加算器で生成されたキャリーアウトとを入力とする排他的論理和素子であるThe saturation processing means is an exclusive OR element that inputs the output of the overflow prediction circuit and the carry-out generated by the carry propagation adder.
ことを特徴とする請求項1又は2のいずれかに記載の積和演算回路。The product-sum operation circuit according to claim 1, wherein the sum-of-products operation circuit is provided.
JP05303896A 1996-03-11 1996-03-11 Multiply and accumulate circuit Expired - Fee Related JP3710193B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP05303896A JP3710193B2 (en) 1996-03-11 1996-03-11 Multiply and accumulate circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP05303896A JP3710193B2 (en) 1996-03-11 1996-03-11 Multiply and accumulate circuit

Publications (2)

Publication Number Publication Date
JPH09245019A JPH09245019A (en) 1997-09-19
JP3710193B2 true JP3710193B2 (en) 2005-10-26

Family

ID=12931728

Family Applications (1)

Application Number Title Priority Date Filing Date
JP05303896A Expired - Fee Related JP3710193B2 (en) 1996-03-11 1996-03-11 Multiply and accumulate circuit

Country Status (1)

Country Link
JP (1) JP3710193B2 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100477913B1 (en) * 1997-12-30 2005-08-29 주식회사 하이닉스반도체 Multiplier with Booth Algorithm
KR100403194B1 (en) * 2000-06-21 2003-10-23 주식회사 에이디칩스 Multiplier
US8316071B2 (en) * 2009-05-27 2012-11-20 Advanced Micro Devices, Inc. Arithmetic processing unit that performs multiply and multiply-add operations with saturation and method therefor
JP6707752B2 (en) * 2017-08-22 2020-06-10 日本電信電話株式会社 Optical multiplier and optical multiplication method
CN111258633B (en) * 2018-11-30 2022-08-09 上海寒武纪信息科技有限公司 Multiplier, data processing method, chip and electronic equipment
CN113031918A (en) * 2019-12-24 2021-06-25 上海寒武纪信息科技有限公司 Data processor, method, device and chip

Also Published As

Publication number Publication date
JPH09245019A (en) 1997-09-19

Similar Documents

Publication Publication Date Title
JP3689183B2 (en) Accurate and effective sticky bit calculation for accurate floating-point division / square root operations
WO1996028774A1 (en) Exponentiation circuit utilizing shift means and method of using same
Li et al. A stochastic reconfigurable architecture for fault-tolerant computation with sequential logic
Venkatachalam et al. Approximate sum-of-products designs based on distributed arithmetic
JP3710193B2 (en) Multiply and accumulate circuit
Gonzalez-Navarro et al. Binary integer decimal-based floating-point multiplication
EP1296223A2 (en) Adder incrementer circuit
US10374580B2 (en) FIR filter circuit design method using approximate computing
EP0539010A2 (en) Method and device for generating sum information/rounding control signal
US9575725B1 (en) Specialized processing block with embedded pipelined accumulator circuitry
Ramesh et al. Efficient implementation of 16-bit multiplier-accumulator using radix-2 modified booth algorithm and SPST adder using Verilog
Rao et al. High-performance compensation technique for the radix-4 CORDIC algorithm
CN111694543A (en) Approximate multiplier design method, approximate multiplier and image sharpening circuit
Ibrahim Radix-2n multiplier structures: A structured design methodology
Hass Synthesizing optimal fixed-point arithmetic for embedded signal processing
Rémi et al. Multiple Constant Multiplication: From Target Constants to Optimized Pipelined Adder Graphs
Awasthi et al. Hybrid signed digit arithmetic in efficient computing: A comparative approach to performance assay
Kim et al. Digit-serial modular multiplication using skew-tolerant domino CMOS
US6044391A (en) Method of generating the sticky-bit from the input operands
US7640286B2 (en) Data processing apparatus and method for performing floating point multiplication
Balasubramanian Approximate early output asynchronous adders based on dual-rail data encoding and 4-phase return-to-zero and return-to-one handshaking
JP3675111B2 (en) 3-input comparator
Fathi et al. Improving Accuracy, Area and Speed of Approximate Floating-Point Multiplication Using Carry Prediction
US20060242219A1 (en) Asynchronous multiplier
Yanushkevich 8.2 Computer Arithmetic

Legal Events

Date Code Title Description
A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20041008

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20041019

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20041122

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: 20050809

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20050809

R150 Certificate of patent (=grant) or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20080819

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20090819

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20090819

Year of fee payment: 4

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

Free format text: PAYMENT UNTIL: 20100819

Year of fee payment: 5

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313111

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

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

Free format text: PAYMENT UNTIL: 20100819

Year of fee payment: 5

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

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

Free format text: PAYMENT UNTIL: 20100819

Year of fee payment: 5

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

Free format text: PAYMENT UNTIL: 20110819

Year of fee payment: 6

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

Free format text: PAYMENT UNTIL: 20120819

Year of fee payment: 7

S533 Written request for registration of change of name

Free format text: JAPANESE INTERMEDIATE CODE: R313533

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

Free format text: PAYMENT UNTIL: 20120819

Year of fee payment: 7

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

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

Free format text: PAYMENT UNTIL: 20120819

Year of fee payment: 7

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

Free format text: PAYMENT UNTIL: 20130819

Year of fee payment: 8

LAPS Cancellation because of no payment of annual fees