0% found this document useful (0 votes)
24 views

02 DLD

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

02 DLD

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

Digital Logic Design

NU-BCS
Lecture 1
content

•Number System
•Conversions
•Binary Arithmetic
•Complements
Number System

• Number system used for set of different symbols or digits


which represent a numerical value.
• Common number system
1. Decimal number system
2. Binary number system
3. Octal number system
4. Hexadecimal number system
1. Decimal number system

• Most popular and common number system.


• Support all mathematical and accounting concept in the
world.
• This number system also called Natural Number System
because it is natural to humans.
• Human used their fingers for counting numbers.
• Decimal digit are:
• "0", "1", "2", "3", "4", "5", "6", "7", "8", "9".

• 345 is recognized three hundred and forty five.


• 5 in the unit position and represent 5 once or 5*100
• 4 represent 4 tens or 4*101
• 3 represent 3 hundred 3*102

• 3 carries the most weight called (MSD) Most significant


digit.
• 5 carries the least weight called (LSD) Least Significant
digit.
2. Binary number system

• Binary number system comprising of two digits.


• Each digit represent its own value.
• Base of the binary system is 2 and the number as ( 0 , 1)
• The number system is natural to electronic machines or
devices.
• Their mechanism off or on switching of the circuits.
• Binary number system used in running and managing
machine operation.
3.Octal Number system

• Octal mean constitutes of 8 digits or symbols.


• In the octal system or base 8, there can be eight choices
for each digit of a number:
• "0", "1", "2", "3", "4", "5", "6", "7".
4.Hexadecimal Number System

• In the hexadecimal system, we allow 16 values for each


digit of a number:
• "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C",
"D", "E", and "F".
• Where “A” stands for 10, “B” for 11 and so on.
Conversions

• Computer uses binary notation and binary codes.


• Therefore arithmetic and other systems are converted to
binary numbers are processed accordingly.
• Some special type of computers which work on Octal and
Hexadecimal number systems.
Possible Conversions

1. Decimal System to Binary System


2. Decimal System to Octal System
3. Decimal System to Hexadecimal System
4. Binary System to Decimal System
5. Octal System to Decimal System
6. Hexadecimal System to Decimal System
7. Binary System to Octal System
8. Octal System to Binary System
9. Binary system to Hexadecimal System
10. Hexadecimal System to Binary System
11. Octal System to Hexadecimal System
12. Hexadecimal System to Octal System
1.Decimal Number System  Binary Number System

• Method
1. Divide decimal number by 2
2. Repeat this method until quotient is less than 2
3. Bottom to top sequence of remainders will be the required
binary number
(14)10 to (?)2

• 14/2 0
• 7/2 1
• 3/2 1
• 1

(14)10 to (1110)2
Practice

1. (43)10 to (101011)2
2. (164)10 to (10100100)2
3. (333)10 to (101001101)2
4. (4096)10 to (1000000000000)2
Conversion of Decimal Fraction to a
Binary Fraction

• Method:
• Multiply decimal fraction by 2.
• Repeat this process with fraction until no fraction found.
• Decimal point placed in the same position in binary
number.
• Top to bottom sequence of whole number will be the
required binary number.
(0.25)10 to (?)2

1. 0.25×2= 0.5
2. 0.5×2= 1.0

• (0.25)10 to (0.01)2
Practice

1. (0.375)10 to (0.011)2
2. (0.4375)10 to (0.0111)2
3. (0.625)10 to (0.101)2
4. (27/32)10 to (0.11011)2
Conversion Decimal Fraction to Binary
Fraction contains Whole number

• Method
1. Convert whole number as described in case-a and store in
x.
2. Convert fraction as described in case-b and store in y.
3. The decimal point is placed in the same position in binary
number as is present in the decimal number.
4. Add the two result x+y. Resultant will be the converted
binary number.
(2.125)10 to (?)2

•. Case-b
Case-a Case-3
(0.125)10 to (?)2
(2)10=(x)2 Add the two result X and
y
X=10
0.125×2 Y=0.001
2/2 0 =0.25 X+Y=10+0.001
1 0.25×2
=0.5
0.5×2
X=10 =1.0 (2.125)10 to (10.001)2

Y=0.001
Practice

1. (2 3
/8 )10 =(10.011)2
2. (512.5)10 =(1000000000.1)2
3. (131.5625 )10 =(10000011.1001)2
4. (2048.0625)10 =(100000000000.0001)2
2.Decimal Number System  Octal Number
System

• Method
1. Divide Decimal Number by 8.
2. Repeat this method until quotient is less than 8.
3. Bottom to top sequence of reminders will be required
octal number.
(19)10 to (?)8

• 19/8 3
• 2

• X=23
• (19)10 to (23)8
Practice

1. (125)10 to (175)8
2. (332)10 to (514)8
3. (2473)10 to (4651)8
4. (11570)10 to (26462)8
Conversion of decimal fraction to an
Octal Fraction

• Method
1. Multiply decimal fraction by 8
2. Repeat this process with fraction only until no fraction is
found .
3. The decimal point placed in the same position in Octal
number as present in the decimal number system.
4. Top to bottom sequence of whole number will be the
required octal number.
(0.55)10 to (?)8

• 0.55×8 =4.4
• 0.4×8 =3.2
• 0.2×8 =1.6
• 0.6×8 =4.8
• 0.8×8 =6.4

(0.55)10 to (0.43146)8
Practice

1. (0.625)10 to (0.5)8
2. (0.771)10 to (0.61260)8
3. (0.1123)10 to (0.07137)8
4. (0.23561)10 to (0.17050)8
Conversion Decimal Fraction to Octal
Fraction contains Whole number

• Method
1. Convert whole number as described in case-a and store in
x.
2. Convert fraction as described in case-b and store in y.
3. The decimal point is placed in the same position in Octal
number as is present in the decimal number.
4. Add the two result x+y. Resultant will be the converted
Octal number.
(8.99)10 to (?)8

• Case-a Case-b

(0.99)10 to (?)8 Case-3


• (8.99)10=(x)2
Add the two result X and y
X=10
0.99×8 =7.92 Y=0.77270
• 8/8 0 0.92×8 =7.36 X+Y=10+0.77270
0.36×8 =2.88
• 1 0.88×8 =7.04
0.04×8 =0.32
(8.99)10 to (10.77270)2
• X=10
Y=0.77270
Practice

1. (2.125)10 to (2.1)8
2. (632.97)10 to (1170.76050)8
3. (113.20)10 to (161.14631)8
4. (4429.625)10 to (10515.5)8
Decimal Number System  Hexadecimal Number
System

• Method:
• Divide Decimal number by 16
• Repeat this process until quotient is less than 16
• Bottom to top sequence of remainders will be the required
Hexadecimal number.
(40)10 to (?)16

• 40/16 8
• 2

• X=28
• (40)10 to (28)16
(397)10 to (?)16

• 397÷16 =24 13(D)


• 24÷16=1 8
• x=18D
• (397)10 to (18D)16
Practice

1. (1343)10 to (53F)16
2. (5132)10 to (140c)16
3. (26295)10 to (66B7)16
Conversion of Decimal Fraction to a
Hexadecimal Fraction

• Method
1. Multiply decimal fraction by 16
2. Repeat this process with fraction only until no fraction is
found .
3. The decimal point placed in the same position in
Hexadecimal number as present in the decimal number
system.
4. Top to bottom sequence of whole number will be the
required Hexadecimal number.
(0.23)10 to (?)16

1. 0.23×16 =3.68
2. 0.68×16 =10.88 (A)
3. 0.88×16 =14.08 (E)
4. 0.08×16 =1.28
5. 0.28×16 =4.48

(0.23)10 to
(0.3AE14)16
Practice

1) (0.62)10 to (0.9EB85)16
2) (0.235)10 to (0.3C28F)16
3) (0.114)10 to (0.1D2F1)16
4) (0.0298)10 to (0.07A0F)16
Conversion Decimal Fraction to
Hexadecimal Fraction contains Whole
number
• Method
1. Convert whole number as described in case-a and store in
x.
2. Convert fraction as described in case-b and store in y.
3. The decimal point is placed in the same position in Octal
number as is present in the decimal number.
4. Add the two result x+y. Resultant will be the converted
Hexadecimal number.
(50.8)10 to (?)16

•.
• Case-a Case-b Case-3

(0.8)10 to (?)16 Add the two result X


• (50.8)10=(x)16 and y
X=32
0.8×16 =12.8 Y=0.CCC…
• 50/16 2 0.8×16 X+Y=32+0.CCC
=12.8
• 3 0.8×16 =12.8
(50.8)10 to
• X=32 (32.CCC…)2
Y=0.CCC…
Practice

• (99.99)10 to (63.FD70A)16
• (336.125)10 to (150.2)16
• (825.625)10 to (63.FD70A)16
• (1029.2213)10 to (405.38A71…)16
Conversion of Binary Decimal Number

• Method:
• Write binary number in power of 2(Base of binary System)
• Calculate the powers this will give the number in decimal.
(111001)2 to (?)10

1. 1110012 = 1⋅25+1⋅24+1⋅23+0⋅22+0⋅21+1⋅20 = 5710

2. (11011)2 to (?)10

• (11011)2= 1⋅24+1⋅23+0⋅22+1⋅21+1⋅20
• =16+8+0+2+1

• =27

• (11011)2 to (27)10
Practice

• (11000)2 to (24)10
• (100011)2 to (35)10
• (111001)2 to (57)10
• (1011010)2 to (90)10
Conversion of binary fraction to Decimal
Fraction

• Method
• Write binary number in power of +ve 2
• Write binary fraction in power of –ve 2
• Calculate the powers this will give the number in decimal.
(111.1011)2 to (?)10

• (111.1011)2 = 1⋅22+1⋅21+1⋅20 + 1.2-1+0.2-2+1.2-3+1.2-4


• 4+2+1+ 0.5+0×0.5+0.125+0.0625=
• 7.6875
• (111.1011)2 to (7.6875)10
Practice

• (1011.0011)2 to (11.1875)10
• (101.101011)2 to (5.671875)10
• (111011.1011)2 to (59.6875)10
• (10110.0101011101)2 to (22.34082031)10
Octal number System  Decimal Number
System

• Method
• Write octal number in power of 8
• Calculate the powers this will give the number in decimal
(124)8 to (?)10

• (124)8 = 1×82 + 2×81 + 4×80


=1×64 +2×8+4×1 = 84

• (124)8 to (84)10
Practice

• (156)8 to (110)10
• (2376)8 to (1278)10
• (22632)8 to (9626)10
• (743126)8 to (247382)10
Conversion of Octal number to Decimal
containing fraction

• Method
• Write Octal number in power of +ve 8
• Write Octal fraction in power of –ve 8
• Calculate the powers this will give the number in decimal.
(0.52)8 to (?)10

• (0.52)2 = 0⋅80+5×8-1+2×8-2

• =0×1+5×0.125+2×0.015625
• =0+0.625+0.03125
• (0.52)8 to (0.56625)10
Practice

• (1.123)8 to (1.16210)10
• (0.5627)8 to (0.72436525)10
• (15.6)8 to (13.75)10
• (71.234)8 to (57.7265625)10
Hexadecimal Number  Decimal Number

• Method
• Write Hexadecimal number in power of 16
• Calculate the powers this will give the number in decimal.
(15)16 to (?)10

• (15)16 = 1×161 + 5×160


• =
1×16+5×1
• =16+5
• =21
• (15)16 to (21)10
Practice

• (AB4)16 to (2740)10
• (64AC)16 to (25772)10
• (EB1A)16 to (56090)10
• (D2763)16 to (862051)10
Conversion of Hexadecimal to Decimal
containing Fraction

• Method
• Write hexadecimal whole number in power of +ve 16
• Write hexadecimal fraction in power of –ve 16
• Calculate the powers this will give the number in Decimal.
(9.B)16 to (?)10

• (9.B)16 =9×160 + B×16-1


• =
9×160 + 11×16-1
• =
9×1 + 11×0.0625
• =
9+0.6875
• =9.6875

• (9.B)16 to (9.6875)10
Practice

• (5.1A)16 to (5.102)10
• (BC.1A)16 to (188.10156)10
• (0.152B)16 to (0.082687368)10
• (Af.23C)16 to (175.13964)10
Binary Number System  Octal Number
System

• Method
• Break binary number into groups of three bits each,
starting from the right most bit towards left.
• If the left most group contains less than three bits then add
zero(s) to the left , so that a group of three bits can be
formed. This additional zero is written as 0 in the following
example.
• Write Octal number against each group of three bits from
table.
(111001)2 to (?)8

• First we break the binary number into groups of 3 bits.


• Group 1 Group2
111 001
7 1

(111001)2 to
(71)8
Practice

• (10110111)2 to (267)8
• (111000001010)2 to (7012)8
• (1011111000001)2 to (12701)8
• (100000000011111111)2 to (400377)8
Conversion of Binary Number to Octal
Number containing Fraction

• Method
• Break binary number into groups of three bits each starting
from right towards left in whole numbers and starting from
the left towards right in fraction.
• If the left most group in whole number and right most
group in fraction respectively contains less than three bits
then add Zero(s)
To the left in whole number or right in fraction.
• The point is placed in the same position in Octal Number as
is present in binary number.
(111.111)2 to (?)8

• 111.111

7.7
(111.111)2 to (7.7)8
Practice

• (1111.1101)2 to (17.64)8
• (0.101111010101)2 to (0.5725)8
• (110110.011)2 to (66.3)8
• (11.1011011)2 to (3.554)8
Octal Number System  Binary Number
System

• Method
• Write a group of three bits against each octal digit from
table.
• If any group contains less than three bits then add zero (s)
to the left so that a group of three bits can be formed.
• Joins these binary digits and result will be the binary
equivalent of octal number.
(54)8 to (?)2

•5 4

101 100

(54)8 to (101100)2
Practice

• ( 652)8 to (110101010)2
• (1364)8 to (001011110100)2
• (7423)8 to (111100010011)2
• (53762)8 to (101011111110010)2
Conversion of Octal to Binary containing
Fraction

• Method
• Write a group of three bits against each octal digit from
table
• If any group contains less than three bits then add zero(s)
to the left so that a group of three bits can be formed this
zero is written as 0
• The point is placed int the same position in binary number
as is present in Octal number
• Join these binary digits and result will be the binary
equivalent of octal number
(232.2)8 to (?)2

2 3 2 . 2

010 011 010 010

(232.2)8 to
(010011010.010)2
Practice

• (453.45)8 to (?)2
• (3232.14)8 to (?)2
• (3146.52)8 to (?)2
• (0.03125)8 to (?)2
Binary Number System  Hexadecimal
Number System

• Method
• Break binary number into groups of four bits each starting
room the right most bit towards left
• If the left most group contains less than four bits then add
zero(s) to the left so tat a group of four bits can be formed
• Write hexadecimal number against each group of four bits
from table
(10011100)2 to (?)16

• 1001 1100

9 C

(10011100)8 to
(9C)16
Practice

• (101101111010)2 to (?)16
• (1000111110101)2 to (?)16
• (110000111110010000)2 to (?)16
• (101000000011110101011010)2 to (?)16
Conversion of Binary number to
hexadecimal number containing fraction

• Method
• Break binary number into groups of four bits starting from
the right towards left in whole numbers and starting from the
left towards right in fraction
• If the left most group in whole number and right most group
in fraction respectively contains less than four bits then add
Zero(s) to the left in whole number or right in fraction so that
a group of four bits can be formed.
• The point is placed in the same position in hexadecimal
number as is present in binary mumber.
(1101.0110)2 to (?)16

• 1101 . 0110

D 6

(1101.0110)8 to
(D6)16
Practice

• (11110.01011)2 to (?)16
• (1011.11010)2 to (?)16
• (0.01111110)2 to (?)16
• (0.1100101001010111)2 to (?)16
Hexadecimal number System  Binary
Number System

• Method
• Write a group of four bits against each hexadecimal digit
from table
• If any group contains less than four bits then add zero(s) to
the left so that a group of four bits can be formed
• Join these binary digits and result will be the binary
equivalent of hexadecimal number.
(AB)16 to (?)2

• A B

1010 1011

(AB)16 to (10101011)2
Practice

• (CDEF)16 to (?)2
• (6A9)16 to (?)2
• (23F0)16 to (?)2
• (415E7)16 to (?)2
Conversion of Hexadecimal to binary
containing Fraction

• Method
• Write a group of four bits against each hexadecimal digit
from table
• If any group contains less than four bits then add Zero(s) to
the left so that a group of four bits can be formed
• The point is placed in the same position in binary number
as is present in hexadecimal number
(AA.1A)16 to (?)2

• A A . 1 A

1010 1010 0001 1010

(AA.1A)16 to (10101010.00011010)2
Practice

• (ABC.CBA)16 to (?)2
• (AB2.234)16 to (?)2
• (0.CF83.1A)16 to (?)2
• (0.10A4EF)16 to (?)2
Octal Number System  Hexadecimal
Nmber

• Method
• Conversion performed in two phases
1. Conversion of Octal number to Binary
2. Conversion of Binary number to hexadecimal number
(17)8 to (?)16

• Step 1 Step 2
• 1 7 Break binary
number into group
of Four bits
001 111 001111
(17)8 to (F)16
(17)8 to (001111)2
Practice

• (235)8 to (?)16
• (4126)8 to (?)16
• (70523)8 to (?)16
• (154420)8 to (?)16
Conversion of Octal Number To
Hexadecimal containing Fraction

• Method
• This conversion is performed in two phase
1. Conversion of Octal Number to Binary Number
2. Conversion of Binary Number to Hexadecimal Number
(1.5)8 to (?)16

Step 2
• Step 1
Break binary
• 1 . 5 number into group
of Four bits
0001.1010
001 101
(1.5)8 to
(1.A)16
(1.5)8 to (001.011)2
Practice

• (33.1)8 to (?)16
• (62.47)8 to (?)16
• (153.10)8 to (?)16
• (2031.07)8 to (?)16
Hexadecimal Number  Octal Number

• Method
• This conversion is performed in two phases
1. Conversion of Hexadecimal number to Binary Number
2. Conversion of Binary number to Octal Number
(44)16 to (?)8

Step 2
• Step 1
Break binary
• 4 4 number into group
of three bits
001000100
0100 0100
(44)16 to
(104)8
(44)16 to (01000100)2
Practice

• (12F)16 to (?)8
• (30C5)16 to (?)8
• (ABD001)16 to (?)8
• (B4E60)16 to (?)8
Conversion of Hexadecimal to Octal
containing Fraction

• Method
• This conversion is performed in two phase
1. Conversion of Hexadecimal number to Binary number
2. Conversion of Binary number to Octal number
(2.3)16 to (?)8

Step 2
• Step 1
Break binary
• 2 . 3 number into group
of three bits
010.001100
0010 0011
(44)16 to
(2.14)8
(2.3)16 to (0010.0011)2
Practice

• (D5.7)16 to (?)8
• (64.EF)16 to (?)8
• (987.1B)16 to (?)8
• (9937.88)16 to (?)8
Binary Arithmetic

• Binary arithmetic has same operations as that of decimal


arithmetic the only difference lies in the octal number of
digits available in the system i.e. two digits in binary
system and ten digits in decimal system . The operation
performed are
• Addition
• Subtraction
• Multiplication
• Division
Binary Addition

• It is a key for binary subtraction, multiplication, division.


There are four rules of binary addition.

In fourth case, a binary


addition is creating a sum of (1
+ 1 = 10) i.e. 0 is written in the
given column and a carry of 1
over to the next column.
Addition
Example1

• 10001 + 11101 = 101110


Example2

• 1110 + 1111 = 11101


Example3

• 101101 + 11001 = 1000110


Example4

• 10111 + 110101 = 1001100


Practice

A. 100+111
B. 11101+101
C. 1100+1101
D. 101010+1111
Binary Subtraction

• Subtraction and Borrow, these two words will be used


very frequently for the binary subtraction. There are four
rules of binary subtraction.
Example 1

10 2-1=1
_ 1
_________
1
Example2

10 0 4-2=2
_ 1 0
_________
10
Example3
Example4

• 1011011 − 10010 = 1001001


Example5

• 100010110 − 1111010 = 10011100


Practice

• 1101-1000
• 1101-1011
• 10111101-1011111
• 11111111-1111111
Binary Multiplication

• Binary multiplication is similar to decimal multiplication. It


is simpler than decimal multiplication because only 0s and
1s are involved. There are four rules of binary
multiplication.
Multiplication
Example
Practice

• 11×11
• 1100×101
• 1111×1101
• 1111×1010
Binary Division

• Binary division is similar to decimal division. It is called as


the long division procedure.

• 11001 ÷ 101=101
Practice

• 1000÷10
• 1111÷11
• 11001÷101
• 100100÷100
Complement Arithmetic

• Complements are used in the digital computers in order to


simplify the subtraction operation and for the logical
manipulations.
• Especially subtraction of large number from a small number.
• there are two types of complements.
1. (r-1)’s complement
2. r’s complement
If the value of r is substituted as 2 then the type of
complement will be 1’s complement and 2’s complement.
Binary system complements

• As the binary system has base r = 2. So the two types of


complements for the binary system are 2's complement
and 1's complement.
• 1's complement (Direct Method)
• The 1's complement of a number is found by changing all
1's to 0's and all 0's to 1's. This is called as taking
complement or 1's complement. Example of 1's
Complement is as follows.
-Indirect method 1’s complement

• Each digits of the number is subtracted from 1 such as


find one complement for 10101

• 11111
• - 10101
• _______
• 01010 1’s complement
2's complement

• The 2's complement of binary number is obtained by


adding 1 to the Least Significant Bit (LSB) of 1's
complement of the number.
• 2's complement = 1's complement + 1
• Example of 2's Complement is as follows.
Convert the following binary numbers to
both their 1’s and 2’s complement

• 110
• 1101
• 11111
• 10110
• 110111
Subtraction in 1’s Complement
A smaller number subtracted from a large number

• Method:
• Take the subtrahend and find out its 1’s complement.
• Now add this 1’s complement to the minuend.
• Add the carry to the right digit of the result.
Regular subtraction
111
101 1’s complement subtraction -11
-----------
_ 11 100 (1’s
comp)
_______
010 101
+ 100
________________
1 001 add
Carry
+ 1
___________________
010
1’s complement Carry is Produced
(111010) – (101011)

(111010) – (101011)

111010
+ 010100
___________
1001110
Drop the carry and add to the number
001110
+ 1
_________
001111
A larger number is to be subtracted from
smaller number

• Method:
• Take the subtrahend and find out its 1’s complement.
• Now add this 1’s complement to the minuend.
• No carry is generated show that the answer is negative.
Regular subtraction

11
10 1’s complement subtraction -11
-----------
_ 11 00 (1’s
_______ comp)

_ 01 10
+ 00
________________
10
___________________
Again complement and
assign negative sign
-01
No carry (100110)-(110001)

• (100110)-(110001)

• 100110
• + 001110
• _________
• 110100 (no carry again complement and assign negative)
• _ 001011
2’s complement
smaller number subtracted from larger number

• Method
• Take the subtrahend and find out its 1’s Complement.
• Add 1 to the right digit of the 1’s complement.
• Now take this total and ad it with the minuend.
• Left most 1 will be dropped down resultant will be the 2’s
complement.
Carry produced

• (1111)-(1001)

• 0110 1111
• + 1 + 0111
• _______ ____________
• 0111 2’s com 10110 ( drop the carry ) result =0110
A large number subtracted from smaller
number

• Method:
• Take the subtrahend and find out its 1’s complement.
• Now add this 1’s complement answer to the minuend.
• No carry is generated which shows that the answer is
negative and is complement of the regular subtraction.
No carry

• (1000) – (1101)

• 0010 1’s com 1000 sum comp


• + 1 + 0011 0100 1’s com
• _____ ________ + 1
• 0011 2’s com 1011 sum _______
• _ 0101

You might also like