Chapter 3 Data Representation. Chapter goals Describe numbering systems and their use in data representation Compare and contrast various data representation.

Slides:



Advertisements
Similar presentations
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 2: Data types and addressing modes dr.ir. A.C. Verschueren.
Advertisements

The Binary Numbering Systems
2-1 Chapter 2 - Data Representation Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring Computer Architecture.
Chapter 2: Data Representation
Principles of Computer Architecture Miles Murdocca and Vincent Heuring Chapter 2: Data Representation.
Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates Invitation to Computer Science, Java Version, Third Edition.
Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates Invitation to Computer Science, C++ Version, Third Edition.
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Data Representation Computer Organization &
Data Representation COE 205
Chapter 3 Data Representation.
Introduction to Programming with Java, for Beginners
8 November Forms and JavaScript. Types of Inputs Radio Buttons (select one of a list) Checkbox (select as many as wanted) Text inputs (user types text)
Data types and variables
Chapter 1 Data Storage. 2 Chapter 1: Data Storage 1.1 Bits and Their Storage 1.2 Main Memory 1.3 Mass Storage 1.4 Representing Information as Bit Patterns.
2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.
Data Representation – Chapter 3 Sections 3-2, 3-3, 3-4.
Mantıksal Tasarım – BBM231 M. Önder Efe
Introduction to Computing Systems from bits & gates to C & beyond Chapter 2 Bits, Data Types & Operations Integer Representation Floating-point Representation.
Chapter 5 Data representation.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Simple Data Type Representation and conversion of numbers
Data Representation – Binary Numbers
Computers Organization & Assembly Language
Computer Arithmetic Nizamettin AYDIN
SCSC 311 Information Systems: hardware and software
Logic and Digital System Design - CS 303
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 Digital Technology and Computer Fundamentals Chapter 1 Data Representation and Numbering Systems.
IT253: Computer Organization
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles of Computer.
Data Representation.
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
Number Systems Spring Semester 2013Programming and Data Structure1.
Cis303a_chapt03-2a.ppt Range Overflow Fixed length of bits to hold numeric data Can hold a maximum positive number (unsigned) X X X X X X X X X X X X X.
Floating Point. Agenda  History  Basic Terms  General representation of floating point  Constructing a simple floating point representation  Floating.
Lecture 5. Topics Sec 1.4 Representing Information as Bit Patterns Representing Text Representing Text Representing Numeric Values Representing Numeric.
CE1111 :Digital Logic Design lecture 01 Introduction Dr. Atef Ali Ibrahim.
CISC1100: Binary Numbers Fall 2014, Dr. Zhang 1. Numeral System 2  A way for expressing numbers, using symbols in a consistent manner.  " 11 " can be.
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.
Data Representation, Number Systems and Base Conversions
Data as the computer sees it 1.  Number systems Number systems  Data storage Data storage  Glossary Glossary 2.
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
Monday, January 14 Homework #1 is posted on the website Homework #1 is posted on the website Due before class, Jan. 16 Due before class, Jan. 16.
Computer Science I Storing data. Binary numbers. Classwork/homework: Catch up. Do analysis of image types.
Chapter 1: Binary Systems
Systems Architecture, Fourth Edition 1 Data Representation Chapter 3.
Data Representation. How is data stored on a computer? Registers, main memory, etc. consists of grids of transistors Transistors are in one of two states,
Types Chapter 2. C++ An Introduction to Computing, 3rd ed. 2 Objectives Observe types provided by C++ Literals of these types Explain syntax rules for.
Chapter 1 Representing Data in a Computer. 1.1 Binary and Hexadecimal Numbers.
BINARY SYSTEMS ENGR. KASHIF SHAHZAD 1. BINARY NUMBERS 1/2 Internally, information in digital systems is of binary form groups of bits (i.e. binary numbers)
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
N 3-1 Data Types  Binary information is stored in memory or processor registers  Registers contain either data or control information l Data are numbers.
1 CE 454 Computer Architecture Lecture 4 Ahmed Ezzat The Digital Logic, Ch-3.1.
Chapter 3 Data Representation
Chapter 3 Data Representation
Programming and Data Structure
Lec 3: Data Representation
Data Representation.
Number Representation
Data Representation Binary Numbers Binary Addition
Chapter 3 Data Storage.
Invitation to Computer Science, Java Version, Third Edition
Chapter 1 Data Storage.
Chapter 2 Bits, Data Types & Operations Integer Representation
Data Representation Data Types Complements Fixed Point Representation
Data Representation – Chapter 3
Storing Negative Integers
Chapter 3 DataStorage Foundations of Computer Science ã Cengage Learning.
Presentation transcript:

Chapter 3 Data Representation

Chapter goals Describe numbering systems and their use in data representation Compare and contrast various data representation methods Describe how nonnumeric data is represented

Data representation Humans have many symbolic forms to represent information Alphabet, numbers, pictograms  Computer can only represent information with electrical signals Is a circuit on or off?

Computers, numbers, and binary data Computers only use on/off signals to represent information These signals can only represent numeric data Even character based data is represented as a number

Why binary data? Electricity has two states, on and off On = 1 Off = 0 Binary numbers only have 0s and 1s Data is stored as collections of binary numbers

Binary numbers are “computer friendly” Binary numbers are signals that can easily be transported Binary numbers can be easily processed (transformed) by two-state electrical devices that are easy to design and fabricate These devices (and/or gates, adders) are strung together like an assembly line to carry out a function

Logic gates

Boolean algebra System developed by George Boole (19 th century mathematician) that can determine if two values are: Equal, not equal, less than, greater than, etc. Boolean algebra allows the CPU to carry out binary arithmetic (see White p )

Binary numbers Can be combined into a positional numbering system Base for decimal numbers is 10, base for binary numbers is 2 Each position to the left is an increasing factor of 2

Terminology for number systems Base is also referred to as the radix Binary numbers have a radix of 2 Decimal numbers have a radix of 10 Radix point separates whole values from fractional values Decimal point is a kind of radix point

Base 2 positional example

Numbering systems Higher base (radix) means fewer positions are needed to represent a number Base 2 needs many more positions than base 10 Base 16 (hexidecimal) is often used to represent binary numbers

Computers & binary numbers Each digit of a binary number is called a bit Bit string – group of digits that describes a single value

Bit strings Left most bit (most significant bit) called high order bit Right most bit (least significant bit) called low order bit 8 bits make a byte Programming languages/spreadsheets/etc. automatically translate from base 10 to base 2 and back again

Hexadecimal notation Base or radix is 16 More compact than binary Symbols used are 0-9, A-F One hexadecimal position corresponds to 4 bits Used to designate memory locations, colors (html & VB)

Goals of computer data representation Any representation format for numeric data represents a balance among several factors, including: Compactness Accuracy Range Ease of manipulation Standardization

Balancing objectives Compactness and range are inversely related: the more compact, the smaller the range Accuracy increases with # of bits used, especially with real numbers: example, 1/3, or (non-terminating fraction)

Other objectives Does information format make it easier for processor to perform operations? Is data in a standard format, allowing simple transfer between computers?

CPU standard data types Integer Real number Character Boolean Memory address

Integer data types Unsigned – assumed to be positive Signed – uses one bit (usually high order bit) to indicate sign 0 is positive, 1 is negative

Representing negative integers Excess notation and twos complement Allow subtraction to be carried out as addition Number is converted to its complement 1 is added to the result When added to another binary number, carry bit is ignored

Range and overflow Most CPUs use a fixed width of 32 or 64 bits to represent an integer For small numbers format is padded with leading zeros Machine processes fixed width information more easily than variable width

Integer overflow If number is too big for fixed width integer format CPU throws an overflow error Integer format width is tradeoff between overflow and wasted space (padded zeros) CPU often use double precision data types for arithmetic operations

Representing real numbers More complicated problem than storing integers Real numbers contain whole & fractional components How to represent both parts together in one format?

Fixed format for real numbers

Floating point notation Any real number can be re-written using floating point (scientific notation) becomes X 10¹ Format stores (mantissa), 1 (exponent), and sign (+) becomes X 10 2 Format stores (mantissa), 2 (exponent), and sign (-)

IEEE floating point format for real numbers

Floating point range Number of bits in floating point format limit range of exponent, mantissa Overflow (too large a number) always occurs in the exponent Underflow (too small a number, i.e. negative exponent does not fit)

Range for mantissa Number of bits for mantissa limit the number of significant digits stored for a real number 23 bits allows for approx. 7 decimal places of precision Mantissa is stored using truncation (information that does not fit is discarded) Does not throw an overflow condition

Processing complexity General rule is floating point operations (+, -, *, etc.) take CPU twice as long as integers (binary) Floating Point Operations Per Second (FLOPS) is a measure of processor speed

Character data Alphabetic letters (upper & lower case), numerals, punctuation marks, special symbols are called characters Variable of type character contain only one symbol Sequence of symbols forming words, sentences, etc. called a string

How computers store characters Character data cannot be directly processed by a computer Must be translated into a number Characters are converted into numbers using a table of correspondences between a character and a bit string

Design issues for character coding schemes Table must be publicly available and all users must use the same table Coding scheme is a tradeoff among compactness, ease of manipulation, accuracy, range, & standardization

Examples of character coding schemes BCD and EBCIDIC – older IBM mainframe computers ASCII – PCs Unicode – larger format allows for expanded and international alphabets (Java and internet applications)

ASCII coding scheme 7 bit format allows for parity bit (used to check for errors over transmission lines) Has unique codes for all uppercase & lowercase letters, numbers, other printable characters Also includes codes for device control

Device control In many applications that handle text, formatting & commands to a device are included in the same stream of data as the text Examples: word processors (reveal codes), HTML tags Examples: CR (carriage return), tab, form feed

Limitations to ASCII Not robust enough to represent multiple languages and symbols 7 bit format allows for 128 unique codes, some languages have thousands of symbols Unicode (16 bit) has 65,536 entries

Boolean data Data types has two values, true and false Can be stored with one bit The results of many CPU operations (comparisons) generate a Boolean value stored in a register

Memory addresses Primary storage is a series of contiguous bytes CPU must be able to access sections of memory directly Sections of memory are accessed by their address (location)

Formats for memory addresses Flat memory model – memory starts at address 0, goes to maximum capacity – 1 Simple integers used to store address Segmented memory model Memory is divided into equal sized segments called pages Address has two parts 00FA:0034 number for page, and location within page

Data structures These five primitive types are quite limited for representing real world data Words, sentences Dates Data base tables More complex data structures constructed from these five primitive types

Chapter summary To be processed by any device, data must be converted from its native format into a form suitable for the processing device. All data, including nonnumeric data, are represented within a modern computer system as strings of binary digits, or bits. Each bit string has a specific data format and coding method.

Summary (cont.) Numeric data is stored using integer, real number, and floating point formats. Characters are converted to numbers by means of a coding table. Boolean vales can have only two values, true and false. Programs often need to define and manipulate data in larger and more complex units than primitive CPU data types.