Chapter 10 Binary Arithmetics

Similar documents
Binary Addition. Add the binary numbers and and show the equivalent decimal addition.

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

Chapter 3: part 3 Binary Subtraction

Semester Transition Point. EE 109 Unit 11 Binary Arithmetic. Binary Arithmetic ARITHMETIC

Number System. Introduction. Decimal Numbers

World Inside a Computer is Binary

Chapter 3: Arithmetic for Computers

Decimal & Binary Representation Systems. Decimal & Binary Representation Systems

EE 109 Unit 6 Binary Arithmetic

Basic Definition INTEGER DATA. Unsigned Binary and Binary-Coded Decimal. BCD: Binary-Coded Decimal

BINARY SYSTEM. Binary system is used in digital systems because it is:

Digital Arithmetic. Digital Arithmetic: Operations and Circuits Dr. Farahmand

A complement number system is used to represent positive and negative integers. A complement number system is based on a fixed length representation

INF2270 Spring Philipp Häfliger. Lecture 4: Signed Binaries and Arithmetic

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: continued. Consulting hours. Introduction to Sim. Milestone #1 (due 1/26)

COMP2611: Computer Organization. Data Representation

10.1. Unit 10. Signed Representation Systems Binary Arithmetic

Moodle WILLINGDON COLLEGE SANGLI. ELECTRONICS (B. Sc.-I) Introduction to Number System

Arithmetic Operations

4/8/17. Admin. Assignment 5 BINARY. David Kauchak CS 52 Spring 2017

Chapter 1 Review of Number Systems

Module 2: Computer Arithmetic

COE 202: Digital Logic Design Number Systems Part 2. Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

CHW 261: Logic Design

ECE/Comp Sci 352 Digital Systems Fundamentals. Charles R. Kime Section 2 Fall Logic and Computer Design Fundamentals

The ALU consists of combinational logic. Processes all data in the CPU. ALL von Neuman machines have an ALU loop.

Number Systems and Conversions UNIT 1 NUMBER SYSTEMS & CONVERSIONS. Number Systems (2/2) Number Systems (1/2) Iris Hui-Ru Jiang Spring 2010

Arithmetic Operations on Binary Numbers

Computer Sc. & IT. Digital Logic. Computer Sciencee & Information Technology. 20 Rank under AIR 100. Postal Correspondence

COMP Overview of Tutorial #2

Number representations

Number Systems CHAPTER Positional Number Systems

MC1601 Computer Organization

Arithmetic and Logical Operations

CS101 Lecture 04: Binary Arithmetic

Chapter 4. Operations on Data

Chapter 4 Arithmetic Functions

D I G I T A L C I R C U I T S E E

Microcomputers. Outline. Number Systems and Digital Logic Review

Principles of Computer Architecture. Chapter 3: Arithmetic

(+A) + ( B) + (A B) (B A) + (A B) ( A) + (+ B) (A B) + (B A) + (A B) (+ A) (+ B) + (A - B) (B A) + (A B) ( A) ( B) (A B) + (B A) + (A B)

Computer (Literacy) Skills. Number representations and memory. Lubomír Bulej KDSS MFF UK

CS & IT Conversions. Magnitude 10,000 1,

ECE 2030D Computer Engineering Spring problems, 5 pages Exam Two 8 March 2012

CO212 Lecture 10: Arithmetic & Logical Unit

2.1. Unit 2. Integer Operations (Arithmetic, Overflow, Bitwise Logic, Shifting)

Lecture 2: Number Systems

Digital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.

We are quite familiar with adding two numbers in decimal

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-2700: Digital Logic Design Winter Notes - Unit 4. hundreds.

Number Systems. Both numbers are positive

Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as:

Digital Fundamentals

Groups of two-state devices are used to represent data in a computer. In general, we say the states are either: high/low, on/off, 1/0,...

Chapter 2: Number Systems

4 Operations On Data 4.1. Foundations of Computer Science Cengage Learning

Goals for this Week. CSC 2400: Computer Systems. Bits, Bytes and Data Types. Binary number system. Finite representations of binary integers

Number Systems Base r

COMPUTER ORGANIZATION AND ARCHITECTURE

COE 202- Digital Logic. Number Systems II. Dr. Abdulaziz Y. Barnawi COE Department KFUPM. January 23, Abdulaziz Barnawi. COE 202 Logic Design

UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS

DRAM uses a single capacitor to store and a transistor to select. SRAM typically uses 6 transistors.

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two Solutions 26 February 2014

Chapter 1. Digital Systems and Binary Numbers

Data Representation. DRAM uses a single capacitor to store and a transistor to select. SRAM typically uses 6 transistors.

ECE 341 Midterm Exam

Computer Organization

CO Computer Architecture and Programming Languages CAPL. Lecture 9

ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT, OAKLAND UNIVERSITY ECE-278: Digital Logic Design Fall Notes - Unit 4. hundreds.

Signed Binary Numbers

Data Representation COE 301. Computer Organization Prof. Muhamed Mudawar

Chapter 5: Computer Arithmetic. In this chapter you will learn about:

Advanced Computer Architecture-CS501

SE311: Design of Digital Systems

CS 31: Introduction to Computer Systems. 03: Binary Arithmetic January 29

COMP 122/L Lecture 2. Kyle Dewey

Numeric Encodings Prof. James L. Frankel Harvard University

Organisasi Sistem Komputer

Learning Objectives. Binary over Decimal. In this chapter you will learn about:

Korea University of Technology and Education

COMPUTER ARCHITECTURE AND ORGANIZATION. Operation Add Magnitudes Subtract Magnitudes (+A) + ( B) + (A B) (B A) + (A B)

Numerical Representations On The Computer: Negative And Rational Numbers

CS 64 Week 1 Lecture 1. Kyle Dewey

Digital Systems and Binary Numbers

But first, encode deck of cards. Integer Representation. Two possible representations. Two better representations WELLESLEY CS 240 9/8/15

9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation

Chapter 2 Bits, Data Types, and Operations

Numerical Representations On The Computer: Negative And Rational Numbers

CS 101: Computer Programming and Utilization

LOGIC DESIGN. Dr. Mahmoud Abo_elfetouh

CS 31: Intro to Systems Binary Arithmetic. Kevin Webb Swarthmore College January 26, 2016

UNIT IV: DATA PATH DESIGN

ECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010

Binary Arithmetic. Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T.

SIGNED AND UNSIGNED SYSTEMS

Computer Arithmetic. Appendix A Fall 2003 Lec.03-58

Arithmetic Processing

Digital Fundamentals. CHAPTER 2 Number Systems, Operations, and Codes

Digital Fundamentals. Lab 6 2 s Complement / Digital Calculator

Introduction to Computers and Programming. Numeric Values

Transcription:

27..27 Chapter Binary Arithmetics Dr.-Ing. Stefan Werner Table of content Chapter : Switching Algebra Chapter 2: Logical Levels, Timing & Delays Chapter 3: Karnaugh-Veitch-Maps Chapter 4: Combinational Circuit Design Chapter 5: Latches and Flip Flops Binary Addition of Chapter 6: Finite State Machines unsigned Chapter 7: State Machine Minimization Binary Subtraction of Chapter 8: Basic Sequential Circuits Chapter 9: Number Systems Chapter : Binary Arithmetic Chapter : Binary Codes unsigned Addition and Subtraction of signed Binary Multiplication 2of 23

27..27 Binary addition of unsigned Binary Arithmetic is basically the same as the arithmetic in every other number system. Considering two bits to be added there are only four possible cases: + = + = += + = Every bit has its position, the case + produces a carry occurring in the next position. 3of 23 Binary addition of unsigned The addition of whole is done bitwise from the least significant bit (LSB) to the most significant ifi bit (MSB): 34 + + 92 ++= += += += 4of 23 2

27..27 Binary addition of unsigned The addition of whole is done bitwise from the least significant bit (LSB) to the most significant bit (MSB): 2 8 2 7 2 6 2 5 2 4 2 3 2 2 2 2 34 + + 92 2568 + 6 + 4 + 2 = 46 5of 23 Problem: in theory: there exist as many digits as needed to represent a number in real life: there is only a limited number of digits in a system. Consider two summands of n-bit length with a resulting addition of only s in the MSB this addition of the two n-bit produces a result with (n+) bits in the given systems the result is out of the range that could be represented with the original word length. this occurrence of a carry in the most significant position is called overflow. 6of 23 3

27..27 Example: Addition of 4 bit yielding an overflow 6 + + 7 7of 23 Binary subtraction of unsigned Likewise the addition, the subtraction can lead to a borrow bit in the next position. Consider the following cases: = = = = Borrow = Borrow = Borrow 8of 23 4

27..27 Binary subtraction of unsigned Example 34-92 --= -= -= Borrow -= -= Borrow 9of 23 Binary subtraction of unsigned Example 2 8 2 7 2 6 2 5 2 4 2 3 2 2 2 2 34-92 28 +64 +6 + 8 + 4 + 2 = 222 of 23 5

27..27 Addition and subtraction of signed In digital circuits it is usually easier to invert the subtrahend and use an addition instead: Z Z 2 = Z +( Z 2 ) Now: Addition using the 2 s Complement Still the old problem: overflows can occur The 2 s Complement s addition can be visualized as running around the already known circle -2 - + + +6 of 23 Addition and subtraction of signed In this model, the overflow is nothing more than stepping from the negative to the positive half at the gateway / (consider + = = 2 + 2 = 2. A carry from the most significant position has to be discarded. Also: 2 s Complement s addition has a different overflow. 8 is just one step away from 7 the h addition i of two positive i can yield a negative one Consider: 2 + 2 = 2 7 + = - 8-2 - + + +6 2 of 23 6

27..27 Addition and subtraction of signed Discard carry An overflow in a 2 s Complement s addition can only occur if both - + are positive or both are negative. -2 + +6 3 of 23 Addition and subtraction of signed Examples Discard carry Addition without overflow MSB + 2 + - + -2 + +6 4 of 23 7

27..27 Addition and subtraction of signed Examples Discard carry Addition without overflow MSB - + + 4-2 + + +() Same as 3 + 4 +6 5 of 23 Addition and subtraction of signed Examples Addition without overflow Discard carry MSB 3 + +() -2-2 - + + +6 6 of 23 8

27..27 Addition and subtraction of signed Examples Discard carry Addition with overflow MSB 4 + Result not valid -2 - + + +6 + 7 of 23 Addition and subtraction of signed Examples Addition with overflow MSB + + (-2) 7 Result not valid -2 - Discard carry + + +6 - -2 8 of 23 9

27..27 Binary Multiplication Consider unsigned integer in the decimal system Example: a b multiply the factor a with each digit of b and multiply single results by powers of according to the n n digit s position i Z B = a b = a xi B = a x consecutively add the results i= m i= m 4 9 6 3 4 9 8 9 4 4 4 7 2 4 2 8 7 49 2 + 49 6 + 49 3 = 24.287 i B 9 of 23 i Binary Multiplication n n i i Example Z B = a b = a xi B = a xi B i= m i= m Binary system: x i is either or therefore a x i is either a or. the multiplication can be visualized in the same scheme as in case of the decimal system Fractional : multiplication is done the same way by just ignoring i the point during the multiplication li procedure. result has as many fraction digits as both factors together Example:.. =. 5 fraction digits, multiplication is the same as above 2 of 23

27..27 Binary multiplication of signed Signed in Sign-Magnitude-Representation cannot be multiplied directly split up into sign and magnitude both parts have to be treated t separately. magnitudes are multiplied as in case of unsigned resulting sign is determined from the signs of the factors: st factor 2 nd factor st sign bit 2 nd sign bit Result Result s sign bit Positive Positive Positive Positive Negative Negative Negative Positive Negative Negative Negative Positive A B C=A B 2 of 23 Binary multiplication of signed Example (word length 6 bit): 3 () = 2 2 Sign st factor A= Sign 2 nd factor B= Magnitude st factor Magnitude 2 nd factor Product of Magnitudes: = Sign of Result: C= 3 () = 22 of 23

27..27 Binary multiplication in 2 s complements Binary Multiplication in 2 s-complement representation cannot be done. Instead the are converted to Sign- Magnitude representation 23 of 23 2