Ch.3 - Computer Organization BIT 1003 - Presentation 5.

Slides:



Advertisements
Similar presentations
CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (2)
Advertisements

Computer ArchitectureFall 2007 © September 5, 2007 Karem Sakallah CS 447 – Computer Architecture.
Arithmetic & Logic Unit Does the calculations Everything else in the computer is there to service this unit Handles integers May handle floating point.
Computer ArchitectureFall 2008 © August 25, CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (1)
Computer ArchitectureFall 2008 © August 27, CS 447 – Computer Architecture Lecture 4 Computer Arithmetic (2)
Floating Point Numbers.  Floating point numbers are real numbers.  In Java, this just means any numbers that aren’t integers (whole numbers)  For example…
School of Computer Science G51CSA 1 Computer Arithmetic.
Binary Representation and Computer Arithmetic
The Binary Number System
Simple Data Type Representation and conversion of numbers
Binary Representation. Binary Representation for Numbers Assume 4-bit numbers 5 as an integer  as an integer  How? 5.0 as a real number  How?
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
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.
NUMBER REPRESENTATION CHAPTER 3 – part 3. ONE’S COMPLEMENT REPRESENTATION CHAPTER 3 – part 3.
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.
Computer Architecture
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 10 Department of Computer Science and Software Engineering University of.
Data Representation - Part II. Characters A variable may not be a non-numerical type Character is the most common non- numerical type in a programming.
CH09 Computer Arithmetic  CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer.
Oct. 18, 2007SYSC 2001* - Fall SYSC2001-Ch9.ppt1 See Stallings Chapter 9 Computer Arithmetic.
9.4 FLOATING-POINT REPRESENTATION
The Teacher CP4 Binary and all that… CP4 Revision.
CSC 221 Computer Organization and Assembly Language
ECE 456 Computer Architecture
COMP201 Computer Systems Floating Point Numbers. Floating Point Numbers  Representations considered so far have a limited range dependent on the number.
1 Number Systems Lecture 10 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007.
CS1Q Computer Systems Lecture 2 Simon Gay. Lecture 2CS1Q Computer Systems - Simon Gay2 Binary Numbers We’ll look at some details of the representation.
Dr Mohamed Menacer College of Computer Science and Engineering Taibah University CE-321: Computer.
Data Representation: Floating Point for Real Numbers Computer Organization and Assembly Language: Module 11.
IT1004: Data Representation and Organization Negative number representation.
IT11004: Data Representation and Organization Floating Point Representation.
Number Systems and Computer Arithmetic Winter 2014 COMP 1380 Discrete Structures I Computing Science Thompson Rivers University.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
1 Ethics of Computing MONT 113G, Spring 2012 Session 4 Binary Addition.
Fixed-point and floating-point numbers Ellen Spertus MCS 111 October 4, 2001.
Software Design and Development Storing Data Computing Science.
Binary Addition The simplest arithmetic operation in binary is addition. Adding two single-digit binary numbers is relatively simple, using a form of carrying:
1 CE 454 Computer Architecture Lecture 4 Ahmed Ezzat The Digital Logic, Ch-3.1.
Chapter 9 Computer Arithmetic
William Stallings Computer Organization and Architecture 8th Edition
Floating Point Numbers
Fundamentals of Computer Science
Data Representation Binary Numbers Binary Addition
William Stallings Computer Organization and Architecture 7th Edition
Data Structures Mohammed Thajeel To the second year students
Number Representations
ECEG-3202 Computer Architecture and Organization
Chapter 8 Computer Arithmetic
Numbers with fractions Could be done in pure binary
Number Representations
Presentation transcript:

Ch.3 - Computer Organization BIT Presentation 5

Contents REAL NUMBER FORMATS INTEGER DATA FORMATS COMPUTER WORD SIZE DATA REPRESENTATION VON NEUMANN ARCHITECTURE CPU/ALU CHARACTER FORMATS MEMORY INSTRUCTION SET

VON NEUMANN ARCHITECTURE  Most computers today operate according to the “von Neumann architecture.”  The main idea of the von Neumann architecture is that the program to be executed resides in the computer’s memory, along with the program’s data.  John von Neumann published this idea in 1945.

DATA REPRESENTATION  We’re used to representing numbers in “base 10.” Why?

DATA REPRESENTATION = ? = ? = ? = 4*100 2*10 +7* = 4*12 2 2* * = 4*16 2 2* *

BASE 2  Computers use base 2, because it’s easy to build hardware that computes based on only two states—on and off, one and zero.  Base 2 is also called the “binary number system,” and the columns in a base-2 number work the same way as in any other base.

 What is the base-10 value of the binary number ?  =

“math facts” for binary math  Binary addition  = 0  = 1  = 10 (remember, this means 2; and also 0 carry 1 to the next column)

 Let’s add the binary value of 1100 to 0110: 1100(12 in base 10) +0110(6 in base 10) 10010(18 in base 10)

COMPUTER WORD SIZE Guess next ^.^ 64 Bit 32 Bit 16 Bit 8 Bit

COMPUTER WORD SIZE  largest number COMPUTER WORD SIZE (Bits) largest number (binary) largest number (base-10) through 65,535 or −32,767 through 32, …0 through 4,294,967,295 or −2,147,483,648 through 2,147,483, … ~trillion billions! (0 → )

DATA FORMATS  Computers need to keep track of the sign (±) of a number.  and must also be able to represent fractional values (real numbers). HOW?

MSB - LSB  MSB: most significant bit (en anlamlı bit)  LSB:least significant bit  for a 8 bit number: MSBLSB

sign (±) of a number unsigned use msb to represent the most significat digit of the number signed / unsigned number signed use msb to represent the sign of the number will be zero if the number is positive, and 1 if the number is negative

e.g.  Here is a positive 6 for an 8-bit computer:  How do we represent −6? ? That would be incorrect!

 What happens if we add 1 to that representation?  which would be −7, not −5! =?

“two’s complement” Add one Change all the zeros to ones and all the ones to zeros Change all the zeros to ones and all the ones to zeros Take binary number Phase 1 Phase 2 Phase 3 The correct representation of a negative number is called the “two’s complement” of the positive value.

two’s complement of All the bits of +6 are “complemented” (reversed) Add The two’s complement of 6 = −6 Phase 1 Phase 2 Phase 3 Add one Change all 0  1 1  0 Change all 0  1 1  0 Take binary number

REAL NUMBER FORMATS Real numbers consist of a mantissa and an exponent. Computer designers decide how to allocate the bits of the computer word so that some can be used for the mantissa and some for the exponent. In addition, the mantissa can be positive or negative, and the exponent can be positive or negative.

mantissa and exponent  Real numbers consist of a mantissa and an exponent. ± mantissa x 10 ± exponent  Computer designers decide how to allocate the bits of the computer word so that some can be used for the mantissa and some for the exponent.  The mantissa can be positive or negative, and the exponent can be positive or negative.

Examples  can be represented as: × 10 − × Scientific notation (normalized) × Language independent arithmetic standard

The IEEE Standard for Floating-Point Arithmetic (IEEE 754)  The 32-bit format looks like this: SEEEEEEEE mmmmmmmmmmmmmmmmmmmmmmmm Sign Exponent Mantissa

exercise  How would we represent ?  in scientific notation: * 2 3

 The IEEE 32-bit specification uses a “bias” of 127 on the exponent(this is a way of doing without a separate sign bit for the exponent)  exponent field will have the binary value of , or 130  After all this, the binary representation of 8.5 is:

example  Calculate the number  sign is 0, so the number is positive;  expo is 124, so the true exponent is –3;  and fraction is.01.

Double-precision 64 bit

32-bit single-precision examples:

HW REVIEW QUESTIONS: 3.1 – 3.7