SlideShare a Scribd company logo
Lectures on Complement Theory (1’s and 2’s, 9’s
and 10’s), BCD Addition, Decimal, Octal, and
Hexadecimal Addition
for
Open Educational Resource
on
Logic Development and Programming (EC221)
by
Dr. Piyush Charan
Assistant Professor
Department of Electronics and Communication Engg.
Integral University, Lucknow
2
1. Complement Theory
2. 1’s and, 2’s complement operation
Number System Continued....
01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow
3
1.Complement Theory
Example 1 Get 1’s complement of 50
Complement Digits
50 = 110010

001101
01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow
4
1’s Complement Arithmetic
(ADD/SUB Method)
1. Read both the operands
2. Negative operand(s) (if any) is converted into 1’s complement form
3. Add both the numbers
4. If carry is generated (i.e. =1) then the resultant number is positive.
5. Add ONE to the output of setp4, to get the final answer.
6. If carry is not generated then the answer is Negative and available in 1’s complement form.
7. Convert output of step 6 into 1’s complement to get final answer.
01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow
5
1. 1’s Complement Theory
Example 1 : Subtract 1010 from 1111 using 1’s complement theory. (15-10 Small negative)

1 0 1 0 0 1 0 1
1 1 1 1
0 1 0 1+
1] 0 1 0 0
+ 0 0 0 1
0 1 0 1 =(5)
1’s complement
Carry “1” means the answer is positive .
01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow
6
1. 1’s Complement Theory
Example 2 : Subtract 1010 from 1000 using 1’s complement theory. (Large negative 8-10)
1 0 1 0 0 1 0 1
1 0 0 0
0 1 0 1+
0] 1 1 0 1
1’s complement
Carry “0” means the answer is negative and available in 1’s complement form.
1 1 0 1 0 0 1 0 = (2)
01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow
7
2’s Complement Arithmetic
1. How to get 2’s complement form
2. Arithmetic operation using 2’s complement theory
01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow
8
2’s Complement Arithmetic (How to get 2’s
complement form..?)
Example 1
Example 2
Complement Digits
Add 1
5 = 00000101
-5 = 11111011

11111010
+1
Complement Digits
Add 1
-13 = 11110011
13 = 00001101

00001100
+1
01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow
9
2’s Complement Arithmetic
(Method)
1. Read both the operands
2. Negative operand (if any) is converted into 2’s complement form
3. Add both the numbers (2’s complement of negative operand with the other one).
4. If carry is generated (i.e. =1) then the resultant number is positive and in original form
5. If carry is not generated(when we have negative operand) then the carry is assumed =0.
6. Carry zero means the resultant number is negative and in a 2’s complement form.
7. Convert the 2’s complement form into the original form.
01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow
POS + NEG → POS Answer
10
Take the 2’s complement of the negative number and use regular binary 8-bit
addition.
000010019
+ (-5)
4
⎯→
⎯
11111011+
00000101

11111010
+1
11111011
2’s
Complement
Process
100000100
Last Bit = 1: Answer is Positive Disregard 9th
Bit
01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow
POS + NEG → NEG Answer
11
Take the 2’s complement of the negative number and use regular 8-bit
binary addition.
11110111(-9)
+ 5
-4
⎯→
⎯
00000101+
00001001

11110110
+1
11110111
2’s
Complement
Process
011111100
Last Bit = 0: Answer is Negative . Discard the last bit
11111100

00000011
+1
00000100
To Check:
Perform 2’s
Complement
On Answer
01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow
Verify the logic using following combinations:
1: (10) –(01)
2: (10) –(02)
3: (10) –(05)
4: (10) –(08)
5: (10) –(09)
6: (10) –(10)
7: (210) –(08)
8: (120) –(55)
9: (52) –(18)
01-10-2020 12Dr. Piyush Charan, Dept. of ECE, IU Lucknow
A+B A B 2’s of B Addition Ans
A=10
B=-1
1 0 1 0
0 0 0 1 1 1 1 0
0 0 0 1
1 1 1 1
1 0 1 0
1 1 1 1 CY =1 So ans is +ve
1 1 0 0 1
+9
B=-2 0 0 1 0 1 1 0 1
0 0 0 1
1 1 1 0
1 0 1 0
1 1 1 0 CY =1 So ans is +ve
1 1 0 0 0
+8
B=-5 0 1 0 1 1 0 1 0
0 0 0 1
1 0 1 1
1 0 1 0
1 0 1 1
1 0 1 0 1 CY =1 So ans is +ve
+5
B=-8 1 0 0 0 0 1 1 1
0 0 0 1
1 0 0 0
1 0 1 0
1 0 0 0
1 0 0 1 0 CY =1 So ans is +ve
+2
B=-9 1 0 0 1 0 1 1 0
0 0 0 1
0 1 1 1
1 0 1 0
0 1 1 1
1 0 0 0 1 CY =1 So ans is +ve
+1
B=-10 1 0 1 0 0 1 0 1
0 0 0 1
0 1 1 0
1 0 1 0
0 1 1 0
1 0 0 0 0 CY =1 So ans is +ve
+0
2’s Complement Arithmetic (Examples)
01-10-2020
13Dr. Piyush Charan, Dept. of ECE, IU Lucknow
Example: Perform 2’s complement subtraction on 210-08
210 = 1 1 0 1 0 0 1 0 (Subtrahend)
8= 0 0 0 0 1 0 0 0 (Minuend)
2’s complement of 8 is = 1 1 1 1 1 0 0 0
Add both the numbers:
1 1 0 1 0 0 1 0
+1 1 1 1 1 0 0 0
1 1 1 0 0 1 0 1 0
Carry = 1 means and is positive +202
01-10-2020 14Dr. Piyush Charan, Dept. of ECE, IU Lucknow
15
2’s Complement Arithmetic (Examples on varying
number of bits)
Example: Perform 2’s complement arithmetic for (30)-(50) using
1: 6-bit number system
2: 8-bit number system
01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow
Example: Perform 2’s complement arithmetic for (30)-(50) using:
(30)= 0 1 1 1 1 0
(-50)= 1 1 0 0 1 0 2’s complement 0 0 1 1 0 1
0 0 0 0 0 1
0 0 1 1 1 0
Add both the numbers
0 1 1 1 1 0
0 0 1 1 1 0
0 1 0 1 1 0 0
Carry =0 means number is negative and in 2’s compl form
(30)= 0 0 0 1 1 1 1 0
(-50)= 0 0 1 1 0 0 1 0 2’s complement 1 1 0 0 1 1 0 1
0 0 0 0 0 0 0 1
1 1 0 0 1 1 1 0
0 0 0 1 1 1 1 0
1 1 0 0 1 1 1 0
0 1 1 1 0 1 1 0 0
Carry =0 means number is negative and in 2’s compl form
0 1 0 0 1 1
0 0 0 0 0 1
0 1 0 1 0 0 = -20
0 0 0 1 0 0 1 1
0 0 0 0 0 0 0 1
0 0 0 1 0 1 0 0 = -20
Add both the numbers
1: 6-bit number system 2: 8-bit number
system
01-10-2020 16Dr. Piyush Charan, Dept. of ECE, IU Lucknow
BCD Numbers
01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow 17
01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow 18
1. Binary to decimal Conversion
2. BCD Addition
11/2/2020
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
19
9’s & 10’s Complement
11/2/2020 20
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
Decimal(base 10) Addition
11/2/2020
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
21
Octal (base 8) Addition
11/2/2020 22
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow
Hexadecimal(base 16) Addition
11/2/2020 23
Dr. Piyush Charan, Dept. of ECE, Integral University,
Lucknow

More Related Content

Similar to Unit 2: Data Representation contd.

About the computer of the important field
About the computer               of the important fieldAbout the computer               of the important field
About the computer of the important field
shubhamgupta7133
 
Module 4_Digital Electronics till complements.pdf
Module 4_Digital Electronics till complements.pdfModule 4_Digital Electronics till complements.pdf
Module 4_Digital Electronics till complements.pdf
manjunath V Gudur
 
Binary Arithmetic Operations
Binary Arithmetic OperationsBinary Arithmetic Operations
Binary Arithmetic Operations
Digital System Design
 
Unit 4 Switching Theory and Logic Gates
Unit 4 Switching Theory and Logic GatesUnit 4 Switching Theory and Logic Gates
Unit 4 Switching Theory and Logic Gates
Dr Piyush Charan
 
Introduction to Quantum Computing from Math perspective
Introduction to Quantum Computing from Math perspectiveIntroduction to Quantum Computing from Math perspective
Introduction to Quantum Computing from Math perspective
Pavel Belevich
 
Logic Design
Logic DesignLogic Design
Logic Design
Partha_bappa
 
PPT 2 - CA unit II 22 7-2020
PPT 2 - CA unit II 22 7-2020PPT 2 - CA unit II 22 7-2020
PPT 2 - CA unit II 22 7-2020
Thyagharajan K.K.
 
Digital_Electronics_Basics.pdf
Digital_Electronics_Basics.pdfDigital_Electronics_Basics.pdf
Digital_Electronics_Basics.pdf
rahul143341
 
1’s and 2’s complements
1’s and 2’s complements1’s and 2’s complements
1’s and 2’s complements
arunachalamr16
 
Two-sample Hypothesis Tests
Two-sample Hypothesis Tests Two-sample Hypothesis Tests
Two-sample Hypothesis Tests
mgbardossy
 
Computer organization and architecture lab manual
Computer organization and architecture lab manual Computer organization and architecture lab manual
Computer organization and architecture lab manual
Shankar Gangaju
 
Chapter_02_The_Language_of_Bits_Any.pptx
Chapter_02_The_Language_of_Bits_Any.pptxChapter_02_The_Language_of_Bits_Any.pptx
Chapter_02_The_Language_of_Bits_Any.pptx
duttnikhil2403
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
Edhole.com
 
Unit 02
Unit 02Unit 02
Unit 02
Partha_bappa
 
ENGR 232Dynamic Engineering SystemsLecture 1.2 - App.docx
ENGR 232Dynamic Engineering SystemsLecture 1.2 - App.docxENGR 232Dynamic Engineering SystemsLecture 1.2 - App.docx
ENGR 232Dynamic Engineering SystemsLecture 1.2 - App.docx
YASHU40
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
Edhole.com
 
B sc3 unit 2 number system
B sc3  unit 2 number systemB sc3  unit 2 number system
B sc3 unit 2 number system
MahiboobAliMulla
 
Digital Electronics and Computer Language
Digital Electronics and Computer Language Digital Electronics and Computer Language
Digital Electronics and Computer Language
Manthan Chavda
 
Lecture 1-431171839-lec2-BinaryArithmetic.ppt
Lecture 1-431171839-lec2-BinaryArithmetic.pptLecture 1-431171839-lec2-BinaryArithmetic.ppt
Lecture 1-431171839-lec2-BinaryArithmetic.ppt
AhmedWasiu
 
B sc ii sem unit 2(a) ns
B sc ii sem  unit 2(a) nsB sc ii sem  unit 2(a) ns
B sc ii sem unit 2(a) ns
MahiboobAliMulla
 

Similar to Unit 2: Data Representation contd. (20)

About the computer of the important field
About the computer               of the important fieldAbout the computer               of the important field
About the computer of the important field
 
Module 4_Digital Electronics till complements.pdf
Module 4_Digital Electronics till complements.pdfModule 4_Digital Electronics till complements.pdf
Module 4_Digital Electronics till complements.pdf
 
Binary Arithmetic Operations
Binary Arithmetic OperationsBinary Arithmetic Operations
Binary Arithmetic Operations
 
Unit 4 Switching Theory and Logic Gates
Unit 4 Switching Theory and Logic GatesUnit 4 Switching Theory and Logic Gates
Unit 4 Switching Theory and Logic Gates
 
Introduction to Quantum Computing from Math perspective
Introduction to Quantum Computing from Math perspectiveIntroduction to Quantum Computing from Math perspective
Introduction to Quantum Computing from Math perspective
 
Logic Design
Logic DesignLogic Design
Logic Design
 
PPT 2 - CA unit II 22 7-2020
PPT 2 - CA unit II 22 7-2020PPT 2 - CA unit II 22 7-2020
PPT 2 - CA unit II 22 7-2020
 
Digital_Electronics_Basics.pdf
Digital_Electronics_Basics.pdfDigital_Electronics_Basics.pdf
Digital_Electronics_Basics.pdf
 
1’s and 2’s complements
1’s and 2’s complements1’s and 2’s complements
1’s and 2’s complements
 
Two-sample Hypothesis Tests
Two-sample Hypothesis Tests Two-sample Hypothesis Tests
Two-sample Hypothesis Tests
 
Computer organization and architecture lab manual
Computer organization and architecture lab manual Computer organization and architecture lab manual
Computer organization and architecture lab manual
 
Chapter_02_The_Language_of_Bits_Any.pptx
Chapter_02_The_Language_of_Bits_Any.pptxChapter_02_The_Language_of_Bits_Any.pptx
Chapter_02_The_Language_of_Bits_Any.pptx
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
 
Unit 02
Unit 02Unit 02
Unit 02
 
ENGR 232Dynamic Engineering SystemsLecture 1.2 - App.docx
ENGR 232Dynamic Engineering SystemsLecture 1.2 - App.docxENGR 232Dynamic Engineering SystemsLecture 1.2 - App.docx
ENGR 232Dynamic Engineering SystemsLecture 1.2 - App.docx
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
 
B sc3 unit 2 number system
B sc3  unit 2 number systemB sc3  unit 2 number system
B sc3 unit 2 number system
 
Digital Electronics and Computer Language
Digital Electronics and Computer Language Digital Electronics and Computer Language
Digital Electronics and Computer Language
 
Lecture 1-431171839-lec2-BinaryArithmetic.ppt
Lecture 1-431171839-lec2-BinaryArithmetic.pptLecture 1-431171839-lec2-BinaryArithmetic.ppt
Lecture 1-431171839-lec2-BinaryArithmetic.ppt
 
B sc ii sem unit 2(a) ns
B sc ii sem  unit 2(a) nsB sc ii sem  unit 2(a) ns
B sc ii sem unit 2(a) ns
 

More from Dr Piyush Charan

Unit 1- Intro to Wireless Standards.pdf
Unit 1- Intro to Wireless Standards.pdfUnit 1- Intro to Wireless Standards.pdf
Unit 1- Intro to Wireless Standards.pdf
Dr Piyush Charan
 
Unit 1 Solar Collectors
Unit 1 Solar CollectorsUnit 1 Solar Collectors
Unit 1 Solar Collectors
Dr Piyush Charan
 
Unit 5 Quantization
Unit 5 QuantizationUnit 5 Quantization
Unit 5 Quantization
Dr Piyush Charan
 
Unit 4 Lossy Coding Preliminaries
Unit 4 Lossy Coding PreliminariesUnit 4 Lossy Coding Preliminaries
Unit 4 Lossy Coding Preliminaries
Dr Piyush Charan
 
Unit 3 Geothermal Energy
Unit 3 Geothermal EnergyUnit 3 Geothermal Energy
Unit 3 Geothermal Energy
Dr Piyush Charan
 
Unit 2: Programming Language Tools
Unit 2:  Programming Language ToolsUnit 2:  Programming Language Tools
Unit 2: Programming Language Tools
Dr Piyush Charan
 
Unit 4 Arrays
Unit 4 ArraysUnit 4 Arrays
Unit 4 Arrays
Dr Piyush Charan
 
Unit 3 Lecture Notes on Programming
Unit 3 Lecture Notes on ProgrammingUnit 3 Lecture Notes on Programming
Unit 3 Lecture Notes on Programming
Dr Piyush Charan
 
Unit 3 introduction to programming
Unit 3 introduction to programmingUnit 3 introduction to programming
Unit 3 introduction to programming
Dr Piyush Charan
 
Forensics and wireless body area networks
Forensics and wireless body area networksForensics and wireless body area networks
Forensics and wireless body area networks
Dr Piyush Charan
 
Final PhD Defense Presentation
Final PhD Defense PresentationFinal PhD Defense Presentation
Final PhD Defense Presentation
Dr Piyush Charan
 
Unit 3 Arithmetic Coding
Unit 3 Arithmetic CodingUnit 3 Arithmetic Coding
Unit 3 Arithmetic Coding
Dr Piyush Charan
 
Unit 2 Lecture notes on Huffman coding
Unit 2 Lecture notes on Huffman codingUnit 2 Lecture notes on Huffman coding
Unit 2 Lecture notes on Huffman coding
Dr Piyush Charan
 
Unit 1 Introduction to Data Compression
Unit 1 Introduction to Data CompressionUnit 1 Introduction to Data Compression
Unit 1 Introduction to Data Compression
Dr Piyush Charan
 
Unit 3 Dictionary based Compression Techniques
Unit 3 Dictionary based Compression TechniquesUnit 3 Dictionary based Compression Techniques
Unit 3 Dictionary based Compression Techniques
Dr Piyush Charan
 
Unit 1 Introduction to Non-Conventional Energy Resources
Unit 1 Introduction to Non-Conventional Energy ResourcesUnit 1 Introduction to Non-Conventional Energy Resources
Unit 1 Introduction to Non-Conventional Energy Resources
Dr Piyush Charan
 
Unit 5-Operational Amplifiers and Electronic Measurement Devices
Unit 5-Operational Amplifiers and Electronic Measurement DevicesUnit 5-Operational Amplifiers and Electronic Measurement Devices
Unit 5-Operational Amplifiers and Electronic Measurement Devices
Dr Piyush Charan
 
Unit 1 Introduction to Data Compression
Unit 1 Introduction to Data CompressionUnit 1 Introduction to Data Compression
Unit 1 Introduction to Data Compression
Dr Piyush Charan
 
Unit 1 Numerical Problems on PN Junction Diode
Unit 1 Numerical Problems on PN Junction DiodeUnit 1 Numerical Problems on PN Junction Diode
Unit 1 Numerical Problems on PN Junction Diode
Dr Piyush Charan
 
Unit 5 Global Issues- Early life of Prophet Muhammad
Unit 5 Global Issues- Early life of Prophet MuhammadUnit 5 Global Issues- Early life of Prophet Muhammad
Unit 5 Global Issues- Early life of Prophet Muhammad
Dr Piyush Charan
 

More from Dr Piyush Charan (20)

Unit 1- Intro to Wireless Standards.pdf
Unit 1- Intro to Wireless Standards.pdfUnit 1- Intro to Wireless Standards.pdf
Unit 1- Intro to Wireless Standards.pdf
 
Unit 1 Solar Collectors
Unit 1 Solar CollectorsUnit 1 Solar Collectors
Unit 1 Solar Collectors
 
Unit 5 Quantization
Unit 5 QuantizationUnit 5 Quantization
Unit 5 Quantization
 
Unit 4 Lossy Coding Preliminaries
Unit 4 Lossy Coding PreliminariesUnit 4 Lossy Coding Preliminaries
Unit 4 Lossy Coding Preliminaries
 
Unit 3 Geothermal Energy
Unit 3 Geothermal EnergyUnit 3 Geothermal Energy
Unit 3 Geothermal Energy
 
Unit 2: Programming Language Tools
Unit 2:  Programming Language ToolsUnit 2:  Programming Language Tools
Unit 2: Programming Language Tools
 
Unit 4 Arrays
Unit 4 ArraysUnit 4 Arrays
Unit 4 Arrays
 
Unit 3 Lecture Notes on Programming
Unit 3 Lecture Notes on ProgrammingUnit 3 Lecture Notes on Programming
Unit 3 Lecture Notes on Programming
 
Unit 3 introduction to programming
Unit 3 introduction to programmingUnit 3 introduction to programming
Unit 3 introduction to programming
 
Forensics and wireless body area networks
Forensics and wireless body area networksForensics and wireless body area networks
Forensics and wireless body area networks
 
Final PhD Defense Presentation
Final PhD Defense PresentationFinal PhD Defense Presentation
Final PhD Defense Presentation
 
Unit 3 Arithmetic Coding
Unit 3 Arithmetic CodingUnit 3 Arithmetic Coding
Unit 3 Arithmetic Coding
 
Unit 2 Lecture notes on Huffman coding
Unit 2 Lecture notes on Huffman codingUnit 2 Lecture notes on Huffman coding
Unit 2 Lecture notes on Huffman coding
 
Unit 1 Introduction to Data Compression
Unit 1 Introduction to Data CompressionUnit 1 Introduction to Data Compression
Unit 1 Introduction to Data Compression
 
Unit 3 Dictionary based Compression Techniques
Unit 3 Dictionary based Compression TechniquesUnit 3 Dictionary based Compression Techniques
Unit 3 Dictionary based Compression Techniques
 
Unit 1 Introduction to Non-Conventional Energy Resources
Unit 1 Introduction to Non-Conventional Energy ResourcesUnit 1 Introduction to Non-Conventional Energy Resources
Unit 1 Introduction to Non-Conventional Energy Resources
 
Unit 5-Operational Amplifiers and Electronic Measurement Devices
Unit 5-Operational Amplifiers and Electronic Measurement DevicesUnit 5-Operational Amplifiers and Electronic Measurement Devices
Unit 5-Operational Amplifiers and Electronic Measurement Devices
 
Unit 1 Introduction to Data Compression
Unit 1 Introduction to Data CompressionUnit 1 Introduction to Data Compression
Unit 1 Introduction to Data Compression
 
Unit 1 Numerical Problems on PN Junction Diode
Unit 1 Numerical Problems on PN Junction DiodeUnit 1 Numerical Problems on PN Junction Diode
Unit 1 Numerical Problems on PN Junction Diode
 
Unit 5 Global Issues- Early life of Prophet Muhammad
Unit 5 Global Issues- Early life of Prophet MuhammadUnit 5 Global Issues- Early life of Prophet Muhammad
Unit 5 Global Issues- Early life of Prophet Muhammad
 

Recently uploaded

COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
DuvanRamosGarzon1
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
ShahidSultan24
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
PrashantGoswami42
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 

Recently uploaded (20)

COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 

Unit 2: Data Representation contd.

  • 1. Lectures on Complement Theory (1’s and 2’s, 9’s and 10’s), BCD Addition, Decimal, Octal, and Hexadecimal Addition for Open Educational Resource on Logic Development and Programming (EC221) by Dr. Piyush Charan Assistant Professor Department of Electronics and Communication Engg. Integral University, Lucknow
  • 2. 2 1. Complement Theory 2. 1’s and, 2’s complement operation Number System Continued.... 01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow
  • 3. 3 1.Complement Theory Example 1 Get 1’s complement of 50 Complement Digits 50 = 110010  001101 01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow
  • 4. 4 1’s Complement Arithmetic (ADD/SUB Method) 1. Read both the operands 2. Negative operand(s) (if any) is converted into 1’s complement form 3. Add both the numbers 4. If carry is generated (i.e. =1) then the resultant number is positive. 5. Add ONE to the output of setp4, to get the final answer. 6. If carry is not generated then the answer is Negative and available in 1’s complement form. 7. Convert output of step 6 into 1’s complement to get final answer. 01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow
  • 5. 5 1. 1’s Complement Theory Example 1 : Subtract 1010 from 1111 using 1’s complement theory. (15-10 Small negative)  1 0 1 0 0 1 0 1 1 1 1 1 0 1 0 1+ 1] 0 1 0 0 + 0 0 0 1 0 1 0 1 =(5) 1’s complement Carry “1” means the answer is positive . 01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow
  • 6. 6 1. 1’s Complement Theory Example 2 : Subtract 1010 from 1000 using 1’s complement theory. (Large negative 8-10) 1 0 1 0 0 1 0 1 1 0 0 0 0 1 0 1+ 0] 1 1 0 1 1’s complement Carry “0” means the answer is negative and available in 1’s complement form. 1 1 0 1 0 0 1 0 = (2) 01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow
  • 7. 7 2’s Complement Arithmetic 1. How to get 2’s complement form 2. Arithmetic operation using 2’s complement theory 01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow
  • 8. 8 2’s Complement Arithmetic (How to get 2’s complement form..?) Example 1 Example 2 Complement Digits Add 1 5 = 00000101 -5 = 11111011  11111010 +1 Complement Digits Add 1 -13 = 11110011 13 = 00001101  00001100 +1 01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow
  • 9. 9 2’s Complement Arithmetic (Method) 1. Read both the operands 2. Negative operand (if any) is converted into 2’s complement form 3. Add both the numbers (2’s complement of negative operand with the other one). 4. If carry is generated (i.e. =1) then the resultant number is positive and in original form 5. If carry is not generated(when we have negative operand) then the carry is assumed =0. 6. Carry zero means the resultant number is negative and in a 2’s complement form. 7. Convert the 2’s complement form into the original form. 01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow
  • 10. POS + NEG → POS Answer 10 Take the 2’s complement of the negative number and use regular binary 8-bit addition. 000010019 + (-5) 4 ⎯→ ⎯ 11111011+ 00000101  11111010 +1 11111011 2’s Complement Process 100000100 Last Bit = 1: Answer is Positive Disregard 9th Bit 01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow
  • 11. POS + NEG → NEG Answer 11 Take the 2’s complement of the negative number and use regular 8-bit binary addition. 11110111(-9) + 5 -4 ⎯→ ⎯ 00000101+ 00001001  11110110 +1 11110111 2’s Complement Process 011111100 Last Bit = 0: Answer is Negative . Discard the last bit 11111100  00000011 +1 00000100 To Check: Perform 2’s Complement On Answer 01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow
  • 12. Verify the logic using following combinations: 1: (10) –(01) 2: (10) –(02) 3: (10) –(05) 4: (10) –(08) 5: (10) –(09) 6: (10) –(10) 7: (210) –(08) 8: (120) –(55) 9: (52) –(18) 01-10-2020 12Dr. Piyush Charan, Dept. of ECE, IU Lucknow
  • 13. A+B A B 2’s of B Addition Ans A=10 B=-1 1 0 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 1 0 1 0 1 1 1 1 CY =1 So ans is +ve 1 1 0 0 1 +9 B=-2 0 0 1 0 1 1 0 1 0 0 0 1 1 1 1 0 1 0 1 0 1 1 1 0 CY =1 So ans is +ve 1 1 0 0 0 +8 B=-5 0 1 0 1 1 0 1 0 0 0 0 1 1 0 1 1 1 0 1 0 1 0 1 1 1 0 1 0 1 CY =1 So ans is +ve +5 B=-8 1 0 0 0 0 1 1 1 0 0 0 1 1 0 0 0 1 0 1 0 1 0 0 0 1 0 0 1 0 CY =1 So ans is +ve +2 B=-9 1 0 0 1 0 1 1 0 0 0 0 1 0 1 1 1 1 0 1 0 0 1 1 1 1 0 0 0 1 CY =1 So ans is +ve +1 B=-10 1 0 1 0 0 1 0 1 0 0 0 1 0 1 1 0 1 0 1 0 0 1 1 0 1 0 0 0 0 CY =1 So ans is +ve +0 2’s Complement Arithmetic (Examples) 01-10-2020 13Dr. Piyush Charan, Dept. of ECE, IU Lucknow
  • 14. Example: Perform 2’s complement subtraction on 210-08 210 = 1 1 0 1 0 0 1 0 (Subtrahend) 8= 0 0 0 0 1 0 0 0 (Minuend) 2’s complement of 8 is = 1 1 1 1 1 0 0 0 Add both the numbers: 1 1 0 1 0 0 1 0 +1 1 1 1 1 0 0 0 1 1 1 0 0 1 0 1 0 Carry = 1 means and is positive +202 01-10-2020 14Dr. Piyush Charan, Dept. of ECE, IU Lucknow
  • 15. 15 2’s Complement Arithmetic (Examples on varying number of bits) Example: Perform 2’s complement arithmetic for (30)-(50) using 1: 6-bit number system 2: 8-bit number system 01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow
  • 16. Example: Perform 2’s complement arithmetic for (30)-(50) using: (30)= 0 1 1 1 1 0 (-50)= 1 1 0 0 1 0 2’s complement 0 0 1 1 0 1 0 0 0 0 0 1 0 0 1 1 1 0 Add both the numbers 0 1 1 1 1 0 0 0 1 1 1 0 0 1 0 1 1 0 0 Carry =0 means number is negative and in 2’s compl form (30)= 0 0 0 1 1 1 1 0 (-50)= 0 0 1 1 0 0 1 0 2’s complement 1 1 0 0 1 1 0 1 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 0 0 0 0 1 1 1 1 0 1 1 0 0 1 1 1 0 0 1 1 1 0 1 1 0 0 Carry =0 means number is negative and in 2’s compl form 0 1 0 0 1 1 0 0 0 0 0 1 0 1 0 1 0 0 = -20 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 = -20 Add both the numbers 1: 6-bit number system 2: 8-bit number system 01-10-2020 16Dr. Piyush Charan, Dept. of ECE, IU Lucknow
  • 17. BCD Numbers 01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow 17
  • 18. 01-10-2020 Dr. Piyush Charan, Dept. of ECE, IU Lucknow 18
  • 19. 1. Binary to decimal Conversion 2. BCD Addition 11/2/2020 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 19
  • 20. 9’s & 10’s Complement 11/2/2020 20 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 21. Decimal(base 10) Addition 11/2/2020 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow 21
  • 22. Octal (base 8) Addition 11/2/2020 22 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow
  • 23. Hexadecimal(base 16) Addition 11/2/2020 23 Dr. Piyush Charan, Dept. of ECE, Integral University, Lucknow