Summer 2012ETE 204 - Digital Electronics1 Binary Arithmetic of Signed Binary Numbers.

Slides:



Advertisements
Similar presentations
Lecture no 6. Two's Complement Given a negative number (N), represented using the Two's Complement representation (N*), the magnitude of the number (P)
Advertisements

Lecture 7. Binary Codes Gray Code(s)  Unweighted code  Code values for successive decimal digits differ in exactly one bit.  Example: 2-bit Gray Code.
HEXADECIMAL NUMBERS Code
Company LOGO Edit your slogan here DKT 122/3 DIGITAL SYSTEM 1 WEEK #3 NUMBER SYSTEMS, OPERATION & CODES (PART 2)
CHAPTER 2 Number Systems, Operations, and Codes
ECE 331 – Digital System Design
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Number Systems Decimal (Base 10) Binary (Base 2) Hexadecimal (Base 16)
EECC341 - Shaaban #1 Lec # 3 Winter Binary Multiplication Multiplication is achieved by adding a list of shifted multiplicands according.
1 Binary Arithmetic, Subtraction The rules for binary arithmetic are: = 0, carry = = 1, carry = = 1, carry = = 0, carry =
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth.
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
Number Systems and Codes Discussion D4.1. Number Systems Counting in Binary Positional Notation Hexadecimal Numbers Negative Numbers.
S. Barua – CPSC 240 CHAPTER 2 BITS, DATA TYPES, & OPERATIONS Topics to be covered are Number systems.
Number System and Codes
Data Representation – Chapter 3 Sections 3-2, 3-3, 3-4.
Data Storage. SIGN AND MAGNITUDE Storing and representing numbers.
CS 105 Digital Logic Design
1 Lecture 2: Number Systems Binary numbers Base conversion Arithmetic Number systems  Sign and magnitude  Ones-complement  Twos-complement Binary-coded.
1.6 Signed Binary Numbers.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Digital Systems and Logic Design
Binary Arithmetic & Data representation
1 Digital Systems and Binary Numbers EE 208 – Logic Design Chapter 1 Sohaib Majzoub.
EE2174: Digital Logic and Lab Professor Shiyan Hu Department of Electrical and Computer Engineering Michigan Technological University CHAPTER 2 Number.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION.
Yuh-Jzer JoungDigital Systems1 Number Systems decimal number : 7397=7× × × ×10 0 a 4 a 3 a 2 a 1 a 0. a -1 a -2 = a 4 ×10 4 +a 3 ×10.
Information Representation. Digital Hardware Systems Digital Systems Digital vs. Analog Waveforms Analog: values vary over a broad range continuously.
Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
ECE 3110: Introduction to Digital Systems BCD, Gray, Character, Action/Event, Serial Data.
1 EENG 2710 Chapter 1 Number Systems and Codes. 2 Chapter 1 Homework 1.1c, 1.2c, 1.3c, 1.4e, 1.5e, 1.6c, 1.7e, 1.8a, 1.9a, 1.10b, 1.13a, 1.19.
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
ECE 2110: Introduction to Digital Systems BCD, Gray, Character, Action/Event, Serial Data.
ECE 3110: Introduction to Digital Systems unsigned Multiplication/Division codes.
Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.
ECE 2110: Introduction to Digital Systems Signed Addition/Subtraction.
Number Systems Binary to Decimal Octal to Decimal Hexadecimal to Decimal Binary to Octal Binary to Hexadecimal Two’s Complement.
C.S. Choy1 ITM1010 COMPUTER AND COMMUNICATION TECHNOLOGIES Prof. C.S. Choy, room 412 Prof. H.K. Tsang, room 306 Tutors: CY Poon ZJ Zhang CW Lee SK Cheung.
ECE 331 – Digital System Design Representation and Binary Arithmetic of Negative Numbers and Binary Codes (Lecture #10) The slides included herein were.
Chapter 3 Complements Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
Computer Math CPS120 Introduction to Computer Science Lecture 4.
Combinational Circuits
Tutorial: ITI1100 Dewan Tanvir Ahmed SITE, UofO
ECE 301 – Digital Electronics Representation of Negative Numbers, Binary Arithmetic of Negative Numbers, and Binary Codes (Lecture #11) The slides included.
1 Positive numbers are well understood An n-bit number represents numbers from 0 to 2 n -1 n+m bits can be used to represent n-bit integer and m-bit fraction.
Ahmad Almulhem, KFUPM 2009 COE 202: Digital Logic Design Number Systems Part 4 Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  The necessity and advantages of coding  The variety of coding systems You will learn: 2.
MECH1500 Chapter 3.
IT1004: Data Representation and Organization Negative number representation.
NUMBER SYSTEMS AND CODES. CS Digital LogicNumber Systems and Codes2 Outline Number systems –Number notations –Arithmetic –Base conversions –Signed.
CCE Department – Faculty of engineering - Islamic University of Lebanon Chapter 6 Binary Arithmetic.
Module –I Codes: Weighted and non-weighted codes
ECE DIGITAL LOGIC LECTURE 3: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/19/2016.
ECE DIGITAL LOGIC LECTURE 4: BINARY CODES Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/26/2016.
Lecture 1.2 (Chapter 1) Prepared by Dr. Lamiaa Elshenawy
Nguyen Le CS147.  2.4 Signed Integer Representation  – Signed Magnitude  – Complement Systems  – Unsigned Versus Signed Numbers.
Computer Math CPS120 Introduction to Computer Science Lecture 7.
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
11001 / 101, / ) Perform subtraction on the given unsigned binary numbers using the 2's complement of the subtrahend. Where the result.
Number Systems Decimal (Base 10) –10 digits (0,1,2,3,4,5,6,7,8,9) Binary (Base 2) –2 digits (0,1) Digits are often called bits (binary digits) Hexadecimal.
Lecture 4: Digital Systems & Binary Numbers (4)
Negative Number Sign-Magnitude: left-most bit as the sign bit –16 bits –Example: 4-bit numbers is given by is given by ’s complement:
ECE 2110: Introduction to Digital Systems
11001 / 101 , / ) Perform subtraction on the given unsigned binary numbers using the 2's complement of the subtrahend. Where the.
Unit 18: Computational Thinking
ECE 331 – Digital System Design
Chapter 1 (Part c) Digital Systems and Binary Numbers
Presentation transcript:

Summer 2012ETE Digital Electronics1 Binary Arithmetic of Signed Binary Numbers

2 2's Complement Addition Addition of n-bit signed binary numbers is straightforward using the 2's Complement number system. Addition is carried out in the same way as for n-bit positive numbers. Carry from the sign bit (leftmost bit) is ignored. Overflow occurs if the correct result (including the sign bit) cannot be represented in n bits. Summer 2012ETE Digital Electronics

3 2's Complement Addition: Example Using 2's Complement addition and 8-bit representation, add the following numbers: Did overflow occur? Summer 2012ETE Digital Electronics

4 2's Complement Addition: Example Using 2's Complement addition and 8-bit representation, add the following numbers: Did overflow occur? Summer 2012ETE Digital Electronics

5 2's Complement Addition: Example Using 2's Complement addition and 8-bit representation, add the following numbers: Did overflow occur? Summer 2012ETE Digital Electronics

6 2's Complement Addition: Example Using 2's Complement addition and 8-bit representation, add the following numbers: Did overflow occur? Summer 2012ETE Digital Electronics

7 2's Complement Subtraction Subtraction can be implemented using addition.  Determine the 2's Complement representation for the negative number -B.  Use 2's Complement addition to add A and -B. A – B = A + (-B) Summer 2012ETE Digital Electronics

8 2's Complement Subtraction: Example Subtract the following numbers, using 2's Complement addition and 8-bit representation: 64 – 78 Did overflow occur? Summer 2012ETE Digital Electronics

9 2's Complement Subtraction: Example Subtract the following numbers, using 2's Complement addition and 8-bit representation: -35 – 62 Did overflow occur? Summer 2012ETE Digital Electronics

10 2's Complement Subtraction: Example Subtract the following numbers, using 2's Complement addition and 8-bit representation: 14 – (-59) Did overflow occur? Summer 2012ETE Digital Electronics

11 2's Complement Subtraction: Example Subtract the following numbers, using binary subtraction and 8-bit representation: 27 – 45 Can this subtraction be carried out? Summer 2012ETE Digital Electronics

12 1's Complement Addition Similar to 2's Complement Addition of n-bit signed binary numbers. However, rather than ignore the carry-out from the sign (leftmost) bit, add it to the least significant bit (LSB) of the n-bit sum.  Known as the end-around carry. Summer 2012ETE Digital Electronics

13 1's Complement Addition: Example Using 1's Complement addition and 8-bit representation, add the following numbers: Did overflow occur? Summer 2012ETE Digital Electronics

14 1's Complement Addition: Example Using 1's Complement addition and 8-bit representation, add the following numbers: Did overflow occur? Summer 2012ETE Digital Electronics

15 Overflow The general rule for detecting overflow when performing 2's Complement or 1's Complement Addition:  An overflow occurs when the addition of two positive numbers results in a negative number.  An overflow occurs when the addition of two negative numbers results in a positive number.  Overflow cannot occur when adding a positive number to a negative number. Summer 2012ETE Digital Electronics

16 Binary Codes Summer 2012ETE Digital Electronics

17 Binary Codes Weighted Codes  Each position in the code has a specific weight  Decimal value of code can be determined Unweighted Codes  Positions of code do not have a specific weight  Decimal value assigned to each code Summer 2012ETE Digital Electronics

18 Binary Codes n-bit Weighted Codes  Code:a n-1 a n-2 a n-3...a 1 a 0  Weights:w n-1, w n-2, w n-3,..., w 1, w 0  Decimal Value:a n-1 x w n-1 + a n-2 x w n-2 + … + a 1 x w 1 + a 0 x w 0 4-bit Weighted Code  Code:a 3 a 2 a 1 a 0 Summer 2012ETE Digital Electronics

19 Binary Codes Examples of 4-bit weighted codes  bits → 16 code words Only 10 code words required to represent decimal digits  bits → 16 code words  Excess-3 (obtained from ) 4 bits → 16 code words Summer 2012ETE Digital Electronics

20 Binary Codes Examples of unweighted codes  2-out-of-5 Code Exactly 2 of the 5 bits are “1” for a valid code word. 10 valid code words.  Gray Code Code values for successive decimal digits differ in exactly one bit. 4 bits → 16 code words. Summer 2012ETE Digital Electronics

21 Binary Codes Summer 2012ETE Digital Electronics

22 Binary Coded Decimal (BCD) 4-bit binary number used to represent each decimal digit. Weighted code: Binary values 0000 … 1001 used to represent decimal values 0 … 9. Binary values 1010 … 1111 not used. Very different from binary representation. Summer 2012ETE Digital Electronics

23 Binary Coded Decimal In BCD, each decimal digit is replaced by its binary equivalent value. Example: Binary: = Summer 2012ETE Digital Electronics

24 ASCII American Standard Code for Information Interchange Common code for the storage and transfer of alphanumeric characters. 7-bit Weighted Code  Can represent 128 characters Used to represent letters, numbers, and other characters Any word or number can be represented using its ASCII code. Summer 2012ETE Digital Electronics

25 ASCII Code (incomplete) Summer 2012ETE Digital Electronics

26 Questions? Summer 2012ETE Digital Electronics