SlideShare a Scribd company logo
1 of 41
Download to read offline
Digital Logic Design (EEEg4302)
Chapter 2 : Number System
AASTU
Department of Electrical and
Computer Engineering
1
Milkias H.
Outline
Chapter 2 : Number System
• Decimal Numbers
• Binary Numbers
• Decimal to Binary Conversion and vice versa
• 1’s and 2’s compliment of binary number
• Signed Number
• Hexadecimal number
• Octal number
• Binary Coded Decimal (BCD) Number
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 base of the system.
• The column weights of decimal numbers are powers of ten that increase from right to left
beginning with
… … 102
101
100
• For fractional decimal numbers, the column weights are negative powers of ten that decrease
from left to right.
10−1
10−2
10−3
……
• Decimal numbers can 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
3
Binary Numbers
• The binary number system is another way to represent quantities.
• It have two digits: 0 and 1. so it is base 2 system.
• The position of a 1 and 0 in a binary number indicates weight.
• The weight of a binary number is based on powers of two.
24
23
22
21
20
• For fractional binary number the weight are negative power of two that decrease from left two
right.
2−12−22−32−42−5
4
Binary Numbers
Examples:
1010 → 1*23 + 0*22 + 1*21 + 1*2024
10.01 → 1*21
+ 0*20
+ 0*2−1
+ 1*2−2
Binary Number Operation:
Add & Sub:
1 + 1 = 10
1 – 1 = 0
0 + 0 = 0
0 – 0 = 0
1 + 0 = 1
1 – 0 = 1
5
Mul & Div:
1 * 1 = 1
1 / 1 = 1
0 * X = 0
Decimal to Binary Numbers
• For Non Fractional Number
Repeated Division by two methods.
(160)10 = (10100000)2
• For Fractional Number
Repeated multiplication by two.
(0.188)10 = (0.00110)2 → for five significant digits
6
Binary to Decimal Conversion
• The decimal value of any binary number can be found by adding the weights of
all bits that are 1 and discarding the weight of all bits that are 0.
• We multiply each binary digits by its weighted position and add each of the
weighted value together.
7
Binary to Decimal Conversion
• Any numbering system can be summarized by the following relationship:
8
Binary to Decimal Conversion
• Example
9
(1010)2 = (10)10 (0.1011)2 = (0.6875)10
Binary to Decimal Conversion
Exercise
• Convert the following decimal to binary format:
65
25.4
• Convert the following binary to decimal format:
101011
1010.01
10
1’s and 2’s Compliment of Binary Number
o 1’s compliment representation:
• Is just the inverse of a binary number.
• To form 1’s compliment invert very bit of the number.
• 1’s compliment of 1001 is 0110.
o 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.
11
Signed Number
• Digital systems, such as computer must handle both positive and negative numbers.
• A signed binary number consists of both sign and magnitude information.
• There are three forms in which signed numbers can be represented in binary:
I. Sign-magnitude form (least used)
II. 1’s complement form
III. 2’s complement form (most important)
• N.B: The left most bit (MSB) in all forms of a signed number is the sign bit, which tells you
whether the number is positive or negative.
Positive number → 0 for sign bit
Negative number → 1 for sign bit
12
Signed Number
I. Sign-magnitude form
• When a signed binary number is represented in sign-magnitude form, the left most bit is the
sign bit and the remaining bits are magnitude bits in true (uncomplemented form).
• Example: using sign-magnitude form (+9) expressed as 8 bit signed binary
And (-9) as
• Notice that the only difference between (+9) and (-9) is the sign bit.
13
1 0 1 0 1 0 1 0
Sign bit Magnitude bits
0 0 0 0 1 0 0 1
1 0 0 0 1 0 0 1
Signed Number
II. 1’s complement form
• Positive numbers in 1’s complement form are represented the same way as sign-magnitude
numbers.
• Negative numbers are the 1’s complements of the corresponding positive numbers.
• Example: using 1’s complement form (+9) expressed as 8 bit signed binary
And (-9) as
14
0 0 0 0 1 0 0 1
1 1 1 1 0 1 1 0
1’s complement
Signed Number
III. 2’s complement form
• Positive numbers in 2’s complement form are represented the same way as sign-magnitude
and 1’s complement forms.
• Negative numbers are the 2’s complement of the corresponding positive numbers.
• Example: using 2’s complement form (+9) expressed as 8 bit signed binary
And (-9) as
• 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.
15
0 0 0 0 1 0 0 1
1 1 1 1 0 1 1 1
2’s complement
Signed Number
• Exercise: Express the decimal number (-20) as an 8 bit number in the (i) Sign-magnitude
(ii) 1’s complement and (iii) 2’s complement forms.
First, find 8 bit binary conversion of (+20)
(i) Sign-magnitude
o change the sign bit to one
(ii) 1’s complement
o 1’s complement of (+20)
(iii) 2’s complement forms.
o 2’s complement of (+20)
16
0 0 0 1 0 1 0 0
1 0 0 1 0 1 0 0
1 1 1 0 1 0 1 1
1 1 1 0 1 1 0 0
Signed Number
• Why 2’s complement form is preferred for representing signed integer numbers?
o Because its easier to convert back to decimal.(1’s complement requires adding 1 to summation
of weight)
o And there are two possible representations of zeros in 1’s complement form which are
[00000000] and [11111111].
Range Of Signed Integer Numbers That Can Be Represented
o The formula for finding the number of different combinations of n-bit is
Total combination = 2𝑛
o For 2’s complement signed numbers, the range of values for n-bit numbers is
Range = - (2𝑛−1) to +(2𝑛−1 - 1)
17
Signed Number
Arithmetic Operations With Signed Numbers
1. ADDITION:
• The addition of two signed numbers with negative numbers represented in signed 2’s
complement form is obtained from the addition of the two numbers including their sign bits.
• A carry out of the sign bit position is discarded.
Example: +6 00000110 -6 11111010
+13 00001101 +13 00001101
+19 00010011 +7 00000111
: +6 00000110 -6 11111010
-13 11110011 -13 11110011
-7 11111001 -19 11101101
18
1 Discard carry
1 Discard carry
addend
augend
sum
Signed Number
Arithmetic Operations With Signed Numbers
1. ADDITION:
• 0verflow condition : when two numbers are added and the number of bits to represent the
sum exceeds the number of bits in the two numbers.
• An over flow results as indicated by an incorrect sign bit.
• Occurs only when both numbers are positive or when both numbers are negative.
19
Signed Number
Arithmetic Operations With Signed Numbers
2. SUBTRACTION:
• Subtraction is addition with the sign of the subtrahend changed. As demonstrated by the
following relationship
(±A) - (+B) = (±A) + (-B)
(±A) - (-B) = (±A) + (+B)
• Take the 2’s complement of the subtrahend (including the sign bit) and add it to the minuend
(including the sign bit). A carry out of the sign bit position is discard.
Example : subtracting +6 (the subtrahend) from +9(minuend) is equivalent to adding (-6) to (+9).
(9) - (6) = 3 = (9) + (-6)
20
difference
minuend
subtrahend
-6 11111010
+9 00001001
+3 00000011
1 Discard carry
Signed Number
Arithmetic Operations With Signed Numbers
3. MULTIPLICATION:
• The multiplication operation in most computers is accomplished using addition.
• Direct addition and partial products are two basic methods for performing multiplication using addition.
• In direct addition method, you add the multiplicand a number of times equal to the multiplier.
• The partial product method is the more common one. The multiplicand is multiplied by each multiplier digit
beginning with the least significant digit.
Example 1. multiply the signed binary numbers 01001101 (multiplicand) and 00000100 (multiplier) using direct
addition method.
Solution since both numbers are positive, they are in true form and the product will positive .
the decimal value of the multiplier is 4, so the multiplicand is added to it self four time as follows
01001101 1st time
+01001101 2nd time
10011010 partial sum
+01001101 3rd time
11100111 partial sum
+01001101 4th time
100110100 product
21
Signed Number
Arithmetic Operations With Signed Numbers
3. MULTIPLICATION:
Example 2. Multiply the signed binary number 01010011 (multiplicand) and 11000101
(multiplayer) using partial product method.
Step 1. The sign bits are different, the product will be negative (1).
Step 2. Take the 2’s complement of the multiplier to put it in true form.
11000101 00111011
22
Step 3. the multiplication proceed as follows. Notice that only
the magnitude bits are used in this step.
Step 4. since the sign of product is 1 as determined in step 1,
take the 2’s compliment of the product.
1001100100001 0110011011111
Attach the sign bit 1 0110011011111
Signed Number
Arithmetic Operations With Signed Numbers
4. DIVISION:
• The division operation computers is accomplished using subtraction.
• Since subtraction is done with an adder, division can be accomplished with an adder.
𝑑𝑖𝑣𝑖𝑑𝑒𝑛𝑑
𝑑𝑖𝑣𝑖𝑠𝑜𝑟
= 𝑞𝑢𝑜𝑡𝑖𝑒𝑛𝑡
Example
Divide 01100100 by 00011001
Solution. Step 1, the sign of both numbers are positive .
Step 2. subtract the divisor from dividend using 2’s compliment addition .
01100100
+11100111
01001011
Add 1 to quotient( quotient is initially zero): 00000000 + 00000001 = 00000001
23
dividend
2’s compliment of divisor
Positive first partial remainder
Signed Number
Arithmetic Operations With Signed Numbers
4. DIVISION:
Step 3. subtract the divisor from the 1st partial remainder using 2’s compliment addition .
01001011
+11100111
00110010
Add 1 to quotient : 00000010
Step 4. subtract the divisor from the 2nd partial remainder using 2’s complement addition
00110010
+11100111
00011001
Add 1 to quotient : 00000011
Step 5. subtract the divisor from 3rd partial remainder using 2’s complement addition
24
1st partial remainders
2’s complement of divisor
Positive 2nd partial remainder
2nd partial remainders
2’s complement of divisor
Positive 3rd partial remainder
Signed Number
Arithmetic Operations With Signed Numbers
4. DIVISION:
Step 5. subtract the divisor from 3rd partial remainder using 2’s complement addition
00011001
+11100111
00000000
Add 1 to quotient : 00000100 (final quotient).
25
3rd partial remainder
2’s complement of divisor
zero remainder
Hexadecimal Number
• The hexadecimal number system has sixteen characters; Consists of digits 0-9
and letters A-F.
• It is used primarily as a compact way of displaying or writing binary numbers.
• Is widely used in computer and microprocessor applications.
• Has a base of sixteen.
• Large binary number can easily be converted to hexadecimal by grouping bits
4 at a time and writing the equivalent hexadecimal character.
26
Hexadecimal Number
27
Counting in hexadecimal
• Once you get to F, simply start over with other column and continue.
• With two hexadecimal digits, you can count up to (FF) which is 255 in decimal.
• The maximum three digit is (FFF) or decimal 4095.
Hexadecimal Number
Binary to Hexadecimal conversion
• Converting a binary number to hexadecimal is straight forward procedure.
Simply break the binary number in to 4 bit group with the equivalent
hexadecimal symbol.
• Example: convert the following binary number to hexadecimal:
a) 1100101001010111 = CA5716
b) 1010000111100011 = A1E316
28
Hexadecimal Number
Hexadecimal to Binary conversion
• To convert from hexadecimal number to a binary number reverse the process
and replace each hexadecimal symbol with the appropriate four bits.
• Example: Determine the binary number for the following hexadecimal number:
(a) 10A416
0001000010100100
(b) AF6C16
1010111101101100
29
Hexadecimal Number
Hexadecimal to Decimal conversion
• To find the decimal equivalent of hexadecimal number is first convert the hexadecimal
number to binary and then convert from binary to decimal
• Example: 2D
00101101 00101101 20
+ 22
+ 23
+ 25
=4510
• Another way to convert a hexadecimal number to its decimal equivalent is to multiply the
decimal value of each hexadecimal digit by its weight and then take the sum of these
products.
• The weight structure
• Example 2D = (2x16) + (Dx1)
= 32+ 13
=4510
30
163 162 161 160
4096 256 16 1
Hexadecimal Number
Decimal to Hexadecimal conversion
• Repeated division of a decimal number by 16 will produce the equivalent
hexadecimal number, formed by remainders of the divisions.
• The first remainder produce is least significant digit (LSD).
• Note that when a quotient has a fraction part, the fraction part is multiplied by the
divisor to get the remainder.
• Example : convert the decimal number 650 to hexadecimal by repeated division by 16.
31
Octal Number
• Like hexadecimal number system the octal number system provides a convenient way
to express binary numbers and codes.
• However it is 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
32
Octal Number
Octal to Decimal conversion
• Octal is also a weight number system. The column weights are powers of 8, which
increase from right to left.
• Example: Express (3702)8 in decimal.
3 7 0 2
83 82 81 80
512 64 8 1
3(512) + 7(64) + 0(8) + 2(1) = (1986)10
33
Octal Number
Decimal to Octal Conversion
• A method of converting a decimal number to an octal number is the repeated
division-by-8 methods.
• Each successive division by 8 yield a remainder that become a digit in the equivalent
octal number .
• The first remainder generated is the least significant digit (LSD).
• Example: convert decimal number (359)10 to octal
34
Octal Number
Binary to Octal 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 (100110010010)2 in octal.
100 110 010 010
4 6 2 2 = (4622)8
35
Octal Number
Octal to Binary Conversion
• Because each octal digit can be represented by a 3-bit binary number, it is
very easy to convert from octal to binary.
• Each octal digit is represented by three bits.
• Example: Convert (613)8 in binary.
6 1 3
110 001 011 = (110001011)2
36
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 used in BCD.
• For 4 bit BCD number, the column weights are 8 4 2 1 (23222120).
• The ease of conversion between 8421 code numbers and familiar decimal
numbers is the main advantage of the code.
• To express any decimal number in BCD, simply replace each decimal digit with
the appropriate 4 bit code.
37
Binary Coded Decimal - BCD
38
Binary Coded Decimal - BCD
Example : convert decimal 170 to BCD
1 7 0
0001 0111 0000
To determine a decimal number from a BCD number, start at the right most bit
and break the code in to 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 (351)10
39
Assignment 1:
• Read and prepare a short note and presentation on Digital
codes (Gray code and ASCII) [text book: page 87- ]
DUE DATE : April 28, 2021
40
Last slide
41

More Related Content

Similar to Chapter 2_Number system (EEEg4302).pdf

Binaty Arithmetic and Binary coding schemes
Binaty Arithmetic and Binary coding schemesBinaty Arithmetic and Binary coding schemes
Binaty Arithmetic and Binary coding schemesDr. Anita Goel
 
Number system in Digital Electronics
Number system in Digital ElectronicsNumber system in Digital Electronics
Number system in Digital ElectronicsJanki Shah
 
Unit 1 data representation and computer arithmetic
Unit 1  data representation and computer arithmeticUnit 1  data representation and computer arithmetic
Unit 1 data representation and computer arithmeticAmrutaMehata
 
Bca 2nd sem-u-1.3 digital logic circuits, digital component
Bca 2nd sem-u-1.3 digital logic circuits, digital componentBca 2nd sem-u-1.3 digital logic circuits, digital component
Bca 2nd sem-u-1.3 digital logic circuits, digital componentRai University
 
digital logic circuits, digital component
digital logic circuits, digital componentdigital logic circuits, digital component
digital logic circuits, digital componentRai University
 
B.sc cs-ii-u-1.3 digital logic circuits, digital component
B.sc cs-ii-u-1.3 digital logic circuits, digital componentB.sc cs-ii-u-1.3 digital logic circuits, digital component
B.sc cs-ii-u-1.3 digital logic circuits, digital componentRai University
 
CDS Fundamentals of digital communication system UNIT 1 AND 2.pdf
CDS Fundamentals of digital communication system UNIT 1 AND 2.pdfCDS Fundamentals of digital communication system UNIT 1 AND 2.pdf
CDS Fundamentals of digital communication system UNIT 1 AND 2.pdfshubhangisonawane6
 
Data representation
Data representationData representation
Data representationChew Hoong
 
UNIT - I.pptx
UNIT - I.pptxUNIT - I.pptx
UNIT - I.pptxamudhak10
 
UNIT - I.pptx
UNIT - I.pptxUNIT - I.pptx
UNIT - I.pptxamudhak10
 
module 1_class_numbers.pptx
module 1_class_numbers.pptxmodule 1_class_numbers.pptx
module 1_class_numbers.pptxssuser2efca7
 
09 binary number systems
09   binary number systems09   binary number systems
09 binary number systemsLee Chadwick
 
data representation
 data representation data representation
data representationHaroon_007
 

Similar to Chapter 2_Number system (EEEg4302).pdf (20)

Binaty Arithmetic and Binary coding schemes
Binaty Arithmetic and Binary coding schemesBinaty Arithmetic and Binary coding schemes
Binaty Arithmetic and Binary coding schemes
 
Number system in Digital Electronics
Number system in Digital ElectronicsNumber system in Digital Electronics
Number system in Digital Electronics
 
Unit 1 data representation and computer arithmetic
Unit 1  data representation and computer arithmeticUnit 1  data representation and computer arithmetic
Unit 1 data representation and computer arithmetic
 
Pp02
Pp02Pp02
Pp02
 
Representation of Negative Numbers
Representation of Negative NumbersRepresentation of Negative Numbers
Representation of Negative Numbers
 
uyuyuy.pdf
uyuyuy.pdfuyuyuy.pdf
uyuyuy.pdf
 
Arithmetic circuits
Arithmetic circuitsArithmetic circuits
Arithmetic circuits
 
Bca 2nd sem-u-1.3 digital logic circuits, digital component
Bca 2nd sem-u-1.3 digital logic circuits, digital componentBca 2nd sem-u-1.3 digital logic circuits, digital component
Bca 2nd sem-u-1.3 digital logic circuits, digital component
 
digital logic circuits, digital component
digital logic circuits, digital componentdigital logic circuits, digital component
digital logic circuits, digital component
 
B.sc cs-ii-u-1.3 digital logic circuits, digital component
B.sc cs-ii-u-1.3 digital logic circuits, digital componentB.sc cs-ii-u-1.3 digital logic circuits, digital component
B.sc cs-ii-u-1.3 digital logic circuits, digital component
 
CDS Fundamentals of digital communication system UNIT 1 AND 2.pdf
CDS Fundamentals of digital communication system UNIT 1 AND 2.pdfCDS Fundamentals of digital communication system UNIT 1 AND 2.pdf
CDS Fundamentals of digital communication system UNIT 1 AND 2.pdf
 
Slide03 Number System and Operations Part 1
Slide03 Number System and Operations Part 1Slide03 Number System and Operations Part 1
Slide03 Number System and Operations Part 1
 
Data representation
Data representationData representation
Data representation
 
UNIT - I.pptx
UNIT - I.pptxUNIT - I.pptx
UNIT - I.pptx
 
UNIT - I.pptx
UNIT - I.pptxUNIT - I.pptx
UNIT - I.pptx
 
module 1_class_numbers.pptx
module 1_class_numbers.pptxmodule 1_class_numbers.pptx
module 1_class_numbers.pptx
 
09 binary number systems
09   binary number systems09   binary number systems
09 binary number systems
 
Data Representation
Data RepresentationData Representation
Data Representation
 
data representation
 data representation data representation
data representation
 
number system.ppt
number system.pptnumber system.ppt
number system.ppt
 

More from TamiratDejene1

Congestion Control and QOS.ppt
Congestion Control and QOS.pptCongestion Control and QOS.ppt
Congestion Control and QOS.pptTamiratDejene1
 
Analog Transmission.ppt
Analog Transmission.pptAnalog Transmission.ppt
Analog Transmission.pptTamiratDejene1
 
Chapter 5 (Part I) - Pointers.pdf
Chapter 5 (Part I) - Pointers.pdfChapter 5 (Part I) - Pointers.pdf
Chapter 5 (Part I) - Pointers.pdfTamiratDejene1
 
Chapter 7 (Part I) - User Defined Datatypes.pdf
Chapter 7 (Part I) - User Defined Datatypes.pdfChapter 7 (Part I) - User Defined Datatypes.pdf
Chapter 7 (Part I) - User Defined Datatypes.pdfTamiratDejene1
 
00-intro-to-classes.pdf
00-intro-to-classes.pdf00-intro-to-classes.pdf
00-intro-to-classes.pdfTamiratDejene1
 
Chapter 8_Shift Registers (EEEg4302)1.pdf
Chapter 8_Shift Registers (EEEg4302)1.pdfChapter 8_Shift Registers (EEEg4302)1.pdf
Chapter 8_Shift Registers (EEEg4302)1.pdfTamiratDejene1
 
Chapter 7_Counters (EEEg4302).pdf
Chapter 7_Counters (EEEg4302).pdfChapter 7_Counters (EEEg4302).pdf
Chapter 7_Counters (EEEg4302).pdfTamiratDejene1
 
Chapter 5_combinational logic (EEEg4302).pdf
Chapter 5_combinational logic (EEEg4302).pdfChapter 5_combinational logic (EEEg4302).pdf
Chapter 5_combinational logic (EEEg4302).pdfTamiratDejene1
 
Chapter 3_Logic Gates (EEEg4302).pdf
Chapter 3_Logic Gates (EEEg4302).pdfChapter 3_Logic Gates (EEEg4302).pdf
Chapter 3_Logic Gates (EEEg4302).pdfTamiratDejene1
 
Chapter 1_Introduction to digital design (EEEg4302).pdf
Chapter 1_Introduction to digital design (EEEg4302).pdfChapter 1_Introduction to digital design (EEEg4302).pdf
Chapter 1_Introduction to digital design (EEEg4302).pdfTamiratDejene1
 
Chapter – 1 Intro to DBS.pdf
Chapter – 1 Intro to DBS.pdfChapter – 1 Intro to DBS.pdf
Chapter – 1 Intro to DBS.pdfTamiratDejene1
 

More from TamiratDejene1 (20)

Ch-3 lecture.pdf
Ch-3 lecture.pdfCh-3 lecture.pdf
Ch-3 lecture.pdf
 
Chapter 2.pptx
Chapter 2.pptxChapter 2.pptx
Chapter 2.pptx
 
Wireless LANs.ppt
Wireless LANs.pptWireless LANs.ppt
Wireless LANs.ppt
 
Data Link Control.ppt
Data Link Control.pptData Link Control.ppt
Data Link Control.ppt
 
Congestion Control and QOS.ppt
Congestion Control and QOS.pptCongestion Control and QOS.ppt
Congestion Control and QOS.ppt
 
Analog Transmission.ppt
Analog Transmission.pptAnalog Transmission.ppt
Analog Transmission.ppt
 
Chapter 5 (Part I) - Pointers.pdf
Chapter 5 (Part I) - Pointers.pdfChapter 5 (Part I) - Pointers.pdf
Chapter 5 (Part I) - Pointers.pdf
 
Chapter 7 (Part I) - User Defined Datatypes.pdf
Chapter 7 (Part I) - User Defined Datatypes.pdfChapter 7 (Part I) - User Defined Datatypes.pdf
Chapter 7 (Part I) - User Defined Datatypes.pdf
 
00-intro-to-classes.pdf
00-intro-to-classes.pdf00-intro-to-classes.pdf
00-intro-to-classes.pdf
 
DLD Chapter-5.pdf
DLD Chapter-5.pdfDLD Chapter-5.pdf
DLD Chapter-5.pdf
 
DLD Chapter-4.pdf
DLD Chapter-4.pdfDLD Chapter-4.pdf
DLD Chapter-4.pdf
 
DLD Chapter-2.pdf
DLD Chapter-2.pdfDLD Chapter-2.pdf
DLD Chapter-2.pdf
 
DLD Chapter-1.pdf
DLD Chapter-1.pdfDLD Chapter-1.pdf
DLD Chapter-1.pdf
 
DLD_Chapter_1.pdf
DLD_Chapter_1.pdfDLD_Chapter_1.pdf
DLD_Chapter_1.pdf
 
Chapter 8_Shift Registers (EEEg4302)1.pdf
Chapter 8_Shift Registers (EEEg4302)1.pdfChapter 8_Shift Registers (EEEg4302)1.pdf
Chapter 8_Shift Registers (EEEg4302)1.pdf
 
Chapter 7_Counters (EEEg4302).pdf
Chapter 7_Counters (EEEg4302).pdfChapter 7_Counters (EEEg4302).pdf
Chapter 7_Counters (EEEg4302).pdf
 
Chapter 5_combinational logic (EEEg4302).pdf
Chapter 5_combinational logic (EEEg4302).pdfChapter 5_combinational logic (EEEg4302).pdf
Chapter 5_combinational logic (EEEg4302).pdf
 
Chapter 3_Logic Gates (EEEg4302).pdf
Chapter 3_Logic Gates (EEEg4302).pdfChapter 3_Logic Gates (EEEg4302).pdf
Chapter 3_Logic Gates (EEEg4302).pdf
 
Chapter 1_Introduction to digital design (EEEg4302).pdf
Chapter 1_Introduction to digital design (EEEg4302).pdfChapter 1_Introduction to digital design (EEEg4302).pdf
Chapter 1_Introduction to digital design (EEEg4302).pdf
 
Chapter – 1 Intro to DBS.pdf
Chapter – 1 Intro to DBS.pdfChapter – 1 Intro to DBS.pdf
Chapter – 1 Intro to DBS.pdf
 

Recently uploaded

Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 

Recently uploaded (20)

Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 

Chapter 2_Number system (EEEg4302).pdf

  • 1. Digital Logic Design (EEEg4302) Chapter 2 : Number System AASTU Department of Electrical and Computer Engineering 1 Milkias H.
  • 2. Outline Chapter 2 : Number System • Decimal Numbers • Binary Numbers • Decimal to Binary Conversion and vice versa • 1’s and 2’s compliment of binary number • Signed Number • Hexadecimal number • Octal number • Binary Coded Decimal (BCD) Number 2
  • 3. 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 base of the system. • The column weights of decimal numbers are powers of ten that increase from right to left beginning with … … 102 101 100 • For fractional decimal numbers, the column weights are negative powers of ten that decrease from left to right. 10−1 10−2 10−3 …… • Decimal numbers can 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 3
  • 4. Binary Numbers • The binary number system is another way to represent quantities. • It have two digits: 0 and 1. so it is base 2 system. • The position of a 1 and 0 in a binary number indicates weight. • The weight of a binary number is based on powers of two. 24 23 22 21 20 • For fractional binary number the weight are negative power of two that decrease from left two right. 2−12−22−32−42−5 4
  • 5. Binary Numbers Examples: 1010 → 1*23 + 0*22 + 1*21 + 1*2024 10.01 → 1*21 + 0*20 + 0*2−1 + 1*2−2 Binary Number Operation: Add & Sub: 1 + 1 = 10 1 – 1 = 0 0 + 0 = 0 0 – 0 = 0 1 + 0 = 1 1 – 0 = 1 5 Mul & Div: 1 * 1 = 1 1 / 1 = 1 0 * X = 0
  • 6. Decimal to Binary Numbers • For Non Fractional Number Repeated Division by two methods. (160)10 = (10100000)2 • For Fractional Number Repeated multiplication by two. (0.188)10 = (0.00110)2 → for five significant digits 6
  • 7. Binary to Decimal Conversion • The decimal value of any binary number can be found by adding the weights of all bits that are 1 and discarding the weight of all bits that are 0. • We multiply each binary digits by its weighted position and add each of the weighted value together. 7
  • 8. Binary to Decimal Conversion • Any numbering system can be summarized by the following relationship: 8
  • 9. Binary to Decimal Conversion • Example 9 (1010)2 = (10)10 (0.1011)2 = (0.6875)10
  • 10. Binary to Decimal Conversion Exercise • Convert the following decimal to binary format: 65 25.4 • Convert the following binary to decimal format: 101011 1010.01 10
  • 11. 1’s and 2’s Compliment of Binary Number o 1’s compliment representation: • Is just the inverse of a binary number. • To form 1’s compliment invert very bit of the number. • 1’s compliment of 1001 is 0110. o 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. 11
  • 12. Signed Number • Digital systems, such as computer must handle both positive and negative numbers. • A signed binary number consists of both sign and magnitude information. • There are three forms in which signed numbers can be represented in binary: I. Sign-magnitude form (least used) II. 1’s complement form III. 2’s complement form (most important) • N.B: The left most bit (MSB) in all forms of a signed number is the sign bit, which tells you whether the number is positive or negative. Positive number → 0 for sign bit Negative number → 1 for sign bit 12
  • 13. Signed Number I. Sign-magnitude form • When a signed binary number is represented in sign-magnitude form, the left most bit is the sign bit and the remaining bits are magnitude bits in true (uncomplemented form). • Example: using sign-magnitude form (+9) expressed as 8 bit signed binary And (-9) as • Notice that the only difference between (+9) and (-9) is the sign bit. 13 1 0 1 0 1 0 1 0 Sign bit Magnitude bits 0 0 0 0 1 0 0 1 1 0 0 0 1 0 0 1
  • 14. Signed Number II. 1’s complement form • Positive numbers in 1’s complement form are represented the same way as sign-magnitude numbers. • Negative numbers are the 1’s complements of the corresponding positive numbers. • Example: using 1’s complement form (+9) expressed as 8 bit signed binary And (-9) as 14 0 0 0 0 1 0 0 1 1 1 1 1 0 1 1 0 1’s complement
  • 15. Signed Number III. 2’s complement form • Positive numbers in 2’s complement form are represented the same way as sign-magnitude and 1’s complement forms. • Negative numbers are the 2’s complement of the corresponding positive numbers. • Example: using 2’s complement form (+9) expressed as 8 bit signed binary And (-9) as • 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. 15 0 0 0 0 1 0 0 1 1 1 1 1 0 1 1 1 2’s complement
  • 16. Signed Number • Exercise: Express the decimal number (-20) as an 8 bit number in the (i) Sign-magnitude (ii) 1’s complement and (iii) 2’s complement forms. First, find 8 bit binary conversion of (+20) (i) Sign-magnitude o change the sign bit to one (ii) 1’s complement o 1’s complement of (+20) (iii) 2’s complement forms. o 2’s complement of (+20) 16 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 1 1 1 0 1 0 1 1 1 1 1 0 1 1 0 0
  • 17. Signed Number • Why 2’s complement form is preferred for representing signed integer numbers? o Because its easier to convert back to decimal.(1’s complement requires adding 1 to summation of weight) o And there are two possible representations of zeros in 1’s complement form which are [00000000] and [11111111]. Range Of Signed Integer Numbers That Can Be Represented o The formula for finding the number of different combinations of n-bit is Total combination = 2𝑛 o For 2’s complement signed numbers, the range of values for n-bit numbers is Range = - (2𝑛−1) to +(2𝑛−1 - 1) 17
  • 18. Signed Number Arithmetic Operations With Signed Numbers 1. ADDITION: • The addition of two signed numbers with negative numbers represented in signed 2’s complement form is obtained from the addition of the two numbers including their sign bits. • A carry out of the sign bit position is discarded. Example: +6 00000110 -6 11111010 +13 00001101 +13 00001101 +19 00010011 +7 00000111 : +6 00000110 -6 11111010 -13 11110011 -13 11110011 -7 11111001 -19 11101101 18 1 Discard carry 1 Discard carry addend augend sum
  • 19. Signed Number Arithmetic Operations With Signed Numbers 1. ADDITION: • 0verflow condition : when two numbers are added and the number of bits to represent the sum exceeds the number of bits in the two numbers. • An over flow results as indicated by an incorrect sign bit. • Occurs only when both numbers are positive or when both numbers are negative. 19
  • 20. Signed Number Arithmetic Operations With Signed Numbers 2. SUBTRACTION: • Subtraction is addition with the sign of the subtrahend changed. As demonstrated by the following relationship (±A) - (+B) = (±A) + (-B) (±A) - (-B) = (±A) + (+B) • Take the 2’s complement of the subtrahend (including the sign bit) and add it to the minuend (including the sign bit). A carry out of the sign bit position is discard. Example : subtracting +6 (the subtrahend) from +9(minuend) is equivalent to adding (-6) to (+9). (9) - (6) = 3 = (9) + (-6) 20 difference minuend subtrahend -6 11111010 +9 00001001 +3 00000011 1 Discard carry
  • 21. Signed Number Arithmetic Operations With Signed Numbers 3. MULTIPLICATION: • The multiplication operation in most computers is accomplished using addition. • Direct addition and partial products are two basic methods for performing multiplication using addition. • In direct addition method, you add the multiplicand a number of times equal to the multiplier. • The partial product method is the more common one. The multiplicand is multiplied by each multiplier digit beginning with the least significant digit. Example 1. multiply the signed binary numbers 01001101 (multiplicand) and 00000100 (multiplier) using direct addition method. Solution since both numbers are positive, they are in true form and the product will positive . the decimal value of the multiplier is 4, so the multiplicand is added to it self four time as follows 01001101 1st time +01001101 2nd time 10011010 partial sum +01001101 3rd time 11100111 partial sum +01001101 4th time 100110100 product 21
  • 22. Signed Number Arithmetic Operations With Signed Numbers 3. MULTIPLICATION: Example 2. Multiply the signed binary number 01010011 (multiplicand) and 11000101 (multiplayer) using partial product method. Step 1. The sign bits are different, the product will be negative (1). Step 2. Take the 2’s complement of the multiplier to put it in true form. 11000101 00111011 22 Step 3. the multiplication proceed as follows. Notice that only the magnitude bits are used in this step. Step 4. since the sign of product is 1 as determined in step 1, take the 2’s compliment of the product. 1001100100001 0110011011111 Attach the sign bit 1 0110011011111
  • 23. Signed Number Arithmetic Operations With Signed Numbers 4. DIVISION: • The division operation computers is accomplished using subtraction. • Since subtraction is done with an adder, division can be accomplished with an adder. 𝑑𝑖𝑣𝑖𝑑𝑒𝑛𝑑 𝑑𝑖𝑣𝑖𝑠𝑜𝑟 = 𝑞𝑢𝑜𝑡𝑖𝑒𝑛𝑡 Example Divide 01100100 by 00011001 Solution. Step 1, the sign of both numbers are positive . Step 2. subtract the divisor from dividend using 2’s compliment addition . 01100100 +11100111 01001011 Add 1 to quotient( quotient is initially zero): 00000000 + 00000001 = 00000001 23 dividend 2’s compliment of divisor Positive first partial remainder
  • 24. Signed Number Arithmetic Operations With Signed Numbers 4. DIVISION: Step 3. subtract the divisor from the 1st partial remainder using 2’s compliment addition . 01001011 +11100111 00110010 Add 1 to quotient : 00000010 Step 4. subtract the divisor from the 2nd partial remainder using 2’s complement addition 00110010 +11100111 00011001 Add 1 to quotient : 00000011 Step 5. subtract the divisor from 3rd partial remainder using 2’s complement addition 24 1st partial remainders 2’s complement of divisor Positive 2nd partial remainder 2nd partial remainders 2’s complement of divisor Positive 3rd partial remainder
  • 25. Signed Number Arithmetic Operations With Signed Numbers 4. DIVISION: Step 5. subtract the divisor from 3rd partial remainder using 2’s complement addition 00011001 +11100111 00000000 Add 1 to quotient : 00000100 (final quotient). 25 3rd partial remainder 2’s complement of divisor zero remainder
  • 26. Hexadecimal Number • The hexadecimal number system has sixteen characters; Consists of digits 0-9 and letters A-F. • It is used primarily as a compact way of displaying or writing binary numbers. • Is widely used in computer and microprocessor applications. • Has a base of sixteen. • Large binary number can easily be converted to hexadecimal by grouping bits 4 at a time and writing the equivalent hexadecimal character. 26
  • 27. Hexadecimal Number 27 Counting in hexadecimal • Once you get to F, simply start over with other column and continue. • With two hexadecimal digits, you can count up to (FF) which is 255 in decimal. • The maximum three digit is (FFF) or decimal 4095.
  • 28. Hexadecimal Number Binary to Hexadecimal conversion • Converting a binary number to hexadecimal is straight forward procedure. Simply break the binary number in to 4 bit group with the equivalent hexadecimal symbol. • Example: convert the following binary number to hexadecimal: a) 1100101001010111 = CA5716 b) 1010000111100011 = A1E316 28
  • 29. Hexadecimal Number Hexadecimal to Binary conversion • To convert from hexadecimal number to a binary number reverse the process and replace each hexadecimal symbol with the appropriate four bits. • Example: Determine the binary number for the following hexadecimal number: (a) 10A416 0001000010100100 (b) AF6C16 1010111101101100 29
  • 30. Hexadecimal Number Hexadecimal to Decimal conversion • To find the decimal equivalent of hexadecimal number is first convert the hexadecimal number to binary and then convert from binary to decimal • Example: 2D 00101101 00101101 20 + 22 + 23 + 25 =4510 • Another way to convert a hexadecimal number to its decimal equivalent is to multiply the decimal value of each hexadecimal digit by its weight and then take the sum of these products. • The weight structure • Example 2D = (2x16) + (Dx1) = 32+ 13 =4510 30 163 162 161 160 4096 256 16 1
  • 31. Hexadecimal Number Decimal to Hexadecimal conversion • Repeated division of a decimal number by 16 will produce the equivalent hexadecimal number, formed by remainders of the divisions. • The first remainder produce is least significant digit (LSD). • Note that when a quotient has a fraction part, the fraction part is multiplied by the divisor to get the remainder. • Example : convert the decimal number 650 to hexadecimal by repeated division by 16. 31
  • 32. Octal Number • Like hexadecimal number system the octal number system provides a convenient way to express binary numbers and codes. • However it is 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 32
  • 33. Octal Number Octal to Decimal conversion • Octal is also a weight number system. The column weights are powers of 8, which increase from right to left. • Example: Express (3702)8 in decimal. 3 7 0 2 83 82 81 80 512 64 8 1 3(512) + 7(64) + 0(8) + 2(1) = (1986)10 33
  • 34. Octal Number Decimal to Octal Conversion • A method of converting a decimal number to an octal number is the repeated division-by-8 methods. • Each successive division by 8 yield a remainder that become a digit in the equivalent octal number . • The first remainder generated is the least significant digit (LSD). • Example: convert decimal number (359)10 to octal 34
  • 35. Octal Number Binary to Octal 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 (100110010010)2 in octal. 100 110 010 010 4 6 2 2 = (4622)8 35
  • 36. Octal Number Octal to Binary Conversion • Because each octal digit can be represented by a 3-bit binary number, it is very easy to convert from octal to binary. • Each octal digit is represented by three bits. • Example: Convert (613)8 in binary. 6 1 3 110 001 011 = (110001011)2 36
  • 37. 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 used in BCD. • For 4 bit BCD number, the column weights are 8 4 2 1 (23222120). • The ease of conversion between 8421 code numbers and familiar decimal numbers is the main advantage of the code. • To express any decimal number in BCD, simply replace each decimal digit with the appropriate 4 bit code. 37
  • 39. Binary Coded Decimal - BCD Example : convert decimal 170 to BCD 1 7 0 0001 0111 0000 To determine a decimal number from a BCD number, start at the right most bit and break the code in to 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 (351)10 39
  • 40. Assignment 1: • Read and prepare a short note and presentation on Digital codes (Gray code and ASCII) [text book: page 87- ] DUE DATE : April 28, 2021 40