Digital Logic
Design
CHAPTER – II
Number System
Addis Ababa Science and Technology University
College of Engineering
Department of Software Engineering
Lecturer: Biruk T.
12/06/2025 Digital Logic Design By Biruk T. 1
Introduction to Numbering System
12/06/2025 Digital Logic Design By Biruk T. 2
Decimal Numbers
●
In the decimal number system each of the
ten digits 0 through 9 represents a certain
● quantity.
●
The base(radix) of decimal numbers is 10.
The position of each digit in a weight
number system is assigned a weight based
●
on The
the base of the
column system.
weights of decimal numbers
powers of ten that increase from right are
beginning with 100, 101,
to left
102,103 ...
12/06/2025 Digital Logic Design By Biruk T. 3
Decimal Numbers
●
For fractional decimal numbers, the column
weights are negative powers of ten that
decrease from left to right.
● – 102 101 numbers
Decimal 100 . 10-1 10can
-2 10-3
be expressed as the sum
of the products of each digit times the column
values for that digit.
● Example:
– 123 → 1*102 + 2*101 + 3*100
– 45.367 → 4*101 + 5*100 + 3*10-1 + 6*10-2
+ 7*10-3
12/06/2025 Digital Logic Design By Biruk T. 4
Binary
●
Numbers
The binary numbersystem is anotherway to
represent quantities.
● It have two digits: 0 and 1. so it is base 2 system.
●
The positionof a 1 and 0 in a binary number
indicates weight.
● The weight of a binary number is based on powers of
–two.
2 2 2 2
4 3 2 1
●
For20
fractional binary number the weight are
negative power of two that decrease from left two
–right.
2 2 2 2
-1 -2 -3 -4 - 2
5
12/06/2025 Digital Logic Design By Biruk T. 5
Binary
● Example
Numbers
–s: 1010 → 1*23 + 0*22 + 1*21 +
– 0*20
10.01 → 1*21 + 0*20 + 0*2-1 +
● Binary Number
1*2 -2
–Operation:
Add & - Mul &
● Sub: Div 1 * 1 =
●
● 1
● 1 + 1 = 10 ●1 / 1 = 1
● 1– 1= 0 *X=0
● 0
● 0+0=
●
0
0– 0=
0
1+0=
12/06/2025 Digital Logic Design By Biruk T. 6
1
1– 0=
Decimal to Binary Numbers
●
For Non Fractional Number
– Repeated Division by two
methods.
– (160)10 =
(10100000)2
12/06/2025 Digital Logic Design By Biruk T. 7
Decimal to Binary Numbers
●
For Fractional Number
– Repeated multiplication
by 2.
– (0.188)10 = (0.00110)2 → for five
significant digits
12/06/2025 Digital Logic Design By Biruk T. 8
Binary to Decimal Conversion
● Any numbering system can be
summarized by the following
relationship:
12/06/2025 Digital Logic Design By Biruk T. 9
Binary to Decimal Conversion
●
Exampl
e:
–
(10011011)2 =
–
(155)10
(0.1011)2 =
12/06/2025 (0.6875)10 Digital Logic Design By Biruk T. 10
Individual Assignment:
● Convert the following decimal to binary
format:
65 ●
● 25.
4
● Convert the following binary to decimal
format:
10101
●
● 1
1010.0
1
12/06/2025 Digital Logic Design By Biruk T. 11
1’s compliment representation and 2’s
compliment representation
12/06/2025 Digital Logic Design By Biruk T. 12
Cont..
Signed numbers:
Methods to represent signed numbers:
1- sign-Magnitude form
2- 1’s compliment representation
3- 2’s compliment representation
12/06/2025 Digital Logic Design By Biruk T. 13
Signed Number in Binary
●
Digital systems, such as computer,
must handle both positive and negative
● numbers.
A signed binarynumber consists
of both sign and magnitude
● information.
How do you represent a negative
number in computers?
– Use 2’s compliment representation!
12/06/2025 Digital Logic Design By Biruk T. 14
Signed Number in Binary
●
1’s compliment representation:
– Is just the inverse of a binary number.
– To form 1’s compliment invert every bit of the
number.
●
– 1’s compliment of 1001 is 0110.
2’s compliment representation:
– Found by adding 1 to LSB of the 1’s compliment.
●
– 2’s compliment of 1001 is 0110 + 1, which is 0111.
Sign-Significant representation:
– The left most bit is the sign bit and the remaining
bit are the magnitude.
– MSB → 1 if negative,
12/06/2025 Digital 0
Logicif positive
Design By Biruk T. 15
2’s Compliment form
● There are several ways to represent signed
binary numbers. In all cases, the MSB in a
signed number is the sign bit, that tells you if
the number is positive or negative.
● Computers use a modified 2’s compliment for
signed numbers. Positive numbers are stored
in true form and negative are stored in
complement form
– Positive number → 0 for sign bit
– Negative number → 1 for sign bit
12/06/2025 Digital Logic Design By Biruk T. 16
2’s Compliment form
● Example:
– Positive 58 → 00111010
● The MSB (red) is the Sign bit.
● The rest (green) are the Magnitude
bit.
– Negative 58 (-58) →
11000110
The MSB (red) is the Sign bit.
●
● The rest (green) are the Magnitude
bit.
● An easy way to read a signed number that uses this
notation is to assign the sign bit a column weight
of -128 (for an 8-bit number). Then add the column
weight for the 1’s.
12/06/2025 Digital Logic Design By Biruk T. 17
2’s Compliment form
● Example:
– Assuming that the sign bit = -128,
show that 11000110 = -58 as a 2’s
complement signed number.
● Column weights: -128+64+0+0
+0+4+2 = -58
12/06/2025 Digital Logic Design By Biruk T. 18
Sign-Magnitude Form
●
When a signed binary number is represented in sign-
magnitude, the left-most bit is the sign bit
magnitude
and bits.
the The magnitude
remaining bitsthe
bits are are the true
complemented)
(un- binary for both positive and negative
● numbers.
Example: Represent the decimal number +25 and -25
in 8-bit signed binary number.
– +25 → 00011001
● – -25 → 10011001
In the sign-magnitude form, a negative number has the
same magnitude bits as the corresponding positive
number but the sign bit is a 1 rather than a zero.
12/06/2025 Digital Logic Design By Biruk T. 19
1’s Complement Form
●
Positive numbers in 1’s complement form are
represented the same way as positive sign-
● magnitude numbers.
Negative number, however, are the 1’s
● complements of the corresponding positive
numbers.
–Example:
+25 → using 8-bit represent +25 and -25 in
– the
00011001 1’s complement form.
-25 →
●
In the 1’s complement form, a negative number is
11100110
the 1’s complement of the corresponding positive
number.
12/06/2025 Digital Logic Design By Biruk T. 20
Individual Assignment
1- list types of methods to represent
signed number in binary
2- with the help of the above listed
methods represent (-58) using 8-bit
12/06/2025 Digital Logic Design By Biruk T. 21
Arithmetic Operations with 2’s
Compliment Signed
Numbers
12/06/2025 Digital Logic Design By Biruk T. 22
Additions
● The two numbers in an addition are the Addend and
Augend. The result is Sum. the
● Using the signed number notation with negative numbers
in 2’s complement form simplifies addition and
substantiation of signed numbers.
●
Rules for addition: Add the two signed numbers. Discard
any final carries. The result is in signed form.
12/06/2025 Digital Logic Design By Biruk T. 23
Additions
● Exercise:
– 0000 1000 + 0000
0011 = ?
– 0000 1111 + 1111
1010 = ?
– 0001 0000 + 1110
1000 = ?
– 1111 1011 + 1111
0111 = ?
12/06/2025 Digital Logic Design By Biruk T. 24
Subtractions
● Subtraction is a special case of addition.
●
For example, subtracting 6 from 9 is
equivalent to adding -6 to 9.
● Basically, the subtraction
sign of the subtrahend
operation changes the and adds it to
the
●
Rules for The
minuend. result is 2’s
subtraction: called the difference.
complement the
subtrahend and add the numbers.
Discard any final carries. The result is in
signed form.
12/06/2025 Digital Logic Design By Biruk T. 25
Subtractions
● Exercise:
– 0001 1110 – 0000 1111 = ?
– 0000 1110 – 1110 1111 = ?
Ans 0000 1110 + 10001 0001 =
100011111
– 1111 1111 – 1111 1000 = ?
12/06/2025 Digital Logic Design By Biruk T. 26
Multiplication
● The numbers in a multiplication are
the
● multiplicand, the multiplier and the product.
The multiplication operation
● in most computers is accomplished
using addition.
● Multiplication is equivalent to adding a
number
to itself a number of times equal to the
multiplier.
When two binary numbers
12/06/2025 Digital Logic Design Byare
Biruk T. multiplied, 27
both numbers must be in true (un-
Multiplication
12/06/2025 28
Digital Logic Design By Biruk T.
Division
● The numbers in a division are the
dividend, the
● divisor,
The and theoperation
quotient. in
accomplish
division computers is using
subtraction
ed is done
subtraction.
with adder,
Since
division
can also accomplished with an adder.
● The result of a division is called the
quotient.
12/06/2025 Digital Logic Design By Biruk T. 29
Division
12/06/2025 30
Digital Logic Design By Biruk T.
Division
31
12/06/2025
Digital Logic Design
Hexadecimal Numbers
12/06/2025 Digital Logic Design By Biruk T. 32
Hexadecimal Numbers
●
The hexadecimal number
system has sixteen
● characters;
It is used primarilyas a compact way
● of displaying or writing binary numbers.
Is widely used in computer and
● microprocessor applications.
●
Has a base of sixteen.
Consists of digits 0-9 and letters A-F.
12/06/2025 Digital Logic Design By Biruk T. 33
Hexadecimal Numbers
Large binary number can
easily be converted to
hexadecimal by grouping bits
4 at a time and writing the
equivalent hexadecimal
character.
12/06/2025 Digital Logic Design By Biruk T. 34
Decimal to Hexadecimal Conversion
●
Repeated division of a decimal number by
16 will produce the equivalent hexadecimal
● number.
Example: Converter to a
(2545)10 number. hexadecimal
● Answer: (9F1)16 Carry and Result in Decimal and Hexa-D
16 2545 1 1
16 159 15 F
16 9 9 9
16 0 0 0
– The LSB of the result is the first
reminder.
12/06/2025 Digital Logic Design By Biruk T. 35
Hexadecimal to Decimal Conversion
● Hexadecimal is a weighted number system.
The column weights are powers of 16, which
increase from right to left.
● Example: Express (1A2F)16 in decimal.
– Start by writing the column weights.
– 1 A 2 F
– 163 162 161
–164096
0
256
– 16 1
1(4096) + 10(256) + 2(16) + 15(1) =
6703
12/06/2025 Digital Logic Design By Biruk T. 36
Binary to Hexadecimal Conversion
●
Larger binary number can be easily
converted to hexadecimal by grouping
bits 4-bit at a time and writing the
● equivalent hexadecimal
Example: Express character.
(1001011000001110) 2
hexadecimin
al.
– 1001 0110 0000
– 1110
– 9 6 0 E
So
(10010110000011
12/06/2025 10)2 = (960E)16Digital Logic Design By Biruk T. 37
Hexadecimal to Binary Conversion
● Example: Convert (95D7)16 to
binary.
– 9 5 D
–
7
1001 0101 1101 0111
– So (95D7)16 = (1001 0101 1101
0111)2
12/06/2025 Digital Logic Design By Biruk T. 38
Octal Number
●
Like the hexadecimal number system, the
octal number system provides a
convenient way to express binary
● numbers
However and
it iscodes.
used less frequently than
hexadecimal in conjunction with computers
and microprocessors to express binary
quantities for input and output purposes.
●
The octal number system is
composed of eight digits, which
are; 0 1 2 3 4 5 6 7
12/06/2025 Digital Logic Design By Biruk T. 39
Octal Number
●
To distinguish octal
numbers from decimal
numbers or hexadecimal
● numbers.
We will use the subscript
8 to indicate an octal
●
number.
For instance, in
158 octal
and D16 in
equivalent to is in
1310
hexadecimal. decimal
12/06/2025 Digital Logic Design By Biruk T. 40
Octal to Decimal Conversion
● Octal is also a weight number system.
column weights are powers of 8,
The
which increase from right to left.
● Example: Express 37028 in
decimal.
– 3 7 0 2
– 83 8 2 81 80
– 512 64 8 1
– 3(512) + 7(64) + 0(8) + 2(1) =
1986
12/06/2025 Digital Logic Design By Biruk T. 41
Decimal to Octal Conversion
● A method of converting a decimal
octal
numbernumber
to an is the repeated division-
by-8 methods.
● Example: Convert 35910 to octal
number. carry
8 359 7
– 35910 = 5478
8 44 4
8 5 5
– The first reminder generated is the Least Significant
Digit (LSD).
12/06/2025 Digital Logic Design By Biruk T. 42
Octal to Binary Conversion
●
Binary number can easily be converted to
octal by grouping bits 3 at a time and
writing the equivalent octal character for
● each group.
Example: Express (1 001 011 000 001
110)2 in octal.
– 001
1 001
1 011
3 00001001
6 110
– (1 001 011 000 001 110)2 =
(113016)8
12/06/2025 Digital Logic Design By Biruk T. 43
Binary Coded Decimal - BCD
●
Binary coded decimal is a way to express each
of the decimal digits with a binary code.
● There are 10 groups in the BCD system.
●
BCD is a weighted code that is commonly used
in digital systems when it is necessary to show
decimal numbers such as in clock displays.
● BCD represents each decimal digit with a 4-bit
● code.
Notice that the codes 1010 through 1111 are
not use in BCD.
12/06/2025 Digital Logic Design By Biruk T. 44
Binary Coded Decimal - BCD
12/06/2025 Digital Logic Design By Biruk T. 45
Binary Coded Decimal - BCD
● For 8-bit BCD number, the column weights are:
– 80 40 20 10 8 4 2 1
●
Question: What are the the column weights for
the BCD number 1000 0011 0101 1001?
●
Answer: 8000 4000 2000 1000 800 400 200
100 80 40
● 20 10 8 4 2 1
Note that you could add the column weights
where there is a 1 to obtain the decimal number.
For this case:
– 8000+200+100+40+10+8+1 = 835910
12/06/2025 Digital Logic Design By Biruk T. 46
Binary Coded Decimal - BCD
●
To express any decimal number in simply replace
BCD, decimal digit with the appropriate each
● 4-bit code.
Example: Convert (170)16 to BCD.
– 1 7 0
– 0001 0111 0000
– So 17010 =
●
To 000101110000 2
determine a decimal number from a BCD number. Start at the right
most bit and break the code into groups of four bits. Then write the
decimal digit represented by each 4-bit group.
● Example: Convert the BCD number 001101010001 to decimal.
– 0011 0101 0001
– 3 5 1 → 001101010001 → 35110
12/06/2025 Digital Logic Design By Biruk T. 47
Steps of BCD Addition
Step 1: Add the two BCD numbers using the rules for binary addition.
Step 2: If a 4-bit sum is equal to or less than 9, it is a valid BCD number.
Step 3: If a 4-bit sum is greater than 9 or if a carry-out of the 4-bit group is generated, it is an
invalid result. Add 6 (0110) to the 4-bit sum in order to skip the six invalid BCD code words
and return the code to 8421. If a carry results when 6 is added, simply add the carry to the next
4-bit group.
12/06/2025 Digital Logic Design By Biruk T. 48
12/06/2025 49
Digital Logic Design By Biruk T.
End of Chapter II
12/06/2025 Digital Logic Design By Biruk T. 50