Fundamental of Computer Architecture By Panyayot Chaikan 240-208 November 01, 2003.

Slides:



Advertisements
Similar presentations
Arithmetic in Computers Chapter 4 Arithmetic in Computers2 Outline Data representation integers Unsigned integers Signed integers Floating-points.
Advertisements

Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
CENG536 Computer Engineering department Çankaya University.
Lecture - 2 Number systems and computer data formats
Topics covered: Floating point arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
2-1 Chapter 2 - Data Representation Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring Computer Architecture.
CMPUT Computer Organization and Architecture I
CHAPTER 2 Number Systems, Operations, and Codes
Digital Fundamentals Floyd Chapter 2 Tenth Edition
Assembly Language and Computer Architecture Using C++ and Java
Chapter 5 Floating Point Numbers. Real Numbers l Floating point representation is used whenever the number to be represented is outside the range of integer.
Number Systems Standard positional representation of numbers:
1 Lecture 3 Bit Operations Floating Point – 32 bits or 64 bits 1.
1 Module 2: Floating-Point Representation. 2 Floating Point Numbers ■ Significant x base exponent ■ Example:
Floating Point Numbers
Representation and Conversion of Numeric Types 4 We have seen multiple data types that C provides for numbers: int and double 4 What differences are there.
S. Barua – CPSC 240 CHAPTER 2 BITS, DATA TYPES, & OPERATIONS Topics to be covered are Number systems.
Chapter 3 Data Representation part2 Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2010.
Binary Representation and Computer Arithmetic
Chapter3 Fixed Point Representation Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
The Binary Number System
© 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
Binary Real Numbers. Introduction Computers must be able to represent real numbers (numbers w/ fractions) Two different ways:  Fixed-point  Floating-point.
Computer Arithmetic Nizamettin AYDIN
Number Systems II Prepared by Dr P Marais (Modified by D Burford)
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.
Fixed-Point Arithmetics: Part II
Number Systems So far we have studied the following integer number systems in computer Unsigned numbers Sign/magnitude numbers Two’s complement numbers.
Computing Systems Basic arithmetic for computers.
Data Representation and Computer Arithmetic
Floating Point. Agenda  History  Basic Terms  General representation of floating point  Constructing a simple floating point representation  Floating.
CH09 Computer Arithmetic  CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer.
9.4 FLOATING-POINT REPRESENTATION
ECEG-3202: Computer Architecture and Organization, Dept of ECE, AAU 1 Floating-Point Arithmetic Operations.
Fixed and Floating Point Numbers Lesson 3 Ioan Despi.
1 Number Systems Lecture 10 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007.
Floating Point Arithmetic
I/O Memory Reg File ALU Program Counter Instruction Register Control Interconnect Control 1)PC contains mem address of Instruction, 2)From memory, instr.
Integer and Fixed Point P & H: Chapter 3
Computer Architecture Lecture 22 Fasih ur Rehman.
Ahmad Almulhem, KFUPM 2009 COE 202: Digital Logic Design Number Systems Part 4 Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:
Digital Fundamentals Tenth Edition Floyd Chapter 2 © 2008 Pearson Education.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Representation of Data (Part II) Computer Studies Notes: chapter 19 Ma King Man.
Chapter 1 Representing Data in a Computer. 1.1 Binary and Hexadecimal Numbers.
CS 125 Lecture 3 Martin van Bommel. Overflow In 16-bit two’s complement, what happens if we add =
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.
Floating Point Representations
Fundamentals of Computer Science
Number Representation
Integer Division.
Chapter 3 Data Storage.
Floating Point Number system corresponding to the decimal notation
Data Representation Data Types Complements Fixed Point Representation
ECEG-3202 Computer Architecture and Organization
Chapter 3 DataStorage Foundations of Computer Science ã Cengage Learning.
COMS 161 Introduction to Computing
Chapter3 Fixed Point Representation
1.6) Storing Integer: 1.7) storing fraction:
Presentation transcript:

Fundamental of Computer Architecture By Panyayot Chaikan November 01, 2003

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Chapter 2 รูปแบบของข้อมูลใน คอมพิวเตอร์ Data representation in computer

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture เนื้อหา รูปแบบการจัดเก็บข้อมูลลงบนคอมพิวเตอร์ ตัวเลขฐานสองแบบมีเครื่องหมาย Overflow ของการกระทำทางคณิตศาสตร์ของ ตัวเลข เลขทศนิยมแบบ Fixed-Point เลขทศนิยมแบบ Floating-Point การกระทำทางคณิตศาสตร์กับเลขทศนิยมแบบ Floating-Point

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Number representation  ลองพิจารณาตัวเลข  เมื่อ  b i = 0 หรือ 1 jj  ค่าของ B หาได้จาก B = b n b 1 b 0 Value of B = b n-1 x 2 n b 1 x b 0 x 2 0

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Binary, signed-integer representations

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Addition/Subtraction of Signed numbers  2’s complement is the most efficient method

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Addition/Subtraction of Signed numbers  Use only Adder  Subtraction:Perform 2’s complement with subtrahend

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Addition/Subtraction of Signed numbers

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Overflow in Integer arithmetic  4-bit signed number ranges from  the result from addition  more than +7 or less than -8, overflow occurred Overfl ow

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Overflow  Overfolow detection rules:  1. Overflow can occur only when adding 2 numbers that have the same sign  2. When adding X and Y, overflow occurs when the sign of result is not the same as the sign of X and Y

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Number representation  We always represent a number in the 2’s complement system  4 bit  8 bit  16 bit  32 bit

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Sign extension  To represent 2’s complement signed number using larger number of bits, repeat the sign bits as many times as needed to the left  for example : convert 4 bits to 8 bits  1001 (-7) (-7)

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Characters  ASCII : American Standard Code for Information Interchange ที่มาของรูป

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Memory location and Addresses  Memory consists of many millions of storage cells,each of which can store a bit of information (0/1)  memory is organized into a group of n bits can be stored or retrieved in a single, basic operation  Each group of n bits is referred to as a word of information

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Memory location and Addresses  Bit, byte, word  A unit of 8 bit is called byte  Word length typically ranges from 16 to 64 bits  CPU access data in memory for 1 word at a time

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Word  32-bit word can store  32-bit 2’s complement number  four ASCII characters

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Memory accessing  To access the memory, addresses for each memory location is required  Addresses range from 0 through 2 k-1 for 2 k address space  24-bit address generates address space of 2 24 or 16,777,216 locations.

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Byte addressable memory  most modern computer have successive addresses refer to successive byte location in the memory  Byte locations have address 0,1,2,  Successive words are located at addresses 0,4,8,12,.... (for 32-bit machine)

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Big-Endian and Little- Endian assignments  2 ways to assign byte address across words

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Little endian VS Big endian

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Little endian VS Big endian

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Word alignment  For Example: keeping value 201F539AH in memory

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Fixed-point number F(B) = (- b 0 x 2 0 )+ (b -1 x 2 -1 )+(b -2 x 2 -2 ) (b -(n-1) x 2 -(n-1) ) B = b 0.b -1 b b - (n-1) -1 (1- 2 -(n-1) ) Sign bit

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Fixed-point number F(B) = (- 1 x 2 0 )+ (1 x 2 -1 )+(0 x 2 -2 )+(0 x 2 -3 )+(1 x )+(0 x 2 -5 )+ (1 x 2 -6 )+(1 x 2 -7 ) = = F(B) =

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Fixed-point number  32-bit, signed, fixed point represent value range approximately 4.55* to 1  This is not sufficient for scientific caclulation such as  Avogadro’s number *10 23 mole -1  Planck’s constant * erg s

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Floating-point number  General form for floating point number in decimal system +X 1.X 2 X 3 X 4 X 5 X 6 X 7 *10 +Y1Y2  When the decimal point is placed to the right of the first(nonzero) significant digit, the number is said to be normalized Significant digits exponent

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture IEEE standard floating- point format Sign bit 8-bit signed exponent in excess-127 representation 23-bit mantissa fraction Value represented = + 1.M x 2 E’-127

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture IEEE standard floating- point format E =signed exponent E’ = E < E’ < 254, 0 and 255 are used to represent special values -126 < E < 127 Value represented = + 1.M x 2 E

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Special Values E’ = 0 and M = > 0 E’ = 255 and M = >  E’ = 0 and M ≠ > denormal number E’ = 255 and M ≠ > NaN (not a number)

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture ….1 x floating-point format : Example

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture …. x 2 9 Normalized vs unnormalized value Unnormalized value

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture …. x 2 6 Normalized vs unnormalized value Normalized value

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Floating-point Add/Subtract rule  1. Choose the number with the smaller exponent and shift its mantissa right a number of steps equal to the difference in exponents  2. Set the exponent of the result equal to the larger exponent  3. Perform addition/subtraction on the mantissas  4. Normalize the resulting value, if necessary

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Floating-point Add/Subtract:Example x x 10 4 = x x 10 4 = x 10 4

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Floating-point Multiply rule  1. Add the exponents and subtract 127  2. Multiply the mantissas and determine the sign of the result  3. Normalize the resulting value, if necessary

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Floating-point Multiply:Example x 10 2 x x 10 4 = ( x ) x 10 (2+4) = x 10 6 = x 10 7

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Floating-point Divide rule  1. Subtract the exponents and add 127  2. Divide the mantissas and determine the sign of the result  3. Normalize the resulting value, if necessary

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture Floating-point Divide:Example x 10 4 ÷ x 10 2 = ( ÷ ) x 10 (4-2) = … x 10 2

Chapter 2 - Data Representation in Computer Fundamental of Computer Architecture จบ บทที่ 2