CPE 201 Digital Design Lecture 3: Digital Systems & Binary Numbers (3)

Slides:



Advertisements
Similar presentations
Addition and Subtraction. Outline Arithmetic Operations (Section 1.2) – Addition – Subtraction – Multiplication Complements (Section 1.5) – 1’s complement.
Advertisements

Binary Systems1 DIGITAL LOGIC DESIGN by Dr. Fenghui Yao Tennessee State University Department of Computer Science Nashville, TN.
COE 202: Digital Logic Design Signed Numbers
2’s Complement Arithmetic (remember it’s a fixed length system)
Forging new generations of engineers. Binary Addition & Subtraction.
Chapter 1 Binary Systems 1-1. Digital Systems
CS 151 Digital Systems Design Lecture 3 More Number Systems.
CSCI 232© 2005 JW Ryder1 Bases  = (3 * 10 2 ) + (2 * 10 1 ) + (4 * 10 0 )  = (3 * 8 2 ) + (2 * 8 1 ) + (4 * 8 0 )  = (1 * 2 3 )
Negative Numbers Module M3.3 Section 2.4. Negative Numbers Subtract by adding ’s complement Ignore carry.
Overview Iterative combinational circuits Binary adders
VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth.
Introduction to Computer Science
Data Representation – Chapter 3 Sections 3-2, 3-3, 3-4.
Chapter 3 Data Representation part2 Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2010.
NEGATIVE BINARY NUMBER – Digital Circuit 1 Choopan Rattanapoka.
1.6 Signed Binary Numbers.
Binary Addition Addition Rules: = = = = = carry 1 1 carry 1 Example 1: Example 2:
Digital Systems and Binary Numbers
Computer Organization & Programming Chapter2 Number Representation and Logic Operations.
Complement Numbers. Outline  Negative Numbers Representation  Sign-and-magnitude  1s Complement  2s Complement  Comparison of Sign-and-Magnitude.
Week #5 Arithmetic Circuits
مدار منطقي مظفر بگ محمدي Course Structure & Grading Homework: 25% Midterm: 30% Final:50% There is 5% extra! ( =105!) Textbook:
Number systems & Binary codes MODULE 1 Digital Logic Design Ch1-2 Outline of Chapter 1  1.1 Digital Systems  1.2 Binary Numbers  1.3 Number-base Conversions.
Computer Number Systems. d n-1 d n-2 d n d 2-m d 1-m d -m Conventional Radix Number r is the radixd i is a digit d i Є {0, 1, ….., r – 1 } -m ≤
IT101: INFORMATION TECHNOLOGY FUNDAMENTALS 1 Edited By Dr. Ahmed Abo-Bakr Information Technology Dept. Faculty of Computers & Information.
Dr. Ahmed Telba EE208: Logic Design Lecture# 1 Introduction & Number Systems.
Positional Number Systems
Number Systems Binary to Decimal Octal to Decimal Hexadecimal to Decimal Binary to Octal Binary to Hexadecimal Two’s Complement.
Number Systems and Logic Prepared by Dr P Marais (Modified by D Burford)
Chapter 3 Complements Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
07/12/ Data Representation Two’s Complement & Binary Arithmetic.
Digital Logic Lecture 3 Binary Arithmetic By Zyad Dwekat The Hashemite University Computer Engineering Department.
Outline Binary Addition 2’s complement Binary Subtraction Half Adder
Assoc. Prof. Dr. Ahmet Turan ÖZCERİT.  The base of numbers  Conversion between number bases  Arithmetic operations on different bases You will learn:
IT1004: Data Representation and Organization Negative number representation.
CPEN Digital Logic Design Binary Systems Spring 2004 C. Gerousis © Digital Design 3 rd Ed., Mano Prentice Hall.
ECE 171 Digital Circuits Chapter 2 Binary Arithmetic Herbert G. Mayer, PSU Status 1/14/2016 Copied with Permission from prof. Mark PSU ECE.
ECE DIGITAL LOGIC LECTURE 3: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/19/2016.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 8 Dr. Shi Dept. of Electrical and Computer Engineering.
1 CS 151 : Digital Design Chapter 4: Arithmetic Functions and Circuits 4-3 : Binary Subtraction.
09/03/20161 Information Representation Two’s Complement & Binary Arithmetic.
Lecture 1.2 (Chapter 1) Prepared by Dr. Lamiaa Elshenawy
Week 1(Number System) Muhammad Ammad uddin Logic Design Lab I (CEN211)
Lecture 4: Digital Systems & Binary Numbers (4)
DIGITAL Logic DESIGN Digital system and binary numbers Lecturer: Ms. Farwah Ahmad.
Addition and Subtraction
Negative Numbers and Subtraction
Chapter 4 Operations on Bits.
Binary Arithmetic Binary arithmetic is essential in all digital computers and in many other types of digital systems. Addition, Subtraction, Multiplication,
Digital Systems and Binary Numbers
Lecture 2 Topics Binary Arithmetic (Unsigned binary operands)
University of Gujrat Department of Computer Science
Binary Addition & Subtraction
Lecture 2 Topics Binary Arithmetic (Unsigned binary operands)
COMPLEMENTS Complements are used in digital computers for simplifying the subtraction operations and for logical manipulation. There are two types of complements.
Data Representation in Computer Systems
EE207: Digital Systems I, Semester I 2003/2004
Data Representation – Chapter 3
Digital Logic Design (ECEg3141) 2. Number systems, operations & codes 1.
Digital Systems Section 12 Binary Adders. Digital Systems Section 12 Binary Adders.
Unit 18: Computational Thinking
Digital Systems and Binary Numbers
Overview Part 1 – Design Procedure Part 2 – Combinational Logic
How are negative and rational numbers represented on the computer?
ECE 171 Digital Circuits Chapter 2 Binary Arithmetic
ECE 331 – Digital System Design
Arithmetic Operation By: Asst Lec. Besma Nazar Nadhem
Chapter3 Fixed Point Representation
Chapter 1 (Part c) Digital Systems and Binary Numbers
Two’s Complement & Binary Arithmetic
Presentation transcript:

CPE 201 Digital Design Lecture 3: Digital Systems & Binary Numbers (3)

2 Lecture Outline Complement systems Arithmetic operations with binary numbers

3 Complements Goal: logicalmanipulation –simplify subtraction operation and logical manipulation Complement systems negate a number by taking its complement Two types of complements for each base-r system –Radix complement: r’s complement –Diminished radix complement: (r-1)’s complement Big advantage: allows us to perform subtraction using addition –Thus, only need adder component, no need for separate subtractor component!

4 Diminished Radix Complement The (r-1)’s complement of an n-digit number N = r n – 1 – N Decimal –r = 10  9’s complement of N is 10 n – 1 – N –10 n : a “1” followed by n “0”s –10 n – 1: a number given by n “9”s The 9’s complement of a digital number is obtained by subtracting each digit from 9

5 Examples: 9’s Complement E.g.: 9’s complement of : – = : – = : =

6 Diminished Radix Complement – Radix 2 Binary –r = 2  1’s complement of N is 2 n – 1 – N –2 n : a “1” followed by n “0”s –2 n – 1: a number given by n “1”s The 1’s complement of a binary number is obtained by subtracting each digit from 1 Observation: 1-0 = 11-1 = 0 –Bit changes! The 1’s complement of a binary number is obtained by flipping the bits of the number

7 Examples: 1’s complement E.g.: 1’s complement of : : : : : :

8 Radix Complement The r’s complement of an n-digit number N = r n – N This means just adding 1 to the (r-1)’s complement! Decimal –Leave all LSB zeros unchanged –Subtract the first nonzero LSB from 10, subtract the rest from 9 Binary –Leave all LSB zeros and the first “1” unchanged –Flip the rest of the bits

9 Examples: 10’s Complement With addition: (1289, 2389, 5840, 3048) 1289: ( ) + 1 = = : ( ) + 1 = = : ( ) + 1 = = :( ) + 1 = = 6952 With alternative rule 1289: : : :6952

10 Examples: 2’s Complement With addition: ( , , , ) : = : = : = : = With alternative rule: ( , ) : : Carry ignored

11 Subtraction with r’s Complements Subtracting a number-done by adding its complement –Adding its complement results in answer exactly 10 more –Drop the 1  results in subtracting using addition only - - Exemplified with base 10 and 1-digit numbers

12 Subtraction with r’s Complements Compute M – N M – N = M + r’s complement (N) = M + r n – N = (M – N) + r n M>N: = (M – N) + r n M<N: = r n – (N – M) Carry to next digit: IGNORED! The r’s complement of the desired result with negative sign! Take the complement and add a negative sign.

13 Subtraction with r’s Complements To compute M – N: –Take the r’s complement of N –Add that value to M –Two cases can occur: A carry to next digit is obtained (M was greater than N)  ignore the carry to get the result No carry is obtained (M was smaller than N)  take the r’s complement of the resulted value and add a negative sign

14 Subtraction Using 10’s Complement – 3250 =  Result = – =  Res. = -10’s complement(30718) = Discard the carry No carry Make sure you fill out to the maximum available number of digits! 0

15 Subtraction Using 2’s Complement X = Y = X – Y = ?Y – X = ? X – Y:Y – X: Res. = -2’s comp. ( ) = Discard the carry No carry

16 Subtraction with (r-1)’s Complements Compute M – N M – N = M + (r-1)’s complement (N) = M + r n – N – 1 = (M – N – 1) + r n M>N: = (M – N – 1) + r n M<N: = r n – 1 – (N – M) Carry to next digit: IGNORED! Got 1 less than result  add 1 The (r-1)’s complement of the desired result with negative sign! Take the complement and add a negative sign.

17 Subtraction with (r-1)’s Complements To compute M – N: –Take the (r-1)’s complement of N –Add that value to M –Two cases can occur: A carry to next digit is obtained (M was greater than N)  ignore the carry and add 1 to get the result No carry is obtained (M was smaller than N)  take the (r-1)’s complement of the resulted value and add a negative sign

18 Subtraction Using 1’s Complement X = Y = X – Y = ?Y – X = ? X – Y:Y – X: ’s complement of = Discard the carry No carry

19 Readings Chapter 1: –Sections 1.6, 1.7