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)

Slides:



Advertisements
Similar presentations
A Simple ALU Binary Logic.
Advertisements

Lecture 4. Basic Binary Arithmetic 2 Single-bit AdditionSingle-bit Subtraction s c xy Carry Sum d xy
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.
GCSE Computing Theory © gcsecomputing.net 1 GCSE Computing 2.14 Data Representation Binary Arithmetic.
ARITHMETIC, LOGIC INSTRUCTIONS, AND PROGRAMS
ECE 331 – Digital System Design
1 Binary Arithmetic, Subtraction The rules for binary arithmetic are: = 0, carry = = 1, carry = = 1, carry = = 0, carry =
ECE 331 – Digital System Design
VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth.
ECE 301 – Digital Electronics Number Systems and Conversion, Binary Arithmetic, and Representation of Negative Numbers (Lecture #10) The slides included.
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
Number System and Codes
1 Binary Numbers Again Recall that N binary digits (N bits) can represent unsigned integers from 0 to 2 N bits = 0 to 15 8 bits = 0 to bits.
1 Lecture 2: Number Systems Binary numbers Base conversion Arithmetic Number systems  Sign and magnitude  Ones-complement  Twos-complement Binary-coded.
Chapter 3 Data Representation part2 Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2010.
1.6 Signed Binary Numbers.
Binary Addition Addition Rules: = = = = = carry 1 1 carry 1 Example 1: Example 2:
Chapter3 Fixed Point Representation Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
ECE 2110: Introduction to Digital Systems Signed Number Conversions.
Computer Organization & Programming Chapter2 Number Representation and Logic Operations.
BINARY ARITHMETIC Binary arithmetic is essential in all digital computers and in many other types of digital systems.
Computer Architecture
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION.
1 Digital Design: Number Systems Credits : Slides adapted from: J.F. Wakerly, Digital Design, 4/e, Prentice Hall, 2006 C.H. Roth, Fundamentals of Logic.
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
Summer 2012ETE Digital Electronics1 Binary Arithmetic of Signed Binary Numbers.
ECE 2110: Introduction to Digital Systems BCD, Gray, Character, Action/Event, Serial Data.
Mohammad Amin Kuhail M.Sc. (York, UK) University of Palestine Faculty of Engineering and Urban planning Software Engineering Department Digital Logic Design.
BR 8/99 Binary Numbers Again Recall than N binary digits (N bits) can represent unsigned integers from 0 to 2 N bits = 0 to 15 8 bits = 0 to 255.
Positional Number Systems
ECE2030 Introduction to Computer Engineering Lecture 2: Number System Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Tech.
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.
ECE 331 – Digital System Design Representation and Binary Arithmetic of Negative Numbers and Binary Codes (Lecture #10) The slides included herein were.
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.
07/12/ Data Representation Two’s Complement & Binary Arithmetic.
Ahmad Almulhem, KFUPM 2009 COE 202: Digital Logic Design Number Systems Part 4 Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:
1 CSC 143 Two' s complement. 2 10's complement  How to represent negative numbers?  Use a sign → but −0 is the same as +0  10's complement  Example.
Addition and Substraction
CEC 220 Digital Circuit Design Binary Codes
CEC 220 Digital Circuit Design Binary Arithmetic & Negative Numbers Monday, January 13 CEC 220 Digital Circuit Design Slide 1 of 14.
CEC 220 Digital Circuit Design Binary Arithmetic & Negative Numbers Fri, Aug 28 CEC 220 Digital Circuit Design Slide 1 of 14.
DIGITAL SYSTEMS Number systems & Arithmetic Rudolf Tracht and A.J. Han Vinck.
ECE 171 Digital Circuits Chapter 2 Binary Arithmetic Herbert G. Mayer, PSU Status 1/14/2016 Copied with Permission from prof. Mark PSU ECE.
CEC 220 Digital Circuit Design Binary Codes Mon, Aug 31 CEC 220 Digital Circuit Design Slide 1 of 14.
ECE DIGITAL LOGIC LECTURE 3: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/19/2016.
Numerical formats What’s the main idea? Want to represent numbers (eg: 45, -12, ) using only bits. We’ve already seen (or you can read in the book)
ECE DIGITAL LOGIC LECTURE 4: BINARY CODES Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/26/2016.
09/03/20161 Information Representation Two’s Complement & Binary Arithmetic.
ECE 3110: Introduction to Digital Systems Signed Number Conversions and operations.
COSC2410: LAB 2 BINARY ARITHMETIC SIGNED NUMBERS FLOATING POINT REPRESENTATION BOOLEAN ALGEBRA 1.
Lecture 4: Digital Systems & Binary Numbers (4)
Unit I From Fundamentals of Logic Design by Roth and Kinney.
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
CHAPTER 9 COMPUTER ARITHMETIC - ALU
CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION
Lecture 2 Topics Binary Arithmetic (Unsigned binary operands)
Wakerly Section 2.4 and further
Lecture 2 Topics Binary Arithmetic (Unsigned binary operands)
Unit 18: Computational Thinking
Number Systems Rayat Shikshan Sanstha’s
Number Systems Rayat Shikshan Sanstha’s
ECE 171 Digital Circuits Chapter 2 Binary Arithmetic
ECE 331 – Digital System Design
Lecture No.5.
Chapter3 Fixed Point Representation
Chapter 1 (Part c) Digital Systems and Binary Numbers
Presentation transcript:

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) can be determined as follows: P = (2 n ) – N* or P = bit-wise complement of N* + 1 ECE Digital Electronics 2

Signed Binary Numbers ECE Digital Electronics 3

4 Binary Arithmetic of Signed Binary Numbers

Two's Complement Addition Addition of n-bit signed numbers using Two's Complement addition is straightforward. Addition is carried out in the same way as the addition of n-bit positive numbers. Carry from the sign position (MSB) is ignored. ECE Digital Electronics 5

Two's Complement Addition Implement the addition of the following signed numbers using Two's Complement Addition: (-29) ECE Digital Electronics 6

Overflow General rule for detecting overflow when adding two n-bit numbers using either One's Complement or Two's Complement Addition  An overflow occurs when the addition of two positive numbers results in a negative value or the addition of two negative numbers results in a positive value.  Cannot occur when adding a positive number and a negative number. ECE Digital Electronics 7

8 Binary Codes

Weighted and Unweighted Codes  A weighted code is one in which each position in the code has a specific weight  An unweighted code is one in which the positions in the code do not have a specific weight A 4-bit weighted code  Weights: w 3, w 2, w 1, w 0  Code: a 3 a 2 a 1 a 0  Decimal: D = a 3 x w 3 + a 2 x w 2 + a 1 x w 1 + a 0 x w 0 ECE Digital Electronics 9

Binary Codes Binary Coded Decimal (BCD)  4-bit binary number used to represent each decimal digit  Weighted code:  The binary values are used to represent the decimal digits  The binary values are not used. How do we interpret these unused codes? ECE Digital Electronics 10

Binary Codes Code  Weighted code with w 3 = 2, w 2 = 4, w 1 = 2, w 0 = 1 Excess-3 Code  Obtained from the (weighted code).  Add 3 ( ) to each of the codes. ECE Digital Electronics 11

Binary Codes ECE Digital Electronics 12