Half adder and full adder

9

Transcript of Half adder and full adder

Page 1: Half adder and full adder
Page 2: Half adder and full adder

Adding two single-bit binary values, X, Y produces a sum S bit and a carry out C-out bit.

This operation is called half addition and the circuit to realize it is called a half adder.

HALF ADDERHALF ADDER

X0011

Y0101

S0110

C-out 0 0 0 1

Half Adder Truth TableInputs Outputs

S(X,Y) = (1,2)S = X’Y + XY’S = X Y

C-out(x, y, C-in) = (3)C-out = XY

X

YSum S

C-out HalfAdder

X

YSC-OUT

Page 3: Half adder and full adder

•Adding two single-bit binary values, X, Y with a carry input bit C-in produces a sum bit S and a carry out C-out bit.

FULL ADDER

X00001111

Y00110011

S01101001

C-out 0 0 0 1 0 1 1 1

C-in 0 1 0 1 0 1 0 1

Full Adder Truth Table

S(X,Y, C-in) = (1,2,4,7)C-out(x, y, C-in) = (3,5,6,7)

Inputs Outputs

Sum S

C-in

X

0 1

00 01 11 10

Y

C-inXY

0

1

2

3

6

7

4

5

1

1 1

1

C-in

X

0 1

00 01 11 10

Y

C-inXY

0

1

2

3

6

7

4

5

1

11 1

Carry C-out

S = X’Y’(C-in) + XY’(C-in)’ + XY’(C-in)’ + XY(C-in)S = X Y (C-in)

C-out = XY + X(C-in) + Y(C-in)

Page 4: Half adder and full adder

FULL ADDER CIRCUIT USING AND-OR

XY

YC-in

C-outXC-in

X

X

Y

C-in

Y

C-in

Y Y’Y

X X’X

C-in C-in’C-in

X’Y’C-in

XY’C-in’

Sum SX’YC-in’

XYC-in

X’

X’

X

X

Y’

Y

Y

C-in

Y

C-in’

C-in’

C-in’

Full Adder

X Y

S

C-inC-out

Page 5: Half adder and full adder

FULL ADDER CIRCUIT USING XOR

Full Adder

X Y

S

C-inC-out XY

YC-in

C-outXC-in

X

X

Y

C-in

Y

C-in

Sum S

X

YC-in

Page 6: Half adder and full adder

Subtracting a single-bit binary value Y from anther X (I.e. X -Y ) produces a difference bit D and a borrow out bit B-out.

This operation is called half subtraction and the circuit to realize it is called a half subtractor.

HALF SUBTRACTORHALF SUBTRACTOR

X0011

Y0101

D0110

B-out 0 1 0 0

Half Subtractor Truth TableInputs Outputs

D(X,Y) = (1,2)D = X’Y + XY’D = X Y

B-out(x, y, C-in) = (1)B-out = X’Y

HalfSubtractor

X

YDB-OUT

X

Y

Difference D

B-out

Page 7: Half adder and full adder

•Subtracting two single-bit binary values, Y, B-in from a single-bit value X produces a difference bit D and a borrow out B-out bit.

This is called full subtraction.

FULL SUBTRACTOR

X00001111

Y00110011

D01101001

B-out 0 1 1 1 0 0 0 1

B-in 0 1 0 1 0 1 0 1

Full Subtractor Truth Table

S(X,Y, C-in) = (1,2,4,7)C-out(x, y, C-in) = (1,2,3,7)

Inputs Outputs

Difference D

B-in

X

0 1

00 01 11 10

Y

B-inXY

0

1

2

3

6

7

4

5

1

1 1

1

B-in

X

0 1

00 01 11 10

Y

B-inXY

0

1

2

3

6

7

4

5

1

11 1

Borrow B-out

S = X’Y’(B-in) + XY’(B-in)’ + XY’(B-in)’ + XY(B-in)S = X Y (C-in)

B-out = X’Y + X’(B-in) + Y(B-in)

Page 8: Half adder and full adder

FULL SUBTRACTOR CIRCUIT USING AND-OR

X’Y

YB-in

B-outX’B-in

X’

X’

Y

B-in

Y

B-in

Y Y’Y

X X’X

B-in B-in’B-in

X’Y’B-in

XY’B-in’

Difference DX’YB-in’

XYB-in

X’

X’

X

X

Y’

Y

Y

B-in

Y

B-in’

B-in’

B-in’

Full Subtractor

X Y

D

B-inB-out

Page 9: Half adder and full adder

FULL SUBTRACTOR CIRCUIT USING XOR

Difference D

X

YB-in

X’Y

YB-in

B-outX’B-in

X’

X’

Y

B-in

Y

B-in

Full Subtractor

X Y

D

B-inB-out