COMP201 Computer Systems Number Representation. Number Representation Introduction Number Systems Integer Representations Examples  Englander Chapter.

Slides:



Advertisements
Similar presentations
A-Level Computing#BristolMet Session Objectives#9 express numbers in binary, binary-coded decimal (BCD), octal and hexadecimal; describe and use two’s.
Advertisements

ICS312 Set 2 Representation of Numbers and Characters.
HEXADECIMAL NUMBERS Code
Chapter 2 : Number System
Binary Representation Introduction to Computer Science and Programming I Chris Schmidt.
CS 151 Digital Systems Design Lecture 3 More Number Systems.
Representations Example: Numbers –145 –CVL – –91 –
Number Systems Standard positional representation of numbers:
1 Lecture 3 Bit Operations Floating Point – 32 bits or 64 bits 1.
Level ISA3: Information Representation

Agenda Shortcuts converting among numbering systems –Binary to Hex / Hex to Binary –Binary to Octal / Octal to Binary Signed and unsigned binary numbers.
VIT UNIVERSITY1 ECE 103 DIGITAL LOGIC DESIGN CHAPTER I NUMBER SYSTEMS AND CODES Reference: M. Morris Mano & Michael D. Ciletti, "Digital Design", Fourth.
ENGIN112 L3: More Number Systems September 8, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 3 More Number Systems.
Number System and Codes
Introduction to Number Systems
Binary Number Systems.
Binary Representation and Computer Arithmetic
Data Representation Number Systems.
ACOE1611 Data Representation and Numbering Systems Dr. Costas Kyriacou and Dr. Konstantinos Tatas.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Computer Arithmetic. Instruction Formats Layout of bits in an instruction Includes opcode Includes (implicit or explicit) operand(s) Usually more than.
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Chapter Contents.
1 Lecture 5 Floating Point Numbers ITEC 1000 “Introduction to Information Technology”
NUMBER REPRESENTATION CHAPTER 3 – part 3. ONE’S COMPLEMENT REPRESENTATION CHAPTER 3 – part 3.
IT253: Computer Organization
1 Digital Systems and Binary Numbers EE 208 – Logic Design Chapter 1 Sohaib Majzoub.
ECEN2102 Digital Logic Design Lecture 1 Numbers Systems Abdullah Said Alkalbani University of Buraimi.
Digital Logic Design Lecture 3 Complements, Number Codes and Registers.
ICS312 Set 1 Representation of Numbers and Characters.
CH09 Computer Arithmetic  CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer.
Information Representation. Digital Hardware Systems Digital Systems Digital vs. Analog Waveforms Analog: values vary over a broad range continuously.
Logic Design Dr. Yosry A. Azzam. Binary systems Chapter 1.
Data Representation Dr. Ahmed El-Bialy Dr. Sahar Fawzy.
Representation of Data Ma King Man. Reference Text Book: Volume 2 Notes: Chapter 19.
Cosc 2150: Computer Organization Chapter 2 Part 1 Integers addition and subtraction.
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.
EEL 3801C EEL 3801 Part I Computing Basics. EEL 3801C Data Representation Digital computers are binary in nature. They operate only on 0’s and 1’s. Everything.
THE BINARY SYSTEM.
Data Representation, Number Systems and Base Conversions
AEEE2031 Data Representation and Numbering Systems.
COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.6 Instructor: Lin Chen Sept 2013.
SAK Chapter 21 Chapter 2 : Number System 2.1 Decimal, Binary, Octal and Hexadecimal Numbers 2.2 Relation between binary number system with other.
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
Digital Representations ME 4611 Binary Representation Only two states (0 and 1) Easy to implement electronically %0= (0) 10 %1= (1) 10 %10= (2) 10 %11=
Number Systems by Dr. Amin Danial Asham. References  Programmable Controllers- Theory and Implementation, 2nd Edition, L.A. Bryan and E.A. Bryan.
Data Representation. Goal: Store numbers, characters, sets, database records in the computer. What we got: Circuit that stores 2 voltages, one for logic.
Chapter 1: Binary Systems
1 Digital Logic Design Lecture 2 More Number Systems/Complements.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
© Prepared By: Razif Razali 1 CHAPTER TWO TCS1023 NUMBERING SYSTEM.
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.
Computer Organization 1 Data Representation Negative Integers.
CHAPTER 3 BINARY NUMBER SYSTEM. Computers are electronic machines which operate using binary logic. These devices use two different values to represent.
Binary Addition The simplest arithmetic operation in binary is addition. Adding two single-digit binary numbers is relatively simple, using a form of carrying:
Cosc 2150: Computer Organization
Integer Real Numbers Character Boolean Memory Address CPU Data Types
Chapter 3 Data Representation
Number Systems.
IT 0213: INTRODUCTION TO COMPUTER ARCHITECTURE
BEE1244 Digital System and Electronics BEE1244 Digital System and Electronic Chapter 2 Number Systems.
Computer Architecture CST 250
Presentation transcript:

COMP201 Computer Systems Number Representation

Number Representation Introduction Number Systems Integer Representations Examples  Englander Chapter 2 and Chapter 4.

Introduction Data must be converted to Binary before it can be stored in Computer

Introduction Format used will depend on data:  e.g. consider the number 9 9 may be represented as may be represented as may be represented as the character 9 may be represented as And the intended purpose of the number within the computer

Considerations  When a coding format is being devised a number of considerations need to be made: Ease of manipulation Conciseness and machine efficiency Accuracy sufficient for problem Standardised data communication

Number Representation Computers store and Manipulate numbers using the binary (base 2) number system Base 10 = 5 10 Roman = V Binary = Base3 = 12 3

Binary Representation Each bit represents a value two times the value of the bit to it’s right. Dec Bin 0000 = 0x x x = 0x x x = 0x x x = 0x x x = 1x x x2 0

Octal Representation Each octal number can be perfectly represented by 3 binary digits = =?? 10

Hexadecimal Representation Each Hex number can be perfectly represented by 4 binary digits Two Hex digits can be used to represent a byte; four for a word A1010 B1011 C1100 D1101 E1110 F = 2EA1 16

Number Conversion methods (You should have already studied this in a previous class. If you did not, or don’t remember, study Chapter 2 in detail.) Base= number of characters in system DecimalOctalHexadecimalBinary

Number Conversion methods Place value: the value of a digit depends upon its placement relative to a reference, say a decimal point. For instance, = = 2 x x 10 0 This leads to methods for converting between bases = 2 x x x x 8 0 Substitute decimal values for powers of 8 to convert into decimal equivalent (1456)

Integer Representations BCD (binary coded decimal) Sign and Magnitude Excess Notation Two’s complement

BCD (Binary Coded Decimal) Each Decimal digit is coded as a 4 bit binary code Developed for early calculators  e.g = bcd Easy for people to understand, Hard for computers to work with Signed Magnitude  Extra bit added to the code to represent the sign  In most cases a 0 represents a +ve a 1 represents a –ve

BCD Example Each Decimal digit is coded as a 4 bit binary code 4 10 = And two digits, 45 10, would be stored in two different memory locations!

Packed BCD Packed BCD simply makes use of the storage space normally wasted in storage of BCD, by using the leftmost 4-bits (nibble) for one digit, and the rightmost nibble for another.  = in packed BCD BCD used in some old financial software and calculators, but now very rare.

Sign Negative integers are often required Computers do not have internal minus signs There are several ways to represent negative and positive integers Choice is often based on the ease of manipulation for the intended purpose

Sign and Magnitude One of the simplest systems is to allocate one bit as the “sign” bit. The other bits are the “magnitude”.  E.g. +24 = = Simple to find the sign Two values for zero Must process sign separately

Excess Notation  fix number of bit positions used  smallest number with 1 in the MSB represents zero (e.g. 1000)  All bit strings greater than this represent +ve numbers  All bit strings less than this represent -ve numbers  Example is known as excess eight notation because 8 (1000) represents zero

Ones Complement Negative numbers formed by inverting the positive representation (logical NOT)  E.g. +24 = = Two values for zero Addition requires carry bit to be wrapped around

Two’s Complement To negate a number invert the bits (logical NOT) then add one.  E.g. +24 = invert Add one -24 = = Works for converting negative to positive as well

Two’s Complement  Can represent numbers in the range -2 n-1 to (2 n-1 -1)  Only one representation of zero Binary Result Positive Negative Compliment

Two’s Complement– another viewpoint: The number wheel (For 4 bits)Reference: Katz: Contemporary Logic Design, p243

Two’s Complement Leftmost bit is always the sign bit All zeroes is the only representation of zero Simple to implement negation, addition and subtraction in hardware. Can be sign extended +510 = = = =

Two’s Complement Examples Express the following in 2’s complement notation (use 16 bit form):    Add the following 2’s complement numbers (they are 12 bits):

Format Use Ones complement common in older computer hardware Two’s complement most common signed integer representation today. Sign and magnitude used in some very early computers Sign and magnitude and Excess notation both used in common floating point formats