binary code decimal adder

17
B S C S I I

Upload: haya-butt

Post on 31-May-2015

222 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Binary code decimal Adder

BSCS II

Page 2: Binary code decimal Adder

BSCS II

BSCS II

Decimal Adder

2

Page 3: Binary code decimal Adder

BSCS II

BCD Adder

When the sum of two digits is less than or equal

to 9 then the ordinary 4-bit adder can be used

But if the sum of two digits is greater than 9 then

a correction must be added “I.e adding 0110”

We need to design a circuit that is capable of

doing the correct addition

3

Page 4: Binary code decimal Adder

BSCS II

The BCD Adder BCD is a numerical code and can be used in

arithmetic operations Addition is the most important operation in BCD Following are the steps to perform addition:

Step1Add the two BCD numbers, using the rules for binary addition

Step2

If a 4-bit sum is equal to or less than 9, it is a valid BCD number

4

Page 5: Binary code decimal Adder

BSCS II

BCD adder (sum up to 9)

Number C S8 S4 S2 S1

0 0 0 0 0 0

1 0 0 0 0 1

2 0 0 0 1 0

3 0 0 0 1 1

4 0 0 1 0 0

5 0 0 1 0 1

6 0 0 1 1 0

7 0 0 1 1 1

8 0 1 0 0 0

9 0 1 0 0 1

The sum is the same with BCD adder

5

Page 6: Binary code decimal Adder

BSCS II

BCD adder (sum is 10 to 19)

Number C S8 S4 S2 S1

10 1 0 0 0 0

11 1 0 0 0 1

12 1 0 0 1 0

13 1 0 0 1 1

14 1 0 1 0 0

15 1 0 1 0 1

16 1 0 1 1 0

17 1 0 1 1 1

18 1 1 0 0 0

19 1 1 0 0 1

6

Page 7: Binary code decimal Adder

BSCS II

7BCD adder (sum is 10 to 19)

Number C S8 S4 S2 S1

10 1 0 0 0 0

11 1 0 0 0 1

12 1 0 0 1 0

13 1 0 0 1 1

14 1 0 1 0 0

15 1 0 1 0 1

16 1 0 1 1 0

17 1 0 1 1 1

18 1 1 0 0 0

19 1 1 0 0 1

K Z8 Z4 Z2 Z1

0 1 0 1 0

0 1 0 1 1

0 1 1 0 0

0 1 1 0 1

0 1 1 1 0

0 1 1 1 1

1 0 0 0 0

1 0 0 0 1

1 0 0 1 0

1 0 0 1 1

Binary sumBCD adder sum

Page 8: Binary code decimal Adder

BSCS II

8BCD adder (sum is 10 to 19)

Number C S8 S4 S2 S1

10 1 0 0 0 0

11 1 0 0 0 1

12 1 0 0 1 0

13 1 0 0 1 1

14 1 0 1 0 0

15 1 0 1 0 1

16 1 0 1 1 0

17 1 0 1 1 1

18 1 1 0 0 0

19 1 1 0 0 1

K Z8 Z4 Z2 Z1

0 1 0 1 0

0 1 0 1 1

0 1 1 0 0

0 1 1 0 1

0 1 1 1 0

0 1 1 1 1

1 0 0 0 0

1 0 0 0 1

1 0 0 1 0

1 0 0 1 1

Binary sumBCD adder sum

Page 9: Binary code decimal Adder

BSCS II

9BCD adder (sum is 10 to 19)

Number C S8 S4 S2 S1

10 1 0 0 0 0

11 1 0 0 0 1

12 1 0 0 1 0

13 1 0 0 1 1

14 1 0 1 0 0

15 1 0 1 0 1

16 1 0 1 1 0

17 1 0 1 1 1

18 1 1 0 0 0

19 1 1 0 0 1

K Z8 Z4 Z2 Z1

0 1 0 1 0

0 1 0 1 1

0 1 1 0 0

0 1 1 0 1

0 1 1 1 0

0 1 1 1 1

1 0 0 0 0

1 0 0 0 1

1 0 0 1 0

1 0 0 1 1

Binary sumBCD adder sum

+6

Page 10: Binary code decimal Adder

BSCS II

10

If sum is up to 9 Use the regular Adder.

If the sum > 9 Use the regular adder and add 6 to the result

Algorithm for BCD Adder

Page 11: Binary code decimal Adder

BSCS II

When is the result > 9

Number

K Z8 Z4 Z2 Z1

10 0 1 0 1 0

11 0 1 0 1 1

12 0 1 1 0 0

13 0 1 1 0 1

14 0 1 1 1 0

15 0 1 1 1 1

16 1 0 0 0 0

17 1 0 0 0 1

18 1 0 0 1 0

19 1 0 0 1 1

Binary sum

C = K +

11

Page 12: Binary code decimal Adder

BSCS II

When is the result > 9

Number

K Z8 Z4 Z2 Z1

10 0 1 0 1 0

11 0 1 0 1 1

12 0 1 1 0 0

13 0 1 1 0 1

14 0 1 1 1 0

15 0 1 1 1 1

16 1 0 0 0 0

17 1 0 0 0 1

18 1 0 0 1 0

19 1 0 0 1 1

Binary sum

C = K + Z8*Z4+

12

Page 13: Binary code decimal Adder

BSCS II

When is the result > 9

Number

K Z8 Z4 Z2 Z1

10 0 1 0 1 0

11 0 1 0 1 1

12 0 1 1 0 0

13 0 1 1 0 1

14 0 1 1 1 0

15 0 1 1 1 1

16 1 0 0 0 0

17 1 0 0 0 1

18 1 0 0 1 0

19 1 0 0 1 1

Binary sum

C = K + Z8*Z4+ Z8*Z2

13

Page 14: Binary code decimal Adder

BSCS II

0011

0101

0 1 0 0 0

0

00

1000

0000

Inputs:[A]=0101, [B]= 0011, Co=0

1 0 0 0

1

14

Page 15: Binary code decimal Adder

BSCS II

0110

0111

1 1 0 1

0

10

1101

0110

Inputs:[A]=0111, [B]= 0110, Co=0

0 0 1 1

1

15

Page 16: Binary code decimal Adder

BSCS II

BSCS II

Q&A

16

Page 17: Binary code decimal Adder

BSCS II

BSCS II

Thank You

17