Decimal arithematic operation

Post on 07-May-2015

350 views 1 download

Transcript of Decimal arithematic operation

DECIMAL ARITHEMATIC OPERATIONS

PRESENTED BY :PADMAPRIYA.G

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

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

B B+ 1

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

dshl A Decimal shift left register A

ADDITION

BCD DIGITS

4 BIT BINARY ADDER

SUM : BINARY RANGING FROM 0 TO 19

DERIVATION OF BCD ADDER

C = K + Z8 Z4 + Z8 Z2

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.

BLOCK DIAGRAM OF BCD ADDER

C = K + Z8 Z4 + Z8 Z2

Parallel decimal addition

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

624 + 879 =1503

1 1 0 1 1 0 1 0

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.

624 + 879 =1503

USING FULL ADDER

Example - ADDITION

6796 0110 0111 1001 01106797 + 0101 0011 0110 1000

1011 1010 1111 1110

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

6796 0110 0111 1001 0110

6797 + 0101 0011 0110 1000 +

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

1011 1010 1111 1110

0110 0110 0110 0110 +

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

10001 10000 10101 10100

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

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

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

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

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.

Example

87 - 39

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

87 1000 0111

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

invalid 1110 0111

87 1000 011160 0110 0000 +

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

0110 ------- 10100 0111

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

+

+

18 – 72

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

18 0001 1000

27 0010 0111

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

0011 1111 invalid

18 0001 1000

27 0010 0111

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

0011 1111

0001 0110

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

0100 (1)0101

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

4 5

9’s complement of 45 = 54

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.

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

BCD SUBTRACTION

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