JP2012069081A - Operational circuit - Google Patents

Operational circuit Download PDF

Info

Publication number
JP2012069081A
JP2012069081A JP2010215779A JP2010215779A JP2012069081A JP 2012069081 A JP2012069081 A JP 2012069081A JP 2010215779 A JP2010215779 A JP 2010215779A JP 2010215779 A JP2010215779 A JP 2010215779A JP 2012069081 A JP2012069081 A JP 2012069081A
Authority
JP
Japan
Prior art keywords
value
product
register
input
output
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.)
Granted
Application number
JP2010215779A
Other languages
Japanese (ja)
Other versions
JP5668391B2 (en
Inventor
Tsuguchika Tabaru
司睦 田原
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.)
Fujitsu Semiconductor Ltd
Original Assignee
Fujitsu Semiconductor 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 Fujitsu Semiconductor Ltd filed Critical Fujitsu Semiconductor Ltd
Priority to JP2010215779A priority Critical patent/JP5668391B2/en
Publication of JP2012069081A publication Critical patent/JP2012069081A/en
Application granted granted Critical
Publication of JP5668391B2 publication Critical patent/JP5668391B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Complex Calculations (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide an operational circuit capable of using a few processing cycles for high-speed computation of operation result corresponding to input data in which an optional value is updated.SOLUTION: An operational circuit includes: a first register for retaining a first value including N elements; a second register for retaining a second value including N elements; an output register for retaining a product-sum operation value obtained through product-sum operation of the first and second values; a first subtractor for subtracting an element in the first value within the first register corresponding to the element from one element in the input first value; a multiplier for multiplying the output of the first subtractor by an element in the second value within the second register corresponding to the element in the input first value; and an adder for adding the output of the multiplier to the product-sum operation value of the output register to output the result to the output register.

Description

本発明は、演算回路に関する。   The present invention relates to an arithmetic circuit.

近年、画像の描画時に行われる座標変換におけるベクトル演算処理や、音声データ等のデジタル・フィルタ処理等において、積和演算が頻繁に用いられる。積和演算とは、積の和を求める演算、つまり乗算の結果を順次加算する演算である。例えば、デジタル・フィルタ処理の演算であるFIR(有限インパルス応答)フィルタの演算において、画像、音声データと係数とを乗算し累積加算する処理として積和演算が用いられる。このようなデジタル・フィルタ処理では、積和演算の処理速度を向上することにより、処理全体の速度を向上することが図られる。   In recent years, product-sum operations are frequently used in vector calculation processing in coordinate transformation performed at the time of drawing an image, digital filter processing of audio data, and the like. The product-sum operation is an operation for obtaining the sum of products, that is, an operation for sequentially adding the results of multiplication. For example, in the calculation of an FIR (finite impulse response) filter, which is an operation of digital filter processing, product-sum operation is used as processing for multiplying image and audio data by a coefficient and cumulatively adding them. In such digital filter processing, it is possible to improve the overall processing speed by improving the processing speed of the product-sum operation.

上記のようなデジタル・フィルタ処理では、画像、音声データの値の一部が更新され、係数については更新されない。従って、演算回路は、全ての入力データについて、積和演算をし直す必要はない。しかし、従来の演算回路は、全ての入力データに基づいて積和演算することにより、積和演算処理に時間を要していた。そこで、例えば、特許文献1のような演算回路が提案されている。   In the digital filter processing as described above, some of the values of the image and audio data are updated, and the coefficients are not updated. Therefore, the arithmetic circuit does not need to repeat the product-sum operation for all input data. However, the conventional arithmetic circuit requires time for the product-sum operation processing by performing the product-sum operation based on all input data. Thus, for example, an arithmetic circuit as disclosed in Patent Document 1 has been proposed.

特許第2530916号公報Japanese Patent No. 2530916

しかしながら、特許文献1の演算回路では、入力データのうち固定のデータが更新された場合の積和演算値を得ることはできるものの、任意のデータが更新された場合の積和演算値を得ることはできない。   However, in the arithmetic circuit of Patent Document 1, although a product-sum operation value can be obtained when fixed data is updated among input data, a product-sum operation value when arbitrary data is updated is obtained. I can't.

また、プロセッサーは、積和演算に限らず、加減算、乗算、論理積、論理和演算等の組合せによる様々な演算を行う。そのような他の組合せ演算回路においても同様にして、入力データ内の任意の値が更新された場合に、全ての入力データについて演算し直すことにより、演算に時間を要していた。   Further, the processor performs not only product-sum operations but also various operations based on combinations of addition / subtraction, multiplication, logical product, logical sum operation, and the like. Similarly, in such other combinational operation circuits, when any value in the input data is updated, it takes time for the calculation by recalculating all the input data.

そこで、本発明では、任意の値が更新された入力データに対応する演算結果を少ない処理サイクルで高速に算出可能な演算回路を提供することを目的とする。   Therefore, an object of the present invention is to provide an arithmetic circuit capable of calculating an arithmetic result corresponding to input data in which an arbitrary value is updated at high speed with a small number of processing cycles.

第1の側面は、N個の要素を有する第1の値を保持する第1のレジスターと、
N個の要素を有する第2の値を保持する第2のレジスターと、
前記第1の値と前記第2の値とが積和演算された積和演算値を保持する出力レジスターと、
入力された前記第1の値の1つの前記要素から、当該要素に対応する前記第1のレジスター内の前記第1の値の前記要素を減算する第1の減算器と、
前記第1の減算器の出力と、前記入力された第1の値の要素に対応する前記第2のレジスター内の前記第2の値の前記要素とを乗算する乗算器と、
前記乗算器の出力と、前記出力レジスターの前記積和演算値とを加算して前記出力レジスターに出力する加算器と、を有する。
A first aspect includes a first register holding a first value having N elements;
A second register holding a second value having N elements;
An output register for holding a product-sum operation value obtained by performing a product-sum operation on the first value and the second value;
A first subtractor for subtracting the element of the first value in the first register corresponding to the element from one of the elements of the input first value;
A multiplier that multiplies the output of the first subtractor with the element of the second value in the second register corresponding to the element of the input first value;
An adder that adds the output of the multiplier and the product-sum operation value of the output register and outputs the result to the output register.

第1の側面によれば、任意の値が更新された入力データに対応する演算結果を少ない処理サイクルで高速に算出可能となる。   According to the first aspect, calculation results corresponding to input data in which an arbitrary value is updated can be calculated at high speed with a small number of processing cycles.

専用の積和演算回路を有するシステムの一例である。It is an example of a system having a dedicated product-sum operation circuit. 式1における積和演算器の一例を表す図である。It is a figure showing an example of the product-sum calculator in Formula 1. 図2の積和演算器をバスに接続する回路の一例を表す図である。FIG. 3 is a diagram illustrating an example of a circuit that connects the product-sum calculator of FIG. 2 to a bus. 〜aが更新される場合の積和演算器における動作波形を表す図である。is a diagram showing operation waveforms in the multiply-add unit when a 0 ~a 7 is updated. のみが更新される場合の積和演算回路における動作波形を表す図である。is a diagram showing the operation waveforms in the product-sum operation circuit when only a 2 is updated. 式2における本実施の形態例における積和演算器の一例を表す図である。It is a figure showing an example of the sum-of-products calculator in the example of this Embodiment in Formula 2. 図6の積和演算器をバスに接続する回路を表す図である。It is a figure showing the circuit which connects the product-sum operation unit of FIG. 6 to a bus | bath. 〜aが更新される場合の図6の積和演算器における動作波形を表す図である。a 0 ~a 7 is a diagram showing operation waveforms in the multiply-add unit 6 when being updated. のみが更新された場合の図6の積和演算器における動作波形を表す図である。Only a 2 is a diagram showing operation waveforms in the multiply-add unit 6 when it is updated. 式3における本実施の形態例における積和演算器の一例を表す図である。It is a figure showing an example of the sum-of-products calculator in the example of this Embodiment in Formula 3. 式4における本実施の形態例における積和演算器の一例を表す図である。It is a figure showing an example of the sum-of-products calculator in the example of this Embodiment in Formula 4. 第4の実施の形態例における積和演算器の一例を表す図である。It is a figure showing an example of the product-sum calculator in the example of a 4th embodiment. 第5の実施の形態例における第1の演算回路である。It is a 1st arithmetic circuit in a 5th example of an embodiment. 第5の実施の形態例における第2の演算回路である。It is the 2nd arithmetic circuit in a 5th example of an embodiment. 図13及び図14の回路をバスに接続する回路を表す図である。It is a figure showing the circuit which connects the circuit of FIG.13 and FIG.14 to a bus | bath. 式7における本実施の形態例における回路の一例を表す図である。It is a figure showing an example of the circuit in this Embodiment in Formula 7.

以下、図面にしたがって本発明の実施の形態について説明する。ただし、本発明の技術的範囲はこれらの実施の形態に限定されず、特許請求の範囲に記載された事項とその均等物まで及ぶものである。   Hereinafter, embodiments of the present invention will be described with reference to the drawings. However, the technical scope of the present invention is not limited to these embodiments, but extends to the matters described in the claims and equivalents thereof.

図1は、専用の積和演算回路を有するシステム10の一例である。同図のシステム10は、CPU11とDMAC12、メモリ13、専用の積和演算回路14(以下、積和演算器)、その他のハードウェア15を有する。CPU11は、メモリ13から読み出した命令をバス16を介して積和演算回路14に送り、積和演算回路はバス16を介して演算結果をCPU11に送る。DMAC12は、その他のハードウェア15とメモリ13間等のCPU11を介さないデータ転送を制御する。   FIG. 1 is an example of a system 10 having a dedicated product-sum operation circuit. A system 10 in FIG. 1 includes a CPU 11 and a DMAC 12, a memory 13, a dedicated product-sum operation circuit 14 (hereinafter referred to as a product-sum operation unit), and other hardware 15. The CPU 11 sends the instruction read from the memory 13 to the product-sum operation circuit 14 via the bus 16, and the product-sum operation circuit sends the operation result to the CPU 11 via the bus 16. The DMAC 12 controls data transfer not via the CPU 11 such as between the other hardware 15 and the memory 13.

具体的に、CPU11は、積和演算器14とのデータのやり取りを、積和演算器14に割り振られたアドレスに対する読み出し及び書き込み処理によって行う。例えば、CPU11から積和演算器14にデータを書き込む場合、CPU11は、バス16に対して積和演算器14のアドレス、書き込みデータ、タイミング信号、書き込みモード信号を発行する。積和演算器14は、これらの信号を検出して発行されたアドレスが積和演算器14のアドレスであることを判定し、バス16からデータを取り込む。一方、積和演算器14からデータを出力する場合、CPU11は、バス16に対して、積和演算器14のアドレス及びタイミング信号を発行し、積和演算器14から供給されたデータをバス16から取り込む。   Specifically, the CPU 11 exchanges data with the product-sum calculator 14 through read and write processing with respect to the address assigned to the product-sum calculator 14. For example, when data is written from the CPU 11 to the product-sum operation unit 14, the CPU 11 issues the address, write data, timing signal, and write mode signal of the product-sum operation unit 14 to the bus 16. The product-sum operation unit 14 detects these signals, determines that the issued address is the address of the product-sum operation unit 14, and takes in data from the bus 16. On the other hand, when outputting data from the product-sum calculator 14, the CPU 11 issues an address and timing signal of the product-sum calculator 14 to the bus 16, and sends the data supplied from the product-sum calculator 14 to the bus 16. Capture from.

積和演算回路14は、一般的に、次の式1に基づいて積和演算値を算出する。式1において、積和演算値「S」は、値「a」「b」の積和演算値である。   The product-sum operation circuit 14 generally calculates a product-sum operation value based on the following equation 1. In Equation 1, the product-sum operation value “S” is a product-sum operation value of the values “a” and “b”.

Figure 2012069081
Figure 2012069081

値「a」は、n個の要素「a,a,…,an−1」、値「b」はn個の要素「b,b,…,bn−1」をそれぞれ有する。式1では、各値のi(0≦i≦n−1)番目の要素同士の組の乗算値「a×b」が順次加算されることにより、積和演算値「S」が算出される。 Value "a", n elements "a 0, a 1, ..., a n-1 ", the value "b" n elements "b 0, b 1, ..., b n-1 ", respectively Have. In Equation 1, a product-sum operation value “S” is calculated by sequentially adding a multiplication value “a i × b i ” of a set of i (0 ≦ i ≦ n−1) -th elements of each value. Is done.

図2は、式1において「n=8」とした場合の積和演算器の一例を表す図である。同図の積和演算器において、値「a」の各要素a〜aはレジスターR00〜R07に入力され、値「b」の各要素b〜bはレジスターR10〜R17に入力される。同図の積和演算器では、値「a」「b」の全てまたは一部の要素が入力信号inputとして入力され、対応するレジスターに書き込まれる。続いて、レジスターに保持された全ての値「a」「b」の要素データを用いて演算が行われ、出力レジスターOUTに積和演算値「S」が出力される。 FIG. 2 is a diagram illustrating an example of a product-sum calculator when “n = 8” in Equation 1. In the product-sum operation unit shown in the figure, the elements a 0 to a 7 of the value “a” are input to the registers R 00 to R 07, and the elements b 0 to b 7 of the value “b” are input to the registers R 10 to R 17. The In the product-sum operation unit shown in the figure, all or a part of the values “a” and “b” are input as the input signal input and written into the corresponding register. Subsequently, an operation is performed using element data of all values “a” and “b” held in the register, and a product-sum operation value “S” is output to the output register OUT.

図2の積和演算器において、まず、演算対象の各要素データ(入力更新データ)が入力信号inputとして入力され、入力更新データに対応するレジスターがライト信号write_0_0〜write_1_7に応答し、当該レジスターに入力更新データが書き込まれる。全ての入力更新データが書き込まれると、入力信号startがカウンターCNTと遅延器DELAに入力される。カウンターCNTは入力信号startに応答して、クロックの立ち上がり毎に0から順にインクリメントした信号を、比較器COMと選択器SELA、SELBに出力する。   In the product-sum calculator of FIG. 2, first, each element data (input update data) to be calculated is input as an input signal input, and a register corresponding to the input update data responds to the write signals write_0_0 to write_1_7, Input update data is written. When all the input update data is written, the input signal start is input to the counter CNT and the delay unit DELA. In response to the input signal start, the counter CNT outputs a signal incremented from 0 every time the clock rises to the comparator COM and the selectors SELA and SELB.

選択器SELA、SELBは、それぞれ、カウンターCNTからのセレクト信号select1(0〜7)に応答して、当該セレクト信号select1に対応するレジスターが保持するデータを乗算器MULへ出力する。具体的に、例えば、セレクト信号select1が「0」の場合、選択器SELAはレジスターR00のデータ、選択器SELBはレジスターR10のデータを乗算器MULに出力する。乗算器MULは同時に入力された値「a」「b」の対応する要素の組の各データを乗算して加算器ADDに順次出力し、加算器ADDは出力された乗算値と、前回の加算器ADDの出力とを順次加算する。   The selectors SELA and SELB output the data held in the register corresponding to the select signal select1 to the multiplier MUL in response to the select signal select1 (0 to 7) from the counter CNT. Specifically, for example, when the select signal select1 is “0”, the selector SELA outputs the data in the register R00, and the selector SELB outputs the data in the register R10 to the multiplier MUL. The multiplier MUL multiplies each data of the corresponding element set of the values “a” and “b” inputted simultaneously and sequentially outputs them to the adder ADD. The adder ADD and the previous addition The outputs of the adder ADD are sequentially added.

一方、比較器COMはカウンターCNTからのセレクト信号select1が「7」の場合、遅延器DELBに信号を出力する。遅延器DELBは、比較器COMからの出力信号を全組の乗算結果が加算されるタイミングに遅延させて、出力レジスターOUTへ書き込み信号writeを出力する。なお、遅延器DELAは、入力信号startを初めの組の乗算値が加算される直前に合わせて遅延させ、加算器ADDにリセット信号resetを出力し予め「0」で初期化しておく。   On the other hand, when the select signal select1 from the counter CNT is “7”, the comparator COM outputs a signal to the delay device DELB. The delay device DELB delays the output signal from the comparator COM to the timing at which all sets of multiplication results are added, and outputs the write signal write to the output register OUT. The delay unit DELA delays the input signal start just before the first set of multiplication values are added, outputs a reset signal reset to the adder ADD, and initializes it beforehand with “0”.

図3は、図2の積和演算器をバスに接続する回路の一例を表す図である。同図において、図1のバス16が、制御バスCB、データバスDB、アドレスバスABを有する。図2の積和演算器にアクセスが発生すると、積和演算器に割り振られたアドレスがアドレスバスABに、有効なアドレスが流れたタイミングを表す信号が制御バスCBに出力される。   FIG. 3 is a diagram illustrating an example of a circuit that connects the product-sum calculator of FIG. 2 to a bus. In FIG. 1, the bus 16 of FIG. 1 has a control bus CB, a data bus DB, and an address bus AB. When an access occurs in the product-sum operation unit in FIG. 2, an address assigned to the product-sum operation unit is output to the address bus AB, and a signal indicating the timing at which a valid address flows is output to the control bus CB.

そして、ゲートG1は有効アドレスを検出し、比較器C00〜C17は、それぞれ検出アドレスと対応するレジスター(レジスターR00〜R07)に割り振られたアドレスとを比較し、一致した場合に、当該アドレスに対応するライト信号write_*_*(write_0_0〜write_1_7)を図2の積和演算器に送る。また、比較器C20は、検出アドレスと入力信号startを発行するためのアドレスとを比較し、一致した場合に、図2の積和演算器に入力信号startを送る。   Then, the gate G1 detects the effective address, and the comparators C00 to C17 compare the detected addresses with the addresses assigned to the corresponding registers (registers R00 to R07), respectively, and correspond to the addresses when they match. The write signal write _ * _ * (write_0_0 to write_1_7) to be sent is sent to the product-sum calculator of FIG. Further, the comparator C20 compares the detected address with the address for issuing the input signal start, and when they match, sends the input signal start to the product-sum calculator of FIG.

また、ゲートG4は、データバスDBから送信されるデータと、有効なデータが検出されたタイミングを表す信号を制御バスCBから検出し、データバスDBの入力データを入力信号inputとして出力する。また、ゲートG2は有効アドレスを検出し、比較器C30は、検出アドレスと積和演算器の出力レジスターOUTのアドレスとを比較し、一致した場合に、出力レジスターOUTの出力値outputをゲートG3からデータバスDBに出力する。   The gate G4 detects data transmitted from the data bus DB and a signal indicating the timing at which valid data is detected from the control bus CB, and outputs the input data of the data bus DB as an input signal input. Further, the gate G2 detects the effective address, and the comparator C30 compares the detected address with the address of the output register OUT of the product-sum calculator, and if they match, the output value output of the output register OUT is output from the gate G3. Output to the data bus DB.

図4は、「a〜a」が更新される場合の図2の積和演算器における動作波形を表す図である。この例において、レジスターR10〜R17には「b〜b」が予め保持されている。また、「p」は各組の要素の乗算値「a×b」であり、「S」はi番目の組までの積和演算値を表す。 FIG. 4 is a diagram illustrating operation waveforms in the product-sum calculator of FIG. 2 when “a 0 to a 7 ” is updated. In this example, “b 0 to b 7 ” are held in the registers R10 to R17 in advance. “P i ” is a multiplication value “a i × b i ” of each set of elements, and “S i ” represents a product-sum operation value up to the i-th set.

図4の動作波形図において、まず、入力信号inputとして「a」が入力されると共に、ライト信号write_0_0に応答して、次のクロックの立ち上がりタイミングでレジスターR00に「a」が書き込まれる。同様にして、入力信号inputとして「a〜a」が順次入力され、「a〜a」がレジスターR01〜レジスターR07に書き込まれる。そして、「a」の入力の次のクロックの立ち上がりタイミングで、入力信号startがカウンターCNTに出力される。 In the operation waveform diagram of FIG. 4, first, “a 0 ” is input as the input signal input, and “a 0 ” is written to the register R 00 at the next clock rising timing in response to the write signal write — 0 — 0 . Similarly, "a 1 ~a 7" are sequentially input as the input signal input The "a 1 ~a 7" is written to the register R01~ register R07. Then, the input signal start is output to the counter CNT at the rising timing of the clock next to the input of “a 7 ”.

カウンターCNTは入力信号startに応答して、クロックの立ち上がりタイミング毎に0から順に7までインクリメントした各信号を選択器SELA、SELBと比較器COMに出力する。最初、セレクト信号select1「0」に応答して、選択器SELAはレジスターR00のデータ「a」を、選択器SELBはレジスターR10のデータ「b」を選択し乗算器MULに出力する。続いて、次のクロックの立ち上がりタイミングで、乗算器MULは、「a」「b」を乗算し、乗算値「p=a×b」を加算器ADDに出力する。 In response to the input signal start, the counter CNT outputs each signal incremented from 0 to 7 at each rising edge of the clock to the selectors SELA and SELB and the comparator COM. First, in response to the select signal select1 “0”, the selector SELA selects the data “a 0 ” in the register R00, and the selector SELB selects the data “b 0 ” in the register R10 and outputs it to the multiplier MUL. Subsequently, at the rising timing of the next clock, the multiplier MUL multiplies “a 0 ” and “b 0 ” and outputs the multiplication value “p 0 = a 0 × b 0 ” to the adder ADD.

また、遅延器DELAはスタート信号startに応答して加算器ADDにリセット信号resetを出力し、最初の組の乗算値「p」が入力される前に加算器ADDを「0」に初期化しておく。従って、加算器ADDは、最初、初期値「0」と乗算器MULから出力された乗算値「p」との加算値「S=0+p」を出力する。同様にして、次のクロックで、加算器ADDは、乗算器MULからの出力「p=a×b」と、1つ前のクロックの加算器ADDからの出力値「pi−1」とを加算した値「S=pi−1+p」を出力する。また、比較器COMは、カウンターCNTの出力信号が7になると遅延器DELBに比較信号を出力し、遅延器DELBは、全ての組の乗算結果「p〜p」が加算されたタイミングに、出力レジスターへの書き込み信号writeを出力する。 The delay unit DELA outputs a reset signal reset to the adder ADD in response to the start signal start, and initializes the adder ADD to “0” before the first set of multiplication values “p 0 ” is input. Keep it. Therefore, the adder ADD first outputs an addition value “S 0 = 0 + p 0 ” between the initial value “0” and the multiplication value “p 0 ” output from the multiplier MUL. Similarly, at the next clock, the adder ADD outputs “p i = a i × b i ” from the multiplier MUL and the output value “p i−1 ” from the adder ADD of the previous clock. ”And“ S i = p i−1 + p i ”are output. Further, the comparator COM outputs a comparison signal to the delay device DELB when the output signal of the counter CNT becomes 7, and the delay device DELB has a timing at which all sets of multiplication results “p 0 to p 7 ” are added. The write signal write to the output register is output.

上記のように、図2の積和演算器は、全ての入力更新データ「a〜a」がレジスターに蓄えられてから積和演算を開始するため、演算結果が得られるまで時間がかかっていた。これにより、図2の積和演算器は、データ「a〜a」が入力され始めてから積和演算値「S」が算出されるまで20サイクル要していた。続いて、「a〜a」のうちひとつのデータのみが更新された場合について述べる。 As described above, the product-sum operation unit of FIG. 2 starts the product-sum operation after all the input update data “a 0 to a 7 ” are stored in the register. Therefore, it takes time until the operation result is obtained. It was. Accordingly, the product-sum calculator of FIG. 2 takes 20 cycles from the start of input of the data “a 0 to a 7 ” until the product-sum operation value “S 7 ” is calculated. Next, a case where only one data among “a 0 to a 7 ” is updated will be described.

図5は、「a〜a」のうち「a」のみが更新される場合の図2の積和演算回路における動作波形を表す図である。この例において、レジスターR10〜R17に「b〜b」が、レジスターR02を除くレジスターR00〜R07に、「a2」を除く「a〜a」が予め保持されている。なお、「p」、「S」については図4の動作波形図と同様である。 FIG. 5 is a diagram illustrating operation waveforms in the product-sum operation circuit of FIG. 2 when only “a 2 ” of “a 0 to a 7 ” is updated. In this example, “b 0 to b 7 ” are held in the registers R 10 to R 17 in advance, and “a 0 to a 7 ” except for “a 2 ” are held in the registers R 00 to R 07 except for the register R 02 in advance. Note that “p i ” and “S i ” are the same as those in the operation waveform diagram of FIG.

図5の動作波形図において、まず、入力信号inputとして「a」が入力されると共に、ライト信号write_0_2に応答して、次のクロックの立ち上がりタイミングでレジスターR02に「a」が書き込まれる。そして、「a」の入力のつぎのクロックの立ち上がりタイミングで、入力信号startがカウンターCNTに出力され、カウンターCNTは、0から順にインクリメントした信号を選択器SELA、SELBと比較器COMとに出力する。そして、図4と同様にして、選択器SELA、SELBは、「0〜7」のセレクト信号select1に対応するレジスターが保持するデータの組を選択して順次乗算器MULに出力し、乗算器MULは各組のデータの乗算値「p(=a×b)」を順次加算器ADDに出力する。加算器ADDは、全ての組の乗算値「p」を順次加算し、積和演算値「S」を出力レジスターOUTに出力する。 In the operation waveform diagram of FIG. 5, first, “a 2 ” is input as the input signal input, and “a 2 ” is written to the register R 02 at the next clock rising timing in response to the write signal write — 0 — 2 . Then, the input signal start is output to the counter CNT at the rising timing of the clock next to the input of “a 2 ”, and the counter CNT outputs the signals incremented from 0 to the selectors SELA, SELB and the comparator COM. To do. In the same manner as in FIG. 4, the selectors SELA and SELB select the data sets held in the registers corresponding to the select signals select1 of “0 to 7” and sequentially output them to the multiplier MUL. Sequentially outputs the multiplication value “p i (= a i × b i )” of each set of data to the adder ADD. The adder ADD sequentially adds all sets of multiplication values “p i ” and outputs a product-sum operation value “S 7 ” to the output register OUT.

このように、図2の積和演算器は、例え「a〜a」のうち「a」のみが更新される場合であっても、レジスターに保持された全てのデータについて積和演算し直していた。また、図2の積和演算器は、演算対象の全てのデータについて積和演算し直すため、全てのデータがレジスターに書き込まれてから演算を開始していた。 As described above, the product-sum operation unit of FIG. 2 performs the product-sum operation on all the data held in the register even if only “a 2 ” of “a 0 to a 7 ” is updated. I was doing it again. Further, since the product-sum operation unit in FIG. 2 performs the product-sum operation again on all the data to be calculated, the operation is started after all the data is written to the register.

これにより、図2の積和演算器は、レジスターに保持された全てのデータを、当該全てのデータがレジスターに格納されてから積和演算し直すため、全ての入力更新データがレジスターに蓄えられるまでのデータ転送時間と、乗算と加算の全てのデータの演算時間とを要し、積和演算値が得られるまで時間を要していた。このため、図2の積和演算器では、「a2」のみが更新される場合であっても、データ「a2」が入力され始めてから積和演算値「S」が算出されるまで13サイクル要していた。 As a result, the product-sum operation unit shown in FIG. 2 recalculates the product-sum operation after all the data stored in the register is stored in the register, so that all the input update data is stored in the register. The data transfer time up to and the calculation time of all data of multiplication and addition are required, and it takes time until the product-sum operation value is obtained. Therefore, in the product-sum calculator of FIG. 2, even if only “a 2 ” is updated, the product-sum operation value “S 7 ” is calculated after the data “a 2 ” starts to be input. It took 13 cycles.

<第1の実施の形態例>
そこで、本実施の形態例の演算回路は、N個の要素を有する第1の値を保持する第1のレジスターと、N個の要素を有する第2の値を保持する第2のレジスターと、第1、第2の値が積和演算された積和演算値を保持する出力レジスターとを有する。そして、本実施の形態例の演算回路は、入力された第1の値の1つの要素から、当該要素に対応する第1のレジスター内の第1の値の要素を減算する減算器と、減算器の出力と入力された第1の値の要素に対応する第2のレジスター内の第2の値の要素とを乗算する乗算器と、乗算器の出力と出力レジスターの積和演算値とを加算して前記出力レジスターに出力する加算器とを有する。
<First Embodiment>
Therefore, the arithmetic circuit according to the present embodiment includes a first register that holds a first value having N elements, a second register that holds a second value having N elements, And an output register for holding a product-sum operation value obtained by multiply-accumulating the first and second values. The arithmetic circuit according to the present embodiment includes a subtracter that subtracts an element of the first value in the first register corresponding to the element from one element of the input first value, A multiplier for multiplying the output of the multiplier by an element of the second value in the second register corresponding to the element of the input first value, and the product-sum operation value of the output of the multiplier and the output register And an adder for adding and outputting to the output register.

本実施の形態例の積和演算器は、次の式2に基づいて積和演算値を算出する。式2において、値「a´=(a´,a´,a´,…,an−1´)」は、前回積和演算された古い値「a=(a,a,a,…,an−1)」である前回データに対してj番目の要素が更新されているものとする。なお、値「a」「a´」のj番目以外の要素は変更なく同一である。そして、「S」は「a」と「b」の積和演算値(以下、前回の積和演算値)であり、「S´」は「a´」と「b」の積和演算値(以下、更新後の積和演算値)を表す。 The product-sum operation unit according to the present embodiment calculates a product-sum operation value based on the following Equation 2. In Equation 2, the value “a ′ = (a 0 ′, a 1 ′, a 2 ′,..., A n−1 ′)” is an old value “a = (a 0 , a 1 , A 2 ,..., A n-1 ) ”, the j-th element is updated. The elements other than the jth value “a” and “a ′” are the same without change. “S” is the product-sum operation value of “a” and “b” (hereinafter, the previous product-sum operation value), and “S ′” is the product-sum operation value of “a ′” and “b” ( Hereinafter, the product-sum calculation value after update) is represented.

Figure 2012069081
Figure 2012069081

式2では、更新後の積和演算値「S´」を、前回の積和演算値「S」に、「S´」と「S」の差分値を加算することによって求める。具体的に、更新後の積和演算値「S´」は、前回の積和演算値「S」から値「a」「b」のj番目の要素の乗算値「a×b」を減算し、値「a´」「b」のj番目の要素の乗算値「a´×b」を加算した値(S´=S−(a×b)+(a´×b))である。この演算式は「S´=S+(a´−a)×b」のようにまとめられる。従って、更新後の積和演算値「S´」は、前回の積和演算値「S」に差分値「(a´−a)×b」が加算されることにより算出される。 In Equation 2, the updated product-sum operation value “S ′” is obtained by adding the difference value between “S ′” and “S” to the previous product-sum operation value “S”. Specifically, the updated product-sum operation value “S ′” is obtained by multiplying the multiplication value “a j × b j ” of the j-th element of the values “a” and “b” from the previous product-sum operation value “S”. A value obtained by subtracting and adding the multiplication value “a j ′ × b j ” of the j-th element of the values “a ′” and “b” (S ′ = S− (a j × b j ) + (a j ′ × b j )). This arithmetic expression is summarized as “S ′ = S + (a j ′ −a j ) × b j ”. Therefore, the updated product-sum operation value “S ′” is calculated by adding the difference value “(a j ′ −a j ) × b j ” to the previous product-sum operation value “S”.

式1と式2とを比較すると、値の一部の要素が更新される場合、式1に対して式2の演算量は少ない。従って、式2は、式1に対してより少ない処理サイクルで更新後の積和演算値「S」を算出することができる。   Comparing Expression 1 and Expression 2, when some elements of the value are updated, the amount of calculation of Expression 2 is smaller than that of Expression 1. Therefore, Equation 2 can calculate the updated product-sum operation value “S” with fewer processing cycles than Equation 1.

図6は、式2において「n=8」とした場合の本実施の形態例における積和演算器の一例を表す図である。図2の積和演算値と同様に、図6の積和演算器において、値「a´」の各要素a´〜a´はレジスターR00〜R07に、値「b」の各要素b〜bはレジスターR10〜R17に格納される。また、本実施の形態例における積和演算器は、レジスターR00〜R17に前回データ「a〜a、b〜b」を、出力レジスターに前回の積和演算値「S」を保持する。 FIG. 6 is a diagram illustrating an example of a product-sum calculator in the present embodiment when “n = 8” in Expression 2. Similar to the product-sum operation value of FIG. 2, in the product-sum operation unit of FIG. 6, each element a 0 ′ to a 7 ′ of the value “a ′” is stored in the registers R00 to R07 and each element b of the value “b” is stored. 0 ~b 7 is stored in the register R10-R17. Further, the product-sum calculator in the present embodiment holds the previous data “a 0 to a 7 , b 0 to b 7 ” in the registers R 00 to R 17, and the previous product-sum operation value “S” in the output register. To do.

また、図6の積和演算器において、updateする組の番号s10は、入力信号inputとして入力される入力更新データに対応する組を表す。そして、write_0_0からwrite_0_7の論理和s0はレジスターR00〜R07のいずれかに格納される入力更新データの有無を表し、write_0_0からwrite_0_7の論理和s0がHレベルの場合、入力更新データがレジスターR00〜R07のいずれかに格納されることを、Lレベルの場合はいずれにも格納されないことを示す。同様に、write_1_0からwrite_1_7の論理和s1は、レジスターR10〜R17のいずれかに格納される入力更新データの有無を表す。   In the product-sum operation unit of FIG. 6, the number s10 of the set to be updated represents a set corresponding to the input update data input as the input signal input. The logical sum s0 from write_0_0 to write_0_7 represents the presence or absence of input update data stored in any of the registers R00 to R07. When the logical sum s0 from write_0_0 to write_0_7 is at H level, the input update data is in the registers R00 to R07. Indicates that it is stored in any of the above, and in the case of the L level, it is not stored in any of them. Similarly, the logical sum s1 of write_1_0 to write_1_7 represents the presence or absence of input update data stored in any of the registers R10 to R17.

図6の積和演算器において、値「a」または値「b」いずれかの入力更新データが入力信号inputとして入力される。そして、入力更新データinputと、入力更新データに基づく前回データの差分値が演算され、当該差分値が前回の積和演算値に加算されることによって更新後の積和演算値が算出される。   In the product-sum calculator of FIG. 6, input update data of either the value “a” or the value “b” is input as the input signal input. Then, the difference value between the input update data input and the previous data based on the input update data is calculated, and the difference value is added to the previous product-sum operation value to calculate the updated product-sum operation value.

まず、入力信号inputとしてデータが入力されると、入力更新データを書き込む前に、updateする組の番号s10に対応するレジスターが予め保持する前回データを、選択器SEL1は遅延器DEL2と減算器SUB1に、選択器SEL2は遅延器DEL3と減算器SUB2にそれぞれ出力する。同時に、入力更新データに対応するレジスターがライト信号write_0_0〜write_1_7に応答し、当該レジスターに入力更新データが書き込まれる。   First, when data is input as the input signal input, the selector SEL1 uses the delay unit DEL2 and the subtractor SUB1 to store the previous data stored in advance in the register corresponding to the set number s10 to be updated before writing the input update data. In addition, the selector SEL2 outputs to the delay device DEL3 and the subtractor SUB2. At the same time, the register corresponding to the input update data responds to the write signals write_0_0 to write_1_7, and the input update data is written into the register.

続いて、減算器SUB1は、入力更新データinputから、選択器SEL1から出力された前回データを減算した減算値を選択器SEL3に出力する。また、遅延器DEL2は、選択器SEL1から出力された前回データを減算器SUB1の出力に合わせて遅延させ、選択器SEL3に出力する。また、遅延器DEL1は、write_0_0からwrite_0_7の論理和s0を減算器SUB1の出力に合わせて遅延させ、セレクト信号select3として選択器SEL3に出力する。そして、選択器SEL3は、セレクト信号select3がHレベルの場合は減算器SUB1からの出力を、セレクト信号select3がLレベルの場合は遅延器DEL2から出力された入力更新データの組の前回データを、乗算器MUL1に出力する。選択器SEL4についても同様である。   Subsequently, the subtractor SUB1 outputs a subtraction value obtained by subtracting the previous data output from the selector SEL1 from the input update data input to the selector SEL3. The delay unit DEL2 delays the previous data output from the selector SEL1 in accordance with the output of the subtractor SUB1, and outputs the delayed data to the selector SEL3. Further, the delay unit DEL1 delays the logical sum s0 of write_0_0 to write_0_7 in accordance with the output of the subtractor SUB1, and outputs it to the selector SEL3 as the select signal select3. The selector SEL3 outputs the previous data of the set of input update data output from the delay unit DEL2 when the select signal select3 is at the H level, and outputs the output from the subtractor DEL2 when the select signal select3 is at the L level. Output to the multiplier MUL1. The same applies to the selector SEL4.

前述したとおり、値「a」または値「b」いずれかのデータが入力されるため、例えば、値「a」のデータが更新される場合、write_0_0からwrite_0_7の論理和s0はHレベル、write_1_0からwrite_1_7の論理和s1はLレベルとなる。この場合、乗算器MUL1は、値「a」に係る選択器SEL3による減算器SUB1からの減算値(a´−a)と、値「b」に係る選択器SEL4による遅延器DEL3からの前回データ(b)とを乗算する。一方、値「b」のデータが更新される場合、write_0_0からwrite_0_7の論理和s0はLレベル、write_1_0からwrite_1_7の論理和s1はHレベルとなり、乗算器MUL1は、値「a」に係る選択器SEL3による遅延器DEL2からの前回データ(a)と、値「b」に係る選択器SEL4による減算器SUB2からの減算値(b´−b)とを乗算する。 As described above, since the data of either the value “a” or the value “b” is input, for example, when the data of the value “a” is updated, the logical sum s0 of write_0_0 to write_0_7 is H level and from write_1_0 The logical sum s1 of write_1_7 is at the L level. In this case, the multiplier MUL1 outputs the subtraction value (a j ′ −a j ) from the subtractor SUB1 by the selector SEL3 related to the value “a” and the delay DEL3 from the selector SEL4 related to the value “b”. Multiply the previous data (b j ). On the other hand, when the data of the value “b” is updated, the logical sum s0 of write_0_0 to write_0_7 is L level, the logical sum s1 of write_1_0 to write_1_7 is H level, and the multiplier MUL1 is the selector for the value “a”. Multiply the previous data (a j ) from the delay unit DEL2 by the SEL3 and the subtraction value (b j ′ −b j ) from the subtractor SUB2 by the selector SEL4 related to the value “b”.

そして、乗算器MUL1は、乗算結果を前回の積和演算値からの差分値として加算器ADD1に出力する。この差分値は、上述した式2における「(a´−a)×b」(値「a」のデータが更新される場合)に対応する。続いて、加算器ADD1は、当該差分値と、出力レジスターOUTが保持する前回の積和演算値とを加算して、出力レジスターOUTに出力する。ただし、連続するクロックサイクルで入力更新データが入力される場合、前回の積和演算値を出力レジスターから入力すると、次の加算器ADD1の演算に間に合わない。そこで、連続するクロックサイクルで更新データが入力される場合、選択器SEL5は、出力レジスターOUTではなく加算器ADD1からの出力を直接加算器ADD1に入力する。 Then, the multiplier MUL1 outputs the multiplication result to the adder ADD1 as a difference value from the previous product-sum operation value. This difference value corresponds to “(a j ′ −a j ) × b j ” (when the data of the value “a” is updated) in the above-described Expression 2. Subsequently, the adder ADD1 adds the difference value and the previous product-sum operation value held in the output register OUT, and outputs the result to the output register OUT. However, when input update data is input in successive clock cycles, if the previous product-sum operation value is input from the output register, it will not be in time for the next adder ADD1. Therefore, when update data is input in successive clock cycles, the selector SEL5 inputs the output from the adder ADD1 directly to the adder ADD1 instead of the output register OUT.

点線で囲んだ連続入力検出回路EC1は、連続するクロックサイクルで入力更新データが発生したか否かを判定する回路である。連続入力検出回路EC1は、遅延器DEL6及び論理積器AND1によって、Hレベルのwrite_0_0からwrite_0_7の論理s0またはwrite_1_0からwrite_1_7の論理和s1が連続することが検出されると、Hレベルのセレクト信号select5を出力する。つまり、連続するクロックサイクルで入力更新データが発生する場合はHレベルのセレクト信号select5を、そうでない場合はLレベルのセレクト信号select5を選択器SEL5に出力する。そして、選択器SEL5は、セレクト信号select5がHレベルの場合は加算器ADD1からの前回の出力を、セレクト信号select5がLレベルの場合は出力レジスターOUTからの出力を加算器ADD1に入力する。   The continuous input detection circuit EC1 surrounded by a dotted line is a circuit that determines whether or not input update data is generated in successive clock cycles. When the delay DEL6 and the AND circuit AND1 detect that the logic s0 from write_0_0 to write_0_7 or the logical sum s1 from write_1_0 to write_1_7 is detected by the delay unit DEL6 and the AND circuit AND1, the continuous input detection circuit EC1 selects the select signal select5 at H level. Is output. That is, when input update data is generated in successive clock cycles, an H level select signal select5 is output to the selector SEL5, and otherwise, an L level select signal select5 is output to the selector SEL5. The selector SEL5 inputs the previous output from the adder ADD1 to the adder ADD1 when the select signal select5 is at the H level and the output from the output register OUT when the select signal select5 is at the L level.

そして、遅延器DEL5は、データが入力されたことを表す論理和器LD1のHレベルの信号を積和演算値が算出されるタイミングに遅延させ、出力レジスターOUTに書き込み信号writeを出力する。なお、図6の積和演算器において、入力レジスター(レジスターR00〜R17)と出力レジスターOUTは、初期状態では「0」に初期化されているものとする。そして、これらのレジスターが一旦初期化された後、入力レジスターが保持する各データの積和演算値が出力レジスターに保持される間は、再度初期化が行われる必要はない。   Then, the delay unit DEL5 delays the H level signal of the OR circuit LD1 indicating that data has been input to the timing at which the product-sum operation value is calculated, and outputs the write signal write to the output register OUT. In the product-sum calculator of FIG. 6, it is assumed that the input registers (registers R00 to R17) and the output register OUT are initialized to “0” in the initial state. After these registers are once initialized, it is not necessary to perform initialization again while the product-sum operation value of each data held in the input register is held in the output register.

このように、図6の積和演算器は、前回の積和演算値に対して、更新された任意の要素データ(入力更新データ)に基づいて前回の積和演算値との差分値((a´−a)×b)を加算することによって、更新後の積和演算値を算出する。このため、図6の積和演算器は、演算対象の全ての値の要素データを積和演算し直す必要がなく、また、全ての入力更新データが対応するレジスターに蓄えられるのを待たずに演算を開始することができる。これにより、図6の積和演算器は、図2の積和演算器に対して、少ない処理サイクルで積和演算値を算出することができる。 As described above, the product-sum operation unit of FIG. 6 has a difference value ((()) from the previous product-sum operation value based on the updated arbitrary element data (input update data) with respect to the previous product-sum operation value. The updated product-sum operation value is calculated by adding a j ′ −a j ) × b j ). For this reason, the product-sum operation unit of FIG. 6 does not need to perform the product-sum operation again on the element data of all values to be calculated, and does not wait for all the input update data to be stored in the corresponding registers. The calculation can be started. Thereby, the product-sum operation unit shown in FIG. 6 can calculate the product-sum operation value with fewer processing cycles than the product-sum operation unit shown in FIG.

ところで、図6の積和演算器は、図2の積和演算器と同様に、入力レジスター及び出力レジスターを有する。ただし、図2の積和演算器は、入力レジスター及び出力レジスターがない場合でも演算可能であるのに対し、本実施の形態例の積和演算器は、入力レジスター及び出力レジスターがない場合は演算できない。というのも、図2の積和演算器では、入力更新データは入力レジスターを介さずに選択器SELA、SELBに出力されてもよく、加算器ADDの出力は出力レジスターOUTを介さずに出力されてもよい。それに対し、本実施の形態例の積和演算器は、前回データ及び前回の積和演算値を演算に用いるため、それらのデータを予め保持しておく入力レジスター及び出力レジスターは必要不可欠である。   By the way, the product-sum operation unit in FIG. 6 has an input register and an output register in the same manner as the product-sum operation unit in FIG. However, the product-sum operation unit of FIG. 2 can perform the operation even when there is no input register and output register, whereas the product-sum operation unit of the present embodiment performs the operation when there is no input register and output register. Can not. This is because, in the product-sum calculator of FIG. 2, the input update data may be output to the selectors SELA and SELB without passing through the input register, and the output of the adder ADD is output without passing through the output register OUT. May be. On the other hand, since the product-sum operation unit of the present embodiment uses the previous data and the previous product-sum operation value for the operation, the input register and the output register that hold the data in advance are indispensable.

図7は、図6の積和演算器をバスに接続する回路を表す図である。同図において、図3のバス接続回路と同じ部分については、同じ引用番号が付与されている。本実施の形態例における積和演算器のバス接続回路は、さらに、3つの信号(ライト信号write_0_0〜write_0_7s0、write_1_0からwrite_1_7の論理和s1、updateする組の番号s10)を生成して図6の演算回路に出力する。   FIG. 7 is a diagram showing a circuit for connecting the product-sum calculator of FIG. 6 to the bus. In the figure, the same reference numbers are assigned to the same parts as those of the bus connection circuit of FIG. The bus connection circuit of the product-sum operation unit in the present embodiment further generates three signals (write signals write_0_0 to write_0_7s0, logical sum s1 of write_1_0 to write_1_7, and the number s10 of the set to be updated) in FIG. Output to the arithmetic circuit.

図7のバス接続回路において、論理和器L10は、ライト信号write_0_0〜write_0_7の論理和に基づいてwrite_0_0からwrite_0_7の論理和s0を生成する。具体的に、ライト信号write_0_0〜write_0_7のいずれかの信号がHレベルの場合、write_0_0からwrite_0_7の論理和s0はHレベルとなる。同様にして、論理和器L20は、ライト信号write_1_0〜write_1_7の論理和に基づいてwrite_1_0からwrite_1_7の論理和s1を生成する。また、論理和器L00〜L07は、各論理和器に対応する組の信号(例えば、論理和器L00の場合、write_0_0、write_1_0)の論理和をそれぞれエンコーダーE1に出力する。エンコーダーE1は、Hレベルの信号を出力する論理和器を、updateする組の番号s10として数値化し、図6の積和演算器に出力する。   In the bus connection circuit of FIG. 7, the OR circuit L10 generates a logical sum s0 from write_0_0 to write_0_7 based on the logical sum of the write signals write_0_0 to write_0_7. Specifically, when any one of the write signals write_0_0 to write_0_7 is at H level, the logical sum s0 from write_0_0 to write_0_7 becomes H level. Similarly, the logical adder L20 generates a logical sum s1 from write_1_0 to write_1_7 based on the logical sum of the write signals write_1_0 to write_1_7. In addition, the logical adders L00 to L07 output the logical sum of a set of signals corresponding to each logical sumr (for example, write_0_0 and write_1_0 in the case of the logical sumr L00) to the encoder E1. The encoder E1 digitizes the logical adder that outputs the H level signal as the number s10 of the set to be updated, and outputs it to the product-sum calculator of FIG.

図8は、入力更新データとして「a´〜a´」が更新される場合の図6の積和演算器における動作波形を表す図である。ここでは入力更新データ「a´〜a´」と前回データである「b〜b」との積和演算が行われる。同図の例において、レジスターR00〜R07には前回データ「a〜a」が、レジスターR10〜R17には前回データ「b〜b」が、出力レジスターには前回の積和演算値「S 」が予め保持される。また、「d」は入力更新データ「a´」から当該入力更新データに対応する前回データ「a」の減算値「d(=a´−a)」であり、「q」は入力更新データに対応する組の値「b」の要素データと減算値「d」との乗算値「q(=d(=a´−a)×b)」である。そして、「S 8−i」は、「i」番目の組までの積和演算値を表す。 FIG. 8 is a diagram illustrating operation waveforms in the product-sum calculator of FIG. 6 when “a 0 ′ to a 7 ′” is updated as input update data. Here, a product-sum operation is performed on the input update data “a 0 ′ to a 7 ′” and “b 0 to b 7 ” which is the previous data. In the example of the figure, the previous data “a 0 to a 7 ” is stored in the registers R 00 to R 07, the previous data “b 0 to b 7 ” is stored in the registers R 10 to R 17, and the previous product-sum operation value is stored in the output register. “S 7 8 ” is held in advance. “D i ” is a subtraction value “d i (= a i ′ −a i )” of the previous data “a i ” corresponding to the input update data from the input update data “a i ′”, and “q i ”is a multiplication value“ q i (= d i (= a i ′ −a i ) × b i ) of element data of the set value “b i ” corresponding to the input update data and the subtraction value “d i ”. Is. “S 7 8-i ” represents a product-sum operation value up to the “i” -th set.

レジスターR00には、予め前回データ「a」が保持される。そして、入力信号inputとして「a´」が入力されると、選択器SEL1は、入力更新データ「a」に対応するupdateする組の番号s10(=0)に基づいて、レジスターR00が予め保持する前回データ「a」を次のクロックの立ち上がりタイミングで遅延器DEL2と減算器SUB1に出力する。同時に、ライト信号write_0_0に応答して、レジスターR00に「a´」が書き込まれる。 The register R00 holds the previous data “a 0 ” in advance. Then, when “a 0 ′” is input as the input signal input, the selector SEL 1 stores the register R 00 in advance based on the number s 10 (= 0) of the set to be updated corresponding to the input update data “a 0 ”. The previous data “a 0 ” to be held is output to the delay unit DEL2 and the subtracter SUB1 at the rising timing of the next clock. At the same time, “a 0 ′” is written to the register R00 in response to the write signal write_0_0.

減算器SUB1は、入力更新データ「a´」から、選択器SEL1から出力された前回データ「a」を減算し、減算値「d(=a´−a)」を選択器SEL3に出力する。また、入力更新データ「a´」はレジスターR00に対応するためwrite_0_0からwrite_0_7の論理和s0はHレベルとなり、遅延器DEL1はHレベルのセレクト信号select1を選択器SEL3に出力する。そのため、選択器SEL3は、Hレベルのセレクト信号select1に基づいて、減算器SUB1からの出力「d」を選択し乗算器MUL1に出力する。 The subtractor SUB1 subtracts the previous data “a 0 ” output from the selector SEL1 from the input update data “a 0 ′”, and selects the subtraction value “d 0 (= a 0 ′ −a 0 )”. Output to SEL3. Since the input update data “a 0 ′” corresponds to the register R00, the logical sum s0 of write_0_0 to write_0_7 becomes H level, and the delay unit DEL1 outputs the H level select signal select1 to the selector SEL3. Therefore, the selector SEL3 selects the output “d 0 ” from the subtractor SUB1 based on the H-level select signal select1, and outputs it to the multiplier MUL1.

一方、選択器SEL2は、updateする組の番号s10(=0)に基づいて、レジスターR10に保持された前回データ「b」を選択して減算器SUB2と遅延器DEL3に出力する。この場合、入力更新データ「a´」はレジスターR10〜R17には対応しないため、選択器SEL4にLレベルのセレクト信号select4が出力され、選択器SEL4は、セレクト信号select4に基づいて遅延器DEL3からの前回データ「b」を選択し乗算器MUL1に出力する。 On the other hand, the selector SEL2 selects the previous data “b 0 ” held in the register R10 based on the number s10 (= 0) of the set to be updated, and outputs it to the subtractor SUB2 and the delay device DEL3. In this case, since the input update data “a 0 ′” does not correspond to the registers R10 to R17, the L level select signal select4 is output to the selector SEL4, and the selector SEL4 receives the delay device DEL3 based on the select signal select4. The previous data “b 0 ” from is selected and output to the multiplier MUL1.

そして、次のクロックの立ち上がりタイミングで、乗算器MUL1は、選択器SEL3から出力された減算値「d」と、選択器SEL4から出力された前回データ「b」とを乗算し、乗算した値「q(=d(=a´−a)×b)」を加算器ADD1に出力する。この例では複数のデータa´〜a´が連続するクロックサイクルで入力されるものの入力更新データ「a´」は最初の入力である。そのため、連続入力検出回路EC1はLレベルのセレクト信号select5を選択器SEL5に出力し、選択器SEL5は、出力レジスターOUTから出力される前回の積和演算値「S 」を加算器ADD1に入力する。 Then, at the next clock rising timing, the multiplier MUL1 multiplies the subtraction value “d 0 ” output from the selector SEL3 by the previous data “b 0 ” output from the selector SEL4. The value “q 0 (= d 0 (= a 0 ′ −a 0 ) × b 0 )” is output to the adder ADD1. In this example, although a plurality of data a 0 ′ to a 7 ′ are input in successive clock cycles, the input update data “a 0 ′” is the first input. Therefore, the continuous input detection circuit EC1 outputs an L-level select signal select5 to the selector SEL5, and the selector SEL5 outputs the previous product-sum operation value “S 7 8 ” output from the output register OUT to the adder ADD1. input.

次のクロックの立ち上がりタイミングで、加算器ADD1は、乗算器MUL1から入力された前回の積和演算結果からの差分値「q」と前回の積和演算値「S 」とを加算し、加算値「S (=S +q)」を出力レジスターOUTに出力する。これにより、出力レジスターOUTに入力更新データ「a´」が反映された積和演算値「S 」が書き込まれる。 At the next clock rise timing, the adder ADD1 adds the difference value “q 0 ” from the previous product-sum operation result input from the multiplier MUL1 and the previous product-sum operation value “S 7 8 ”. The added value “S 7 7 (= S 7 8 + q 0 )” is output to the output register OUT. As a result, the product-sum operation value “S 7 7 ” reflecting the input update data “a 0 ′” is written to the output register OUT.

「a´」に続いて入力される入力更新データ「a´〜a´」についても同様である。ただし、「a´〜a´」の演算時は、連続クロックサイクルで入力更新データが発生する場合に該当するため、加算器ADD1は、入力更新データ「a´(i=1〜7)」に基づく差分値「q」と、加算器ADD1から出力された前回の積和演算値「S 8−i」とを加算し、出力レジスターOUTに出力する。そして、遅延器DEL5は、それぞれの入力更新データが反映された積和演算値が出力レジスターOUTに出力される都度、出力レジスターOUTに書き込み信号writeを出力する。 The same applies to the input update data “a 1 ′ to a 7 ′” input subsequent to “a 0 ′”. However, since the calculation of “a 1 ′ to a 7 ′” corresponds to the case where the input update data is generated in continuous clock cycles, the adder ADD1 uses the input update data “a i ′ (i = 1 to 7). The difference value “q i ” based on “)” and the previous product-sum operation value “S 7 8-i ” output from the adder ADD 1 are added and output to the output register OUT. The delay device DEL5 outputs a write signal “write” to the output register OUT each time a product-sum operation value reflecting each input update data is output to the output register OUT.

このように、本実施の形態例の積和演算器は、複数のデータを連続して入力する場合であっても、入力と演算のパイプライン処理によりそれぞれの入力更新データに基づく差分値を前回の積和演算値に順次加算することによって、それぞれ入力更新データに対応する更新後の積和演算値をその都度算出する。このため、本実施の形態例の積和演算値は、複数の入力更新データ「a´〜a´」がレジスターに蓄えられるのを待たずに演算を開始することができ、全ての入力更新データがレジスターに蓄えられるまでのデータ転送時間を要しない。これにより、図2の積和演算器が、積和演算値の演算にデータ「a´〜a´」が入力され始めてから20サイクル要するのに対し、本実施の形態例における積和演算器は12サイクルで積和演算値を算出することができる。 As described above, the product-sum operation unit according to the present embodiment, even when a plurality of pieces of data are continuously input, the difference value based on the respective input update data by the pipeline processing of the input and the operation is previously calculated. The product-sum operation values after updating corresponding to the input update data are calculated each time. For this reason, the product-sum operation value of the present embodiment can start the operation without waiting for a plurality of input update data “a 0 ′ to a 7 ′” to be stored in the register. Data transfer time is not required until update data is stored in the register. As a result, the product-sum operation unit of FIG. 2 takes 20 cycles after the data “a 0 ′ to a 7 ′” starts to be input for the operation of the product-sum operation value. The calculator can calculate the product-sum operation value in 12 cycles.

図9は、入力更新データとして「a´」のみが更新される場合の図6の積和演算器における動作波形を表す図である。図8と同様にして、レジスターR00〜R07には前回データ「a〜a」が、レジスターR10〜R17には前回データ「b〜b」が、出力レジスターには前回の積和演算値「S」が予め保持される。「d」、「q」については図8と同様であり、「S」は前回の積和演算値を、「S´」は更新後の積和演算値を表す。 FIG. 9 is a diagram illustrating operation waveforms in the product-sum operation unit in FIG. 6 when only “a 2 ′” is updated as input update data. As in FIG. 8, the previous data “a 0 to a 7 ” is stored in the registers R 00 to R 07, the previous data “b 0 to b 7 ” is stored in the registers R 10 to R 17, and the previous product-sum operation is performed in the output register. The value “S 7 ” is held in advance. “D i ” and “q i ” are the same as those in FIG. 8, “S 7 ” represents the previous product-sum operation value, and “S 7 ′” represents the updated product-sum operation value.

入力信号inputとして「a´」が入力されると、選択器SEL1は、入力更新データ「a´」に対応するupdateする組の番号s10(=2)に基づいて、レジスターR02が予め保持する前回データ「a」を次のクロックの立ち上がりタイミングで遅延器DEL2と減算器SUB1に出力する。同時に、ライト信号write_0_2に応答して、レジスターR02に「a´」が書き込まれる。 When “a 2 ′” is input as the input signal input, the selector SEL 1 holds in advance the register R 02 based on the number s 10 (= 2) of the set to be updated corresponding to the input update data “a 2 ′”. The previous data “a 2 ” to be output is output to the delay unit DEL2 and the subtracter SUB1 at the rising timing of the next clock. At the same time, “a 2 ′” is written to the register R02 in response to the write signal write_0_2.

減算器SUB1は、入力更新データ「a´」から、選択器SEL1から出力された前回データ「a」を減算し、減算値「d(=a´−a)」を選択器SEL3に出力する。そして、選択器SEL3は、遅延器DEL1からのHレベルのセレクト信号select3に基づいて、減算器SUB1からの出力「d」を選択し乗算器MUL1に出力する。一方、選択器SEL4は、遅延器DEL4からのLレベルのセレクト信号select4に基づいて、遅延器DEL3からの前回データ「b」を選択し乗算器MUL1に出力する。 The subtractor SUB1 subtracts the previous data “a 2 ” output from the selector SEL1 from the input update data “a 2 ′”, and selects the subtraction value “d 2 (= a 2 ′ −a 2 )”. Output to SEL3. Then, the selector SEL3 selects the output “d 2 ” from the subtractor SUB1 based on the H level select signal select3 from the delay device DEL1, and outputs it to the multiplier MUL1. On the other hand, the selector SEL4 selects the previous data “b 2 ” from the delay device DEL3 based on the L level select signal select4 from the delay device DEL4, and outputs it to the multiplier MUL1.

そして、次のクロックの立ち上がりタイミングで、乗算器MUL1は、選択器SEL3から出力された減算値「d」と、選択器SEL4から出力された前回データ「b」とを乗算し、乗算値「q(=(d(=a´−a)×b)」を加算器ADD1に出力する。この例は、連続するクロックサイクルで入力更新データが発生しない場合に該当するため、選択器SEL5は出力レジスターOUTから出力される前回の積和演算値「S」を加算器ADD1に入力する。そして、加算器ADD1は、次のクロックの立ち上がりタイミングで、前回の積和演算値「S」と乗算器MUL1からの出力「q」とを加算し、加算値「S´(=S+q)」を出力レジスターOUTに出力する。 At the next clock rising timing, the multiplier MUL1 multiplies the subtraction value “d 2 ” output from the selector SEL3 by the previous data “b 2 ” output from the selector SEL4, and the multiplied value. “Q 2 (= (d 2 (= a 2 ′ −a 2 ) × b 2 )” is output to the adder ADD 1. This example corresponds to a case where no input update data is generated in successive clock cycles. The selector SEL5 inputs the previous product-sum operation value “S 7 ” output from the output register OUT to the adder ADD1, and the adder ADD1 performs the previous product-sum operation at the rising timing of the next clock. The value “S 7 ” and the output “q 2 ” from the multiplier MUL 1 are added, and the added value “S 7 ′ (= S 7 + q 2 )” is output to the output register OUT.

このように、本実施の形態例の積和演算器は、演算対象の全ての値の要素データを積和演算し直す必要がなく、入力更新データ「a´」がレジスターR02に蓄えられるのを待たずに演算を開始することができるため、特に、一部の要素「a2´」だけが更新された場合に、より少ない処理サイクルで積和演算値を算出することができる。これにより、図2の積和演算器が積和演算値の演算にデータ「a´」が入力され始めてから13サイクル要していたのに対し、本実施の形態例における積和演算器は5サイクルで積和演算値を算出することができる。 As described above, the product-sum operation unit of the present embodiment does not need to perform the product-sum operation again on the element data of all values to be calculated, and the input update data “a 2 ′” is stored in the register R02. Since the calculation can be started without waiting for the calculation, the product-sum calculation value can be calculated with fewer processing cycles, particularly when only a part of the element “a 2 ′” is updated. As a result, the product-sum operation unit in FIG. 2 takes 13 cycles after the data “a 2 ′” starts to be input for the calculation of the product-sum operation value. The product-sum operation value can be calculated in 5 cycles.

従って、本実施の形態例の積和演算器は、演算対象の全ての要素データがレジスターに蓄えられるまでのデータ転送時間、及び、全ての要素データの演算時間を要しないことにより、図2の積和演算器に対してより少ない処理サイクルで積和演算値を算出することができる。   Therefore, the product-sum calculator of the present embodiment does not require the data transfer time until all the element data to be calculated are stored in the register and the calculation time of all the element data. The product-sum operation value can be calculated with fewer processing cycles than the product-sum operation unit.

<第2の実施の形態例>
第1の実施の形態例では、2つの値「a」「b」の積和演算値を算出する積和演算器について述べたが、第2の実施の形態例では、さらに、値「c」を加えた値「a」「b」「c」の積和演算値を演算する積和演算器について述べる。第2の実施の形態例の積和演算器は、次の式3に基づいて積和演算値を算出する。
<Second Embodiment>
In the first embodiment, the product-sum operation unit that calculates the product-sum operation value of the two values “a” and “b” has been described. However, in the second embodiment, the value “c” is further provided. A product-sum operation unit that calculates the product-sum operation value of the values “a”, “b”, and “c” added with the above will be described. The product-sum operation unit according to the second embodiment calculates a product-sum operation value based on the following Equation 3.

Figure 2012069081
Figure 2012069081

式3における、値「a」、値「a´」及び、値「b」については、式2と同様である。ただし、式3において、「S」は「a」と「b」と「c」の積和演算値(以下、前回の積和演算値)であり、「S´」は「a´」と「b」と「c」との積和演算値(以下、更新後の積和演算値)を表す。式3において、更新後の積和演算値「S´」は、前回の積和演算値「S」に対して、差分値「(a´−a)×b×c」が加算されることによって算出される。 The value “a”, the value “a ′”, and the value “b” in Equation 3 are the same as those in Equation 2. However, in Equation 3, “S” is the product-sum operation value of “a”, “b”, and “c” (hereinafter, the previous product-sum operation value), and “S ′” is “a ′” and “ The product-sum operation value of “b” and “c” (hereinafter, the product-sum operation value after update) is represented. In Equation 3, the updated product-sum operation value “S ′” is obtained by adding the difference value “(a j ′ −a j ) × b j × c j ” to the previous product-sum operation value “S”. To be calculated.

図10は、式3において「n=8」とした場合の本実施の形態例における積和演算器の一例を表す図である。図6と同様に、同図の積和演算器では、値「a」の各要素a〜aはレジスターR00〜R07に、値「b」の各要素b〜bはレジスターR10〜R17に、値「c」の各要素c〜cはレジスターR20〜R27に格納される。また、本実施の形態例における積和演算器は、入力レジスター(レジスターR00〜R27)に前回データを、出力レジスターOUTに前回の積和演算値を保持する。 FIG. 10 is a diagram illustrating an example of a product-sum calculator in the present embodiment when “n = 8” in Equation 3. 6, in the product-sum calculator of FIG. 6, each element a 0 to a 7 of the value “a” is stored in the registers R 00 to R 07, and each element b 0 to b 7 of the value “b” is stored in the registers R 10 to R 10. In R17, each element c 0 to c 7 of the value “c” is stored in the registers R20 to R27. In addition, the product-sum calculator in the present embodiment holds the previous data in the input register (registers R00 to R27) and the previous product-sum operation value in the output register OUT.

また、図10の積和演算器において、図6と同じ部分については同様の引用番号が付与される。同図の積和演算器は、さらに、レジスターR20〜R27、write_2_0からwrite_2_7の論理和s2、選択器SEL6、SEL7、減算器SUB3、遅延器DEL7、DEL8を有する。write_2_0からwrite_2_7の論理和s2はレジスターR20〜R27のいずれかに格納される入力更新データの有無を表す。また、同図の積和演算器では、入力信号inputとして、値「a」「b」「c」のいずれかの更新データが入力される。   In the product-sum calculator of FIG. 10, the same reference numbers are assigned to the same parts as those of FIG. The product-sum operation unit shown in the figure further includes registers R20 to R27, logical sum s2 of write_2_0 to write_2_7, selectors SEL6 and SEL7, subtractor SUB3, delay units DEL7 and DEL8. The logical sum s2 from write_2_0 to write_2_7 represents the presence or absence of input update data stored in any of the registers R20 to R27. In addition, in the product-sum operation unit of the same figure, update data of values “a”, “b”, and “c” is input as the input signal input.

図10の積和演算器の動作は、図6と同様である。同10の積和演算器では、値「a」「b」「c」のいずれかのデータが入力されるため、例えば、値「a´」のデータが入力された場合、write_0_0からwrite_0_7の論理和s0はHレベル、write_1_0からwrite_1_7の論理和s1、及びwrite_2_0からwrite_2_7の論理和s2はLレベルとなる。従って、乗算器MUL1は、値「a」に係る選択器SEL3による減算器SUB1からの減算値(a´−a)と、値「b」に係る選択器SEL4による遅延器DEL3からの前回データ(b)と、値「c」に係る選択器SEL7による遅延器DEL7からの前回データ(c)とを乗算する。 The operation of the product-sum calculator of FIG. 10 is the same as that of FIG. In the same 10 product-sum operation unit, any one of the values “a”, “b”, and “c” is input. For example, when data of the value “a ′” is input, the logic of write_0_0 to write_0_7 The sum s0 is at the H level, the logical sum s1 from write_1_0 to write_1_7, and the logical sum s2 from write_2_0 to write_2_7 is at the L level. Accordingly, the multiplier MUL1 includes the subtraction value (a j ′ −a j ) from the subtractor SUB1 by the selector SEL3 related to the value “a” and the previous time from the delay DEL3 by the selector SEL4 related to the value “b”. The data (b j ) is multiplied by the previous data (c j ) from the delay device DEL 7 by the selector SEL 7 related to the value “c”.

そして、乗算器MUL1は、乗算結果を前回の積和演算値からの差分値として加算器ADD1に出力する。この差分値は、上述した式3における「(a´−a)×b×c」に対応する。そして、加算器ADD1は、当該差分値と、出力レジスターOUTまたは前回の加算器ADD1からの出力のいずれかを加算し、更新後の積和演算値として出力レジスターOUTに出力する。 Then, the multiplier MUL1 outputs the multiplication result to the adder ADD1 as a difference value from the previous product-sum operation value. This difference value corresponds to “(a j ′ −a j ) × b j × c j ” in Expression 3 described above. The adder ADD1 adds the difference value and either the output register OUT or the previous output from the adder ADD1, and outputs the result as an updated product-sum operation value to the output register OUT.

このように、本実施の形態例の積和演算器は、値「a」「b」に、さらに値「c」を加えた3つの値の積和演算値についても、図6の積和演算器と同様に、入力と演算のパイプライン処理により、前回の積和演算値に対して、更新された任意の要素データ(入力更新データ)に基づく前回の積和演算値との差分値を加算することによって、更新後の積和演算値を算出する。このため、積和演算器は、演算対象の全ての値「a」「b」「c」の要素データを積和演算し直す必要がなく、また、全ての入力更新データが対応するレジスターに蓄えられるのを待たずに演算を開始することができる。   As described above, the product-sum operation unit of the present embodiment also uses the product-sum operation of FIG. 6 for the product-sum operation value of three values obtained by adding the value “c” to the values “a” and “b”. In the same way as the unit, the difference between the previous product-sum operation value based on the updated arbitrary element data (input update data) is added to the previous product-sum operation value by pipeline processing of input and operation By doing so, an updated product-sum operation value is calculated. For this reason, the product-sum operation unit does not need to perform the product-sum operation again on the element data of all the values “a”, “b”, and “c” to be calculated, and stores all the input update data in the corresponding registers. The computation can be started without waiting for it.

これにより、本実施の形態例の積和演算器は、3つの値の積和演算値を算出する場合についても、演算対象の全ての要素データがレジスターに蓄えられるまでのデータ転送時間、及び、全ての要素データの演算時間を要しないことにより、より少ない処理サイクルで積和演算値を算出することができる。なお、本実施の形態例では3つの値の積和演算を行う場合について述べたが、本実施の形態例の積和演算器は、4つ以上の値の積和演算を行う場合にも有効である。   Thereby, the product-sum operation unit of the present embodiment also calculates the data transfer time until all the element data to be calculated are stored in the register, even when calculating the product-sum operation value of the three values, and By not requiring calculation time for all the element data, the product-sum operation value can be calculated with fewer processing cycles. In the present embodiment, the case where the product-sum operation of three values is performed has been described. However, the product-sum operation unit of the present embodiment is also effective when performing the product-sum operation of four or more values. It is.

<第3の実施の形態例>
第1の実施の形態例では、値「a」「b」のいずれかの要素データが入力される積和演算器について述べたが、第3の実施の形態例では、値「a」「b」の同組の要素データが同時に入力される積和演算器について述べる。
<Third Embodiment>
In the first embodiment, the product-sum operation unit to which any element data of the values “a” and “b” is input has been described. In the third embodiment, the values “a” and “b” are described. The sum-of-products calculator to which the same set of element data of "

第3の実施の形態例の積和演算器は、次の式4に基づいて積和演算値を算出する。式4において、値「a」、「a´」は式2と同様であり、値「b´=(b´,b´,b´,…,an−1´)」は前回積和演算された古い値「b=(b,b,b,…,bn−1)」である前回データに対してj番目の要素が更新されているものとする。そして、「S」は「a」と「b」の積和演算値(以下、前回の積和演算値)であり、「S´」は「a´」と「b´」の積和演算値(以下、更新後の積和演算値)を表す。 The product-sum operation unit of the third embodiment calculates a product-sum operation value based on the following equation 4. In Expression 4, the values “a” and “a ′” are the same as those in Expression 2, and the values “b ′ = (b 0 ′, b 1 ′, b 2 ′,..., A n−1 ′)” are the previous time. It is assumed that the j-th element is updated with respect to the previous data which is the old value “b = (b 0 , b 1 , b 2 ,..., B n−1 )” obtained by the product-sum operation. “S” is the product-sum operation value of “a” and “b” (hereinafter, the previous product-sum operation value), and “S ′” is the product-sum operation value of “a ′” and “b ′”. (Hereinafter referred to as an updated product-sum operation value).

Figure 2012069081
Figure 2012069081

式4では、式2と同様に、更新後の積和演算値「S´」を、前回の積和演算値「S」に、「S´」と「S」の差分値を加算することによって求める。具体的に、更新後の積和演算値「S´」は、前回の積和演算値「S」から値「a」「b」のj番目の要素の乗算値「a×b」を減算し、値「a´」「b´」のj番目の要素の乗算値「a´×b´」を加算した値(S´=S−(a×b)+(a´×b´))である。従って、更新後の積和演算値「S´」は、前回の積和演算値「S」に差分値「−(a×b)+(a´×b´)」が加算されることにより算出される。 In Equation 4, as in Equation 2, the updated product-sum operation value “S ′” is added to the previous product-sum operation value “S” by adding the difference value between “S ′” and “S”. Ask. Specifically, the updated product-sum operation value “S ′” is obtained by multiplying the multiplication value “a j × b j ” of the j-th element of the values “a” and “b” from the previous product-sum operation value “S”. A value obtained by subtracting and adding the multiplication value “a j ′ × b j ′” of the j-th element of the values “a ′” and “b ′” (S ′ = S− (a j × b j ) + (a j '× b j ')). Accordingly, the updated product-sum operation value “S ′” is obtained by adding the difference value “− (a j × b j ) + (a j ′ × b j ′)” to the previous product-sum operation value “S”. Is calculated.

式1と式4とを比較すると、値の一部の要素が更新される場合、式1に対して式4の演算量は少ない。従って、式4は、式1に対してより少ない処理サイクルで更新後の積和演算値「S」を算出することができる。   Comparing Expression 1 and Expression 4, when some elements of the value are updated, the amount of calculation of Expression 4 is smaller than Expression 1. Therefore, Equation 4 can calculate the updated product-sum operation value “S” with fewer processing cycles than Equation 1.

図11は、式4において「n=8」とした場合の本実施の形態例における積和演算器の一例を表す図である。図6の積和演算器と同様に、同図の積和演算器では、値「a」の各要素a〜aはレジスターR00〜R07に格納され、値「b」の各要素b〜bはレジスターR10〜R17に格納される。また、同図の積和演算器では、各入力レジスターに前回データを、出力レジスターOUTに前回の積和演算値を保持する。また、同図の積和演算器には、値「a」「b」の同じ組の更新後のデータが同時に入力されるため、値「a」に対応する入力信号input_0と、値「b」に対応する入力信号inout_1とが入力される。 FIG. 11 is a diagram illustrating an example of a product-sum calculator in the present embodiment when “n = 8” in Equation 4. Similar to the product-sum operation unit in FIG. 6, in the product-sum operation unit in FIG. 6, the elements a 0 to a 7 of the value “a” are stored in the registers R 00 to R 07 and the elements b 0 of the value “b” ~b 7 is stored in the register R10-R17. In the product-sum operation unit shown in the figure, the previous data is stored in each input register, and the previous product-sum operation value is held in the output register OUT. Furthermore, since the updated data of the same set of values “a” and “b” are simultaneously input to the product-sum calculator of FIG. 23, the input signal input_0 corresponding to the value “a” and the value “b” And an input signal inout_1 corresponding to.

図11の積和演算器において、入力信号input_0として、値「a」に係る入力更新データが入力されると、入力更新データを書き込む前に、選択器SEL1はupdateする組の番号s10に対応するレジスターが予め保持する前回データを選択器SEL8と乗算器MUL3とに出力する。同時に、入力更新データに対応するレジスターがライト信号write_0_0〜write_0_7に応答して、対応するレジスターR00〜R07に入力更新データが書き込まれる。   In the product-sum calculator of FIG. 11, when input update data related to the value “a” is input as the input signal input_0, the selector SEL1 corresponds to the number s10 of the set to be updated before writing the input update data. The previous data held in the register in advance is output to the selector SEL8 and the multiplier MUL3. At the same time, the registers corresponding to the input update data are written in the corresponding registers R00 to R07 in response to the write signals write_0_0 to write_0_7.

同様にして、入力信号input_0と同じ組のデータであって、値「b」に係るデータが入力信号input_1として入力されると、入力更新データを書き込む前に、選択器SEL2はupdateする組の番号s10に対応するレジスターが予め保持する前回データを選択器SEL9と乗算器MUL3とに出力する。同時に、入力更新データに対応するレジスターがライト信号write_1_0〜write_1_7に応答して、対応するレジスターR10〜R17に入力更新データが書き込まれる。   Similarly, when the data of the same set as the input signal input_0 and the data related to the value “b” is input as the input signal input_1, the selector SEL2 updates the number of the set to be updated before writing the input update data. The previous data held in advance in the register corresponding to s10 is output to the selector SEL9 and the multiplier MUL3. At the same time, the registers corresponding to the input update data are written to the corresponding registers R10 to R17 in response to the write signals write_1_0 to write_1_7.

続いて、選択器SEL8は、セレクト信号select8(write_0_0からwrite_0_7の論理和s0)に基づいて、入力更新データinput_0と、選択器SEL1から出力された入力更新データに対応する前回データのいずれかを選択し乗算器MUL2に出力する。具体的に、選択器SEL8は、セレクト信号select8がHレベルの場合は入力更新データinput_0を、セレクト信号select8がLレベルの場合は選択器SEL1から出力された前回データを乗算器MUL2に出力する。選択器SEL9についても同様である。   Subsequently, the selector SEL8 selects either the input update data input_0 or the previous data corresponding to the input update data output from the selector SEL1 based on the select signal select8 (logical sum s0 of write_0_0 to write_0_7). Output to the multiplier MUL2. Specifically, the selector SEL8 outputs the input update data input_0 to the multiplier MUL2 when the select signal select8 is at the H level and the previous data output from the selector SEL1 when the select signal select8 is at the L level. The same applies to the selector SEL9.

前述したとおり、本実施の形態例の積和演算器では、値「a」「b」の同組のデータが同時に入力されるため、write_0_0からwrite_0_7の論理和s0と、write_1_0からwrite_1_7の論理和s1とが、同時にHレベルとなる。この場合、乗算器MUL2は、両入力更新データinput_0、input_1を乗算した乗算値を(a´×b´)、乗算器MUL3は両入力更新データに対応する前回データを乗算した乗算値(a×b)を、それぞれ減算器SUB4に出力する。 As described above, the product-sum operation unit of the present embodiment inputs the same set of data of the values “a” and “b” at the same time, so the logical sum s0 from write_0_0 to write_0_7 and the logical sum of write_1_0 to write_1_7. s1 becomes H level at the same time. In this case, the multiplier MUL2 multiplies the input update data input_0 and input_1 by multiplication (a j ′ × b j ′), and the multiplier MUL3 multiplies the previous data corresponding to both input update data by the multiplication value ( a j × b j ) are output to the subtracter SUB4.

そして、減算器SUB4は、乗算器MUL2が出力する両入力更新データの乗算値(a´×b´)から、乗算器MUL3からの出力である各前回データの乗算値(a×b)を減算し、前回の積和演算結果からの差分値として加算器ADD1に出力する。この差分値は、上述した式4における「−(a×b)+(a´×b´)」に対応する。そして、加算器ADD1は、当該差分値と、出力レジスターOUTまたは前回の加算器ADD1からの出力のいずれかを加算し、更新後の積和演算値として出力レジスターOUTに出力する。 Then, subtractor SUB4 is the multiplier MUL2 multiplies values of the two input update data is outputted from the (a j '× b j' ), multiplied values of the previous data is output from the multiplier MUL3 (a j × b j ) is subtracted and output to the adder ADD1 as a difference value from the previous product-sum operation result. This difference value corresponds to “− (a j × b j ) + (a j ′ × b j ′)” in Expression 4 described above. The adder ADD1 adds the difference value and either the output register OUT or the previous output from the adder ADD1, and outputs the result as an updated product-sum operation value to the output register OUT.

このように、本実施の形態例の積和演算器は、値「a」「b」の任意の同組の要素データ(入力更新データ)を同時に更新する場合の積和演算値において、入力と演算のパイプライン処理により、前回の積和演算値に入力更新データに基づく前回の積和演算値との差分値を加算することにより、更新後の積和演算値を順次算出することができる。このため、積和演算器は、演算対象の全ての組の要素データを積和演算し直す必要がなく、また、全ての入力更新データが対応するレジスターに蓄えられるのを待たずに演算を開始することができる。   As described above, the product-sum operation unit according to the present embodiment has an input and a product-sum operation value in the case of simultaneously updating any of the same set of element data (input update data) of the values “a” and “b”. By adding the difference value from the previous product-sum operation value based on the input update data to the previous product-sum operation value by the operation pipeline processing, the updated product-sum operation value can be sequentially calculated. For this reason, the product-sum operation unit does not need to perform the product-sum operation again on all the sets of element data to be calculated, and does not wait for all the input update data to be stored in the corresponding register. can do.

これにより、本実施の形態例の積和演算器は、値「a」「b」の任意の同組の要素データを同時に更新する場合において、演算対象の全ての要素データがレジスターに蓄えられるまでのデータ転送時間、及び、全ての要素データの演算時間を要しないことにより、より少ない処理サイクルで積和演算値を算出することができる。   As a result, the product-sum operation unit according to the present embodiment, when updating any element data of the same set of values “a” and “b” at the same time, until all the element data to be calculated are stored in the register. Therefore, the product-sum operation value can be calculated with fewer processing cycles.

<第4の実施の形態例>
第1の実施の形態例では、1セットの入力レジスター及び出力レジスターを有する積和演算器について述べたが、第4の実施の形態例では、複数の入力レジスター及び出力レジスター(以下、レジスターセット)を保持する積和演算器について述べる。第4の実施の形態例では、例えば、mセットの入力レジスター(レジスターR00_i〜R17_i(0≦i≦m−1))及び出力レジスター(OUT_i)を有する。そして、それぞれのレジスターセットに共有の演算部により、各レジスターセットの値「a」「b」の積和演算を行う。
<Fourth embodiment>
In the first embodiment, the product-sum operation unit having one set of input registers and output registers has been described. However, in the fourth embodiment, a plurality of input registers and output registers (hereinafter referred to as register sets) are used. A product-sum operation unit that holds In the fourth embodiment, for example, m sets of input registers (registers R00_i to R17_i (0 ≦ i ≦ m−1)) and output registers (OUT_i) are included. Then, a product-sum operation of the values “a” and “b” of each register set is performed by an arithmetic unit shared by each register set.

図12は、第4の実施の形態例における積和演算器の一例を表す図である。同図の積和演算器は、さらに、updateするレジスターセットの番号s20を有する。updateするレジスターセットの番号s20とは、積和演算対象のレジスターセットの識別番号である。また、同図の積和演算器では、入力信号inputとして、updateするレジスターセットの番号s20で指定されたレジスターセットの値「a」「b」のいずれかの更新後のデータが入力される。   FIG. 12 is a diagram illustrating an example of a product-sum calculator in the fourth embodiment. The product-sum calculator of FIG. 6 further has a register set number s20 to be updated. The register set number s20 to be updated is an identification number of the register set subject to the product-sum operation. Further, in the product-sum operation unit in the figure, as the input signal input, the updated data of any of the register set values “a” and “b” designated by the register set number s20 to be updated is input.

図12の積和演算値において、入力信号inputとしてデータが入力される際に、updateするレジスターセットの番号s20に基づいて、積和演算対象のレジスターセットが選択される。そして、updateするレジスターセットの番号s20で指定されたレジスターセットのレジスターR00_i〜R17_iに保持された前回データが選択器SEL1、SEL2を介して遅延器DEL2、DEL3及び減算器SUB1、SUB2に出力されると共に、当該レジスターに入力更新データが書き込まれる。その後、乗算器MUL1の差分値の演算処理までは、図6の積和演算器と同様である。   In the product-sum operation value of FIG. 12, when data is input as the input signal input, the register set subject to product-sum operation is selected based on the register set number s20 to be updated. The previous data held in the registers R00_i to R17_i of the register set designated by the register set number s20 to be updated is output to the delay units DEL2, DEL3 and the subtracters SUB1, SUB2 via the selectors SEL1, SEL2. At the same time, the input update data is written to the register. Thereafter, the processing up to the calculation of the difference value of the multiplier MUL1 is the same as that of the product-sum operation unit of FIG.

続いて、加算器ADD1は、乗算器MUL1から出力された差分値と、連続入力検出回路EC2の出力するセレクト信号select11に基づく前回の積和演算値とを加算する。連続入力検出回路EC2は、連続するクロックサイクルでデータが入力されたか否かに加え、updateするレジスターセットの番号c20が1つ前のクロックサイクルと同じか否かを判定する。連続入力検出回路EC2は、2つの条件が真の場合、選択器SEL11にHレベルのセレクト信号select11を出力し、2つの条件のいずれかまたは両方が真ではない場合は、選択器SEL11にLレベルのセレクト信号select11を出力する。   Subsequently, the adder ADD1 adds the difference value output from the multiplier MUL1 and the previous product-sum operation value based on the select signal select11 output from the continuous input detection circuit EC2. The continuous input detection circuit EC2 determines whether or not the register set number c20 to be updated is the same as the previous clock cycle, in addition to whether or not data is input in successive clock cycles. The continuous input detection circuit EC2 outputs an H level select signal select11 to the selector SEL11 when the two conditions are true, and outputs an L level to the selector SEL11 when either or both of the two conditions are not true. The select signal select11 is output.

そして、選択器SEL11は、Hレベルのセレクト信号select11が出力された場合、加算器ADD1からの出力を再度加算器ADD1に入力し、Lレベルのセレクト信号select11が出力された場合、遅延器DEL9から入力されたupdateするレジスターセットの番号s20に基づく出力レジスターOUT_iが保持する前回の積和演算値を、加算器ADD1に入力する。つまり、加算器ADD1は、連続するクロックサイクルで入力更新データが発生し、かつ、1つ前のクロックサイクルとレジスターセット番号が同じである場合は加算器ADD1の前回の出力を、それ以外の場合はレジスターセット番号に対応する出力レジスターOUT_iの出力を、前回の積和演算値として入力とする。   The selector SEL11 inputs the output from the adder ADD1 to the adder ADD1 again when the H level select signal select11 is output, and from the delay unit DEL9 when the L level select signal select11 is output. The previous product-sum operation value held in the output register OUT_i based on the input register set number s20 to be updated is input to the adder ADD1. In other words, the adder ADD1 outputs the previous output of the adder ADD1 when input update data is generated in successive clock cycles and the register set number is the same as the previous clock cycle, otherwise Takes the output of the output register OUT_i corresponding to the register set number as the previous product-sum operation value.

そして、遅延器DEL10は、updateするレジスターセットの番号s20を入力更新データに対応する積和演算値が算出されるタイミングに遅延させ、updateするレジスターセットの番号s20に基づく出力レジスターOUT_iを選択し書き込み信号writeを出力する。   Then, the delay unit DEL10 delays the register set number s20 to be updated at the timing when the product-sum operation value corresponding to the input update data is calculated, and selects and writes the output register OUT_i based on the register set number s20 to be updated. Output signal write.

このように、本実施の形態例の積和演算器は、複数のレジスターセットを有し、更新された任意の要素データ(入力更新データ)に対応するレジスターセットの積和演算値を算出する場合についても、入力と演算のパイプライン処理により、前回の積和演算値に対して、入力更新データに基づく前回の積和演算値との差分値を加算することによって、当該レジスターセットの更新後の積和演算値を算出することができる。このため、積和演算器は、演算対象の全ての値の要素データを積和演算し直す必要がなく、また、全ての入力更新データが対応するレジスターに蓄えられるのを待たずに演算を開始することができる。   As described above, the product-sum operation unit according to the present embodiment has a plurality of register sets, and calculates the product-sum operation value of the register set corresponding to the updated arbitrary element data (input update data). In addition, by adding the difference value from the previous product-sum operation value based on the input update data to the previous product-sum operation value by the pipeline processing of input and operation, the updated register set is updated. A product-sum operation value can be calculated. For this reason, the product-sum operation unit does not need to perform the product-sum operation again on the element data of all values to be calculated, and also starts the operation without waiting for all the input update data to be stored in the corresponding register. can do.

これにより、本実施の形態例の積和演算器は、演算対象の全ての要素データがレジスターに蓄えられるまでのデータ転送時間、及び、全ての要素データの演算時間を要しないことにより、複数のレジスターセットそれぞれの値「a」「b」の積和演算値をより少ない処理サイクルで高速に算出することができる。   As a result, the product-sum calculator of the present embodiment does not require the data transfer time until all the element data to be calculated are stored in the register, and the calculation time of all the element data. The product-sum operation value of the values “a” and “b” of each register set can be calculated at a high speed with fewer processing cycles.

<第5の実施の形態例>
図13、図14は、第5の実施の形態例における積和演算器の一例を表す図である。本実施の形態例は、図13の演算回路と、m個の図14の演算回路を有する。図13の演算回路は、入力信号data_0、data_iを、各図14の演算回路に出力する。入力信号data_0は入力更新データに対応する第1のレジスターセット(レジスターR00〜R07)の前回データであり、入力信号data_iは入力更新データに対応する第2のレジスターセット(レジスターR10_i〜R17_i(1≦i≦m))の前回データである。
<Fifth Embodiment>
FIG. 13 and FIG. 14 are diagrams illustrating an example of a product-sum calculator in the fifth embodiment. This embodiment has the arithmetic circuit in FIG. 13 and m arithmetic circuits in FIG. The arithmetic circuit in FIG. 13 outputs the input signals data_0 and data_i to the arithmetic circuits in FIG. The input signal data_0 is the previous data of the first register set (registers R00 to R07) corresponding to the input update data, and the input signal data_i is the second register set (registers R10_i to R17_i (1 ≦ 1) corresponding to the input update data. i ≦ m)).

第5の実施の形態例では、1組の第1のレジスターセット(レジスターR00〜R07)と、m組の第2のレジスターセット(レジスターR10_i〜R17_i)及び出力レジスターOUT_iを有する積和演算器について述べる。第5の実施の形態例では、例えば、m個の第2のレジスターセットの値と、第2のレジスターセットそれぞれに共有の第1のレジスターセットの値とをそれぞれ積和したm個の積和演算値を出力レジスターOUT_iに出力する。本実施の形態例における積和演算器は、例えば、行列とベクトルとの積を求める場合に有効である。この場合、第1のレジスターセットはベクトルに当たり、m個の第2のレジスターセットは「m×8」行列に当たる。   In the fifth embodiment, a product-sum operation unit having one set of first register sets (registers R00 to R07), m sets of second register sets (registers R10_i to R17_i), and an output register OUT_i. State. In the fifth embodiment, for example, m product sums obtained by multiplying and summing the values of m second register sets and the values of the first register set shared by the second register sets, respectively. The calculated value is output to the output register OUT_i. The product-sum operation unit in the present embodiment is effective, for example, when obtaining a product of a matrix and a vector. In this case, the first register set corresponds to a vector, and the m second register sets correspond to an “m × 8” matrix.

Figure 2012069081
Figure 2012069081

式5は、第2のレジスターセットを「m×8」行列(b1,0,b1,1,……,bm,7)、第1のレジスターセットをベクトル(a,a,…,a)とした場合の行列とベクトルの積の演算を表す式である。式5の演算では、行列の各行とベクトルの演算「(bi,0×a)+(bi,1×a)+…+(bi,7×a)」が行われ、「output_i」として算出される。 Equation 5 represents the second register set as an “m × 8” matrix (b 1 , 0 , b 1 , 1 ,..., B m, 7 ), and the first register set as a vector (a 0 , a 1 , .., A 7 ) is an expression representing the operation of the product of a matrix and a vector. In the calculation of Equation 5, each matrix row and vector calculation “(b i, 0 × a 0 ) + (b i, 1 × a 1 ) +... + (B i, 7 × a 7 )” is performed, Calculated as “output_i”.

図13は、入力更新データに対応する各レジスターセットの前回データdata_0、data_iを出力する演算回路である。同図の演算回路において、第1のレジスターセット(レジスターR00〜R07)または第2のレジスターセット(レジスターR10_i〜R17_i)のいずれかの値が入力される。同図の演算回路において、入力信号inputとしてデータが入力されると、入力更新データが書き込まれる前に、選択器SELm0〜mmは各レジスターセットのupdateする組の番号s10に対応するレジスターが予め保持する前回データdata_0、data_iを出力する。同時に、入力更新データに対応するレジスターがライト信号write_0_0〜write_m_7に応答し、当該レジスターに入力更新データが書き込まれる。   FIG. 13 is an arithmetic circuit that outputs the previous data data_0 and data_i of each register set corresponding to the input update data. In the arithmetic circuit shown in the figure, the value of either the first register set (registers R00 to R07) or the second register set (registers R10_i to R17_i) is input. In the arithmetic circuit shown in the figure, when data is input as the input signal input, before the input update data is written, the selectors SELm0 to mm hold in advance the registers corresponding to the number s10 of the set to be updated in each register set. The previous data data_0 and data_i are output. At the same time, the register corresponding to the input update data responds to the write signals write_0_0 to write_m_7, and the input update data is written into the register.

図14は、第1のレジスターセットと、m個のうちの1つの第2のレジスターセットの積和演算値を算出する演算回路である。同図の演算回路は、例えば、行列とベクトルの積を求める演算の場合、行列内のある行とベクトルとの積の演算に当たる。また、write_0_0からwrite_0_7の論理和s0はレジスターR00〜R07のいずれかに格納される入力更新データの有無を、write_i_0からwrite_i_7の論理和siはレジスターR10_i〜R17_iのいずれかに格納される入力更新データの有無を表す。   FIG. 14 is an arithmetic circuit that calculates the product-sum operation value of the first register set and one of the m second register sets. For example, in the case of an operation for obtaining a product of a matrix and a vector, the arithmetic circuit shown in FIG. 6 corresponds to the operation of a product of a certain row in the matrix and the vector. The logical sum s0 from write_0_0 to write_0_7 indicates the presence / absence of input update data stored in any of the registers R00 to R07, and the logical sum si from write_i_0 to write_i_7 is input update data stored in any of the registers R10_i to R17_i. Indicates the presence or absence of

図14の演算回路において、まず、入力更新データinputに加えて、入力更新データinputに対応する第1のレジスターセットの前回データdata_0が、入力更新データに対応する第2のレジスターセットの前回データdata_iが入力される。例えば、第1のレジスターセットに対応するデータが入力された場合、write_0_0からwrite_0_7の論理和s0はHレベル、write_i_0からwrite_i_7の論理和siはLレベルとなる。この場合、選択器SEL3は、減算器SUB1から入力される入力更新データinputから前回データdata_0の減算値を乗算器MUL1に出力し、選択器SEL4は、遅延器DEL3から入力される入力更新データに対応する第2のレジスターセットの前回データdata_iを乗算器MUL1に出力する。   In the arithmetic circuit of FIG. 14, first, in addition to the input update data input, the previous data data_0 of the first register set corresponding to the input update data input is changed to the previous data data_i of the second register set corresponding to the input update data. Is entered. For example, when data corresponding to the first register set is input, the logical sum s0 of write_0_0 to write_0_7 is H level, and the logical sum si of write_i_0 to write_i_7 is L level. In this case, the selector SEL3 outputs the subtraction value of the previous data data_0 from the input update data input input from the subtractor SUB1 to the multiplier MUL1, and the selector SEL4 converts the input update data input from the delay device DEL3. The previous data data_i of the corresponding second register set is output to the multiplier MUL1.

そして、乗算器MUL1は、それぞれの選択器SEL3、SEL4からの入力を乗算し差分値として加算器ADD1に出力する。続いて、加算器ADD1は、当該差分値と、出力レジスターOUT_iまたは前回の加算器ADD1からの出力のいずれかを加算し、更新後の積和演算値として出力レジスターOUT_iに出力する。   The multiplier MUL1 multiplies the inputs from the selectors SEL3 and SEL4 and outputs the result as a difference value to the adder ADD1. Subsequently, the adder ADD1 adds the difference value and either the output from the output register OUT_i or the previous adder ADD1, and outputs the result as an updated product-sum operation value to the output register OUT_i.

図15は、図13及び図14の回路をバスに接続する回路を表す図である。同図において、図7のバス接続回路と同じ部分については、同様の引用番号が付与される。本実施の形態例におけるバス接続回路は、さらに、m(1≦i≦m)個の第2のレジスターセットのwrite_i_0からwrite_i_7の論理和siを対応する演算回路(図14)に出力する。なお、図15中ではs1からs(m-1)までの回路を省略し、smの回路で代表させている。また、論理和器L00〜L07は、各論理和器に対応する組のライト信号write_0_i、write_1_i、…、write_m_iの論理和をそれぞれエンコーダーE2に出力する。エンコーダーE2は、Hレベルの信号を出力する論理和器をupdateする組の番号s10として数値化し、図13の演算回路に出力する。   FIG. 15 is a diagram illustrating a circuit that connects the circuits of FIGS. 13 and 14 to a bus. In the figure, the same reference numbers are assigned to the same parts as the bus connection circuit of FIG. The bus connection circuit in the present embodiment further outputs the logical sum si of write_i_0 to write_i_7 of m (1 ≦ i ≦ m) second register sets to the corresponding arithmetic circuit (FIG. 14). In FIG. 15, the circuits from s1 to s (m-1) are omitted and are represented by the sm circuit. In addition, the logical adders L00 to L07 output logical sums of sets of write signals write_0_i, write_1_i,..., Write_m_i corresponding to the respective logical adders to the encoder E2. The encoder E2 digitizes a logical adder that outputs an H level signal as a set number s10 to be updated, and outputs it to the arithmetic circuit of FIG.

また、比較器C30は、検出アドレスがm個の図14の出力レジスターOUT_i(1≦i≦m)のアドレスに該当するかを比較し、一致する場合にゲートG3に読み出し信号を出力する。また、論理積器AND2は、検出アドレスに対応する出力レジスターOUT_iを選択するセレクト信号select20を選択器SEL20に出力する。具体的に、論理積器AND2は、例えば、連続するアドレスを付与した各出力レジスターOUT_iのアドレスの下所定数桁と、当該所定数の各桁に「1」を保持する値との論理積値を、セレクト信号select20として選択器SEL20に出力する。そして、選択器SEL20は、セレクト信号select20に基づいて、検出アドレスに対応する出力レジスターOUT_iが保持する値output_iをゲートG3からデータバスDBに出力する。   Further, the comparator C30 compares whether the detected address corresponds to the address of the m output registers OUT_i (1 ≦ i ≦ m) in FIG. 14, and outputs a read signal to the gate G3 if they match. The AND circuit AND2 outputs a select signal select20 for selecting the output register OUT_i corresponding to the detected address to the selector SEL20. Specifically, the logical product AND2 is, for example, a logical product value of a predetermined number of digits under the address of each output register OUT_i given consecutive addresses and a value holding “1” in each digit of the predetermined number Is output to the selector SEL20 as the select signal select20. Then, the selector SEL20 outputs the value output_i held by the output register OUT_i corresponding to the detection address from the gate G3 to the data bus DB based on the select signal select20.

このように、本実施の形態例における積和演算器は、複数セットの第2のレジスター及び出力レジスターと共有の第1のレジスターセットを有し、更新された任意の要素データ(入力更新データ)に対応する複数セットの積和演算値を算出する場合についても有効である。本実施の形態例の積和演算器は、演算とパイプライン処理により、複数セットの前回の積和演算値に対してそれぞれ、入力更新データに基づく前回の積和演算値との差分値を加算することによって、当該複数セットの更新後の積和演算値を算出することができる。このため、積和演算器は、演算対象の全ての値の要素データを積和演算し直す必要がなく、また、全ての入力更新データが対応するレジスターに蓄えられるのを待たずに演算を開始することができる。   As described above, the sum-of-products calculator in this embodiment has a plurality of sets of second registers and output registers and a shared first register set, and updated arbitrary element data (input update data). This is also effective when calculating a plurality of sets of product-sum operation values corresponding to. The product-sum operation unit according to the present embodiment adds a difference value with the previous product-sum operation value based on the input update data to each of a plurality of sets of previous product-sum operation values by operation and pipeline processing. By doing so, it is possible to calculate the product-sum operation value after updating the plurality of sets. For this reason, the product-sum operation unit does not need to perform the product-sum operation again on the element data of all values to be calculated, and also starts the operation without waiting for all the input update data to be stored in the corresponding register. can do.

これにより、本実施の形態例の積和演算器は、複数セットの第2のレジスターセットと共有の第1のレジスターセットとの複数の積和演算値を算出する場合において、演算対象の全ての要素データがレジスターに蓄えられるまでのデータ転送時間、及び、全ての要素データの演算時間を要しないことにより、より少ない処理サイクルで複数セットそれぞれの積和演算値を算出することができる。このように、本実施の形態例における積和演算器は、例えば、行列とベクトルの積を高速に求めることができる。   Thereby, the product-sum operation unit according to the present embodiment calculates all the product-sum operation values of the plurality of second register sets and the shared first register set. By not requiring the data transfer time until the element data is stored in the register and the operation time of all the element data, it is possible to calculate the product-sum operation value for each of the plurality of sets with fewer processing cycles. As described above, the product-sum operation unit in the present embodiment can, for example, obtain a product of a matrix and a vector at high speed.

<第6の実施の形態例>
第1の実施の形態例から第5の実施の形態例にかけて、積和演算値を算出する積和演算器について述べた。しかしながら、本発明の演算回路は、積和演算に限定されるものではなく、他の演算に対しても有効である。そこで、第6の実施の形態例では、積和演算以外の演算回路について述べる。
<Sixth embodiment>
In the first embodiment to the fifth embodiment, the product-sum operation unit that calculates the product-sum operation value has been described. However, the arithmetic circuit of the present invention is not limited to the product-sum operation, and is effective for other operations. Therefore, in the sixth embodiment, an arithmetic circuit other than the product-sum operation will be described.

本実施の形態例では、例えば、値「a=(a,a,a,…,an−1)」と値「b=(b,b,b,…,bn−1)」の各組のそれぞれの論理積を排他的論理和する論理和・排他的論理和演算回路(以下、AND・XOR演算回路)について述べる。AND・XOR演算回路は、一般的に、次の式6に基づいてAND・XOR演算値を演算する。 In the present embodiment, for example, the value “a = (a 0 , a 1 , a 2 ,..., A n−1 )” and the value “b = (b 0 , b 1 , b 2 ,. -1 ) "will be described with respect to a logical sum / exclusive OR operation circuit (hereinafter referred to as an AND / XOR operation circuit) that performs exclusive OR operation on each logical product of each set. The AND / XOR operation circuit generally calculates an AND / XOR operation value based on the following equation (6).

Figure 2012069081
Figure 2012069081

式6において、関数fは論理積を求める関数であり、「A」は、値「a」と値「b」の各組の論理積がさらに排他的論理和された値である。式6に基づく演算回路では、例えば、値「a」のうち一部の要素のみが更新された場合に、値「a」「b」の全ての要素について論理積と排他的論理和をし直していた。 In Expression 6, the function f is a function for obtaining a logical product, and “A” is a value obtained by further exclusive-ORing the logical product of each pair of the value “a” and the value “b”. In the arithmetic circuit based on Expression 6, for example, when only some of the elements of the value “a” are updated, the logical product and exclusive OR are re-performed for all the elements of the values “a” and “b”. It was.

そこで、本実施の形態例の演算回路は、次の式7に基づいてAND・XOR演算値を求める。式7において、値「a´=(a´,a´,a´,…,an−1´)」は、前回演算された古い値「a=(a,a,a,…,an−1)」である前回データに対してj番目の要素が更新されているものとする。また、「A」は、値「a」と値「b」のAND・XOR演算値(以下、前回のAND・XOR演算値)であり、「A´」は値「a´」と値「b」のAND・XOR演算値(以下、更新後のAND・XOR演算値)を表す。 Therefore, the arithmetic circuit according to the present embodiment obtains an AND / XOR arithmetic value based on the following Expression 7. In Equation 7, the value “a ′ = (a 0 ′, a 1 ′, a 2 ′,..., A n−1 ′)” is the old value “a = (a 0 , a 1 , a 2, ..., it is assumed that the j-th element is updated for the previous data is a n-1) ". “A” is an AND / XOR operation value of the value “a” and the value “b” (hereinafter, the previous AND / XOR operation value), and “A ′” is the value “a ′” and the value “b”. "AND / XOR operation value (hereinafter, updated AND / XOR operation value)".

Figure 2012069081
Figure 2012069081

式7において、更新後のAND・XOR演算値「A´」は、「値「a」「b」のj番目の要素の論理積(f(a,b))と、値「a´」「b」のj番目の要素の論理積(f(a´,b))との排他的論理和」と前回のAND・XOR演算値「A」との排他的論理和によって求められる(A´=A^(f(a,b))^(f(a´,b)))。この演算式は、「A´=A^(f(a^a´,b))」のようにまとめられる。従って、更新後のAND・XOR演算値「A´」は、前回のAND・XOR演算値「A」と、「f(a^a´,b)」との排他的論理和によって求められる。 In Expression 7, the updated AND · XOR operation value “A ′” is obtained by calculating the logical product (f (a j , b j )) of the “value“ a ”and“ b ”and the value“ a ′ ”. "Exclusive OR with the logical product (f (a j ', b j )) of the jth element of" b "" and the previous AND / XOR operation value "A". (A ′ = A ^ (f (a j , b j )) ^ (f (a j ′, b j ))). This arithmetic expression can be summarized as “A ′ = A ^ (f (a j ^ a j ′, b j ))”. Therefore, the updated AND / XOR operation value “A ′” is obtained by exclusive OR of the previous AND / XOR operation value “A” and “f (a j ^ a j ′, b j )”. It is done.

式6と式7とを比較すると、値の一部の要素が更新される場合、式6に対して式7の演算量は少ない。従って、式7は、式6に対してより少ない処理サイクルで更新後のAND・XOR演算値「A´」を算出することができる。   Comparing Expression 6 and Expression 7, when some elements of the value are updated, the amount of calculation of Expression 7 is smaller than Expression 6. Therefore, Equation 7 can calculate the updated AND · XOR operation value “A ′” with fewer processing cycles than Equation 6.

図16は、式7において「n=8」とした場合の本実施の形態例における回路の一例を表す図である。同図の演算回路において、値「a」の各要素a〜aはレジスターR00〜R07に、値「b」の各要素b〜bはレジスターR10〜R17に格納される。また、同様にして、本実施の形態例における演算回路は、レジスターR00〜R17に前回データを、出力レジスターに前回のAND・XOR演算値を保持する。また、値「a」または値「b」のいずれかの更新後のデータが入力信号inputとして入力される。 FIG. 16 is a diagram illustrating an example of a circuit in the present embodiment when “n = 8” in Expression 7. In the arithmetic circuit shown in the figure, the elements a 0 to a 7 having the value “a” are stored in the registers R 00 to R 07, and the elements b 0 to b 7 having the value “b” are stored in the registers R 10 to R 17. Similarly, the arithmetic circuit in the present embodiment holds the previous data in the registers R00 to R17 and the previous AND / XOR operation value in the output register. Also, updated data of either the value “a” or the value “b” is input as the input signal input.

なお、図16の演算回路の式7「A^f(a^a´,b)」と、図6の積和演算器の式2「S+(a´−a)×b」において、式7の論理積は式2の積算に、式7の排他的論理和は式2の加減算に対応する。そのため、図16の演算回路は、図6の積和演算回路に対して、減算器SUB1、SUB2の代わりに排他的論理和器XOR1、XOR2を、乗算器MUL1の代わりに論理積器AND3を、加算器ADD1の代わりに排他的論理和器XOR3を有する。 In addition, Expression 7 “A ^ f (a j ^ a j ′, b j )” of the arithmetic circuit in FIG. 16 and Expression 2 “S + (a j ′ −a j ) × b of the product-sum operation unit in FIG. Inj ”, the logical product of Expression 7 corresponds to the integration of Expression 2, and the exclusive OR of Expression 7 corresponds to the addition and subtraction of Expression 2. Therefore, the arithmetic circuit in FIG. 16 is different from the product-sum arithmetic circuit in FIG. 6 in that the exclusive ORs XOR1 and XOR2 are substituted for the subtracters SUB1 and SUB2, the logical ANDer AND3 is substituted for the multiplier MUL1, Instead of the adder ADD1, an exclusive OR circuit XOR3 is provided.

図16の演算回路において、例えば、値「a´」のデータ(a´)が入力信号inputとして入力された場合、排他的論理和器XOR1は、入力更新データinputと、選択器SEL1から出力された入力更新データに対応する前回データ(a)との排他的論理和を演算して選択器SEL3に出力する(a^a´)。そして、選択器SEL3は、遅延器DEL1からのHレベルのセレクト信号select3に基づいて、排他的論理和器XOR1からの出力を選択して論理積器AND3に出力する。一方、選択器SEL4は、Lレベルのセレクト信号select4に基づいて、遅延器DEL3からの入力である、入力更新データに対応する前回データ(b)を選択して論理積器AND3に出力する。 In the arithmetic circuit of FIG. 16, for example, when data (a j ′) of value “a ′” is input as the input signal input, the exclusive OR XOR1 outputs the input update data input and the selector SEL1. The exclusive OR with the previous data (a j ) corresponding to the inputted update data is calculated and output to the selector SEL3 (a j ^ a j '). Then, the selector SEL3 selects the output from the exclusive OR circuit XOR1 based on the H level select signal select3 from the delay device DEL1, and outputs it to the AND circuit AND3. On the other hand, the selector SEL4 selects the previous data (b j ) corresponding to the input update data, which is an input from the delay device DEL3, based on the L level select signal select4, and outputs the selected data to the AND circuit AND3.

続いて、論理積器AND3は、選択器SEL3による排他的論理和器XOR1からの出力(a^a´)と、選択器SEL4による遅延器DEL3からの前回データ(b)との論理積を演算し、排他的論理和器XOR3に出力する。この出力は、上述した式7における「f(a^a´,b」に対応する。そして、排他的論理和器XOR3は、論理積器AND3からの出力と、出力レジスターOUTまたは前回の排他的論理和器XOR3からの出力のいずれかとの排他的論理和を求め、更新後のAND・XOR演算値として出力レジスターOUTに出力する。 Subsequently, the AND circuit AND3 calculates the logic between the output (a j ^ a j ′) from the exclusive OR circuit XOR1 by the selector SEL3 and the previous data (b j ) from the delay device DEL3 by the selector SEL4. The product is calculated and output to the exclusive OR XOR3. This output corresponds to “f (a j ^ a j ′, b j ” in the above-described expression 7. Then, the exclusive OR XOR3 outputs the output from the AND AND3 and the output register OUT or the previous time. XOR with one of the outputs from the XOR3 is output to the output register OUT as the updated AND / XOR operation value.

このように、本実施の形態例の演算回路は、値「a」と値「b」のAND・XOR演算値を求める場合についても、入力と演算のパイプライン処理により、前回のAND・XOR演算値に基づいて更新後のAND・XOR演算値を求めることができる。このため、本実施の形態例の演算回路は、演算対象の全ての値の要素データを演算し直す必要がなく、また、全ての入力更新データが対応するレジスターに蓄えられるのを待たずに演算を開始することができる。これにより、本実施の形態例の演算回路は、値「a」と値「b」のAND・XOR演算値を求める場合について、演算対象の全ての要素データがレジスターに蓄えられるまでのデータ転送時間、及び、全ての要素データの演算時間を要しないことにより、より少ない処理サイクルでAND・XOR演算値を算出することができる。   As described above, the arithmetic circuit according to the present embodiment also obtains the AND / XOR operation value of the value “a” and the value “b” by the pipeline processing of the input and the operation, and the previous AND / XOR operation. An updated AND / XOR operation value can be obtained based on the value. Therefore, the arithmetic circuit according to the present embodiment does not need to recalculate element data of all values to be calculated, and does not wait for all input update data to be stored in the corresponding register. Can start. As a result, the arithmetic circuit according to the present embodiment determines the data transfer time until all the element data to be calculated are stored in the register when the AND / XOR calculation value of the value “a” and the value “b” is obtained. And by not requiring the calculation time of all the element data, the AND / XOR calculation value can be calculated with fewer processing cycles.

このように、本発明の演算回路は、積和演算以外の演算回路にも有効である。このような演算回路は、次のように一般化される。   Thus, the arithmetic circuit of the present invention is also effective for arithmetic circuits other than product-sum operations. Such an arithmetic circuit is generalized as follows.

まず、演算回路は、N個の要素を有する第1の値(a)、第2の値(b)とを保持するレジスターと、第1、2の値に対して「第1演算(積算、論理積)」したN個の第1演算値を、さらに「第2演算(加減算、排他的論理和)」した演算結果値(S、A)を保持するレジスターとを有する。   First, the arithmetic circuit has a register for holding a first value (a) and a second value (b) having N elements, and “first operation (integration, And a register for holding the operation result values (S, A) obtained by performing “second operation (addition / subtraction, exclusive OR)”.

また、演算回路は、「入力された第1の値の1つの前記要素(a´(=入力更新データ))と、当該要素に対応する第1の値の要素(a)とに対して「第2演算(加減算、排他的論理和)」を行う第1の演算器」と、「第1の演算器の出力と、入力された第1の値の要素に対応する第2の値の要素(b)とに対して「第1演算(積算、論理積)」を行う第2の演算器」を有する。さらに、演算回路は、第2の演算器の出力と、出力レジスターの演算結果値(S、A)とに対して「第2演算(加減算、排他的論理和)」を行って出力レジスターに出力する第3の演算器とを有する。 Further, the arithmetic circuit determines that “the one element (a j ′ (= input update data)) of the input first value and the element (a j ) of the first value corresponding to the element” "First operation unit for performing second operation (addition / subtraction, exclusive OR)", "output of first operation unit, and second value corresponding to input first value element" And a second arithmetic unit that performs “first operation (integration, logical product)” on the element (b j ). Further, the arithmetic circuit performs “second operation (addition / subtraction, exclusive OR)” on the output of the second arithmetic unit and the operation result value (S, A) of the output register and outputs the result to the output register. And a third computing unit.

そして、前述の第2の演算器による演算は、「入力された第1の値の要素に対応する第1のレジスター内の第1の値の要素(a)と当該要素に対応する第2の値の要素(b)とに対する「第1演算(積算、論理積)」の結果を第2演算に基づいて打ち消す値と…(1)」、「入力された第1の値の要素(a´)と当該要素に対応する第2の値の要素(b)とに対する「第1演算(積算、論理積)」の結果…(2)」と、に対する「第2演算(加減算、排他的論理和)」…(3)について分配法則を満たす。 Then, the calculation by the second arithmetic unit described above is “the first value element (a j ) in the first register corresponding to the input first value element and the second value corresponding to the element. A value that cancels the result of the “first operation (integration, logical product)” with respect to the value element (b j ) based on the second operation (1) ”,“ element of the input first value ( a j ') and the second value element (b j ) corresponding to the element (b j ) result of "first operation (integration, logical product)" (2) "and" second operation (addition / subtraction, Exclusive logical OR) ”(3) satisfies the distribution rule.

以下、上記の一般化された構成を第1の実施の形態例、及び、第6の実施の形態例に対応させて説明する。まず、第1の実施の形態例の積和演算器において、第1演算は積算、第2演算は加減算に当たる。また、演算結果値「S」は、値「a」と値「b」の各要素データの積算値を、さらに加算した積和演算値に当たる。   The above generalized configuration will be described below in correspondence with the first embodiment and the sixth embodiment. First, in the product-sum operation unit of the first embodiment, the first operation corresponds to integration, and the second operation corresponds to addition / subtraction. The calculation result value “S” corresponds to a product-sum calculation value obtained by further adding the integrated values of the element data of the values “a” and “b”.

(1)について、「入力された第1の値の要素に対応する第1のレジスター内の第1の値の要素(a)」と「当該要素に対応する第2の値の要素(b)」とに対する積算の結果とは、「a×b」である。そして、「a×b」を加減算に基づいて打ち消す値とは、「a×b」に加減算することによって「0」となる値、即ち、「−(a×b)」を示す。そして、(2)について、「入力された第1の値の要素(a´)」と「当該要素に対応する第2の値の要素(b)」とに対する積算の結果は、「a´×b」であるため、(3)は「−(a×b)+(a´×b)」である。 For (1), “the first value element (a j ) in the first register corresponding to the input first value element” and “the second value element (b) corresponding to the element (b) j ) ”and the result of the integration is“ a j × b j ”. Then, the value of canceling based on the subtraction of "a j × b j", the value becomes "0" by subtracting the "a j × b j", ie, "- (a j × b j)" Indicates. Then, with respect to (2), the result of integration with respect to “input first value element (a j ′)” and “second value element (b j ) corresponding to the element” is “a j ′ × b j ”, (3) is“ − (a j × b j ) + (a j ′ × b j ) ”.

第1の実施の形態例における第2の演算器の演算は「(a´−a)×b」であり、当該演算は(3)「−(a×b)+(a´×b)」に対して分配法則を満たしている。従って、第1の実施の形態例における演算回路は、上記の構成に該当する。 The operation of the second arithmetic unit in the first embodiment is “(a j ′ −a j ) × b j ”, and the operation is (3) “− (a j × b j ) + (a j ′ × b j ) ”is satisfied. Therefore, the arithmetic circuit in the first embodiment corresponds to the above configuration.

続いて、第6の実施の形態例の積和演算器において、第1演算は論理積、第2演算は排他的論理和に当たる。また、演算結果値「A」は、値「a」と値「b」の各要素データの各論理積を、さらに排他的論理和したAND・XOR演算値に当たる。   Subsequently, in the product-sum operation unit of the sixth embodiment, the first operation corresponds to a logical product, and the second operation corresponds to an exclusive OR. The operation result value “A” corresponds to an AND / XOR operation value obtained by further exclusive-ORing each logical product of the element data of the value “a” and the value “b”.

(1)について、「入力された第1の値の要素に対応する第1のレジスター内の第1の値の要素(a)」と「当該要素に対応する第2の値の要素(b)」とに対する論理積の結果とは、「f(a,b)」である。そして、「f(a,b)」を排他的論理和に基づいて打ち消す値とは、「f(a,b)」との排他的論理和が「0」となる値である。排他的論理和演算において、同じ値の排他的論理和は「0」となる。従って、「f(a,b)」を排他的論理和に基づいて打ち消す値は同値、即ち「f(a,b)」である。そして、(2)について、「入力された第1の値の要素(a´)」と「当該要素に対応する第2の値の要素(b)」とに対する論理積の結果は、「f(a´,b)」であるため、(3)は「(f(a,b))^(f(a´,b))」である。 For (1), “the first value element (a j ) in the first register corresponding to the input first value element” and “the second value element (b) corresponding to the element (b) The result of the logical product for “ j )” is “f (a j , b j )”. Then, the value of canceling based on exclusive OR "f (a j, b j)" is a value that is a exclusive OR of the "f (a j, b j)" is "0" . In the exclusive OR operation, the exclusive OR of the same value is “0”. Therefore, the "f (a j, b j)" is a value for canceling based on the exclusive OR equivalence, or "f (a j, b j)". For (2), the result of the logical product of “the input first value element (a j ′)” and “the second value element (b j ) corresponding to the element” is “ f (a j ', b j ) for "a is, (3)" (f (a j, b j )) ^ (f (a j' is a, b j)) ".

第6の実施の形態例における第2の演算器の演算「f(a^a´,b)」であり、当該演算は(3)「(f(a,b))^(f(a´,b))」に対して分配法則を満たしている。従って、第6の実施の形態例における演算回路は、上記の構成に該当する。 The operation “f (a j ^ a j ′, b j )” of the second arithmetic unit in the sixth embodiment is the same as (3) “(f (a j , b j )) ^ The distribution law is satisfied for (f (a j ′, b j )) ”. Therefore, the arithmetic circuit in the sixth embodiment corresponds to the above configuration.

第1の実施の形態例の積和演算器、及び、第6の実施の形態例の演算回路は、上記のように一般化される。従って、本発明の演算回路は、上記の一般化した構成に該当する他の演算回路についても有効であり、当該演算回路は同様にして任意の値が更新された入力データに対する演算結果をより少ない処理サイクルで高速に求めることができる。   The product-sum operation unit of the first embodiment and the operation circuit of the sixth embodiment are generalized as described above. Therefore, the arithmetic circuit of the present invention is also effective for other arithmetic circuits corresponding to the generalized configuration described above, and the arithmetic circuit similarly has fewer arithmetic results for input data in which an arbitrary value is updated. It can be obtained at high speed in the processing cycle.

以上の実施の形態をまとめると、次の付記のとおりである。   The above embodiment is summarized as follows.

(付記1)
N個の要素を有する第1の値を保持する第1のレジスターと、
N個の要素を有する第2の値を保持する第2のレジスターと、
前記第1の値と前記第2の値とが積和演算された積和演算値を保持する出力レジスターと、
入力された前記第1の値の1つの前記要素から、当該要素に対応する前記第1のレジスター内の前記第1の値の前記要素を減算する第1の減算器と、
前記第1の減算器の出力と、前記入力された第1の値の要素に対応する前記第2のレジスター内の前記第2の値の前記要素とを乗算する乗算器と、
前記乗算器の出力と、前記出力レジスターの前記積和演算値とを加算して前記出力レジスターに出力する加算器と、
を有することを特徴とする演算回路。
(Appendix 1)
A first register holding a first value having N elements;
A second register holding a second value having N elements;
An output register for holding a product-sum operation value obtained by performing a product-sum operation on the first value and the second value;
A first subtractor for subtracting the element of the first value in the first register corresponding to the element from one of the elements of the input first value;
A multiplier that multiplies the output of the first subtractor with the element of the second value in the second register corresponding to the element of the input first value;
An adder that adds the output of the multiplier and the product-sum operation value of the output register to output to the output register;
An arithmetic circuit comprising:

(付記2)
付記1において、さらに、
前記入力された第1の値の要素に対応する前記第1のレジスター内の第1の値の要素を選択して前記第1の減算器に出力する第1の選択器を有することを特徴とする演算回路。
(Appendix 2)
In Appendix 1,
A first selector for selecting the first value element in the first register corresponding to the inputted first value element and outputting the selected first value element to the first subtractor; Arithmetic circuit to perform.

(付記3)
付記1または2において、さらに、
入力された前記第2の値の1つの前記要素から、当該要素に対応する前記第2のレジスター内の前記第2の値の前記要素を減算する第2の減算器を有し、
前記乗算器は、前記第2の減算器の出力と、前記入力された第2の要素に対応する前記第1のレジスター内の前記第1の値の前記要素とを乗算することを特徴とする演算回路。
(Appendix 3)
In Appendix 1 or 2,
A second subtracter for subtracting the element of the second value in the second register corresponding to the element from one of the elements of the input second value;
The multiplier multiplies the output of the second subtracter by the element of the first value in the first register corresponding to the input second element. Arithmetic circuit.

(付記4)
付記3において、さらに、
前記第1の値の要素が入力された場合は前記第1の減算器の出力を選択して前記乗算器に出力し、前記第2の値の要素が入力された場合は当該要素に対応する前記第1のレジスター内の前記第1の値の前記要素を選択して前記乗算器に出力することを特徴とする演算回路。
(Appendix 4)
In Appendix 3,
When the element of the first value is input, the output of the first subtracter is selected and output to the multiplier, and when the element of the second value is input, it corresponds to the element An arithmetic circuit, wherein the element of the first value in the first register is selected and output to the multiplier.

(付記5)
付記1または2において、さらに、
N個の要素を有する第3の値を保持する第3のレジスターを有し、
前記出力レジスターは、前記第1の値と前記第2の値に加え、前記第3の値が積和演算された積和演算値を保持し、
前記乗算器は、前記第1の減算器の出力と前記入力された第1の値の要素に対応する前記第2のレジスター内の前記第2の値の前記要素に加えて、前記第3のレジスター内の前記第3の値の前記要素を乗算することを特徴とする演算回路。
(Appendix 5)
In Appendix 1 or 2,
A third register holding a third value having N elements;
The output register holds a product-sum operation value obtained by performing a product-sum operation on the third value in addition to the first value and the second value,
In addition to the element of the second value in the second register corresponding to the element of the input first value and the output of the first subtractor, the multiplier An arithmetic circuit that multiplies the element of the third value in a register.

(付記6)
付記1または2において、
前記第1のレジスターは、前記第1の値を複数セット保持し、
前記第2のレジスターは、前記第2の値を複数セット保持し、
前記出力レジスターは、前記複数セットの第1、第2の値それぞれの前記積和演算値を保持し、
前記第1の減算器は、入力された前記複数セットのうち第1セットの前記第1の値の1つの要素から、当該要素に対応する前記第1セットの前記第1のレジスター内の第1の値の要素を減算し、
前記乗算器は、前記第1の減算器の出力と、前記第1セットの第1の値の要素に対応する前記第1セットの前記第2のレジスター内の第2の値の要素とを乗算し、
前記加算器は、前記乗算器の出力と、前記第1セットの前記出力レジスターの前記積和演算値とを加算することを特徴とする演算回路。
(Appendix 6)
In Appendix 1 or 2,
The first register holds a plurality of sets of the first value;
The second register holds a plurality of sets of the second values;
The output register holds the product-sum operation value of each of the first and second values of the plurality of sets;
The first subtracter receives a first element in the first register of the first set corresponding to the element from one element of the first value of the first set among the plurality of sets input. Subtract elements of the value of
The multiplier multiplies the output of the first subtracter with a second value element in the second register of the first set corresponding to a first value element of the first set. And
The adder adds the output of the multiplier and the product-sum operation value of the output register of the first set.

(付記7)
付記1または2において、
前記第2のレジスターは、前記第2の値を複数セット保持し、
前記出力レジスターは、第1の値と前記複数セットの第2の値それぞれとの前記積和演算値を保持し、
前記乗算器は、前記複数セット毎に、前記第1の減算器の出力と、前記入力された第1の値の要素に対応する当該複数セットのそれぞれの前記第2のレジスター内の第2の値の要素とを乗算し、
前記加算器は、前記複数セット毎に、前記乗算器の出力と、当該複数セットそれぞれの出力レジスターの前記積和演算値とを加算して当該出力レジスターに出力することを特徴とする演算回路。
(Appendix 7)
In Appendix 1 or 2,
The second register holds a plurality of sets of the second values;
The output register holds the product-sum operation value of a first value and each of the plurality of sets of second values;
For each of the plurality of sets, the multiplier is configured to output a second subtractor in each second register of the plurality of sets corresponding to the output of the first subtractor and the element of the input first value. Multiply by the value element,
The adder adds, for each of the plurality of sets, the output of the multiplier and the product-sum operation value of the output register of each of the plurality of sets, and outputs the result to the output register.

(付記8)
N個の要素を有する第1の値を保持する第1のレジスターと、
N個の要素を有する第2の値を保持する第2のレジスターと、
前記第1の値と前記第2の値とが積和演算された積和演算値を保持する出力レジスターと、
入力された前記第1の値の1つの前記要素と、当該要素に対応し、入力された前記第2の値の1つの前記要素とを乗算する第1の乗算器と、
前記入力された第1の値の要素に対応する前記第1のレジスター内の前記第1の値の前記要素と、前記入力された第2の値の要素に対応する前記第2のレジスター内の前記第2の値の前記要素とを乗算する第2の乗算器と、
前記第1の乗算器の出力から前記第2の乗算器の出力を減算する減算器と、
前記減算器の出力と、前記出力レジスターの前記積和演算値とを加算して前記出力レジスターに出力する加算器と、
を有することを特徴とする演算回路。
(Appendix 8)
A first register holding a first value having N elements;
A second register holding a second value having N elements;
An output register for holding a product-sum operation value obtained by performing a product-sum operation on the first value and the second value;
A first multiplier for multiplying one of the elements of the inputted first value by one of the elements of the inputted second value corresponding to the element;
The element of the first value in the first register corresponding to the element of the input first value and the element of the second register corresponding to the element of the input second value A second multiplier for multiplying the element of the second value;
A subtractor for subtracting the output of the second multiplier from the output of the first multiplier;
An adder that adds the output of the subtracter and the product-sum operation value of the output register to output to the output register;
An arithmetic circuit comprising:

(付記9)
N個の要素を有する第1の値を保持する第1のレジスターと、
N個の要素を有する第2の値を保持する第2のレジスターと、
前記第1の値と前記第2の値とに対して第1演算したN個の第1演算値を、さらに第2演算した演算結果値を保持する出力レジスターと、
入力された前記第1の値の1つの前記要素と、当該要素に対応する前記第1のレジスター内の前記第1の値の前記要素とに対して前記第2演算を行う第1の演算器と、
前記第1の演算器の出力と、前記入力された第1の値の要素に対応する前記第2のレジスター内の前記第2の値の前記要素とに対して前記第1演算を行う第2の演算器と、
前記第2の演算器の出力と、前記出力レジスターの前記演算結果値とに対して前記第2演算を行って前記出力レジスターに出力する第3の演算器と、
を有し、
前記第2の演算器による演算は、前記入力された第1の値の要素に対応する前記第1のレジスター内の第1の値の要素と、当該要素に対応する前記第2のレジスター内の第2の値の要素とに対する前記第1演算の結果を前記第2演算に基づいて打ち消す値と、前記入力された第1の値の要素と、当該要素に対応する前記第2のレジスター内の第2の値の要素とに対する前記第1演算の結果と、に対する前記第2演算について分配法則を満たすことを特徴とする演算回路。
(Appendix 9)
A first register holding a first value having N elements;
A second register holding a second value having N elements;
An output register that holds N first calculation values that have been first calculated with respect to the first value and the second value, and further holds a calculation result value that has been second calculated;
A first arithmetic unit that performs the second operation on one element of the input first value and the element of the first value in the first register corresponding to the element When,
A second that performs the first operation on the output of the first calculator and the element of the second value in the second register corresponding to the element of the input first value; With the calculator of
A third computing unit that performs the second computation on the output of the second computing unit and the computation result value of the output register and outputs the second computation to the output register;
Have
The calculation by the second calculator is performed by calculating an element of the first value in the first register corresponding to the element of the input first value and an element of the second register corresponding to the element. A value for canceling the result of the first operation on the element of the second value based on the second operation; an element of the input first value; and a value in the second register corresponding to the element An arithmetic circuit characterized by satisfying a distribution law for the second operation on the result of the first operation on an element of a second value.

(付記10)
付記9において、
前記第1演算は論理積であり、前記第2演算は排他的論理和であることを特徴とする演算回路。
(Appendix 10)
In Appendix 9,
The arithmetic circuit is characterized in that the first operation is a logical product and the second operation is an exclusive OR.

(付記11)
付記9において、
前記第1演算は積であり、前記第2演算は加減であることを特徴とする演算回路。
(Appendix 11)
In Appendix 9,
The arithmetic circuit, wherein the first operation is a product and the second operation is addition / subtraction.

11:CPU、12:DMAC、13:メモリ、14:積和演算器、15:その他のハードウェア 11: CPU, 12: DMAC, 13: Memory, 14: Product-sum calculator, 15: Other hardware

Claims (5)

N個の要素を有する第1の値を保持する第1のレジスターと、
N個の要素を有する第2の値を保持する第2のレジスターと、
前記第1の値と前記第2の値とが積和演算された積和演算値を保持する出力レジスターと、
入力された前記第1の値の1つの前記要素から、当該要素に対応する前記第1のレジスター内の前記第1の値の前記要素を減算する第1の減算器と、
前記第1の減算器の出力と、前記入力された第1の値の要素に対応する前記第2のレジスター内の前記第2の値の前記要素とを乗算する乗算器と、
前記乗算器の出力と、前記出力レジスターの前記積和演算値とを加算して前記出力レジスターに出力する加算器と、
を有することを特徴とする演算回路。
A first register holding a first value having N elements;
A second register holding a second value having N elements;
An output register for holding a product-sum operation value obtained by performing a product-sum operation on the first value and the second value;
A first subtractor for subtracting the element of the first value in the first register corresponding to the element from one of the elements of the input first value;
A multiplier that multiplies the output of the first subtractor with the element of the second value in the second register corresponding to the element of the input first value;
An adder that adds the output of the multiplier and the product-sum operation value of the output register to output to the output register;
An arithmetic circuit comprising:
請求項1において、さらに、
前記入力された第1の値の要素に対応する前記第1のレジスター内の第1の値の要素を選択して前記第1の減算器に出力する第1の選択器を有することを特徴とする演算回路。
The claim 1, further comprising:
A first selector for selecting the first value element in the first register corresponding to the inputted first value element and outputting the selected first value element to the first subtractor; Arithmetic circuit to perform.
請求項1または2において、さらに、
入力された前記第2の値の1つの前記要素から、当該要素に対応する前記第2のレジスター内の前記第2の値の前記要素を減算する第2の減算器を有し、
前記乗算器は、前記第2の減算器の出力と、前記入力された第2の要素に対応する前記第1のレジスター内の前記第1の値の前記要素とを乗算することを特徴とする演算回路。
In claim 1 or 2, further
A second subtracter for subtracting the element of the second value in the second register corresponding to the element from one of the elements of the input second value;
The multiplier multiplies the output of the second subtracter by the element of the first value in the first register corresponding to the input second element. Arithmetic circuit.
N個の要素を有する第1の値を保持する第1のレジスターと、
N個の要素を有する第2の値を保持する第2のレジスターと、
前記第1の値と前記第2の値とが積和演算された積和演算値を保持する出力レジスターと、
入力された前記第1の値の1つの前記要素と、当該要素に対応し、入力された前記第2の値の1つの前記要素とを乗算する第1の乗算器と、
前記入力された第1の値の要素に対応する前記第1のレジスター内の前記第1の値の前記要素と、前記入力された第2の値の要素に対応する前記第2のレジスター内の前記第2の値の前記要素とを乗算する第2の乗算器と、
前記第1の乗算器の出力から前記第2の乗算器の出力を減算する減算器と、
前記減算器の出力と、前記出力レジスターの前記積和演算値とを加算して前記出力レジスターに出力する加算器と、
を有することを特徴とする演算回路。
A first register holding a first value having N elements;
A second register holding a second value having N elements;
An output register for holding a product-sum operation value obtained by performing a product-sum operation on the first value and the second value;
A first multiplier for multiplying one of the elements of the inputted first value by one of the elements of the inputted second value corresponding to the element;
The element of the first value in the first register corresponding to the element of the input first value and the element of the second register corresponding to the element of the input second value A second multiplier for multiplying the element of the second value;
A subtractor for subtracting the output of the second multiplier from the output of the first multiplier;
An adder that adds the output of the subtracter and the product-sum operation value of the output register to output to the output register;
An arithmetic circuit comprising:
N個の要素を有する第1の値を保持する第1のレジスターと、
N個の要素を有する第2の値を保持する第2のレジスターと、
前記第1の値と前記第2の値とに対して第1演算したN個の第1演算値を、さらに第2演算した演算結果値を保持する出力レジスターと、
入力された前記第1の値の1つの前記要素と、当該要素に対応する前記第1のレジスター内の前記第1の値の前記要素とに対して前記第2演算を行う第1の演算器と、
前記第1の演算器の出力と、前記入力された第1の値の要素に対応する前記第2のレジスター内の前記第2の値の前記要素とに対して前記第1演算を行う第2の演算器と、
前記第2の演算器の出力と、前記出力レジスターの前記演算結果値とに対して前記第2演算を行って前記出力レジスターに出力する第3の演算器と、
を有し、
前記第2の演算器による演算は、前記入力された第1の値の要素に対応する前記第1のレジスター内の第1の値の要素と、当該要素に対応する前記第2のレジスター内の第2の値の要素とに対する前記第1演算の結果を前記第2演算に基づいて打ち消す値と、前記入力された第1の値の要素と、当該要素に対応する前記第2のレジスター内の第2の値の要素とに対する前記第1演算の結果と、に対する前記第2演算について分配法則を満たすことを特徴とする演算回路。
A first register holding a first value having N elements;
A second register holding a second value having N elements;
An output register that holds N first calculation values that have been first calculated with respect to the first value and the second value, and further holds a calculation result value that has been second calculated;
A first arithmetic unit that performs the second operation on one element of the input first value and the element of the first value in the first register corresponding to the element When,
A second that performs the first operation on the output of the first calculator and the element of the second value in the second register corresponding to the element of the input first value; With the calculator of
A third computing unit that performs the second computation on the output of the second computing unit and the computation result value of the output register and outputs the second computation to the output register;
Have
The calculation by the second calculator is performed by calculating an element of the first value in the first register corresponding to the element of the input first value and an element of the second register corresponding to the element. A value for canceling the result of the first operation on the element of the second value based on the second operation; an element of the input first value; and a value in the second register corresponding to the element An arithmetic circuit characterized by satisfying a distribution law for the second operation on the result of the first operation on an element of a second value.
JP2010215779A 2010-09-27 2010-09-27 Arithmetic circuit Expired - Fee Related JP5668391B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010215779A JP5668391B2 (en) 2010-09-27 2010-09-27 Arithmetic circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010215779A JP5668391B2 (en) 2010-09-27 2010-09-27 Arithmetic circuit

Publications (2)

Publication Number Publication Date
JP2012069081A true JP2012069081A (en) 2012-04-05
JP5668391B2 JP5668391B2 (en) 2015-02-12

Family

ID=46166229

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010215779A Expired - Fee Related JP5668391B2 (en) 2010-09-27 2010-09-27 Arithmetic circuit

Country Status (1)

Country Link
JP (1) JP5668391B2 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113316763A (en) * 2019-03-04 2021-08-27 松下知识产权经营株式会社 Processor and control method of processor

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004266768A (en) * 2003-03-04 2004-09-24 Mega Chips Corp Image processing system and digital camera
JP2008113295A (en) * 2006-10-31 2008-05-15 Matsushita Electric Ind Co Ltd Video signal processor
JP2008131336A (en) * 2006-11-21 2008-06-05 Nec Electronics Corp Filter calculator and motion compensation device
JP2008242594A (en) * 2007-03-26 2008-10-09 Nec Electronics Corp Filter computing unit and motion compensation device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004266768A (en) * 2003-03-04 2004-09-24 Mega Chips Corp Image processing system and digital camera
JP2008113295A (en) * 2006-10-31 2008-05-15 Matsushita Electric Ind Co Ltd Video signal processor
JP2008131336A (en) * 2006-11-21 2008-06-05 Nec Electronics Corp Filter calculator and motion compensation device
JP2008242594A (en) * 2007-03-26 2008-10-09 Nec Electronics Corp Filter computing unit and motion compensation device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113316763A (en) * 2019-03-04 2021-08-27 松下知识产权经营株式会社 Processor and control method of processor

Also Published As

Publication number Publication date
JP5668391B2 (en) 2015-02-12

Similar Documents

Publication Publication Date Title
US6366936B1 (en) Pipelined fast fourier transform (FFT) processor having convergent block floating point (CBFP) algorithm
JP2622896B2 (en) Division device
Chung et al. A high-performance elliptic curve cryptographic processor over GF (p) with SPA resistance
US6754689B2 (en) Method and apparatus for performing subtraction in redundant form arithmetic
JPWO2007063601A1 (en) Arithmetic apparatus and method for performing floating-point division or square root operation
US6941334B2 (en) Higher precision divide and square root approximations
JP5668391B2 (en) Arithmetic circuit
Jamadagni et al. An asynchronous divider implementation
JP6428488B2 (en) Adder / Subtractor and Control Method of Adder / Subtractor
US6813628B2 (en) Method and apparatus for performing equality comparison in redundant form arithmetic
KR101128505B1 (en) method and apparatus for modular multiplication
Dixit et al. FPGA accomplishment of a 16-bit divider
TW202333041A (en) System and method performing floating-point operations
CN114385112A (en) Apparatus and method for processing modular multiplication
JP3941868B2 (en) Calculation apparatus and calculation method
Pandit et al. Design and simulation of 16× 16 bit iterative logarithmic multiplier for accurate results
Chinta et al. High speed most significant bit first truncated multiplier
Fahmy et al. Improving the effectiveness of floating point arithmetic
JP2943255B2 (en) Reciprocal calculation circuit
JPH0424730B2 (en)
Kalpana LMS Adaptive Filter Design and Implementation of a Low Complexity LMS Filter
JP3336986B2 (en) Signal processor and multiply-accumulate unit with rounding function used therefor
JPH09223016A (en) Method and device for arithmetic processing
JPH0535773A (en) Method and system for vector division
JPH05174050A (en) Series arithmetic unit

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20130529

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20140212

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20140218

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20140421

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20140826

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20141027

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20141201

R150 Certificate of patent or registration of utility model

Ref document number: 5668391

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313111

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

LAPS Cancellation because of no payment of annual fees