0% found this document useful (0 votes)
4 views12 pages

02 Arithmetic Operations

The document provides an overview of arithmetic operations in digital logic design, detailing addition, subtraction, multiplication, and division across various number systems including decimal, binary, octal, and hexadecimal. It explains the rules and examples for each operation, emphasizing the differences in carry and borrowing rules based on the base of the number system. The document serves as a guide for understanding how to perform these operations using logic circuits rather than software.

Uploaded by

joshuapedrosa439
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views12 pages

02 Arithmetic Operations

The document provides an overview of arithmetic operations in digital logic design, detailing addition, subtraction, multiplication, and division across various number systems including decimal, binary, octal, and hexadecimal. It explains the rules and examples for each operation, emphasizing the differences in carry and borrowing rules based on the base of the number system. The document serves as a guide for understanding how to perform these operations using logic circuits rather than software.

Uploaded by

joshuapedrosa439
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

02 Arithmetic Operations

Performing Arithmetic Operationsg

Introduction

Arithmetic operations in logic design refer to hardware-based computations implemented using digital logic
circuits. Unlike software arithmetic (performed by programs), logic design arithmetic is realized using logic
gates, combinational circuits, and sequential circuits.

A. Addition of Number System


Addition of number systems is the process of adding numbers written in different numeral systems
such as decimal, binary, octal, and hexadecimal. Although the symbols and bases differ, the basic
idea of addition is the same: add digits from right to left and carry over when the sum reaches the
base of the number system.

1. Decimal Number System(Base 10)


Digits used: 0–9
Carry rule: Carry when the sum is 10 or more

Example
458
+ 267
-----
725

Explanation:
• 8 + 7 = 15 → write 5, carry 1
• 5 + 6 + 1 = 12 → write 2, carry 1
• 4+2+1=7

2. Binary Number System (Base 2)


Digits used: 0, 1
Carry rule: Carry when the sum is 2
Binary Addition Rules
• 0+0=0
• 0+1=1
• 1+0=1
• 1 + 1 = 10 (sum = 0, carry = 1)
Example
1011 (11)
+ 0110 (6)
------
10001 (17)

Digital Logic Page 1 of 12


Explanation:
• 1+0=1
• 1 + 1 = 0, carry 1
• 0 + 1 + 1 = 0, carry 1
• 1 + 0 + 1 = 0, carry 1

3. Octal Number System (Base 8)


Digits used: 0–7
Carry rule: Carry when the sum is 8 or more

Example
457₈
+ 326₈
------
1005₈

Explanation:
• 7 + 6 = 13₁₀ → 5₈, carry 1
• 5 + 2 + 1 = 8₁₀ → 0₈, carry 1
• 4 + 3 + 1 = 8₁₀ → 0₈, carry 1

4. Hexadecimal Number System (Base 16)


Digits used: 0–9, A–F
(A = 10, B = 11, …, F = 15)
Carry rule: Carry when the sum is 16 or more

Example:
3A7₁₆
+ 2F9₁₆
------
6A0₁₆

Explanation:
• 7 + 9 = 16₁₀ → 0, carry 1
• A (10) + F (15) + 1 = 26₁₀ → A, carry 1
• 3+2+1=6

Digital Logic Page 2 of 12


B. Subtraction of Number System
Subtraction in any number system follows the same basic idea, but the borrow rule depends on the
base of the number system.

General Rules for Subtraction


• Subtract from right to left.
• If the top digit is smaller than the bottom digit, a borrow is required.
• Borrowing means taking 1 from the next higher place value.
• The borrowed value equals the base of the number system.

1. Decimal Subtraction (Base 10)


Digits used: 0–9
Borrowing rule:
• When the top digit is smaller than the bottom digit, borrow 1 from the next left digit.
• Borrowing adds 10 to the current digit.
Example
752
− 389
------
363

Explanation
• 2 − 9 → borrow 1 → 12 − 9 = 3
• 4 − 8 → borrow 1 → 14 − 8 = 6
• 6−3=3

2. Binary Subtraction (Base 2)


Digits used: 0, 1
Borrowing rule:
• Binary subtraction follows base-2 borrowing rules.
• If the top bit is smaller than the bottom bit, borrow 1 from the next higher bit.
Borrowing 1 in binary converts 0 into 10₂.

Example
1010₂
− 0111₂
--------
0011₂

Explanation
• 0 − 1 → borrow → 10₂ − 1 = 1
• 0 − 1 → borrow → 10₂ − 1 = 1
• 0 − 1 → borrow → 10₂ − 1 = 1
• 0−0=0

Digital Logic Page 3 of 12


Methods of Binary Subtraction

Subtraction of Binary Numbers using 1’s Complement, and 2’s Complement


Both 1’s complement and 2’s complement are methods used to represent negative binary
numbers and to perform binary subtraction using addition. However, they differ in procedure,
handling of carry, and practical use.

Subtraction Method
• 1’s Complement Subtraction
o Take 1’s complement of subtrahend by inverting 0 to 1, 1 to 0
o Convert subtraction into addition then a dd to minuend
o If carry occurs → add it back (end-around carry)
o If no carry → complement result and attach negative sign

Example (1)
Subtract: 10102 − 00112
Step 1: Get 1’s complement of 0011 = 1100

Step 2: Converts subtraction into addition then add to minuend

1010 (From Minuend)


+ 1100 (From Subtrahend)
------
1 0110 (Sum with carry)

Step 3: Carry occurs add carry back:


0110 (Sum)
+ 1 (From Carry)
------
0111 (Final Answer)

Step 4: Take the result as final answer


0111 (Final Answer)

Example (2):
Subtract: 0101₂ - 1000₂
Step 1: Get 1’s complement of 1000 = 0111

Step 2: Convert subtraction into addition then add to minuend


0101
+ 0111
------
1100
Step 3: No carry → take 1’s complement
1’s comp of 1100 = 0011
Digital Logic Page 4 of 12
Step 4: Complement result and attach negative sign
−(0011₂) (Final Answer)

• 2’s Complement Subtraction


o Take 2’s complement of subtrahend
▪ Take 1’s complement
▪ Add 1
o Convert subtraction into addition
o Add to minuend
o Ignore final carry
o Get the final result

Example (1)
Subtract 1010₂ − 0011₂

Step 1: Get 1’s complement of 0011 = 1100


Step 2: Add 1
1100 (1’s complement)
+ 1
------
1101
Step 3: Convert subtraction into addition then add to minuend
1010
+ 1101
------
1 0111

Step 4: Ignore the final carry and get the final result
0111₂ (Final Answer)

3. Subtraction of Octal Number System (Base-8)


The octal number system uses base 8, so subtraction follows rules similar to decimal
subtraction but borrowing is done in 8, not in 10.
• Digits used: 0, 1, 2, 3, 4, 5, 6, 7
• Borrowing rule:
o When the top digit is smaller than the bottom digit, borrow 1 from the next higher place
value, which adds 8 to the current digit.

General Rule for Octal Subtraction


• Write the numbers vertically
• Start subtracting from the rightmost digit
• If the top digit < bottom digit:
o Borrow 1 from the next left digit

Digital Logic Page 5 of 12


o Add 8 to the current digit
• Continue until all digits are subtracted
• Write the final result in octal

Example (1):
531₈
− 211₈
------
320₈

Explanation:
o Units: 1 − 1 = 0
o Eights: 3 − 1 = 2
o Sixty-fours: 5 − 2 = 3

Example (2):
402₈
− 157₈
------
225₈

Explanation:
Step 1: Units place
• 2 − 7 → not possible
• Borrow 1 from 0 → 2 becomes 8₈ + 2 = 10₈
• 10₈ − 7 = 3
Step 2: Eights place
• The 0 became −1 due to borrowing
• Borrow from 4 → 0 becomes 7, How and Why?
Borrowing 1 adds 8,
So: −1 + 8 = 7
Therefore;
7−5=2
Step 3: Sixty-fours place
• 3−1=2

Cross Checking Answer


Step 1: Convert to Decimal
Convert 402₈ → decimal
4 × 82 + 0 × 81 + 2 × 80 = 256 + 0 + 2 = 25810
Convert 157₈ → decimal
1 × 82 + 5 × 81 + 7 × 80 = 64 + 40 + 7 = 11110

Digital Logic Page 6 of 12


Step 2: Subtract in Decimal
258 − 111 = 14710

Step 3: Convert Decimal Result Back to Octal


Repeated division by 8:
Division Quotient Remainder
147 ÷ 8 18 3
18 ÷ 8 2 2
2÷8 0 2
Read remainders bottom to top:
14710 = 2238

4. Subtraction of the Hexadecimal Number System (Base-16)


The hexadecimal number system uses base 16, so subtraction is similar to decimal
subtraction—but borrowing is done in 16, not 10.

Digits used: 0–9, A–F


A = 10, B = 11, C = 12, D = 13, E = 14, F = 15
Borrowing rule:
When the top digit is smaller than the bottom digit, borrow 1 from the next left digit, which
adds 16 to the current digit.

General Rule for Hexadecimal Subtraction


• Write the numbers vertically
• Subtract from right to left
• If top digit < bottom digit:
o Borrow 1
o Add 16 to the current digit
• Continue until all digits are subtracted
• Express the final result in hexadecimal

Example (1):
9C₁₆
− 2A₁₆
-----
72₁₆

Example (2):
A03₁₆
− 2F9₁₆
------
70A₁₆

Digital Logic Page 7 of 12


C. Multiplication of Number Systems
Multiplication works the same logical way across number systems—the only thing that changes is
the base and the carry rule. Let’s walk through the most common one’s step by step, from simple to
technical.

1. Multiplication in Decimal Number System (Base 10)


Digits used: 0–9
Carry rule: Carry when the result is 10 or more

Example:
2310
×410
---------

21

Explanation:
• 4 × 3 = 12→ write 2, carry 1
• 4 × 2 = 8, plus carry 1 → 9

2. Multiplication in Binary Number System (Base 2)


Digits used: 0, 1
Carry rule: Carry when the result is 2 or more

Example
1012 × 112

Explanation
101
× 11
-----
101 ← multiply by LSB (1)
+ 101 ← multiply by next bit (1), shift left
-----
11112 ← Final Answer

Digital Logic Page 8 of 12


3. Octal Multiplication (Base 8)
Digits used: 0–7
Carry rule: Carry when the result is 8 or more

General Octal Formula in Multiplication

where;

“mod 8” means - What is left over after dividing or grouping by 8


Or,

Example (1):
78
x 68
----
528 , How?

Explanation:
• 7 x 6 = 42
• carry = (42 / 8) = 5
• remainder = 42 – ( 8 x 5 ) = 42 – 40 = 2

Write 2,
Carry 5, so;
Final answer is 528

Example (2):
26
x 23
----------

Solution:
• Multiply 6 x 3 = 18
• So on and so forth

Digital Logic Page 9 of 12


4. Hexadecimal Multiplication (Base-16)
• Digits: 0–9, A–F
(A=10, B=11, C=12, D=13, E=14, F=15)
• Carry rule: Carry when the result is 16 or more
• The same formula applies as octal, but they differ in base number

Example (1):
1A16 × 416 = 6816
Explanation:
• Multiply first digit
1A₁₆
× 4₁₆
---------
• Multiply first digit
A × 4 = 10 × 4 = 40
Regroup:
40 = (2 × 16 ) + 8

o Write 8
o Carry 2
• Multiply second digit
1×4=4
Add carry:
4+2=6
Regroup:
6 = ( 0 × 16 ) + 6
o Write 6
o No carry

• Get the final answer


1A₁₆
× 4₁₆
---------
68₁₆

Digital Logic Page 10 of 12


D. Division of Number Systems
Division works by repeated subtraction of the divisor, respecting the base.

At every step:
• Quotient digit must be less than the base
• Remainder must be less than the divisor

General formula

Where;

or

1. Decimal Division ( Base-10)


8410 ÷ 410 = 2110

2. Binary Division ( Base-2)


10102÷102 = 1012

3. Octal Division ( Base-8 )

Example (1):
528 ÷ 68 = 648 ?

Explanation:

• Divide 56 by 6, then get the quotient by respecting the


rule of octal. A carry is produced if the product is 8 or
more.

• Multiply 6 x 7 in decimal to get 42, then convert it back


to octal by dividing the product by 8 to get the octal
value.

• Get the quotient as your final answer, include


remainder if there is.

• Therefore, the correct answer is 78 not 648.

Example(2):
Digital Logic Page 11 of 12
1268 ÷ 168 = ?8

Explanation:
Refer to the board demonstration done during our
class sessions.

4. Hexadecimal Division ( Base 16)


Example (1):
6816÷416 = 1A16

Explanation:

Refer to the board demonstration done during our


class sessions.

Digital Logic Page 12 of 12

You might also like