Decimal arithematic operation

25
DECIMAL ARITHEMATIC OPERATIONS PRESENTED BY : PADMAPRIYA.G

Transcript of Decimal arithematic operation

Page 1: Decimal arithematic operation

DECIMAL ARITHEMATIC OPERATIONS

PRESENTED BY :PADMAPRIYA.G

Page 2: Decimal arithematic operation

INTRO

INP

UT

•Decimal numbers

ALU

•Decimal numbers are placed in the registers in coded form - Binary coded decimal (BCD )

•Micro operations are performed

output

•Decimal numbers

Page 3: Decimal arithematic operation

DECIMAL ARITHEMATIC MICROOPERATION SYMBOLS

A A + B

Add contents of registers A and B, and transfer the sum into A.

B’ 9’s complement of B. A A + B’ +1 content of A plus 10’s complement of B into A

Page 4: Decimal arithematic operation

B B+ 1

Increment BCD number in B dshr A Decimal shift right register A

dshl A Decimal shift left register A

Page 5: Decimal arithematic operation

ADDITION

BCD DIGITS

4 BIT BINARY ADDER

SUM : BINARY RANGING FROM 0 TO 19

Page 6: Decimal arithematic operation

DERIVATION OF BCD ADDER

C = K + Z8 Z4 + Z8 Z2

Page 7: Decimal arithematic operation

Output of binary adder : Binary form .

Conversion to BCD

Binary sum ≤ 1001 : no conversion

Binary sum ≥ 1001 : non valid BCD

add binary 6 (0110)

3 different ways to add.

Page 8: Decimal arithematic operation

BLOCK DIAGRAM OF BCD ADDER

C = K + Z8 Z4 + Z8 Z2

Page 9: Decimal arithematic operation

Parallel decimal addition

BCD adders = digits in the number. Sum is formed in parallel. requires only 1 micro operations.

Page 10: Decimal arithematic operation

624 + 879 =1503

1 1 0 1 1 0 1 0

Page 11: Decimal arithematic operation

DIGIT SERIAL, BIT PARALLEL ADDITION

Digits are applied to single BCD adder serially.

Bits of each coded digit are transferred in parallel.

For k digits – k micro operations.

Page 12: Decimal arithematic operation

624 + 879 =1503

Page 13: Decimal arithematic operation

USING FULL ADDER

Page 14: Decimal arithematic operation

Example - ADDITION

6796 0110 0111 1001 01106797 + 0101 0011 0110 1000

1011 1010 1111 1110

• +• -----------------------------------------

Page 15: Decimal arithematic operation

6796 0110 0111 1001 0110

6797 + 0101 0011 0110 1000 +

--------------------------------

1011 1010 1111 1110

0110 0110 0110 0110 +

-----------------------------------

10001 10000 10101 10100

Page 16: Decimal arithematic operation

6796 0110 0111 1001 01106797 + 0101 0011 0110 1000

1011 1010 1111 1110 0110 0110 0110 0110

10001 10000 10101 10100 1 1 1 1

0001 0010 0001 0110 01001 2 1 6 4

+-------------------------------------------

+-------------------------------------------

+ ------------------------------------------------------ ------------------------------------------------------

Page 17: Decimal arithematic operation

SUBTRACTION

Using 9’s complement : - Find 9’s complement of the –ve

number. - Add the 2 numbers. - IF result ≥ 10,add 6(0110). - If the carry is generated add it with the result, else find the 9’s complement of it.

Page 18: Decimal arithematic operation

Example

87 - 39

9’s complement of 39 = 99-39 = 60

87 1000 0111

60 0110 0000 + --------------------

invalid 1110 0111

Page 19: Decimal arithematic operation

87 1000 011160 0110 0000 +

------------------ 1110 0111

0110 ------- 10100 0111

1-------------------- 0100 1000-------------------- 4 8

+

+

Page 20: Decimal arithematic operation

18 – 72

9’s complement of 72 = 99-72 =27

18 0001 1000

27 0010 0111

-----------------

0011 1111 invalid

Page 21: Decimal arithematic operation

18 0001 1000

27 0010 0111

-----------------

0011 1111

0001 0110

------- -------

0100 (1)0101

------- --------

4 5

9’s complement of 45 = 54

Page 22: Decimal arithematic operation

USING 10’S COMPLEMENT

• Using 10’s complement : - Find the 10’s complement of the number.

- Add the 2 numbers. - If the result ≥ 10, add 6(0110).

- If the carry is not generated , then find the 10’s complement of the result.

Page 23: Decimal arithematic operation

34 – 5610’s complement of 56 = (99-56)+1 = 44

34 0011 010044 0100 0100 +

--------------- 0111 1000

7 8 10’s complement of 78 = 22

Page 24: Decimal arithematic operation

BCD SUBTRACTION

M = 0 - addition is performed. M = 1 - subtraction is performed.

Page 25: Decimal arithematic operation