Announcement. (CSC-3501) Lecture 3 (22 Jan 2008) Today, 1 st homework will be uploaded at our class website. Seung-Jong Park (Jay)

Similar documents
Chapter 2. Data Representation in Computer Systems

9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation

Chapter 2. Data Representation in Computer Systems

Chapter 2. Data Representation in Computer Systems. Objectives (1 of 2) Objectives (2 of 2)

CHAPTER 2 Data Representation in Computer Systems

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1

CHAPTER 2 Data Representation in Computer Systems

Digital Fundamentals

Homework 1 graded and returned in class today. Solutions posted online. Request regrades by next class period. Question 10 treated as extra credit

UNIT 7A Data Representation: Numbers and Text. Digital Data

QUIZ ch.1. 1 st generation 2 nd generation 3 rd generation 4 th generation 5 th generation Rock s Law Moore s Law

CHW 261: Logic Design

CMSC 2833 Lecture 18. Parity Add a bit to make the number of ones (1s) transmitted odd.

MACHINE LEVEL REPRESENTATION OF DATA

Digital Fundamentals

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 02, SPRING 2013

IEEE Standard for Floating-Point Arithmetic: 754

Digital Fundamentals. CHAPTER 2 Number Systems, Operations, and Codes

Review of Number Systems

Digital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.

Number Systems Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute of Technology Kharagpur Number Representation

Chapter 10 Error Detection and Correction 10.1

Digital Fundamentals

MYcsvtu Notes DATA REPRESENTATION. Data Types. Complements. Fixed Point Representations. Floating Point Representations. Other Binary Codes

IBM 370 Basic Data Types

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 02, FALL 2012

CHAPTER TWO. Data Representation ( M.MORRIS MANO COMPUTER SYSTEM ARCHITECTURE THIRD EDITION ) IN THIS CHAPTER

Binary Codes. Dr. Mudathir A. Fagiri

Lecture 2: Number Systems

Data Representation 1

M1 Computers and Data

Chapter 2 Data Representations

DRAM uses a single capacitor to store and a transistor to select. SRAM typically uses 6 transistors.

Data Representations & Arithmetic Operations

Data Representation. DRAM uses a single capacitor to store and a transistor to select. SRAM typically uses 6 transistors.

Floating-point Arithmetic. where you sum up the integer to the left of the decimal point and the fraction to the right.

Digital Systems and Binary Numbers

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers

COMP2611: Computer Organization. Data Representation

Floating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Lecture 3

Ch. 7 Error Detection and Correction

BINARY SYSTEM. Binary system is used in digital systems because it is:

Character Codes and Error Detec=on

LING 388: Computers and Language. Lecture 5

COMP2121: Microprocessors and Interfacing. Number Systems

Lecture (02) Operations on numbering systems

Divide: Paper & Pencil

Chapter 10 Error Detection and Correction. Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Objectives. Connecting with Computer Science 2

Number Systems. Both numbers are positive

DIGITAL SYSTEM FUNDAMENTALS (ECE 421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE 422) COURSE / CODE NUMBER SYSTEM

Floating Point. The World is Not Just Integers. Programming languages support numbers with fraction

Representing Information. Bit Juggling. - Representing information using bits - Number representations. - Some other bits - Chapters 1 and 2.3,2.

Inf2C - Computer Systems Lecture 2 Data Representation

Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

COSC 243. Data Representation 3. Lecture 3 - Data Representation 3 1. COSC 243 (Computer Architecture)

3 Data Storage 3.1. Foundations of Computer Science Cengage Learning

Chapter 4: Data Representations

Bits, Words, and Integers

Number Systems CHAPTER Positional Number Systems

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two Solutions 26 February 2014

Lecture (03) Binary Codes Registers and Logic Gates

ECE232: Hardware Organization and Design

CMSC 313 Lecture 03 Multiple-byte data big-endian vs little-endian sign extension Multiplication and division Floating point formats Character Codes

Numeric Encodings Prof. James L. Frankel Harvard University

Number Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example

Administrivia. CMSC 216 Introduction to Computer Systems Lecture 24 Data Representation and Libraries. Representing characters DATA REPRESENTATION

CSN Telecommunications. 5: Error Coding. Data, Audio, Video and Images Prof Bill Buchanan

Electronic Data and Instructions

CSCI 402: Computer Architectures. Arithmetic for Computers (3) Fengguang Song Department of Computer & Information Science IUPUI.

Computer Organization

umber Systems bit nibble byte word binary decimal

Real Numbers finite subset real numbers floating point numbers Scientific Notation fixed point numbers

Number Systems and Conversions UNIT 1 NUMBER SYSTEMS & CONVERSIONS. Number Systems (2/2) Number Systems (1/2) Iris Hui-Ru Jiang Spring 2010

Introduction to Computers and Programming. Numeric Values

Thus needs to be a consistent method of representing negative numbers in binary computer arithmetic operations.

a- As a special case, if there is only one symbol, no bits are required to specify it.

Advanced Computer Networks. Rab Nawaz Jadoon DCS. Assistant Professor COMSATS University, Lahore Pakistan. Department of Computer Science

The Gray Code. Script

CPE300: Digital System Architecture and Design

D I G I T A L C I R C U I T S E E

Module 2: Computer Arithmetic

Number Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr

Binary Systems and Codes

Chapter 4: Computer Codes. In this chapter you will learn about:

DIGITAL SYSTEM DESIGN

Topic Notes: Bits and Bytes and Numbers

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two 26 February 2014

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Bits and Bytes and Numbers

ECE331: Hardware Organization and Design

LABORATORY. 3 Representing Numbers OBJECTIVE REFERENCES. Learn how negative numbers and real numbers are encoded inside computers.

LOGIC DESIGN. Dr. Mahmoud Abo_elfetouh

Binary Addition & Subtraction. Unsigned and Sign & Magnitude numbers

Numbering systems. Dr Abu Arqoub

Positional Number System

1.1. INTRODUCTION 1.2. NUMBER SYSTEMS

Digital Computers and Machine Representation of Data

Signed Multiplication Multiply the positives Negate result if signs of operand are different

Transcription:

Computer Architecture (CSC-3501) Lecture 3 (22 Jan 2008) Seung-Jong Park (Jay) http://www.csc.lsu.edu/~sjpark 1 Announcement Today, 1 st homework will be uploaded at our class website Due date is the beginning of next lecture Late homework grade will be dropped 20% per date late 2 1

Floating Point The signed magnitude, one s complement, and two s complement representation that we have just presented deal with integer values only. Without modification, these formats are not useful in scientific or business applications that deal with real number values. Floating-point representation solves this problem. If we are clever programmers, we can perform floating-point calculations using any integer format. This is called floating-point emulation, because floating point values aren t stored as such, we just create programs that make it seem as if floatingpoint values are being used. Most of today s computers are equipped with specialized hardware that performs floating-point arithmetic with no special programming required. 3 Floating Point Representation Computers use a form of scientific notation for floating-point representation ese Numbers written in scientific notation have three components: Computer representation of a floatingpoint number consists of three fixedsize fields: The IEEE-754 single precision floating point standard d uses an 8-bit exponent and a 23-bit significand. The IEEE-754 double precision standard uses an 11-bit exponent and a 52-bit significand. 4 2

How to Convert to Base-2 Floating Point Example: Express 32 10 in the simplified 14-bit floatingpoint model. Convert 32 10 to Base 2 100000 2 =1.0 X 2 5 Normalize (leftmost bit of the significand must be 1) 1.0 X 2 5 = 0.1 X 2 6 00110 For illustrative purposes, we will use a 14-bit model with a 5-bit exponent and an 8-bit significand. 5 Why Normalization? The illustrations shown at the right are all equivalent representations for 32 using our simplified model. Not only do these synonymous representations waste space, but they can also cause confusion. 0.1 X 2 6 0.01 X 2 7 0.001 X 2 8 0.0001 X 2 9 Rule: leftmost bit of the significand must be 1. 6 3

How to Represent Negative Exponent 2-2? Biased exponent Exponent larger than biased is positive integer exponent Exponent smaller than biased is negative integer exponent Example 1: express 32 10 in the revised 14-bit floating-point model. We know that 32 = 1.0 x 2 5 = 0.1 x 2 6. To use our excess 16 biased exponent, we add 16 to 6, giving 22 10 (=10110 2 ). Negative Exponent Example 2: express 0.0625 10 in the revised 14-bit floating-point model. We know that 0.0625 is 2-4. So in (binary) scientific notation 0.0625 = 1.0 x 2-4 = 0.1 x 2-3. To use our excess 16 biased exponent, we add 16 to -3, giving 13 10 (=01101 2 ). 7 Another Example of Floating Point Example: Express -26.625 10 in the revised 14-bit floating-point model. We find 26.625 10 = 11010.101 2. Integral part 26 = 11010 2 Fractional part 0.625 = 0.101 2 0.625 X 2 = 1.25 1 (generate 1 and continue with the rest) 0.25 X 2 = 0.5 0 (generate 0 and continue) 0.5 X 2 = 1.0 1 (generate 1 and nothing remains) Normalizing, we have: 26.625 10 = 11010.101 2 =0.11010101 x 2 5. To use our excess 16 biased exponent, we add 16 to 5, giving 21 10 (=10101 2 ). We also need a 1 in the sign bit. 8 4

IEEE-754 Floating Point Standard Both the 14-bit model that we have presented and the IEEE-754 floating point standard allow two representations for zero. Zero is indicated by all zeros in the exponent and the significand, but the sign bit can be either 0 or 1. This is why programmers should avoid testing a floating-point value for equality to zero. Negative zero does not equal positive zero. Number Sign Exponent Fraction 0 X 00000000 00000000000000000000000 0 11111111 00000000000000000000000-1 11111111 00000000000000000000000 NaN X 11111111 non-zero NaN is used for numbers that don t exist, such as -1 or log(-5). 9 History of Character Codes The earliest computer coding systems used six bits. Binary-coded decimal (BCD) was one of these early codes. It was used by IBM mainframes in the 1950s and 1960s. In 1964, BCD was extended to an 8-bit code, Extended Binary- Coded Decimal Interchange Code (EBCDIC). EBCDIC was one of the first widely-used computer codes that supported upper and lowercase alphabetic characters, in addition to special characters, such as punctuation and control characters. EBCDIC and BCD are still in use by IBM mainframes today. Other computer manufacturers chose the 7-bit ASCII (American Standard Code for Information Interchange) as a replacement for 6- bit codes. While BCD and EBCDIC were based upon punched card codes, ASCII was based upon telecommunications (Telex) codes. Until recently, ASCII was the dominant character code outside the IBM mainframe world. 10 5

Character Codes (Cont) Many of today s systems embrace Unicode, a 16-bit system that can encode the characters of every language in the world. The Java programming language, and some operating systems now use Unicode as their default character code. The Unicode codespace is divided into six parts. The first part is for Western alphabet codes, including English, Greek, and Russian. 11 Error Detection It is physically impossible for any data recording or transmission medium to be 100% perfect 100% of the time over its entire e expected ed useful u life. Thus, error detection and correction is critical to accurate data transmission, storage and retrieval. Error Detection Parity bit can check some simple bit error Sometimes high-order bit of ASCII coded to enable detection of errors Even parity set bit to make number of 1 s even A (01000001) with even parity is 01000001 C (01000011) with even parity is 11000011 12 6

Cyclic redundancy checking (CRC) CRC utilizes the redundant bits at the end of the block It is more powerful method Method Original message M(x) / Generator polynomial G(x) Quotient is discarded Remainder is attached to message in BCC (Block Check Character) Commonly used cyclic codes CRC-12 G(x) = x12 + x11 + x3 + x2 + x + 1 CRC-16 G(x) = x16 + x15 + x2 + 1 CRC-CCITT G(x) = x16 + x12 + x5 + 1 13 CRC Example at page 83 Encode Original Message = 1001011 M(x) () = 1x 6 +0x 5 +0x 4 +1x 3 +0x 2 +1x 1 +1x 0 = x 6 +x 3 +x 1 +1 G(x) = 1x 3 +0x 2 +1x 1 +1x 0 = x 3 +x 1 +1 Shift M(x) Make large number before division M(x) X x 3 = x 9 +x 6 +x 4 +x 3 = 1001011000 M(x)X x 3 / G(x) 1001011000 / 1011 = quotient is 1010 and remainder is 100 Add remainder 100 to 1001011000 1001011000 + 100 = 1001011100 Decode Encoded message / G(x) 1001011100 / 1011 = quotient is 1010100 and remainder is Zero Zero remainder means no error Non-zero remainder means some errors 14 7

Error Correction Hamming code can detect errors and correct them. Hamming codes are code words formed by adding redundant check bits, or parity bits, to a data word. The Hamming distance between two code words is the number of bits in which two code words differ. This pair of bytes has a Hamming distance of 3: The minimum Hamming distance for a code is the smallest Hamming distance between all pairs of words in the code. The minimum Hamming distance for a code, D(min), determines its error detecting and error correcting capability. Hamming codes can detect D(min) - 1 errors and correct errors 15 Hamming Code Example Using our code words of length 12, number each bit position starting with 1 in the low-order bit. Each bit position corresponding to an even power of 2 will be occupied by a check bit. These check bits contain the parity of each bit position for which it participates in the sum. Since 2 (= 2 1 ) contributes to the digits, 2, 3, 6, 7, 10, and 11. Position 2 will contain the parity for bits 3, 6, 7, 10, and 11. Bit 1checks the digits, 3, 5, 7, 9, and 11, so its value is 1 to make even parity. Bit 4 checks the digits, 5, 6, 7, and 12, so its value is 1. Bit 8 checks the digits, 9, 10, 11, and 12, so its value is also 1. 16 8

Hamming Code Cont. Suppose an error occurs in bit 5, as shown above. Our parity bit values are: Bit 1 checks digits, 3, 5, 7, 9, and 11. Its value is 1, but should be zero. Bit 2 checks digits 2, 3, 6, 7, 10, and 11. The zero is correct. Bit 4 checks digits, 5, 6, 7, and 12. Its value is 1, but should be zero. Bit 8 checks digits, 9, 10, 11, and 12. This bit is correct. We have erroneous bits in positions 1 and 4. With two parity bits that don t check, we know that the error is in the data, and not in a parity bit. Which data bits are in error? We find out by adding the bit positions of the erroneous bits. Simply, 1 + 4 = 5. This tells us that the error is in bit 5. If we change bit 5 to a 1, all parity bits check and our data is restored. 17 9