Digital Logic Octal and Hexadecimal Arithmetic RUPESH KUMAR

  • Slides: 8
Download presentation
Digital Logic: Octal and Hexadecimal Arithmetic RUPESH KUMAR DUTTA Assistant Professor, ECE Department

Digital Logic: Octal and Hexadecimal Arithmetic RUPESH KUMAR DUTTA Assistant Professor, ECE Department

Octal Arithmetic A SUM B 2

Octal Arithmetic A SUM B 2

Octal Addition � Add the right most digits of each octal numbers. � Find

Octal Addition � Add the right most digits of each octal numbers. � Find the modulo of the sum of digits means divide the sum by 8 and the remainder so obtained is the octal equivalent of the sum and the quotient is added to the next sum of digits from right side. � Example: - Add the octal numbers (123)8 and (527)8. 1 1 2 3 5 2 7 6 5 2 If SUM is ≤ 7 than no change. 3 3+7=10 (more than 7) Divide 10 by 8 (Quotient=1, Reminder=2 )

Octal Subtraction � Find either 7’s or 8’s complement of the subtrahend. � Add

Octal Subtraction � Find either 7’s or 8’s complement of the subtrahend. � Add the minuend and the subtrahend. � Example: - Subtract (453)8 – (234)8. � Using 8’s complement: � 8’s complement of 234 = 544 � Add (453)8 + (544)8 Discard carry 4 1 453 + 544 1217 If SUM is ≤ 7 than no change. If SUM is >7 than divide the sum by 8. Thus, (453)8 – (234)8 =(217)8

Hexadecimal Addition 5

Hexadecimal Addition 5

Hexadecimal Addition � Add the right most digits of each Hexadecimal numbers. � Find

Hexadecimal Addition � Add the right most digits of each Hexadecimal numbers. � Find the modulo of the sum of digits means divide the sum by 16 and the remainder so obtained is the Hexadecimal equivalent of the sum and the quotient is added to the next sum of digits from right side. � Example 2: Find the sum of the hexadecimal numbers (A 2 AC)16 and (1 FAB)16? If SUM is ≤ 15 than no change. If SUM is >15 than divide the sum by 16. 6 If SUM is ≤ 15 than no change. 1 1 1 A 2 A C 1 F A B C 2 5 7 C(12)+B(11)=23 (more than 15) Divide 23 by 16 Reminder=7) (Quotient=1, 21/16(Quotient=1, Reminder=5) 18/16(Quotient=1, Reminder=2)

Hexadecimal Subtraction � Find either 15’s or 16’s complement of the subtrahend. � Add

Hexadecimal Subtraction � Find either 15’s or 16’s complement of the subtrahend. � Add the minuend and the subtrahend. � Example: - Subtract (ABC)16 – (A 3 B)16. � Using 16’s complement: � 16’s complement of A 3 B = 5 C 5 If SUM is ≤ 15 than no change. � Add (ABC)16 + (5 C 5)16 If SUM is >15 than divide the sum by Discard carry 7 11 + ABC 5 C 5 1081 16. Thus, (ABC)16 – (A 3 B)16=(81)16

Thanks …. 8

Thanks …. 8