JPH05257643A - Binary complement unit - Google Patents

Binary complement unit

Info

Publication number
JPH05257643A
JPH05257643A JP4086225A JP8622592A JPH05257643A JP H05257643 A JPH05257643 A JP H05257643A JP 4086225 A JP4086225 A JP 4086225A JP 8622592 A JP8622592 A JP 8622592A JP H05257643 A JPH05257643 A JP H05257643A
Authority
JP
Japan
Prior art keywords
input
adder
terminals
digit
coupled
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP4086225A
Other languages
Japanese (ja)
Inventor
Kazuo Okada
一夫 岡田
Yoshihiko Kamo
良彦 加茂
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 Ltd
Fujitsu General Ltd
Original Assignee
Fujitsu Ltd
Fujitsu General 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 Ltd, Fujitsu General Ltd filed Critical Fujitsu Ltd
Priority to JP4086225A priority Critical patent/JPH05257643A/en
Publication of JPH05257643A publication Critical patent/JPH05257643A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To obtain the complement unit of simple constitution which maintains the relation of negative-to-positive conversion without fail. CONSTITUTION:Data input terminals for (n) bits are coupled with (n) bits of one side of an adder 14 through inverters, the output side of a NAND circuit 15 is coupled with the least-digit input terminal CO among input terminals for (n) bits of the other side of the adder 14, and the remaining inputs are grounded; and the largest-digit input terminal E3 among the input terminals of the NAND circuit 15 is coupled with the largest digit A3 of (n)-bit data, other terminals are coupled with the output sides of the inverters except the largest digit in order, and a complementary number is obtained from the output terminals for (n) bits of the adder 14. For example, when negative maximum values 1, 0, 0, and 0 are inputted as 4-bit input data, they are inverted and 0, 1, 1, and 1 are inputted to the adder; and thus 0, 1, 1, and 1 are outputted for the input of 1, 0, 0, and 0, and consequently the negative-to-positive conversion is performed.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は、コンピュータなどの計
算で負の数を得るために用いられる2進法の補数器に関
するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a binary complementer used to obtain a negative number in a computer or the like.

【0002】[0002]

【従来の技術】従来、2進法の補数器を加算器で構成す
ると、図3に示すようになる。すなわち、nビットのデ
ータ入力端子A0,A1,A2,A3から入力したディ
ジタル信号をインバータ10、11、12、13で反転
して加算器14の一方の入力端子B0,B1,B2,B
3に入力する。この加算器14には、他方の入力端子C
0,C1,C2,C3から常時1が加えられる。する
と、出力端子D0,D1,D2,D3には、入力した数
の補数が得られる。
2. Description of the Related Art Conventionally, when a binary complementer is constructed by an adder, it becomes as shown in FIG. That is, the digital signals input from the n-bit data input terminals A0, A1, A2, A3 are inverted by the inverters 10, 11, 12, 13 and one input terminal B0, B1, B2, B of the adder 14 is inverted.
Enter in 3. This adder 14 has the other input terminal C
1 is always added from 0, C1, C2 and C3. Then, the complement of the input number is obtained at the output terminals D0, D1, D2 and D3.

【0003】具体的には、図4において、A0,A1,
A2,A3に入力したデータが、0、0、0、1とする
と、インバータ10、11、12、13で反転されて、
B0,B1,B2,B3への入力が、1、1、1、0と
なる。他方のC0,C1,C2,C3への入力は、常時
0、0、0、1であるから、この1が加えられて、D
0,D1,D2,D3からの出力として、入力の補数の
1、1、1、1が得られる。同様に、A0,A1,A
2,A3が、0、1、1、1のとき、D0,D1,D
2,D3は、補数1、0、0、1が得られる。その他の
場合も同様である。
Specifically, in FIG. 4, A0, A1,
If the data input to A2 and A3 are 0, 0, 0 and 1, they are inverted by the inverters 10, 11, 12 and 13,
Inputs to B0, B1, B2, B3 are 1, 1, 1, 0. The inputs to the other C0, C1, C2 and C3 are always 0, 0, 0 and 1, so this 1 is added and D
As outputs from 0, D1, D2 and D3, input complements 1, 1, 1, 1 are obtained. Similarly, A0, A1, A
When 2, A3 is 0,1,1,1, D0, D1, D
For 2, D3, complements 1, 0, 0, 1 are obtained. The same applies to other cases.

【0004】[0004]

【発明が解決しようとする課題】ところが、この従来の
補数器では、A0,A1,A2,A3に負の最大値1、
0、0、0が入力すると、B0,B1,B2,B3が、
0、1、1、1となり、C0,C1,C2,C3は、常
時0、0、0、1であるから、この1が加えられて、D
0,D1,D2,D3には、1、0、0、0が得られ
る。このように、1、0、0、0の入力に対し、出力も
1、0、0、0となって、負から負への変換の関係にな
るという問題があった。
However, in this conventional complementer, the maximum negative value of 1 for A0, A1, A2 and A3,
When 0, 0, 0 is input, B0, B1, B2, B3 are
0, 1, 1, 1, and C0, C1, C2, C3 are always 0, 0, 0, 1, so this 1 is added to D
1, 0, 0, 0 is obtained in 0, D1, D2, D3. As described above, there is a problem in that the output becomes 1, 0, 0, 0 with respect to the input of 1, 0, 0, 0, and there is a relation of conversion from negative to negative.

【0005】本発明は、簡単な構成により、必ず負から
正への変換の関係が維持されるものを得ることを目的と
するものである。
It is an object of the present invention to obtain, with a simple structure, one in which the relationship of conversion from negative to positive is always maintained.

【0006】[0006]

【課題を解決するための手段】本発明は、nビットのデ
ータ入力端子をそれぞれインバータを介して加算器14
のnビットの一方の入力端子に結合し、この加算器14
のnビットの他方の入力端子のうち、最小桁の入力端子
にナンド回路15の出力側を結合し、残りの入力端子を
接地し、前記ナンド回路15入力端子のうち最大桁の入
力端子を前記nビットのデータ入力端子の最大桁に結合
し、その他の入力端子をそれぞれ最大桁以外の前記イン
バータの出力側に順次結合し、前記加算器14のnビッ
トの出力端子から補数を得るようにしたことを特徴とす
る2進法の補数器である。
According to the present invention, an adder 14 is provided for each of n-bit data input terminals via an inverter.
Is connected to one of the n-bit input terminals of
Of the other n-bit input terminals, the output side of the NAND circuit 15 is coupled to the input terminal of the least significant digit, the remaining input terminals are grounded, and the input terminal of the most significant digit of the NAND circuit 15 input terminals is It is connected to the maximum digit of the n-bit data input terminal, the other input terminals are sequentially coupled to the output side of the inverter other than the maximum digit, and the complement is obtained from the n-bit output terminal of the adder 14. It is a binary complementer.

【0007】[0007]

【作用】nビット(例えば4ビット)の入力データが、
0、0、0、1とすると、インバータで反転されて加算
器へのデータ入力が、1、1、1、0となる。また、ナ
ンド回路15の入力が、0、1、1、0である。ここ
で、ナンド回路15の出力は、このナンド回路15への
入力が、1、1、1、1のとき0となる以外は、すべて
1であるから加算器の他方の入力の最小桁は1である。
そのため、加算器の他方の入力は、0、0、0、1とな
って、この1が加えられて、加算器の出力として入力の
補数の1、1、1、1が得られる。同様に、入力データ
が、0、1、1、1のとき、出力として補数1、0、
0、1が得られる。その他の場合も同様である。
Operation: When n-bit (for example, 4-bit) input data is
When 0, 0, 0, 1 is inverted by the inverter and the data input to the adder becomes 1, 1, 1, 0. The inputs to the NAND circuit 15 are 0, 1, 1, 0. Here, the output of the NAND circuit 15 is all 1 except that the input to the NAND circuit 15 is 0 when the input to this NAND circuit 15 is 1, 1, 1, and 1, so the minimum digit of the other input of the adder is 1. Is.
Therefore, the other input of the adder becomes 0, 0, 0, 1 and this 1 is added, and the complements of the input 1, 1, 1, 1 are obtained as the output of the adder. Similarly, when the input data is 0, 1, 1, 1, the output is complement 1, 0,
0 and 1 are obtained. The same applies to other cases.

【0008】つぎに、入力データとして負の最大値1、
0、0、0が入力すると、インバータで反転されて加算
器へのデータ入力が、0、1、1、1となる。また、ナ
ンド回路15への入力が、1、1、1、1である。ここ
で、ナンド回路15の出力は、その入力が、1、1、
1、1のときのみ0となるから、加算器の他方の入力
は、0、0、0、0となって、加算器の出力として、加
算器へのデータ入力の0、1、1、1がそのまま得られ
る。このようにして、1、0、0、0の入力に対し、出
力が0、1、1、1となって、負から正への変換がなさ
れる。
Next, as the input data, the maximum negative value 1,
When 0, 0, 0 is input, it is inverted by the inverter and the data input to the adder becomes 0, 1, 1, 1. The inputs to the NAND circuit 15 are 1, 1, 1, 1. Here, the output of the NAND circuit 15 has inputs 1, 1,
Since it becomes 0 only when it is 1, 1, the other input of the adder becomes 0, 0, 0, 0, and 0, 1, 1, 1 of the data input to the adder as the output of the adder Can be obtained as is. In this way, for inputs of 1, 0, 0, 0, outputs become 0, 1, 1, 1 and conversion from negative to positive is performed.

【0009】[0009]

【実施例】以下、本発明の一実施例を説明する。図1に
おいて、nビット(例えば4ビット)のデータ入力端子
A0,A1,A2,A3をインバータ10、11、1
2、13を介して加算器14の一方の入力端子B0,B
1,B2,B3に結合する。この加算器14には、他方
の入力端子C0,C1,C2,C3が設けられ、このう
ち、C1,C2,C3は、接地されている。残りの最小
桁の入力端子C0には、ナンド回路15が結合されてお
り、このナンド回路15の入力端子E0,E1,E2,
E3のうち、E0,E1,E2は、それぞれ前記インバ
ータ10、11、12の出力側に結合され、最大桁の入
力端子E3のみ、前記データ入力端子の最大桁A3に直
接結合されている。D0,D1,D2,D3は、出力端
子である。
EXAMPLE An example of the present invention will be described below. In FIG. 1, n-bit (for example, 4-bit) data input terminals A0, A1, A2, and A3 are connected to inverters 10, 11, and 1.
One of the input terminals B0 and B of the adder 14 via
It binds to 1, B2 and B3. The adder 14 is provided with the other input terminals C0, C1, C2 and C3, of which C1, C2 and C3 are grounded. A NAND circuit 15 is coupled to the remaining minimum digit input terminal C0, and the input terminals E0, E1, E2 of the NAND circuit 15 are connected.
Of E3, E0, E1, and E2 are coupled to the output sides of the inverters 10, 11, and 12, respectively, and only the maximum digit input terminal E3 is directly coupled to the maximum digit A3 of the data input terminal. D0, D1, D2 and D3 are output terminals.

【0010】以上のような構成における作用を図2に基
づき説明する。データ入力端子A0,A1,A2,A3
に入力したデータが、0、0、0、1とすると、インバ
ータ10、11、12、13で反転されて、加算器14
の一方の入力端子B0,B1,B2,B3の入力が、
1、1、1、0となる。また、ナンド回路15の入力端
子E0,E1,E2,E3は、データ入力端子A0が
0、インバータ10、11、12の出力が1、1、0で
あるから、全体として、0、1、1、0となる。ここ
で、ナンド回路15の出力、すなわち、C0は、ナンド
回路15の入力E0,E1,E2,E3が、1、1、
1、1のとき0となる以外は、すべて1であるからC0
は1である。そのため、加算器14の他方の入力端子C
0,C1,C2,C3は、0、0、0、1となって、こ
の1が加えられて、出力端子D0,D1,D2,D3に
は、入力の補数の1、1、1、1が得られる。同様に、
データ入力端子A0,A1,A2,A3が、0、1、
1、1のとき、出力端子D0,D1,D2,D3には、
補数1、0、0、1が得られる。その他の場合も同様で
ある。
The operation of the above structure will be described with reference to FIG. Data input terminals A0, A1, A2, A3
When the data input to 0 is set to 0, 0, 0, 1, it is inverted by the inverters 10, 11, 12, 13 and the adder 14
The input to one of the input terminals B0, B1, B2, B3 is
It becomes 1, 1, 1, 0. The input terminals E0, E1, E2, E3 of the NAND circuit 15 have the data input terminal A0 of 0 and the outputs of the inverters 10, 11, 12 are 1, 1, 0. , 0. Here, the output of the NAND circuit 15, that is, C0, is such that the inputs E0, E1, E2, E3 of the NAND circuit 15 are 1, 1,
C0 because all are 1 except 0 when 1 and 1
Is 1. Therefore, the other input terminal C of the adder 14
0, C1, C2, C3 become 0, 0, 0, 1 and this 1 is added to the output terminals D0, D1, D2, D3, which are 1, 1, 1, 1 of the complement of the input. Is obtained. Similarly,
Data input terminals A0, A1, A2, A3 are 0, 1,
When 1, 1, output terminals D0, D1, D2, D3,
The complements 1, 0, 0, 1 are obtained. The same applies to other cases.

【0011】つぎに、データ入力端子A0,A1,A
2,A3に負の最大値1、0、0、0が入力すると、加
算器14の一方の入力端子B0,B1,B2,B3が、
0、1、1、1となる。また、ナンド回路15の入力端
子E0,E1,E2,E3が、1、1、1、1である。
ここで、ナンド回路15の出力、すなわち、C0は、E
0,E1,E2,E3が、1、1、1、1のときのみ0
となるから、加算器14の他方の入力端子C0,C1,
C2,C3は、0、0、0、0となって、出力端子D
0,D1,D2,D3には、加算器14の一方の入力端
子B0,B1,B2,B3への入力データ0、1、1、
1がそのまま得られる。このようにして、1、0、0、
0の入力に対し、出力が0、1、1、1となって、負か
ら正への変換がなされる。
Next, the data input terminals A0, A1, A
When the maximum negative value 1, 0, 0, 0 is input to 2, A3, one input terminal B0, B1, B2, B3 of the adder 14 becomes
It becomes 0, 1, 1, 1. The input terminals E0, E1, E2, E3 of the NAND circuit 15 are 1, 1, 1, 1.
Here, the output of the NAND circuit 15, that is, C0 is E
0 only when 0, E1, E2, E3 are 1, 1, 1, 1
Therefore, the other input terminals C0, C1, of the adder 14
C2 and C3 become 0, 0, 0, 0, and output terminal D
0, D1, D2, D3 include input data 0, 1, 1, and 1 to one input terminal B0, B1, B2, B3 of the adder 14.
1 is obtained as it is. In this way, 1, 0, 0,
For 0 input, output becomes 0, 1, 1, 1 and conversion from negative to positive is performed.

【0012】前記実施例では、4ビットを例にして説明
したが、これに限られるものではなく、nビットの場合
に適用できる。
In the above-described embodiment, the case of 4 bits has been described as an example, but the present invention is not limited to this and can be applied to the case of n bits.

【0013】[0013]

【発明の効果】本発明は、nビットのデータ入力端子を
それぞれインバータを介して加算器14のnビットの一
方の入力端子に結合し、この加算器14のnビットの他
方の入力端子のうち、最小桁の入力端子にナンド回路1
5の出力側を結合し、残りの入力端子を接地し、前記ナ
ンド回路15入力端子のうち最大桁の入力端子を前記n
ビットのデータ入力端子の最大桁に結合し、その他の入
力端子をそれぞれ最大桁以外の前記インバータの出力側
に順次結合し、前記加算器14のnビットの出力端子か
ら補数を得るようにしたので、負の最大値が入力して
も、負から負への変換の関係になるということがなく、
必ず負から正への変換の関係が維持されるものである。
According to the present invention, an n-bit data input terminal is coupled to one of n-bit input terminals of an adder 14 via an inverter, and the n-bit other input terminal of the adder 14 is connected. , NAND circuit 1 to the input terminal of the smallest digit
5 is connected to the output side, the remaining input terminals are grounded, and the input terminal of the largest digit among the NAND circuit 15 input terminals is the n-th input terminal.
Since it is connected to the maximum digit of the bit data input terminal, the other input terminals are sequentially coupled to the output side of the inverter other than the maximum digit, and the complement is obtained from the n-bit output terminal of the adder 14. , Even if the maximum negative value is input, there is no relation of conversion from negative to negative,
The relationship of conversion from negative to positive is always maintained.

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

【図1】本発明による2進法の補数器の一実施例を示す
ブロック図である。
FIG. 1 is a block diagram showing an embodiment of a binary complementer according to the present invention.

【図2】本発明による2進法の補数変換の説明図であ
る。
FIG. 2 is an explanatory diagram of binary complement conversion according to the present invention.

【図3】従来の2進法の補数器のブロック図である。FIG. 3 is a block diagram of a conventional binary complementer.

【図4】従来の2進法の補数変換の説明図である。FIG. 4 is an explanatory diagram of conventional binary complement conversion.

【符号の説明】[Explanation of symbols]

10、11、12、13…インバータ、14…加算器、
15…ナンド回路。
10, 11, 12, 13 ... Inverter, 14 ... Adder,
15 ... NAND circuit.

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 nビットのデータ入力端子をそれぞれイ
ンバータを介して加算器14のnビットの一方の入力端
子に結合し、この加算器14のnビットの他方の入力端
子のうち、最小桁の入力端子にナンド回路15の出力側
を結合し、残りの入力端子を接地し、前記ナンド回路1
5入力端子のうち最大桁の入力端子を前記nビットのデ
ータ入力端子の最大桁に結合し、その他の入力端子をそ
れぞれ最大桁以外の前記インバータの出力側に順次結合
し、前記加算器14のnビットの出力端子から補数を得
るようにしたことを特徴とする2進法の補数器。
1. An n-bit data input terminal is coupled to one of n-bit input terminals of an adder 14 via an inverter, respectively, and the n-bit other input terminal of the adder 14 has the least significant digit. The output side of the NAND circuit 15 is connected to the input terminal, and the remaining input terminals are grounded.
Of the five input terminals, the input terminal of the maximum digit is coupled to the maximum digit of the n-bit data input terminal, and the other input terminals are sequentially coupled to the output side of the inverter other than the maximum digit, respectively, A binary complementer, wherein a complement is obtained from an n-bit output terminal.
JP4086225A 1992-03-10 1992-03-10 Binary complement unit Pending JPH05257643A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP4086225A JPH05257643A (en) 1992-03-10 1992-03-10 Binary complement unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP4086225A JPH05257643A (en) 1992-03-10 1992-03-10 Binary complement unit

Publications (1)

Publication Number Publication Date
JPH05257643A true JPH05257643A (en) 1993-10-08

Family

ID=13880851

Family Applications (1)

Application Number Title Priority Date Filing Date
JP4086225A Pending JPH05257643A (en) 1992-03-10 1992-03-10 Binary complement unit

Country Status (1)

Country Link
JP (1) JPH05257643A (en)

Similar Documents

Publication Publication Date Title
US4953115A (en) Absolute value calculating circuit having a single adder
US4163211A (en) Tree-type combinatorial logic circuit
US4761760A (en) Digital adder-subtracter with tentative result correction circuit
JPH0428180B2 (en)
JPH07182141A (en) Arithmetic unit/method
US4520347A (en) Code conversion circuit
JPH0375900B2 (en)
US4623872A (en) Circuit for CSD-coding of a binary number represented in two's complement
JPH09222991A (en) Adding method and adder
JPH05257643A (en) Binary complement unit
JPH0519170B2 (en)
JPH01187630A (en) Size comparison circuit
JP2991788B2 (en) Decoder
JPH01220528A (en) Parity generator
JPS61105640A (en) Parallel complement circuit
JPH0635668A (en) Full adder
JP2890412B2 (en) Code conversion circuit
JPH07120964B2 (en) Extension circuit
KR0154934B1 (en) Improved circuit for accomplishing the 2's complement
JP2599984B2 (en) Input data peak value detection circuit
JP2513021B2 (en) Signed digit number sign judgment circuit
JPH051498B2 (en)
JPH0377538B2 (en)
JPS59168543A (en) Binary-decimal converting circuit
JPH0580978A (en) Arithmetic processing circuit

Legal Events

Date Code Title Description
A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20001017