6 October 2015Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.

Slides:



Advertisements
Similar presentations
Introduction to Computer Systems
Advertisements

8 October 2013Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
15 October 2013Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
Intro to CS – Honors I Representing Numbers GEORGIOS PORTOKALIDIS
2’s Complement Arithmetic (remember it’s a fixed length system)
Number Systems Discussion D4.1 Appendix C. Number Systems Counting in Binary Positional Notation Hexadecimal Numbers Negative Numbers.
CS 151 Digital Systems Design Lecture 3 More Number Systems.
1 Lecture 3 Bit Operations Floating Point – 32 bits or 64 bits 1.
Negative Numbers Module M3.3 Section 2.4. Negative Numbers Subtract by adding ’s complement Ignore carry.
Number Representation (1) Fall 2005 Lecture 12: Number Representation Integers and Computer Arithmetic.
CSCI 3 CH 1.6. REMINDER Remember to put your Student ID # on your homework Remember to put your Student ID # on your homework If you are not going to.
Digital Circuits. Analog and Digital Signals Noise margins in Logic Circuits VMVM.
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
Two’s Complement 1.As an action: (Assume the starting value is 1011) 1.Flip the bits from the starting value => Add one to get the answer.
Floating Point Numbers.  Floating point numbers are real numbers.  In Java, this just means any numbers that aren’t integers (whole numbers)  For example…
COMP201 Computer Systems Number Representation. Number Representation Introduction Number Systems Integer Representations Examples  Englander Chapter.
3. Representing Integer Data
Computer Organization & Programming Chapter2 Number Representation and Logic Operations.
Lecture for Week Spring.  Numbers can be represented in many ways. We are familiar with the decimal system since it is most widely used in everyday.
Copyright © Cengage Learning. All rights reserved. CHAPTER 2 THE LOGIC OF COMPOUND STATEMENTS THE LOGIC OF COMPOUND STATEMENTS.
Introduction to Computer Systems
Digital Logic Design Lecture 3 Complements, Number Codes and Registers.
CPS120: Introduction to Computer Science Computer Math: Signed Numbers.
Calculating Two’s Complement. The two's complement of a binary number is defined as the value obtained by subtracting the number from a large power of.
46 Number Systems Problem: Implement simple pocket calculator Need: Display, adders & subtractors, inputs Display: Seven segment displays Inputs: Switches.
Representation of Data Ma King Man. Reference Text Book: Volume 2 Notes: Chapter 19.
Chapter 2 Binary Values and Number Systems. 2 2 Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645,
Chapter 2: The Logic of Compound Statements 2.5 Application: Number Systems and Circuits for Addition 1 Counting in binary is just like counting in decimal.
6 October 2015Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
Lecture 2 Binary Values and Number Systems. The number 943 is an example of a number written in positional notation. The relative positions of the digits.
ECE 2110: Introduction to Digital Systems Signed Addition/Subtraction.
29 September 2015Birkbeck College, U. London1 Introduction to Computer Systems Department of Computer Science and Information Systems Autumn 2015 Preliminary.
29 September 2015Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
Addition and Substraction
COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.6 Instructor: Lin Chen Sept 2013.
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
20 October 2015Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
13 October 2015Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
3 November 2015Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
Lecture 6 Excess Notation. Excess 8 notation indicates that the value for zero is the bit pattern for 8, that is 1000 Excess 8 notation indicates that.
IT1004: Data Representation and Organization Negative number representation.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
ECE DIGITAL LOGIC LECTURE 3: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/19/2016.
In decimal we are quite familiar with placing a “-” sign in front of a number to denote that it is negative The same is true for binary numbers a computer.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 8 Dr. Shi Dept. of Electrical and Computer Engineering.
12 February 2016Birkbeck College, U. London1 Introduction to Programming Lecturer: Steve Maybank Department of Computer Science and Information Systems.
24 November 2015Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
1 Ethics of Computing MONT 113G, Spring 2012 Session 4 Binary Addition.
09/03/20161 Information Representation Two’s Complement & Binary Arithmetic.
Computer Organization 1 Data Representation Negative Integers.
27 October 2015 Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
Lecture 2: 8/29/2002CS149D Fall CS149D Elements of Computer Science Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
ECE 3110: Introduction to Digital Systems Signed Number Conversions and operations.
Two’s Complement The language of machines, part II.
Binary Values. Numbers Natural Numbers Zero and any number obtained by repeatedly adding one to it. Examples: 100, 0, 45645, 32 Negative Numbers.
Binary Arithmetic James A. Rome Tennessee Governor's Academy August 2010.
Department of Computer Science Georgia State University
Fundamentals of Computer Science
Introduction to Computer Systems
Introduction To Computer Science
Number Systems and Circuits for Addition – Negative Integers
Introduction to Programming
1.6) Storing Integer:.
Unit 18: Computational Thinking
CPS120: Introduction to Computer Science
CSC 220: Computer Organization Signed Number Representation
Presentation transcript:

6 October 2015Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems Autumn 2015 Week 2b: Number Representations

6 October 2015Brookshear, Section 1.62 Representations of Negative Integers Put a minus sign in front of the representation for a positive integer. Excess notation. Two’s Complement notation – the most popular representation for integers in computers.

6 October 2015Brookshear, Section 1.63 Excess Notation Problem: represent a set of positive and negative integers using bit strings with a fixed length n. Represent 0 by 10…0 (n bits). Represent positive numbers by counting up from 10…0 in standard binary notation. Represent negative integers by counting down from 10…0 in standard binary notation.

6 October 2015Brookshear, Section 1.64 Three Bit Excess Notation n=

6 October 2015Brookshear, Section 1.65 Alternative Name: Excess Four Notation bit string = Binary(number+4) e.g. 110 = Binary(2+4) 011 = Binary(-1+4)

Examples Find the 6 bit excess notation for the decimal numbers 7 and -6. Which decimal number has the 5 bit excess notation 10101? 6 October 2015Birkbeck College, U. London6

6 October 2015Birkbeck College, U. London7 Two’s Complement Notation Form the bit string 10…0 with n+1 bits. Represent 0 by the rightmost n bits of 10…0. Represent positive integers by counting up from 10…0 in standard binary notation and using the rightmost n bits. Represent negative integers by counting down from 10…0 in standard binary notation and using the rightmost n bits.

6 October 2015Birkbeck College, U. London8 Examples

6 October 2015Brookshear, Section 1.69 Example of Two’s Complement Notation n=4 The left most bit indicates the sign.

Summary 6 October 2015Birkbeck College, U. London10

6 October 2015Brookshear, Section Addition and Subtraction  In the two’s complement system subtraction reduces to addition.  E.g. to evaluate 6-5 in 4 bit two’s complement notation, add the tc bit strings for 6 and –5, then take the four rightmost bits === ==

6 October 2015Brookshear, Section Explanation  TC(6) = rightmost four bits of Binary(2 4 +6)  TC(-5) = rightmost four bits of Binary(2 4 -5)  Binary((2 4 +6)+(2 4 -5))= Binary( ).  The right most four bits of Binary( ) form the bit string for TC(1).

Why Use Two’s Complement Addition and subtraction require one circuit for addition and one circuit for negation. This is more efficient than having a circuit for addition and a circuit for subtraction. 6 October 2015Brookshear, Section 1.613

Notation  Let s, t be bit strings. The concatenation of s and t is s||t, e.g. 110||001 =  Let s be a bit string. Then complement(s) is the bit string obtained by reversing the bits of s, e.g. complement(110) = October 2015Birkbeck College, U. London14

6 October 2015Brookshear, Section Two’s Complement Notation for m and -m Let TC(m) = s || 1 || t, where t is a string of zeros. TC(-m) = complement[s]||1||t. Examples: n = 4, TC(3) = 0011, TC(-3) = 1101 TC(-1) = 1111, TC(1) = 0001

6 October 2015Brookshear, Section Sketch Proof Let TC(m) = s || 1 || t, where t is a string of zeros. Add: s||1||t + complement(s)||1||t t+t = t = string of zeros 1+1 = 0+carry s+complement(s) = string of ones carry+string of ones = 10…0 The rightmost n bits are all zero.

Alternative Algorithm TC(-m) = complement(TC(m))+1 Proof: let r be a string of 1s with the same length as t. Then complement(s||1||t)+1= (complement(s)||0||r)+1= complement(s)||1||t 6 October 2015Birkbeck College, U. London17

6 October 2015Birkbeck College, U. London18 Example Find the 5 bit two’s complement representations for the decimal integers 5 and -5.