Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Half-adder
-Adds two bits -Produces a sum and carry
Full-adder
-Adds three 1-bit value Like half-adder, produces a sum and carry -Allows building N-bit adders Connect Cout of one adder to Cin of the next -These are called ripple-carry adders
BINARY ADDER
Binary adder that produces the arithmetic sum of binary numbers can be constructed with full adders connected in cascade, with the output carry from each full adder connected to the input carry of the next full adder in the chain Note that the input carry C-1 in the least significant position must be 0.
For example to add A= 1011 and B= 0011 0 1 1 0 Ci 1 0 1 1 Ai 0 0 1 1 Bi -------------------------------Sum: 1 1 1 0 Si Output carry: 0 0 1 1 Ci+1 Input carry:
FA(n-1)
FA(n-2)
...
FA1
FA0
C-1
C1 S1
C0 S0
An-1 An-2
A1 A0
Bn-1 Bn-2
B1 B0
carry input
Adder
C-1 .. Cn-1 Sn-1 Sn-2 S1 S0
output
BINARY SUBTRACTOR
The subtraction A B can be done by taking the 2s complement of B and adding it to A because A- B = A + (-B) It means if we use the inveters to make 1s complement of B (connecting each Bi to an inverter) and then add 1 to the least significant bit (by setting carry C0 to 1) of binary adder, then we can make a binary subtractor. Ex5 0101 0101 -2 0010 + 1101 (1s complement) 0010 + 1 (add 1 to LSB) 0011 = (+3)
BCD ADDER
The 4-bit binary adder can used to perform addition of BCD numbers . If 4-bit sum output is not valid BCD or if a carry C3 is generated then decimal 6(0110) is to be added to the sum to get correct value Ex2 Ex1
9 +8 17
1 0 0 1 1 0 0 0 1 0 0 0 1 0 0 0 1 + 0 1 1 0 0 1 1 1
0 1 1 1 + 0 1 0 0 1 0 1 1
carry
+ 1
1 7 1
BCD inputs
BCD ADDER
A inputs
B inputs
A3 A2 A1 A0
B3 B2 B1 B 0
4-bit Adder(AD1)
c3 S3 s2 s1 s0
Cin
Logic 0
A3 A2 A1 A0
B3 B2 B1 B0
Logic 0
4-bit Adder(AD2) C3 S3 S2 S1 S0
Tens
ones
BCD outputs