JPH0149973B2 - - Google Patents

Info

Publication number
JPH0149973B2
JPH0149973B2 JP58121951A JP12195183A JPH0149973B2 JP H0149973 B2 JPH0149973 B2 JP H0149973B2 JP 58121951 A JP58121951 A JP 58121951A JP 12195183 A JP12195183 A JP 12195183A JP H0149973 B2 JPH0149973 B2 JP H0149973B2
Authority
JP
Japan
Prior art keywords
binary number
signal line
circuit
absolute value
input
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired
Application number
JP58121951A
Other languages
Japanese (ja)
Other versions
JPS6014326A (en
Inventor
Teru Ishizuka
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.)
NEC Corp
Original Assignee
Nippon Electric Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nippon Electric Co Ltd filed Critical Nippon Electric Co Ltd
Priority to JP58121951A priority Critical patent/JPS6014326A/en
Publication of JPS6014326A publication Critical patent/JPS6014326A/en
Publication of JPH0149973B2 publication Critical patent/JPH0149973B2/ja
Granted legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/544Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices for evaluating functions by calculation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2207/00Indexing scheme relating to methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F2207/544Indexing scheme relating to group G06F7/544
    • G06F2207/5442Absolute difference

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • General Engineering & Computer Science (AREA)

Description

【発明の詳細な説明】 〔発明の属する技術分野〕 本発明は2進数の差の絶対値演算回路に関す
る。
DETAILED DESCRIPTION OF THE INVENTION [Technical field to which the invention pertains] The present invention relates to a circuit for calculating the absolute value of a difference between binary numbers.

〔従来技術の説明〕[Description of prior art]

従来、2つの2進数XとYとの差の絶対値演算
回路では、Yの1の補数と、前記Xと、最下位
ビツトへの補助入力とを1つ以上の全加算器の入
力とし、全加算器の最上位からの桁上げ出力によ
つてX≧Yか、X≦Yかを判定しX≧Yのときに
はX−Y=X++1を、X≦YのときにはY−
X=X+(X+の1の補数)を計算すること
によつて2数XとYの差の絶対値|X−Y|を出
力する。
Conventionally, in a circuit for calculating the absolute value of the difference between two binary numbers X and Y, the one's complement of Y, the X, and an auxiliary input to the least significant bit are input to one or more full adders, It is determined whether X≧Y or X≦Y by the carry output from the top of the full adder, and when X≧Y, X-Y=X++1, and when X≦Y, Y-
By calculating X=X+ (one's complement of X+), the absolute value |X-Y| of the difference between the two numbers X and Y is output.

この絶対値演算回路の構成は基本的に2つに大
別され、1つは全加算器の最上位の桁上げ出力か
ら最下位の補助入力へのフイードバツク回路をも
つことによりX≧YのときX≦Yのときの計算に
同一の全加算器を利用する方法であり、他の1つ
はX≧YのときとX≦Yのときの計算を分離して
複数の全加算器を利用する方法である。
The configuration of this absolute value arithmetic circuit is basically divided into two parts: one is a feedback circuit from the most significant carry output of the full adder to the least significant auxiliary input, so that when X≧Y; One method uses the same full adder for calculations when X≦Y, and the other method separates calculations when X≧Y and X≦Y and uses multiple full adders. It's a method.

第1図に前者の、第2図に後者の方法による絶
対値演算回路の一例をそれぞれ示す。第1図にお
いて、2つの2進数XとYはXは信号線10を通
つて直接全加算器120に入力され、またYは信
号線11を通つて各ビツト反転回路110に入力
された後、信号線12を通つて全加算器120に
入力される。全加算器120の最上位の桁上げ出
力C0は信号線13を通つて選択回路130の入
力となると同時に信号線14を通つて全加算器1
20の最下位ビツトの補助入力となる。全加算器
120の和Sは信号線15を通り選択回路130
への直接の入力となると同時に各ビツト反転回路
140を通り、和Sの1の補数となつて信号線
16を通つて選択回路130の入力となる。選択
回路130は、前記和Sと、その1の補数と、
前記桁上げ出力C0とを入力とし、桁上げ出力C0
が1のときには和Sを選択し、また桁上げ出力
C0が0のときには和Sの1の補数を選択して
Zとし、信号線17より出力する。ここでZは2
数XとYとの差の絶対値となる。
FIG. 1 shows an example of an absolute value calculation circuit using the former method, and FIG. 2 shows an example of an absolute value calculation circuit using the latter method. In FIG. 1, two binary numbers X and Y are input directly to the full adder 120 through the signal line 10, and after inputting Y to each bit inversion circuit 110 through the signal line 11, It is input to the full adder 120 through the signal line 12. The most significant carry output C0 of the full adder 120 is input to the selection circuit 130 through the signal line 13 and at the same time is input to the full adder 1 through the signal line 14.
It serves as an auxiliary input for the 20 least significant bits. The sum S of the full adder 120 passes through the signal line 15 to the selection circuit 130.
At the same time, it passes through each bit inversion circuit 140, becomes the one's complement of the sum S, and becomes an input to the selection circuit 130 through the signal line 16. The selection circuit 130 selects the sum S, its one's complement,
The above carry output C0 is input, and the carry output C0
When is 1, select sum S, and carry output
When C0 is 0, the one's complement of the sum S is selected as Z, and is output from the signal line 17. Here Z is 2
This is the absolute value of the difference between the numbers X and Y.

また第2図において、2つの2進数XとYは、
Xは信号線20を通つて全加算器220および2
21の入力となり、またYは信号線21を通つて
各ビツト反転回路210に入力された後、信号線
22を通つて全加算器220および221の入力
となる。全加算器220の最下位ビツトの補助入
力は0とする。この全加算器220の和S0は信
号線25より各ビツト反転回路240を通り、和
S0の1の補数0となつて信号線26を通り選択
回路230の入力となる。全加算器220の最上
位の桁上げ出力C0は信号線23を通り選択回路
230の入力となる。全加算器221の最下位ビ
ツトの補助入力は1とする。この全加算器221
の和S1は信号線28を通つて選択回路230の
入力となる。選択回路230は、前記和S1と、
前記和S0の1の補数0と、前記桁上げ出力C0と
を入力とし、桁上げ出力C0が1のときには和S1
側を選択し、桁上げ出力C0が0のときには和0
側を選択してZとし、信号線27より出力する。
ここでZは2数XとYとの差の絶対値となる。
Also, in Figure 2, the two binary numbers X and Y are
X passes through signal line 20 to full adders 220 and 2
Y is input to each bit inversion circuit 210 through a signal line 21, and then input to full adders 220 and 221 through a signal line 22. The auxiliary input of the least significant bit of full adder 220 is set to 0. The sum S0 of the full adder 220 is passed through each bit inversion circuit 240 from the signal line 25, and is added to the sum S0.
The one's complement of S0 is 0, which passes through the signal line 26 and is input to the selection circuit 230. The most significant carry output C0 of the full adder 220 passes through the signal line 23 and becomes an input to the selection circuit 230. The auxiliary input of the least significant bit of full adder 221 is set to 1. This full adder 221
The sum S1 is input to the selection circuit 230 through the signal line 28. The selection circuit 230 selects the sum S1 and
The one's complement 0 of the sum S0 and the carry output C0 are input, and when the carry output C0 is 1, the sum S1
When the carry output C0 is 0, the sum is 0.
Select the side and set it to Z, and output from the signal line 27.
Here, Z is the absolute value of the difference between the two numbers X and Y.

第1図および第2図に示したこれらの回路で
は、入力Xと入力YがMビツトの2進数であつ
て、かつYの下位Nビツトの全ビツトが0である
ことが既知であつても、Yの1の補数のMビツ
ト全部を計算に使用するため、利用する全加算器
はMビツト分の桁数となつてその和が決定される
までの桁上げ伝搬時間が長くなり、そのことが絶
対値演算回路全体の演算性能を下げる大きな要因
となつていた。
In these circuits shown in FIGS. 1 and 2, even if input X and input Y are M-bit binary numbers, and it is known that all of the lower N bits of Y are 0, , all M bits of the 1's complement of Y are used in calculations, so the full adder used has M bits of digits, and the carry propagation time is long until the sum is determined. was a major factor in lowering the arithmetic performance of the entire absolute value arithmetic circuit.

〔発明の目的〕[Purpose of the invention]

本発明の目的は、2つのMビツトの2進数入力
のうち一方の下位Nビツトが0であることが既知
の場合に、その入力の下位Nビツトと上位M―N
ビツトとを分離して演算することによつて上記欠
点を解決し、演算時間を短縮化して、されに金物
量を削減し得る絶対値演算回路を提供することに
ある。
An object of the present invention is to input two M-bit binary inputs in which, when it is known that the lower N bits of one of the inputs are 0, the lower N bits and upper M-N bits of that input are
The object of the present invention is to provide an absolute value calculation circuit which solves the above-mentioned drawbacks by performing calculations separately from bits, shortens calculation time, and reduces the amount of hardware.

〔発明の特徴〕[Features of the invention]

本発明の絶対値演算回路は、Mビツトの2進数
X入力とMビツトのうち下位Nビツトが0の2進
数Yの入力とに対して前記2進数Xの下位Nビツ
ト部の2進数X2の全ビツトの論理和C1を作成す
る論理和回路を含み、前記Mビツトの2進数Xの
上位M―Nビツト部の2進数X1とこの論理和C1
との和すなわちX1+C1と、前記Mビツトの2進
数Yの上位M―Nビツト部の2進数Y1との大小
関係を判定し、X1+C1>Y1のときにはX1−Y1
を計算し絶対値Zの上位M―Nビツト部として出
力するとともに判定信号C0=1を出力し、X1+
C1≦Y1のときには、X1+C1−Y1を計算し絶対
値Zの上位M―Nビツト部として出力するととも
に判定信号C0=0を出力する補助入力絶対値演
算回路と、前記2進数X2の2の補数X3を計算し
て出力する補数発生回路と、前記2進数X2と前
記補数X3とを入力とし、前記判定信号C0によつ
て前記2進数X2または前記補数X3のいずれか一
方を選択し絶対値Zの下位Nビツト部として出力
する選択回路とを備えたことを特徴とする。
The absolute value calculation circuit of the present invention calculates the binary number X2 of the lower N bits of the binary number It includes a logical sum circuit that creates a logical sum C1 of all bits, and the binary number X1 of the upper M-N bit part of the M-bit binary number X and this logical sum C1
, that is, X1 + C1, and the binary number Y1 of the upper MN bit part of the M-bit binary number Y is determined, and when X1 + C1 > Y1, X1 - Y1
is calculated and output as the upper MN bit part of the absolute value Z, and the judgment signal C0=1 is output, and X1+
When C1≦Y1, an auxiliary input absolute value calculation circuit calculates X1+C1−Y1 and outputs it as the upper M−N bit part of the absolute value Z, and also outputs a judgment signal C0=0, and the two's complement of the binary number X2. A complement generation circuit that calculates and outputs X3 receives the binary number X2 and the complement X3 as input, selects either the binary number X2 or the complement X3 according to the judgment signal C0, and calculates the absolute value Z. The present invention is characterized in that it includes a selection circuit that outputs the lower N bits of the data.

〔実施例による説明〕[Explanation based on examples]

次に本発明の実施例を図面を参照して詳細に説
明する。
Next, embodiments of the present invention will be described in detail with reference to the drawings.

第3図は本発明の一実施例絶対値演算回路のブ
ロツク構成図、第4図は演算する2進数X、Yお
よび演算出力Zのビツト構成を示す図である。第
4図に示すように、2進数XおよびYはMビツト
からなり、2進数YはMビツトのうちの下位Nビ
ツトが0であることが既知であり、上位M―Nビ
ツト部が2進数Y1で表される。また2進数Xは
下位Nビツト部が2進数X2で表され、上位M―
Nビツト部が2進数X1で表される。さらに2進
数Zは下位Nビツトが2進数Z2で表され、上位
M―Nビツトが2進数Z1で表される。
FIG. 3 is a block diagram of an absolute value calculation circuit according to an embodiment of the present invention, and FIG. 4 is a diagram showing the bit configuration of binary numbers X and Y to be calculated and the calculation output Z. As shown in FIG. 4, binary numbers X and Y consist of M bits, and it is known that the lower N bits of the M bits of binary number Y are 0, and the upper M−N bits are the binary number. Represented by Y1. Furthermore, the lower N bits of the binary number X are expressed as the binary number X2, and the upper M-
The N bit part is represented by a binary number X1. Furthermore, the lower N bits of the binary number Z are represented by the binary number Z2, and the higher M−N bits are represented by the binary number Z1.

第3図において、上記2進数Y1、X1およびX2
の各出力は、それぞれ信号線30、31および3
2を通つて補助入力付絶対値演算回路300の入
力に接続される。この信号線32は信号線34お
よび35に分岐し、信号線34は補数発生回路3
10の入力に接続され、信号線35は選択回路3
20の入力に接続される。また補数発生回路31
0の出力は信号線36を通つて選択回路320の
入力に接続される。前記演算回路300の判定出
力は信号線37を通つて選択回路320の入力に
接続される。この演算回路300は信号線38に
接続され、2進数Z1を出力し、選択回路320
は信号線39に接続され、2進数Z2を出力する。
In Figure 3, the above binary numbers Y1, X1 and X2
The respective outputs are connected to signal lines 30, 31 and 3, respectively.
2 to the input of the absolute value calculation circuit 300 with auxiliary input. This signal line 32 branches into signal lines 34 and 35, and the signal line 34 is connected to the complement generation circuit 3.
10, and the signal line 35 is connected to the selection circuit 3.
Connected to 20 inputs. Also, the complement generation circuit 31
The output of 0 is connected to the input of selection circuit 320 through signal line 36. The determination output of the arithmetic circuit 300 is connected to the input of a selection circuit 320 through a signal line 37. This arithmetic circuit 300 is connected to the signal line 38 and outputs a binary number Z1, and the selection circuit 320
is connected to the signal line 39 and outputs the binary number Z2.

このような構成の回路では、2進数XおよびY
が入力されると、前記2進数Yの上位M―Nビツ
トの2進数Y1は信号線30を通り、また前記2
進数Xの上位M―Nビツトの2進数X1は信号線
31を通つて補助入力付絶対値演算回路300に
入力する。前記2進数Xの下位Nビツトの2進数
X2は信号線32を通り補助入力付絶対値演算回
路300に入力するとともに、信号線34を通り
補数発生回路310に入力し、かつ信号線35を
通つて選択回路320に入力する。補助入力絶対
値演算回路300は前記2進数Y1と前記2進数
X1と前記2進数X2とが入力すると、2進数X2の
全ビツトの論理和C1を作成し、X1+C1>Y1か
X1+C1≦Y1かを判定してその判定信号C0を信号
線37を通して選択回路320に出力するととも
に、X1+C1>Y1のときにはX1−Y1を計算し、
X1+C1≦Y1のときにはY1−X1−C1を計算して
その計算結果の2進数Z1を信号線37を通して
出力する。ここで2進数Z1は前記2つのMビツ
トの2進数XとYとの差の絶対値|X−Y|の上
位M―Nビツトとなる。
In a circuit configured like this, binary numbers X and Y
is input, the binary number Y1 of the upper M−N bits of the binary number Y passes through the signal line 30, and the binary number Y1 of the upper M−N bits of the binary number Y passes through the signal line
The binary number X1 of the upper M−N bits of the base number X is inputted to the absolute value calculation circuit 300 with auxiliary input through the signal line 31. Binary number of the lower N bits of the binary number X
X2 is inputted to the absolute value calculation circuit 300 with auxiliary input through the signal line 32, inputted to the complement generation circuit 310 through the signal line 34, and inputted to the selection circuit 320 through the signal line 35. The auxiliary input absolute value calculation circuit 300 receives the binary number Y1 and the binary number Y1.
When X1 and the binary number X2 are input, the logical sum C1 of all bits of the binary number
It determines whether X1+C1≦Y1 and outputs the determination signal C0 to the selection circuit 320 through the signal line 37, and when X1+C1>Y1, calculates X1−Y1,
When X1+C1≦Y1, Y1-X1-C1 is calculated and the binary number Z1 resulting from the calculation is outputted through the signal line 37. Here, the binary number Z1 is the upper M-N bits of the absolute value |X-Y| of the difference between the two M-bit binary numbers X and Y.

補数発生回路310は前記2進数X2を入力す
ると、X2の2の補数X3を信号線36を通して選
択回路320に出力する。選択回路320は、前
記2進数X2と、前記補数X3と、前記判定信号C0
とを入力すると、判定信号C0が1か0かによつ
て2進数X2かその補数X3かのいずれかを選択し
て2進数Z2とし、信号線39を通して出力する。
ここで2進数Z2は前記2つのMビツトの2進数
XとYとの差の絶対値|X−Y|の下位Nビツト
となる。
When the complement generating circuit 310 receives the binary number X2, it outputs the two's complement X3 of X2 to the selection circuit 320 through the signal line 36. The selection circuit 320 selects the binary number X2, the complement X3, and the determination signal C0.
When this is input, either the binary number X2 or its complement X3 is selected depending on whether the determination signal C0 is 1 or 0, and the binary number Z2 is outputted through the signal line 39.
Here, the binary number Z2 is the lower N bits of the absolute value |X-Y| of the difference between the two M-bit binary numbers X and Y.

次に第3図に示した補助入力付絶対値演算回路
300の詳細なブロツク構成を第5図を参照して
説明る。第5図において、信号線32は論理和回
路400の入力に接続される。また信号線31は
全加算器420の入力に接続される。また信号線
30は各ビツト反転回路410および信号線40
を介して全加算器420の入力に接続される。論
理和回路400の出力は信号線41を介して論理
和430の一方の入力に接続され、他方の入力に
は全加算器420の判定信号出力が信号線42を
介して接続される。この論理和回路430の出力
は信号線43を介して全加算器420の補助入力
に接続される。この全加算器420の出力は信号
線45を介して直接選択回路440の入力に接続
され、また各ビツト反転回路450および信号線
46を介して選択回路440の入力に接続され
る。また全加算器420の判定出力は前記信号線
37に接続される。この信号線37は信号線47
および前記信号線42に分岐し、信号線47は選
択回路440の入力に接続される。この選択回路
440の出力には前記信号線38が接続される。
Next, the detailed block configuration of the absolute value calculation circuit 300 with auxiliary input shown in FIG. 3 will be explained with reference to FIG. In FIG. 5, signal line 32 is connected to the input of OR circuit 400. In FIG. Further, the signal line 31 is connected to the input of a full adder 420. Further, the signal line 30 is connected to each bit inversion circuit 410 and the signal line 40.
is connected to the input of full adder 420 via . The output of the OR circuit 400 is connected to one input of the OR 430 via a signal line 41, and the determination signal output of the full adder 420 is connected to the other input via a signal line 42. The output of this OR circuit 430 is connected to the auxiliary input of the full adder 420 via a signal line 43. The output of the full adder 420 is directly connected to the input of the selection circuit 440 via a signal line 45, and is also connected to the input of the selection circuit 440 via each bit inversion circuit 450 and a signal line 46. Further, the determination output of the full adder 420 is connected to the signal line 37. This signal line 37 is the signal line 47
and branches into the signal line 42, and the signal line 47 is connected to the input of a selection circuit 440. The output of this selection circuit 440 is connected to the signal line 38 .

このような構成の回路では、2進数X2が信号
線32を通つて論理和回路400に入力し、2進
数Y1が信号線30を通つて各ビツト反転回路4
10に入力し、かつ2進数X1が信号線31を通
つて全加算器420に入力すると、論理和回路4
00は2進数X2の全ビツトが0のときのみ論理
和信号C1を0にし、また2進数X2の全ビツトの
うち1ビツトでも1があるときには論理和信号
C1を1にする。この論理和信号C1は信号線41
を通つて論理和回路430に入力する。各ビツト
反転回路410は前記2進数Y1が入力すると、
2進数Y1の各ビツトを反転させ、2進数Y1の1
の補数1を信号線40を通して全加算器420
に出力する。全加算器420は、前記2進数X1
と、前記2進数1と、論理和回路430の出力
である最下位ビツトへの補助入力C2とを入力し、
和S=X1+1+C2を計算し、信号線45を通し
て選択回路440と各ビツト反転回路450とに
出力する。ここで前記全加算器420はその最上
位からの桁上げ出力が1のときにはX1+C2>Y1
を示し、また0のときにはX1+C2≦Y1を示す。
全加算器420はこの判定結果を判定信号C0と
して信号線37を通して出力するとともに、信号
線47を通して選択回路440に出力し、かつ信
号線42を通して論理和回路430に出力する。
In a circuit with such a configuration, the binary number
10 and when the binary number X1 is input to the full adder 420 through the signal line 31, the OR circuit 4
00 sets the OR signal C1 to 0 only when all bits of the binary number
Set C1 to 1. This OR signal C1 is the signal line 41
It is input to the OR circuit 430 through. When the binary number Y1 is input to each bit inversion circuit 410,
Invert each bit of binary number Y1 and convert it to 1 of binary number Y1.
The complement 1 of 1 is passed through the signal line 40 to the full adder 420
Output to. The full adder 420 receives the binary number X1
, the binary number 1, and the auxiliary input C2 to the least significant bit which is the output of the OR circuit 430,
The sum S=X1+1+C2 is calculated and outputted to the selection circuit 440 and each bit inversion circuit 450 through the signal line 45. Here, when the carry output from the most significant adder 420 is 1, X1+C2>Y1
, and when it is 0, it indicates X1+C2≦Y1.
Full adder 420 outputs this determination result as determination signal C0 through signal line 37, outputs it through signal line 47 to selection circuit 440, and outputs it through signal line 42 to OR circuit 430.

論理和回路430は前記論理和信号C1と前記
判定信号C0とを入力すると、論理和信号C1と判
定信号C0との論理和を計算し、その論理和信号
C2が信号線43を通つて前記全加算器420の
補助入力に導かれる。この結果前記全加算器42
0は判定信号C0が1のときには論理和信号C2を
1にし、判定信号C0が0のときには論理和信号
C2をC1にして、それぞれ補助入力とすることに
なる。各ビツト反転450は前記和Sを入力する
と、和Sの各ビツトを反転させ、和Sの1の補数
Sを信号線46を通して選択回路440に出力す
る。選択回路440は、前記和Sと、その1の補
数と、前記判定信号線C0とを入力すると、判
定信号C0が1のときには和Sを選択し、また判
定信号C0が0のときには和Sの1の補数を選
択して2進数Z1とし、信号線38を通して出力
する。ここで2進数Z1は判定信号C0が1のとき
にはZ1=S=X1−Y1となり、また判定信号C0が
0のときにはZ1==Y1−X1−C1となる。
When the logical sum circuit 430 receives the logical sum signal C1 and the judgment signal C0, it calculates the logical sum of the logical sum signal C1 and the judgment signal C0, and outputs the logical sum signal.
C2 is led to the auxiliary input of the full adder 420 through a signal line 43. As a result, the full adder 42
0 sets the OR signal C2 to 1 when the judgment signal C0 is 1, and sets the OR signal C2 to 1 when the judgment signal C0 is 0.
C2 will be changed to C1, and each will be used as an auxiliary input. Each bit inverter 450 receives the sum S, inverts each bit of the sum S, and outputs the one's complement S of the sum S to the selection circuit 440 through the signal line 46. When the selection circuit 440 receives the sum S, its one's complement, and the judgment signal line C0, it selects the sum S when the judgment signal C0 is 1, and selects the sum S when the judgment signal C0 is 0. The one's complement number is selected and made into a binary number Z1, which is output through the signal line 38. Here, the binary number Z1 becomes Z1=S=X1-Y1 when the judgment signal C0 is 1, and becomes Z1==Y1-X1-C1 when the judgment signal C0 is 0.

次に補助入力付絶対値演算回路300の他の実
施例を第6図を参照して詳細に説明する。第6図
において、信号線32は論理和回路500の入力
に接続される。また信号線31は全加算器520
および521の各入力に接続される。また信号線
30は各ビツト反転回路510および信号線50
を介して全加算器520および521の各入力に
接続される。論理和回路500の出力は信号線5
1を介して全加算器520の補助入力に接続され
る。また全加算器521の補助入力には1が与え
られる。全加算器520の出力は信号線52、各
ビツト反転回路530および信号線53を介して
選択回路540の入力に接続される。また全加算
器521の出力は信号線54を介して選択回路5
40の入力に接続される。さらに全加算器520
の判定出力は前記信号線37に接続される。この
信号線37は信号線55に分岐して選択回路54
0の入力に接続される。この選択回路540の出
力には前記信号線38が接続される。
Next, another embodiment of the absolute value calculation circuit 300 with auxiliary input will be described in detail with reference to FIG. In FIG. 6, signal line 32 is connected to the input of OR circuit 500. In FIG. Further, the signal line 31 is connected to the full adder 520
and 521. Further, the signal line 30 is connected to each bit inversion circuit 510 and the signal line 50.
is connected to each input of full adders 520 and 521 via. The output of the OR circuit 500 is the signal line 5
1 to the auxiliary input of full adder 520. Further, 1 is given to the auxiliary input of the full adder 521. The output of full adder 520 is connected to the input of selection circuit 540 via signal line 52, each bit inversion circuit 530, and signal line 53. Further, the output of the full adder 521 is sent to the selection circuit 5 via the signal line 54.
Connected to 40 inputs. Furthermore, full adder 520
The determination output of is connected to the signal line 37. This signal line 37 branches into a signal line 55 and a selection circuit 54
Connected to the 0 input. The output of this selection circuit 540 is connected to the signal line 38 .

このような構成の回路では、2進数X2が信号
線32を通つて論理和回路500に入力し、2進
数Y1が信号線30を通つて各ビツト反転回路5
10に入力し、かつ2進数X1が信号線31を通
つて全加算器520および521に入力すると、
論理和回路500は2進数X2の全ビツトが0の
ときのみ論理和信号C1を0にし、また2進数X2
の全ビツトのうち1ビツトでも1があるときには
論理和信号C1を1にする。この論理和信号C1は
信号線51を通つて全加算器520の最下位への
補助入力となる。各ビツト反転回路510は前記
2進数Y1を入力すると、2進数Y1の各ビツトを
反転させ、2進数Y1の1の補数1を信号線50
を通して全加算器520および521に出力す
る。
In a circuit with such a configuration, the binary number
10 and the binary number X1 is input to the full adders 520 and 521 through the signal line 31,
The OR circuit 500 sets the OR signal C1 to 0 only when all bits of the binary number X2 are 0;
If even one bit is 1 among all the bits, the OR signal C1 is set to 1. This OR signal C1 passes through the signal line 51 and becomes an auxiliary input to the lowest level of the full adder 520. When each bit inverting circuit 510 receives the binary number Y1, it inverts each bit of the binary number Y1 and transfers the one's complement 1 of the binary number Y1 to the signal line 50.
It is output to full adders 520 and 521 through.

全加算器520は前記2進数X1と前記2進数
Y1とを入力とし、前記論理和信号C1を最下位ビ
ツトへの補助入力として和S0=X1+1+C1を計
算し、信号線52を通して各ビツト反転回路53
0に出力する。ここで全加算器520の最上位か
らの桁上げ出力が1のときにはX1+C1>Y1を示
し、また0のときにはX1+C1≦Y1を示す。全加
算器520はこの判定結果を判定信号C0として
信号線37を通して出力するとともに、信号線5
5を通して選択回路540に出力する。一方全加
算器521は前記2進数X1と前記2進数1とを
入力とし、最下位ビツトへの補助入力を1として
和S1=X1+1+1を計算し、信号線54を通し
て選択回路540に出力する。各ビツト反転回路
530は前記和S0を入力すると、和S0の各ビツ
トを反転させ、和S0の1の補数0を信号線53
を通して選択回路540に出力する。
The full adder 520 inputs the binary number X1 and the binary number
Y1 is input, and the logical sum signal C1 is used as an auxiliary input to the least significant bit to calculate the sum S0=X1+1+C1, and each bit inversion circuit 53 is
Output to 0. Here, when the carry output from the most significant adder 520 is 1, it indicates X1+C1>Y1, and when it is 0, it indicates X1+C1≦Y1. The full adder 520 outputs this judgment result as a judgment signal C0 through the signal line 37, and also outputs the judgment result through the signal line 5.
5 to the selection circuit 540. On the other hand, the full adder 521 receives the binary number X1 and the binary number 1, sets the auxiliary input to the least significant bit as 1, calculates the sum S1=X1+1+1, and outputs it to the selection circuit 540 through the signal line 54. When each bit inversion circuit 530 receives the sum S0, it inverts each bit of the sum S0 and outputs the one's complement 0 of the sum S0 to the signal line 53.
It is output to the selection circuit 540 through.

選択回路540は、前記和S1と、前記補数0
と、前記判定信号C0とを入力すると、判定信号
C0が1のときには和S1を選択し、判定信号C0が
0のときには和S0の1の補数0を選択して2進
数Z1とし、信号線38を通して出力する。ここ
で2進数Z1は判定信号C0が1のときには、Z1=
S1=X1−Y1となり、また判定信号C0が0のとき
にはZ1=0=Y1−X1−C1となる。
The selection circuit 540 selects the sum S1 and the complement 0.
and the judgment signal C0 are input, the judgment signal
When C0 is 1, the sum S1 is selected, and when the determination signal C0 is 0, the 1's complement 0 of the sum S0 is selected and output as a binary number Z1 through the signal line 38. Here, when the judgment signal C0 is 1, the binary number Z1 is Z1=
S1=X1-Y1, and when the determination signal C0 is 0, Z1=0=Y1-X1-C1.

本発明では前記絶対値|X−Y|の上位M―N
ビツトの2進数Z1は補助入力付絶対値演算回路
300による演算時間のみによつて決定され、下
位Nビツトの2進数Z2の演算時間の影響を受け
ないため、従来技術では下位Nビツトが決定され
た後、上位M―Nビツトが決定されていたのに比
較し、全体の演算時間を短縮することができる。
さらに下位Nビツトでは絶対値演算回路としての
機能をもつ回路は必要とせず、下位Nビツトの演
算回路を補数発生回路と選択回路のみで構成する
ことにより、全体の金物量も削減することができ
る。
In the present invention, the upper M−N of the absolute value |X−Y|
The bit binary number Z1 is determined only by the calculation time of the absolute value calculation circuit with auxiliary input 300, and is not affected by the calculation time of the lower N bits of the binary number Z2. Therefore, in the conventional technology, the lower N bits are determined. Compared to the case where the upper MN bits were determined after the calculation, the overall calculation time can be shortened.
Furthermore, the lower N bits do not require a circuit that functions as an absolute value calculation circuit, and by configuring the lower N bit calculation circuit only with a complement generation circuit and a selection circuit, the overall amount of hardware can be reduced. .

〔発明の効果〕〔Effect of the invention〕

本発明は、以上説明したように、2つのMビツ
トの2進数入力のうち一方の下位Nビツトが0で
あることが既知の場合には、下位Nビツトと上位
M―Nビツトとの演算を分離した構成にすること
により、演算時間を短縮し、金物量を削減できる
優れた効果がある。
As explained above, when it is known that the lower N bits of one of two M-bit binary inputs are 0, the present invention performs an operation on the lower N bits and the upper M−N bits. The separate configuration has the advantage of shortening calculation time and reducing the amount of hardware.

【図面の簡単な説明】[Brief explanation of drawings]

第1図および第2図は従来例絶対値演算回路の
ブロツク構成図。第3図は本発明の一実施例絶対
値演算回路のブロツク構成図。第4図は演算する
2進数X・Yおよび演算出力Zのビツト構成を示
す図。第5図は第3図で示した補助入力付絶対値
演算回路の一例を示すブロツク構成図。第6図は
第3図で示した補助入力付絶対値演算回路の他の
例を示すブロツク構成図。 300…補助入力付絶対値演算回路、310…
補数発生回路、320、440、540…選択回
路、400、430、500…論理和回路、41
0、450、510、530…各ビツト反転回
路、420、520、521…全加算器。
1 and 2 are block diagrams of a conventional absolute value calculation circuit. FIG. 3 is a block diagram of an absolute value calculation circuit according to an embodiment of the present invention. FIG. 4 is a diagram showing the bit configuration of the binary numbers X and Y to be operated and the operation output Z. FIG. 5 is a block diagram showing an example of the absolute value calculation circuit with auxiliary input shown in FIG. 3. FIG. 6 is a block diagram showing another example of the absolute value calculation circuit with auxiliary input shown in FIG. 3. 300... Absolute value calculation circuit with auxiliary input, 310...
Complement generation circuit, 320, 440, 540... Selection circuit, 400, 430, 500... OR circuit, 41
0, 450, 510, 530... each bit inversion circuit, 420, 520, 521... full adder.

Claims (1)

【特許請求の範囲】 1 Mビツトの2進数XとMビツトのうち下位N
ビツトが0の2進数Yとの差の絶対値 Z=|X−Y| を計算する絶対値演算回路において、 前記2進数Xの下位Nビツト部を2進数X2と
し、その上位M―Nビツト部を2進数X1とし、
かつ前記2進数Yの上位M−Nビツト部を2進数
Y1とするとき、 前記2進数X2の全ビツトの論理和C1を作成す
る論理和回路を含み、この論理和C1と前記2進
数X1との和すなわちX1+C1と、2進数Y1との
大小関係を判定し、 X1+C1>Y1のときにはX1−Y1を計算し前記
絶対値Zの上位M−Nビツト部Z1として出力する
とともに、判定信号C0=1を出力し、 X1+C1≦Y1のときにはY1−X1−C1 を計算し前記絶対値Zの上位M―Nビツト部Z1
して出力するとともに判定信号C0=0を出力す
る補助入力付絶対値演算回路と、 前記2進数X2の2の補数X3を計算して出力す
る補数発生回路と、 前記2進数X2と前記補数X3とを入力とし、前
記判定信号C0に基づいて2進数X2または補数X3
のいずれか一方を選択し前記絶対値Zの下位Nビ
ツト部Z2として出力する選択回路と を備えたことを特徴とする絶対値演算回路。
[Claims] 1 M-bit binary number X and lower N of M bits
In an absolute value arithmetic circuit that calculates the absolute value Z= | Let the part be a binary number X1,
And the upper M-N bit part of the binary number Y is converted into a binary number.
When Y1, it includes an OR circuit that creates a logical sum C1 of all bits of the binary number X2, and determines the magnitude relationship between the sum of this logical sum C1 and the binary number X1, that is, X1 + C1, and the binary number Y1. However, when X1+C1>Y1, calculate X1-Y1 and output it as the upper M-N bit part Z1 of the absolute value Z, and output the judgment signal C0=1, and when X1+C1≦Y1, Y1-X1-C1 an absolute value arithmetic circuit with an auxiliary input that calculates and outputs it as the upper M−N bit part Z1 of the absolute value Z and also outputs a judgment signal C0=0, and calculates the two's complement X3 of the binary number X2. a complement generation circuit that outputs the binary number X2 and the complement X3, and generates the binary number X2 or the complement X3 based on the determination signal C0;
An absolute value calculation circuit comprising: a selection circuit which selects one of the following and outputs it as the lower N bit part Z2 of the absolute value Z.
JP58121951A 1983-07-05 1983-07-05 Arithmetic circuit of absolute value Granted JPS6014326A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP58121951A JPS6014326A (en) 1983-07-05 1983-07-05 Arithmetic circuit of absolute value

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP58121951A JPS6014326A (en) 1983-07-05 1983-07-05 Arithmetic circuit of absolute value

Publications (2)

Publication Number Publication Date
JPS6014326A JPS6014326A (en) 1985-01-24
JPH0149973B2 true JPH0149973B2 (en) 1989-10-26

Family

ID=14823950

Family Applications (1)

Application Number Title Priority Date Filing Date
JP58121951A Granted JPS6014326A (en) 1983-07-05 1983-07-05 Arithmetic circuit of absolute value

Country Status (1)

Country Link
JP (1) JPS6014326A (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS62142010U (en) * 1986-03-04 1987-09-08
KR870009295A (en) * 1986-03-28 1987-10-24 엔. 라이스 머레트 ALU for Bit Slice Processors with Multiplexed Bypass Paths
JPH07122845B2 (en) * 1986-11-06 1995-12-25 日本電気株式会社 Arithmetic unit
JP2681968B2 (en) * 1988-02-12 1997-11-26 松下電器産業株式会社 Arithmetic processing unit
JPH0223746U (en) * 1988-07-28 1990-02-16
JPH038018A (en) * 1989-06-06 1991-01-16 Toshiba Corp Adder / subtracter for signed absolute value
US5699287A (en) * 1992-09-30 1997-12-16 Texas Instruments Incorporated Method and device for adding and subtracting thermometer coded data
DE69424979T2 (en) * 1993-04-02 2000-11-02 The Furukawa Electric Co., Ltd. END PIECE OF AN OPTICAL FIBER, METHOD FOR PRODUCING THE SAME AND STRUCTURE FOR CONNECTING THE END PIECE TO AN OPTICAL DEVICE

Also Published As

Publication number Publication date
JPS6014326A (en) 1985-01-24

Similar Documents

Publication Publication Date Title
US6233597B1 (en) Computing apparatus for double-precision multiplication
EP0328063B1 (en) Absolute value calculating circuit having a single adder
JP3345894B2 (en) Floating point multiplier
JPH0149973B2 (en)
JPH05134851A (en) Multiplying circuit output system
US5325321A (en) High speed parallel multiplication circuit having a reduced number of gate stages
JPH0464091B2 (en)
JPH07118654B2 (en) Arithmetic unit
JPH11134175A (en) Multiplier/adder/subtracter and computing element
GB2094525A (en) Programmable read-only memory adder
JPH05233217A (en) Three-input rounding addition circuit
JP2551111B2 (en) Square arithmetic circuit
JP2734438B2 (en) Multiplier
JP2901463B2 (en) Addition device
JP2550597B2 (en) Squarer
JPH04149728A (en) Rom type digital arithmetic circuit
JPS62216034A (en) Parallel multiplier
US7231414B1 (en) Apparatus and method for performing addition of PKG recoded numbers
JP2890412B2 (en) Code conversion circuit
JPH05265715A (en) Adder/multiplier
JP2996024B2 (en) Multiplication circuit
JPH1115641A (en) Multiplier using redundant binary adder
JPH01126829A (en) Decoder circuit
JPH0584527B2 (en)
JPH01176120A (en) Decoder circuit