You are on page 1of 21

Sulaimani Polytechnic University

Technical College of Informatics


(Network Department)

Digital Logic design


Lecture 4:Arithmatic Operation
Lecturer: Jutyar Fatih Awrahman
Jutyar.faith@spu.edu.iq
Previous lecture Lecture 4
• Convert between • Arithmetic operation
• Decimal & binary • Addition
• Decimal & Octal • Subtraction
• Decimal & Hexadecimal • Multiplication
• Binary & Octal • Division
• Binary & Hexadecimal
• Octal & Hexadecimal
Binary Addition(+)

- Binary Addition: The four basic rules for adding binary digits
(bits) are as follows.

Rules of binary addition


0+0=0
0+1=1
1+0=1
1 + 1 = 0, and carry 1 to next significant bit.

21 December 2022 3
Binary Addition
Examples:
1 1 1 1
1 1 0 1 11
+ 1 0 0 + 0 11
10 1 0 1 0 10

1 1 1 1 1 1
0 0 0 1 1 0 1 0 1 1 1 1
+0 0 0 0 1 1 0 0 + 1 1 1 1
0 0 1 0 0 1 1 0 1 1 1 1 0
Binary Subtraction(-)
• Binary Subtraction: The four basic rules for subtracting binary digits (bits)
are as follows.

Rules of binary Subtraction

0–0=0
0 – 1 = 1, and borrow 1 from the next significant bit.
1–0=1
1–1=0

21 December 2022 5
Binary Subtraction
Examples:

1 1 1 01
- 0 1 - 0 01
10 10 0
10
0 10 0 0 10
00 1 0 0 1 0 1 1 1 0 1 1
- 00 0 1 0 0 0 1 - 0 1 1 1 1
00 0 1 0 1 0 0 0 1 1 0 0
Binary Multiplication(x)
• Binary Multiplication: The four basic rules for multiplication binary digits
(bits) are as follows.

Rules of binary Multiplication

0x0=0
0x1=0
1x0=0
1 x 1 = 1, and no carry or borrow bits.

21 December 2022 7
Binary Multiplication
Examples:
1 1 0 1 Multiplicand
x 0 1 1 0 Multiplier

1 1 0 0 0 0 Partial products
1 1 0 1
1 1 0 1
+ 0 0 0 0

1 0 0 1 1 1 0 Product

21 December 2022 8
Binary Multiplication

Examples:
1 1 0 0 Multiplicand
x 0 1 1 1 Multiplier
1 1 1 0 0 Partial products
1
1 1 1 0 0
1 1 0 0
+ 0 0 0 0

1 0 1 0 1 0 0 Product

21 December 2022 9
Binary Division
The binary division operation is similar to the base 10 decimal system,
except the base 2. there are different ways to solve division problems
using binary operations. Long division is one of them and easiest and the
most efficient way.

Rules of the binary division


1÷1=1
1 ÷ 0 = Meaningless
0÷1=0
0 ÷ 0 = Meaningless
Binary Division(÷)
Examples: 000111

Decimal Division 110 101010


-0
________
10
016 -________
0
8 128 101
-0
________ - 0
________
12 1010
-________
8 - ________
110
48 01001
- 48 -________
110
________
0 000110
- ________
110
0
Octal Addition(+)
R=8(0 ➔ 7) R=8(0 ➔ 7)
0➔0 8 ➔ 10
1➔1 9 ➔ 11
2➔ 2 10➔ 12
3➔ 3 11➔ 13
4➔4 12 ➔ 14
5➔5 13 ➔ 15
6➔6 14 ➔ 16
7➔7 15 ➔ 17
16 ➔ 20
Octal Addition(+)
Examples:
R=8(0 ➔ 7)
243
8 ➔ 10
(+)8 2 1 2 9 ➔ 11
10➔ 12
455
11➔ 13
12 ➔ 14
1 1 13 ➔ 15
567 14 ➔ 16
15 ➔ 17
(+)8 2 4 3 16 ➔ 20
1032
Octal Subtraction(-)
Examples:
7 4 3
(-)8 5 6 4
1 5 7
Octal Multiplication(x)
R=8(0 ➔ 7)
8 ➔ 10
9 ➔ 11
10➔ 12
11➔ 13
12 ➔ 14
13 ➔ 15
14 ➔ 16
15 ➔ 17
16 ➔ 20
Octal division(÷)
Examples: (422)8 ÷ (7)8
Decimal Octal
047 405
0x7=0 0
7 422 1x7=7 7 7 3 4 = 28
3443
-0 2 x 7 = 14 16 81 80
________ -34
________
3 x 7 = 21` 25 4 + 24
42 04 28
4 x 7 = 28 34
-________
34 -________
0
5 x 7 = 35 43
62 6 x 7 = 42 52 43
- 61
________ 7 x 7 = 49 61 - 43
________ 43 = 35
01 8 x 7 = 56 70 0 81 80
9 x 7 = 63 77 3 + 32
35
(422)8 ÷ (7)8 = (47)8 Quotient
Hexadecimal
R=8(0 ➔ F)
Decimal ➔ hexadecimal
Hexadecimal ➔ binary
16 ➔ 10 24 ➔ 18
0 ➔ 0000 8 ➔ 1000
17 ➔ 11 25 ➔19
1 ➔ 0001 9 ➔ 1001
2➔ 0010 18➔ 12 26 ➔1A
10 A➔ 1010
3➔ 0011 19➔ 13 27 ➔1B
11 B➔ 1011
4 ➔ 0100 20 ➔14 28 ➔1C
12 C➔ 11100
5 ➔ 0101 21 ➔ 15
6 ➔ 0110 13 D➔ 1101 22 ➔ 16
7 ➔ 0111 14 E➔ 1110 23 ➔ 17
15 F➔ 1111
Hexadecimal Addition(+)
Examples: () 10➔ () 16 () 10➔ () 16
5 6 8 9 10 ➔ A 20 ➔14
(+)16 4 5 7 4 11 ➔ B 21 ➔ 15
12 ➔ C 22 ➔ 16
9 B F D 13 ➔ D 23 ➔ 17
14 ➔ E 24 ➔ 18
15 ➔ F 25 ➔19
A D D 16 ➔ 10 26 ➔1A
17 ➔ 11 27 ➔1B
(+)16 D A D 18➔ 12 28 ➔1C
19➔ 13
1 8 8 A
FIND 899 (+)16 189
Hexadecimal Subtraction(-)
Examples: () 10➔ () 16 () 10➔ () 16
9 6 5 4 10 ➔ A 20 ➔14
(-)16 5 3 2 1 11 ➔ B 21 ➔ 15
12 ➔ C 22 ➔ 16
4 3 3 3 13 ➔ D 23 ➔ 17
16+6 16+3 14 ➔ E 24 ➔ 18
8 6 3 16+11 15 ➔ F 25 ➔19
9 7 4 B 16 ➔ 10 26 ➔1A
17 ➔ 11 27 ➔1B
(-)16 5 8 7 C 18➔ 12 28 ➔1C
19➔ 13
3 E C F
FIND FAD (-)16 AEF
Hexadecimal multiplication
Examples: 12*3=36 () 10➔ () 16 () 10➔ () 16
(36)10 ➔ (24)16
9 4 A B C 10 ➔ A 20 ➔14
(X)16 2 3 36/16| 2 4 11 ➔ B 21 ➔ 15
(X)16 1 2
2 2
2/16 | 0 2 12 ➔ C 22 ➔ 16
1 2 8 2 0 3 4 13 ➔ D 23 ➔ 17
11*3=33 24 ➔ 18
1 1 14 ➔ E
+ 9 4 + 1 5 7 8 (35)10 ➔(23)16
15 ➔ F 25 ➔19
1 7 7 B 4 16 ➔ 10 26 ➔1A
A 6 8 10*3 =30
(32)10 ➔ (20)16 17 ➔ 11 27 ➔1B
18➔ 12 28 ➔1C
12*2=24 19➔ 13
(24)10 ➔ (18)16
FIND 63 (X)16 24 11*2=22
23 ➔(17)16
10*2=20 ➔ (15)16
Thank you

You might also like