Wakerly Section 2.4 and further

Slides:



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

Chapter 1 Binary Systems 1-1. Digital Systems
King Fahd University of Petroleum and Minerals
Wakerly Section 2.4 and further Addition and Subtraction of Nondecimal Numbers.
CS 151 Digital Systems Design Lecture 3 More Number Systems.
Assembly Language and Computer Architecture Using C++ and Java
Assembly Language and Computer Architecture Using C++ and Java
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)
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
1.6 Signed Binary Numbers.
1 Arithmetic and Logical Operations - Part II. Unsigned Numbers Addition in unsigned numbers is the same regardless of the base. Given a pair of bit sequences.
BINARY ARITHMETIC Binary arithmetic is essential in all digital computers and in many other types of digital systems.
#1 Lec # 2 Winter EECC341 - Shaaban Positional Number Systems A number system consists of an order set of symbols (digits) with relations.
Chapter 2 Number Systems + Codes. Overview Objective: To use positional number systems To convert decimals to binary integers To convert binary integers.
Number Systems. Why binary numbers? Digital systems process information in binary form. That is using 0s and 1s (LOW and HIGH, 0v and 5v). Digital designer.
Lecture 4 Last Lecture –Positional Numbering Systems –Converting Between Bases Today’s Topics –Signed Integer Representation Signed magnitude One’s complement.
Number Systems Number Systems Stone Age: knots, some stone marks Roman Empire: more systematic notation I, II, III, IV, V, VI, VII.VIII, IX, X, C=100,
ECE 301 – Digital Electronics Unsigned and Signed Numbers, Binary Arithmetic of Signed Numbers, and Binary Codes (Lecture #2)
Operations on Bits Arithmetic Operations Logic Operations
Digital Logic Lecture 3 Binary Arithmetic By Zyad Dwekat The Hashemite University Computer Engineering Department.
MECH1500 Chapter 3.
DIGITAL SYSTEMS Number systems & Arithmetic Rudolf Tracht and A.J. Han Vinck.
Chapter 1: Binary Systems
1 Digital Logic Design Lecture 2 More Number Systems/Complements.
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.
ECE DIGITAL LOGIC LECTURE 15: COMBINATIONAL CIRCUITS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 10/20/2015.
Integer Operations Computer Organization and Assembly Language: Module 5.
COSC2410: LAB 2 BINARY ARITHMETIC SIGNED NUMBERS FLOATING POINT REPRESENTATION BOOLEAN ALGEBRA 1.
Lecture 4: Digital Systems & Binary Numbers (4)
Representing Positive and Negative Numbers
William Stallings Computer Organization and Architecture 8th Edition
Department of Computer Science Georgia State University
Cosc 2150: Computer Organization
Chapter 2 Binary Number Systems.
Number Systems & Binary Arithmetic
Number Systems and Codes (parte 1)
Negative Numbers and Subtraction
EI205 Lecture 2 Dianguang Ma Fall, 2008.
Digital Systems and Number Systems
Number systems and codes
Data Representation in Computer Systems
Digital Systems and Binary Numbers
Lecture 2 Topics Binary Arithmetic (Unsigned binary operands)
IT 0213: INTRODUCTION TO COMPUTER ARCHITECTURE
Lecture 2 Topics Binary Arithmetic (Unsigned binary operands)
Chapter 1 Number Systems, Number Representations, and Codes
BEE1244 Digital System and Electronics BEE1244 Digital System and Electronic Chapter 2 Number Systems.
Data Representation Data Types Complements Fixed Point Representation
Data Representation in Computer Systems
Subtraction The arithmetic we did so far was limited to unsigned (positive) integers. Today we’ll consider negative numbers and subtraction. The main problem.
EE207: Digital Systems I, Semester I 2003/2004
ECEG-3202 Computer Architecture and Organization
Data Representation – Chapter 3
Digital Logic Design (ECEg3141) 2. Number systems, operations & codes 1.
EEL 3705 / 3705L Digital Logic Design
Unit 18: Computational Thinking
Digital Systems and Binary Numbers
Overview Part 1 – Design Procedure Part 2 – Combinational Logic
Decimal and binary representation systems
UNIVERSITY OF MASSACHUSETTS Dept
Binary to Decimal Conversion
ECE 171 Digital Circuits Chapter 2 Binary Arithmetic
ECE 331 – Digital System Design
UNIVERSITY OF MASSACHUSETTS Dept
Chapter3 Fixed Point Representation
CHAPTER 69 NUMBER SYSTEMS AND CODES
Presentation transcript:

Wakerly Section 2.4 and further Addition and Subtraction of Nondecimal Numbers

Addition and Subtraction Use same technique as decimal Except that the addition and subtraction tables are different Already seen addition table Truth table for Sum and Cout function

Subtraction table bin x y bout d 1

Examples 191+141 (Let’s first convert these to binary as an exercise.) 210-109

Addition and Subtraction of Octal and Hexadecimal Numbers Not really too different But the addition and subtraction tables must be developed.

Section 2.5: Rep. of Negative Numbers More accurately: representation of signed numbers Signed-magnitude representation Radix-complement representation 2’s-complement representation Diminished radix-complement representation Ones’ complement representation Excess representations

Signed-magnitude representation Also called, “sign-and-magnitude representation” A number consists of a magnitude and a symbol representing the sign Usually 0 means positive, 1 negative Sign bit Usually the entire number is represented with 1 sign bit to the left, followed by a number of magnitude bits

Machine arithmetic with signed-magnitude representation Takes several steps to add a pair of numbers Examine signs of the addends If same, add magnitudes and give the result the same sign as the operands If different, must… Compare magnitude of the two operands Subtract smaller number from larger Give the result the sign of the larger operand For this reason the signed-mag rep is not as popular as one might think because of its “naturalness”

Complement number systems Negates a number by taking its complement instead of negating the sign Exact meaning of taking its complement is defined in various ways – will see Not natural for humans, but better for machine arithmetic Will describe 2 complement number systems Radix complement – very popular in real computers Diminished radix-complement – not very useful, may skip or not spend much time on it

Radix-complement number representation Must first decide how many bits to represent the number – say n. Complement of a number = rn – number Example: 4-bit decimal: Original number = 3524 10’s complement = 10000-3524 = 6476 0 and positive numbers: 0000-4999 Negative numbers: 5000-9999, where 9999 is ‘minus 1.’

Two’s-complement representation Just radix-complement when radix = 2 Used a lot in computers and other digital arithmetic circuits 0 and positive numbers: leftmost bit = 0 Negative numbers: leftmost bit = 1 To find a number’s complement – just flip all the bits and add 1 See graphical view – Fig. 2.3, p. 40.

Two’s-Comp Addition and Subtraction Rules Starting from 1000 (-8) on up, each successive 2’s comp number all the way to 0111 (+7) can be obtained by adding 1 to the previous one, ignoring any carries beyond the 4th bit position Since addition is just an extension of ordinary counting, 2’s comp numbers can be added by ordinary binary addition! No different cases based on operands’ signs! Overflow possible Occurs if result is out of range To detect – happens if operands are the same sign but sum is a different sign of that of the operands

Binary multiplication Grammar school method for decimal: add a list of shifted multiplicands computed according to the digits of the multiplier Same method can be used in binary For two unsigned operands, the only possible values of the multiplier digits are 0 and 1 Thus it’s trivial to form the shifted multiplicands

Binary multiplication in binary on a machine More convenient to add each shifted multiplicand as it is created to a partial product Will do an example. In general when we multiply an n-bit number by an m-bit number, the result requires at most n+m bits to express The shift-and-add algorithm requires m partial products and additions to obtain result, but the 1st addition is trivial (adding to 0)

Binary code for decimal numbers Any encoding needs at least 4 bits/decimal digit BCD (8421), a weighted code Packed BCD 2421 code Self-complementing: the code for the 9s’ comp of any digit may be obtained by complementing the individual bits of the digit’s code word Excess 3 Not a weighted code, but is also self-complementing Since code follows standard binary counting sequence, standard binary counters can easily be made to count in excess-3

Biquinary code Uses more than 4 bits First 2 bits indicate whether the number is in the range 0-4 or 5-0 One-hot Last 5 bits indicate which of the five numbers in the selected range is represented Also one-hot Advantage: error-detection property. If any 1 bit in a code word is accidentally changed to the opposite value, the resulting code word doesn’t represent a decimal digit at all – flagged as error.