NIS and IT Department
Technical College of Informatics - Akre
Duhok Polytechnic University
Logic Design
Asst. Prof. Dr. Musaab S. Sultan
PhD - England
Marks distribution
Mid Term Exam Activity Final Exam
Practical Theoretical Practical Theoretical
13% 12% 25% 25% 25%
The subject in English Language
25 October 2023 Logic Design
Chapter One - Numbering Systems
Chapter Two - Arithmetic operations for numbering systems &
digital codes
Chapter Three - Logic Gates
Logic Design
Chapter One
Numbering Systems
Asst. Prof. Dr. Musaab S. Sultan
PhD - England
25 October 2023 Computer Organization and Logic Design 4
Chapter One
Numbering Systems
• Decimal numbers
• Binary numbers
• Octal numbers
• Hexadecimal numbers
• Numbering systems conversions
25 October 2023 Computer Organization and Logic Design 5
Decimal numbers
• The ten digits, 0 through 9 is: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.
• The position of each digit in a decimal number indicates the magnitude of
the quantity represented and can be assigned a weight.
• The weights for whole numbers are positive powers of ten that increase
from right to left, beginning with 100 = 1. …..104 103 102 101 100
• For fractional numbers, the weights are negative powers of ten that
decrease from right to left beginning with 10−1 … .10−4 10−3 10−2
10−1 100
• Example: (345)10
300 + 40 + 5 = 3*102 + 4*101 + 5*100 = (345)10
25 October 2023 Computer Organization and Logic Design 6
Omar Sedqi Kareem
Omar Sedqi Kareem
Binary numbers
• It is another way to represent quantities.
• It is less complicated than the decimal system because it has only two
digits.
• Binary system with its two digits is a base-two system. (0 and 1).
Binary weight 23 22 21 20
Weight value 8 4 2 1
• Largest decimal number = 2𝑛 - 1
• For example: if n=5
25 - 1 = 31
25 October 2023 Computer Organization and Logic Design 9
Octal numbers
• It is composed of eight digits, which are: 0, 1, 2, 3, 4, 5, 6, and 7.
• Counting in octal is similar to counting in decimal, except that the digits 8
and 9 are not exist.
• The weight of the octal number is: 84 83 82 81 80 8−1 .
For example: octal number (2374)8
= (2*83 ) + (3*82 ) + (7*81 ) + (4*80 )
= (2*512)+ (3*64) + (7*8) + (4*1)
= 1024+192+56 + 4 = (1276)10
25 October 2023 Computer Organization and Logic Design 10
Hexadecimal Numbers
• It has a base of sixteen; it is composed of 16 digits with numbers and alphabetic
characters. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F.
• Most digital systems process binary data in groups that are multiples of four bits.
• Each hexadecimal digit represent a four bits binary.
• For example: (AB4D)16
= (A*163 ) + (B*162 ) + (4*161 ) + (D*160 )
• The result will represent as a decimal number.
• = 40960 + 2816 + 64 + 13 = (43853)10
25 October 2023 Computer Organization and Logic Design 11
Omar Sedqi Kareem
Decimal to Binary conversion(D B)
• There are many methods to convert the decimal to binary numbers.
• To get the binary number for a given decimal number, divide the decimal number
by 2 until the quotient is 0. Remainders form the binary number. (this method is
known repeated division by 2).
• For example:
- Convert (125)10 to Binary
- Convert (58)10 to Binary 2 125
2 62 1
LSB (lowest significant bit)
2 31 0
2 15 1
2 7 1
2 3 1
2 1 1 MSB (most significant bit)
2 0 1
12510 = 11111012
25 October 2023 Computer Organization and Logic Design 13
• Another example:
- Convert (58)10 to Binary
2 58
2 29 0
2 14 1
2 7 0
2 3 1
2 1 1
2 0 1
5810 = 1110102
25 October 2023 Computer Organization and Logic Design 14
Omar Sedqi Kareem
Decimal fraction to binary conversion
• Decimal fraction to binary using the repeated multiplication-by-2.
• multiplying each resulting fractional part of the product by 2 until the
fractional product is zero or until the desired number of decimal places is
reached.
• Example: Convert (0.3125)10 to Binary
0.3125*2
MSB 0 0.6250*2
1 1.2500*2
0 0.5000*2
LSB 1 1.0000
0.0000*2
= (0.0101)2
25 October 2023 Computer Organization and Logic Design 16
Binary to Decimal conversion
• Technique
– Multiply each bit by 2n, where n is the “weight” of the bit
– The weight is the position of the bit, starting from 0 on the right
– Add the results
Example:
– In case there is a fractional binary:
For example: (0.1011) 1010112 => 1 x 20 = 1
1 x 21 = 2
0.10112 => 1 x 2-1 = 0.5 0 x 22 = 0
0 x 2-2 = 0 1 x 23 = 8
1 x 2-3 = 0.125 0 x 24 = 0
1 x 2-4 = 0.0625 1 x 25 = 32
(0.6875)10 4310
25 October 2023 Computer Organization and Logic Design 18
Binary to Decimal conversion
Omar Sedqi Kareem
Decimal to Octal conversion
• In order to get the octal number from the decimal, divide the decimal
number into 8 until the quotient is 0.
• Example: Convert the number (359)10 to octal number.
Reminder LSB
8 359
8 44 7
8 5 4
0 5 MSB
(359)10 = (547)8
25 October 2023 Computer Organization and Logic Design 20
Decimal to Hexadecimal conversion
• Divide the number by 16, and keep track of the reminder.
• Example: convert (650)10 to
hexadecimal.
LSB
16 650 Reminder
16 40 A
16 2 8
0 2
MSB
= (28A)16
25 October 2023 Computer Organization and Logic Design 21
An example Decimal to Binary, Octal and Hexadecimal conversion
Convert (0.265)₁₀ to binary, octal, hexadecimal.
= (0.01000)2
= (0.20753)8
= (0.43D70)16
25 October 2023 Computer Organization and Logic Design 22
Binary to Octal conversion
Group three bits, starting from right to left.
For example: convert (110001011100)2 to octal:
group it into three bits: (110 001 011 100)
(6 1 3 4)8
25 October 2023 Computer Organization and Logic Design 23
Binary to Hexadecimal conversion
It is the same method as octal, but it is group four bits instead of three.
For example: (100101101001101)2 to Hexadecimal:
group it into four bits: (0100 1011 0100 1101)
= (4 B 4 D) 16
25 October 2023 Computer Organization and Logic Design 24
Octal to Binary conversion
• Octal digit can be represented by a 3-bit binary number.
• For Example:
(25)8 -------- (010101)2
(140)8 -------(001100000)2
25 October 2023 Computer Organization and Logic Design 25
Octal to Decimal conversion
Multiply each bit by 2n, where n is the “weight” of the bit
The weight is the position of the bit, starting from 0 on the right
For Example: (2374)8 --------- (1276)10
2* 83 + 3*82 + 7*81 + 4*80
25 October 2023 Computer Organization and Logic Design 26
Octal to Hexadecimal conversion
• Use binary as an intermediary.
• Convert the octal to binary and then convert the binary to
Hexadecimal.
25 October 2023 Computer Organization and Logic Design 27
Hexadecimal to Binary conversions
• Convert each hexadecimal digit to a 4-bit equivalent binary representation.
• Example: (10A4)16
1 0 A 4
0001 0000 1010 0100 = (0001000010100100)2
25 October 2023 Computer Organization and Logic Design 28
Hexadecimal to Decimal conversion
First method:
Example: (A85)16 (2693)10
1- Convert to binary number.
2- Then, convert from binary number to decimal number as follows:
A 8 5
1010 1000 0101 =
Second method:
Example: (E5)16 (229)10
E*161 + 5* 160 = 14*16+ 5*1 = (229)10
25 October 2023 Computer Organization and Logic Design 29
Hexadecimal to Octal conversion
• Use binary as an intermediary
1F0C16 = ?8
1 F 0 C
0001 1111 0000 1100
1 7 4 1 4
1F0C16 = 174148
25 October 2023 Computer Organization and Logic Design 30
Home works
1- Express each of the following decimal numbers as a sum of the products:
(234.67)10 (1245)10 (954)10 (23.3456)10
2- What is the decimal number for the (1011001)2 ?
3- Convert the following decimal numbers to binary:
- (19)10 - (39)10 - (25.265)10 - (35.125)10
4- Convert the decimal numbers (64)₁₀, (50)₁₀, to (binary, octal,
hexadecimal) equivalents.
25 October 2023 Computer Organization and Logic Design 31