# CO Computer Architecture and Programming Languages CAPL. Lecture 15

Size: px
Start display at page:

## Transcription

1 CO Computer Architecture and Programming Languages CAPL Lecture 15 Dr. Kinga Lipskoch Fall 2017

2 How to Compute a Binary Float Decimal fraction: Integral part: Fraction part: Bits: 0 bit: x 2 = bit: x 2 = bit: x 2 = bit: x 2 = bit: x 2 = bit: x 2 = x x 2 3 Number now needs to be normalized and exponent needs to be determined ( ) Result: Split number in integral and fractional part Compute bit pattern for integral part For the fractional part multiply by 2 If result has bit set left of decimal point (>= 1.0) generate set bit, otherwise generate zero bit Continue with rest until result does not have rest CAPL Fall / 39

3 Floating Point Addition 0.5 ten = 1/2 ten = 1/2 1 ten = 0.1 two = 0.1 two 2 0 = two ten = 7/16 ten = 7/2 4 ten = two = two 2 0 = two 2 2 Lesser exponent shifted right until exponent matches larger number two 2 2 = two 2 1 Add significands two ( two 2 1 ) = two 2 1 Normalize the sum two 2 1 = two 2 4 Round the sum (already fits into 4 bits) two 2 4 = two = 1/2 4 ten = CAPL Fall / 39

4 Floating Point Addition Addition (and subtraction) (±F 1 2 E1 ) + (±F 2 2 E2 ) = ±F 3 2 E3 Step 1: Restore the hidden bit in F 1 and in F 2 Step 2: Align fractions by right shifting F 2 by E1 E2 positions (assuming E1 E2) keeping track of (three of) the bits shifted out in a round bit, a guard bit, and a sticky bit Step 3: Add the resulting F 2 to F 1 to form F 3 Step 4: Normalize F 3 (so it is in the form 1.XXXXX... ) If F 1 and F 2 have the same sign F 3 [1, 4) 1 bit right shift F 3 and increment E3 If F 1 and F 2 have different signs F 3 may require many left shifts each time decrementing E 3 Step 5: Round F 3 and possibly normalize F 3 again Step 6: Rehide the most significant bit of F 3 before storing the result CAPL Fall / 39

5 Start 1. Compare the exponents of the two numbers Shift the smaller number to the right until its exponent would match the larger exponent 2. Add the significands 3. Normalize the sum, either shifting right and incrementing the exponent or shifting left and decrementing the exponent Overflow or Underflow? Yes No 4. Round the significand to the appropriate number of bits Exception No Still normalized? Yes Done CAPL Fall / 39

6 MIPS Floating Point Instructions MIPS has a separate Floating Point Register File (\$f0, \$f1,..., \$f31) (whose registers are used in pairs for double precision values) with special instructions to load to and store from them lwc1 \$f1,54(\$s2) # \$f1 = Memory[\$s2+54] swc1 \$f1,58(\$s4) # Memory[\$s4+58] = \$f1 And supports IEEE 754 single add.s \$f2,\$f4,\$f6 # \$f2 = \$f4 + \$f6 and double precision operations add.d \$f2,\$f4,\$f6 # \$f2 \$f3 = \$f4 \$f5 + \$f6 \$f7 similarly for sub.s, sub.d, mul.s, mul.d, div.s, div.d CAPL Fall / 39

7 Summary Computer arithmetic is constrained by limited precision Bit patterns have no inherent meaning but standards do exist two s complement IEEE 754 floating point Computer instructions determine meaning of the bit patterns Performance and accuracy are important so there are many complexities in real machines Algorithm choice is important and may lead to hardware optimizations for both space and time (e.g., multiplication) CAPL Fall / 39

8 Floating Point Issues Integers can represent every number between smallest and largest number Floating point numbers only represent an approximation, for numbers they cannot really represent gap between 0 and smallest positive number Infinite number of real numbers between 0 and 1, but no more than 2 53 numbers can be represented in double precision format IEEE 754 keeps two extra bits during intermediate results guard and round sticky bit four rounding modes CAPL Fall / 39

9 Guard and Round Add 2.56 ten 10 0 to 2.34 ten 10 2 Assume we have only three significant digits Additionally guard and round shift smaller number right to align exponents able to represent the two least significant digits when we align exponents ten ten = ten Rounding up yields 2.37 ten 10 2 Without guard drop two digits from calculation, result would be 2.36 ten 10 2 CAPL Fall / 39

10 Round, Guard and Sticky Bit Example above may only need one bit, multiply can need two binary product may have leading 0 bit normalization must shift product left, round bit is being used to round Rounding modes includes nearest even What to do with 0.50? half the time up, half the time down standard says if least significant bit retained in such case is odd round up, otherwise truncate Sticky bit is set whenever nonzero bits to the right of round bit allows to see difference between ten and ten CAPL Fall / 39

11 Sign Exponent Fraction Sign Exponent Fraction Small ALU Exponent difference Control Shift right Big ALU Increment or decrement Shift left or right Floating point adder: Exponent of one operand is subtracted from the other to determine which is larger and by how much Difference controls three multiplexers: from left to right Select larger exponent Significand of smaller number Significand of larger number Smaller significand is shifted right, then significands are added using Big ALU Normalization step shifts sum left or right and increments or decrements the exponent Rounding creates final result Rounding hardware May require normalizing again Sign Exponent Fraction CAPL Fall / 39

12 Performance What is performance? Measuring performance Performance metrics Performance evaluation Why does some hardware perform better with different programs? What performance factors are related to hardware? CAPL Fall / 39

13 Performance Metrics Purchasing perspective given a collection of machines, which has the best performance? least cost? best cost/performance rate? Design perspective faced with design options, which has the best performance improvement? least cost? best cost/performance rate? Both require basis for comparison metric for evaluation Goal is to understand what factors in the architecture contribute to the overall system performance and the relative importance (and cost) of these factors CAPL Fall / 39

14 Speed Performance Definition Normally interested in reducing Response time (a.k.a. execution time) the time between the start and the completion of a task Important to individual users Thus, to maximize performance, need to minimize execution time performance X = 1 / execution_time X If X is n times faster than Y, then performance X performance Y execution_time Y = = n execution_time X CAPL Fall / 39

15 Very Simple Example How much faster is A than B? If ratio Performance A / Performance B = n Execution time B / Execution time A = n 25/20 = 1.25 then A is by a factor of 1.25 faster than B CAPL Fall / 39

16 Computer Performance Response Time (latency) How long does it take for my job to run? How long does it take to execute a job? How long must I wait for the database query? Throughput How many jobs can the machine run at once? What is the average execution rate? How much work is getting done? Decreasing response time almost always improves throughput CAPL Fall / 39

17 What is Meant by Time Time is the measure of computer performance The computer that performs the same amount of work in the least time is the fastest Elapsed Time counts everything (disk and memory accesses, I/O, etc.) a useful number, but often not good for comparison purposes CPU time does not count I/O or time spent running other programs can be broken up into system time and user time Our focus: user CPU time time spent executing the lines of code that are in our program CAPL Fall / 39

18 Performance Factors Want to distinguish elapsed time and the time spent on our task CPU execution time (CPU time) time the CPU spends working on a task Does not include time waiting for I/O or running other programs CPU execution time for a program = CPU clock cycles for a program x Clock cycle time CPU execution time for a program = CPU clock cycles for a program Clock rate Can improve performance by reducing either the length of the clock cycle or the number of clock cycles required for a program CAPL Fall / 39

19 Machine Clock Rate Clock rate (CR) (unit: MHz, GHz) is inverse of clock cycle (CC) time (clock period) CC = 1/CR one clock period 10 nsec clock cycle 100 MHz clock rate 5 nsec clock cycle 200 MHz clock rate 2 nsec clock cycle 500 MHz clock rate 1 nsec clock cycle 1 GHz clock rate 500 psec clock cycle 2 GHz clock rate 250 psec clock cycle 4 GHz clock rate 200 psec clock cycle 5 GHz clock rate CAPL Fall / 39

20 Clock Cycles Per Instruction Not all instructions take the same amount of time to execute One way to think about execution time is that it equals the number of instructions executed multiplied by the average time per instruction # CPU clock cycles for a program = Instructions for a program x Average clock cycles per instruction Clock cycles per instruction (CPI) the average number of clock cycles each instruction takes to execute A way to compare two different implementations of the same ISA CAPL Fall / 39

21 Comparing Code Segments Compiler designer needs to decide between two code sequences for particular computer Knows that: CPI Code seq. Sequence 1: = 5 instructions Sequence 2: = 6 instructions CPU clock cycles = n CPI i IC i i=1 Is Sequence 1 faster? CPI varies by instruction mix instruction count & CPI needs to be compared 1 2 CPI for this instruction class A B C Instr. counts for instr. class A B C CAPL Fall / 39

22 Effective CPI Computing the overall effective CPI is done by looking at the different types of instructions and their individual cycle counts and averaging Overall effective CPI = n CPI i IC i IC total i=1 where n is the number of instruction classes CPI i is the (average) number of clock cycles per instruction for that instruction class IC i is the overall number of instructions of class i and IC total is the total number of instructions weight of instructions of class i The overall effective CPI varies by instruction mix a measure of the dynamic frequency of instructions across one or many programs CAPL Fall / 39

23 Performance Equation Our basic performance equation is then CPU time = Instruction count * CPI * Clock cycle time CPU time = Instruction count * CPI Clock rate These equations contain the three key factors that affect performance Can measure the CPU execution time by running the program The clock rate is usually given Can measure overall instruction count by using profilers/simulators without knowing all of the implementation details CPI varies by instruction type and ISA implementation for which we must know the implementation details CAPL Fall / 39

24 Evaluating Performance CPU time = Instruction count x CPI x Clock cycle Algorithm might also effect CPI, by using floating-point rather than integer arithmetic Language also affects CPI, for example Java allows more data abstraction more indirect calls higher CPI CAPL Fall / 39

25 A Simple Example (1) Op Frequency CPI i Freq * CPI ALU 50% 1 Load 20% 5 Store 10% 3 Branch 20% 2 = How much faster would the machine be if a better data cache reduced the average load time to 2 cycles? How does this compare with using branch prediction to shave a cycle off the branch time? What if two ALU instructions could be executed at once? CAPL Fall / 39

26 A Simple Example (2) Op Frequency CPI i Freq * CPI ALU 50% Load 20% Store 10% Branch 20% = 2.2 = 1.6 How much faster would the machine be if a better data cache reduced the average load time to 2 cycles? CPU time new = 1.6 x IC x CC so 2.2/1.6 means 37.5% faster How does this compare with using branch prediction to shave a cycle off the branch time? What if two ALU instructions could be executed at once? CAPL Fall / 39

27 A Simple Example (3) Op Frequency CPI i Freq * CPI ALU 50% Load 20% Store 10% Branch 20% = 2.2 = 1.6 = 2.0 How much faster would the machine be if a better data cache reduced the average load time to 2 cycles? CPU time new = 1.6 x IC x CC so 2.2/1.6 means 37.5% faster How does this compare with using branch prediction to shave a cycle off the branch time? CPU time new = 2.0 x IC x CC so 2.2/2.0 means 10% faster What if two ALU instructions could be executed at once? CAPL Fall / 39

28 A Simple Example (4) Op Frequency CPI i Freq * CPI ALU 50% Load 20% Store 10% Branch 20% = 2.2 = 1.6 = 2.0 = 1.95 How much faster would the machine be if a better data cache reduced the average load time to 2 cycles? CPU time new = 1.6 x IC x CC so 2.2/1.6 means 37.5% faster How does this compare with using branch prediction to shave a cycle off the branch time? CPU time new = 2.0 x IC x CC so 2.2/2.0 means 10% faster What if two ALU instructions could be executed at once? CPU time new = 1.95 x IC x CC so 2.2/1.95 means 12.8% faster CAPL Fall / 39

29 Summary: Evaluating ISA (1) Design-time metrics: Can it be implemented, in how long, at what cost? Can it be programmed? Ease of compilation? Static Metrics: How many bytes does the program occupy in memory? Dynamic Metrics: How many instructions are executed? How many bytes does the processor fetch to execute the program? How many clocks cycles are required per instruction? Best Metric: Time to execute the program CAPL Fall / 39

30 Summary: Evaluating ISA (2) Depends on the instructions set, the processor organization, and compilation techniques CPI Instruction Count Cycle Time CAPL Fall / 39

31 MIPS as a Performance Measure MIPS = Million Instructions Per Second MIPS = instruction count execution time * 10 6 = instruction count CPU clocks * cycle time * 10 6 = instruction count * clock rate = instruction count * CPI * 10 6 clock rate CPI * 10 6 A faster machine has a higher MIPS rate execution time = instruction count MIPS * 10 6 CAPL Fall / 39

32 MIPS Metric Not Adequate MIPS does not take into account the instruction set (capabilities or complexity of instructions) different ISAs not comparable The MIPS rate depends on the program and its instruction mix MIPS are not constant, even on a single machine MIPS can vary inversely with performance CAPL Fall / 39

33 MIPS Metric not Adequate: Example Three instruction classes and given CPI Two compilers Cycles CPI Code from Compiler 1 Compiler 2 CPI for this instruction class A B C Instr. counts (in billions) for instruction class A 5 10 B 1 1 C 1 1 CPU clock cycles = CPIi IC i Compiler 1: 7 billion instructions, 10 billion cycles Compiler 2: 12 billion instructions, 15 billion cycles CAPL Fall / 39

34 Execution Time CPU execution time for a program = CPU clock cycles for a program Clock rate 10 * 10 9 Execution time = 1 4 * 10 9 = 2.50 seconds 15 * 10 9 Execution time = 2 4 * 10 9 = 3.75 seconds Compiler 1 generates a faster program CAPL Fall / 39

35 MIPS Rate (1) MIPS = Instruction count Execution time * 10 6 ( ) * 10 9 MIPS = * 10 6 = ( ) * 10 9 MIPS = * 10 6 = CAPL Fall / 39

36 MIPS Rate (2) MIPS = Instruction count Execution time * 10 6 ( ) * 10 9 MIPS = * 10 6 = 2800 ( ) * 10 9 MIPS = * 10 6 = 3200 Compiler 2 has a higher MIPS rating, but the code from Compiler 1 runs faster CAPL Fall / 39

37 Summary A given program will require Some number of instructions (machine) Some number of cycles Some number of seconds Vocabulary Cycle time (seconds per cycle) Clock rate (cycles per second) CPI (cycles per instruction) MIPS (millions of instructions per second) CAPL Fall / 39

38 Amdahl s Law (1967) General law concerning the speedup Version 1 speedup = = performance after improvement performance before improvement execution time before improvement execution time after improvement Version 2 execution time after improvement = execution time affected by improvement amount of improvement + execution time unaffected CAPL Fall / 39

39 Example Program runs 100 sec, of which multiplication operations run 80 sec How much do I have to improve speed of multiplication to run the program 5 times as fast? 80 sec / n + (100 sec - 80 sec) 20 sec = (80 sec / n) + 20 sec Not possible Performance enhancement is limited by the amount that the improved feature is used CAPL Fall / 39

### Written Homework 3. Floating-Point Example (1/2)

Written Homework 3 Assigned on Tuesday, Feb 19 Due Time: 11:59pm, Feb 26 on Tuesday Problems: 3.22, 3.23, 3.24, 3.41, 3.43 Note: You have 1 week to work on homework 3. 3 Floating-Point Example (1/2) Q:

### Divide: Paper & Pencil

Divide: Paper & Pencil 1001 Quotient Divisor 1000 1001010 Dividend -1000 10 101 1010 1000 10 Remainder See how big a number can be subtracted, creating quotient bit on each step Binary => 1 * divisor or

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

CSCI 402: Computer Architectures Arithmetic for Computers (4) Fengguang Song Department of Computer & Information Science IUPUI Homework 4 Assigned on Feb 22, Thursday Due Time: 11:59pm, March 5 on Monday

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

1 Floating Point The World is Not Just Integers Programming languages support numbers with fraction Called floating-point numbers Examples: 3.14159265 (π) 2.71828 (e) 0.000000001 or 1.0 10 9 (seconds in

### Computer Architecture and IC Design Lab. Chapter 3 Part 2 Arithmetic for Computers Floating Point

Chapter 3 Part 2 Arithmetic for Computers Floating Point Floating Point Representation for non integral numbers Including very small and very large numbers 4,600,000,000 or 4.6 x 10 9 0.0000000000000000000000000166

### Floating Point Arithmetic

Floating Point Arithmetic CS 365 Floating-Point What can be represented in N bits? Unsigned 0 to 2 N 2s Complement -2 N-1 to 2 N-1-1 But, what about? very large numbers? 9,349,398,989,787,762,244,859,087,678

### Floating Point Arithmetic

Floating Point Arithmetic Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu EEE3050: Theory on Computer Architectures, Spring 2017, Jinkyu Jeong (jinkyu@skku.edu)

### Floating Point Arithmetic. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Floating Point Arithmetic Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Floating Point (1) Representation for non-integral numbers Including very

### Defining Performance. Performance. Which airplane has the best performance? Boeing 777. Boeing 777. Boeing 747. Boeing 747

Defining Which airplane has the best performance? 1 Boeing 777 Boeing 777 Boeing 747 BAC/Sud Concorde Douglas DC-8-50 Boeing 747 BAC/Sud Concorde Douglas DC- 8-50 0 100 200 300 400 500 Passenger Capacity

### CS3350B Computer Architecture CPU Performance and Profiling

CS3350B Computer Architecture CPU Performance and Profiling Marc Moreno Maza http://www.csd.uwo.ca/~moreno/cs3350_moreno/index.html Department of Computer Science University of Western Ontario, Canada

### Chapter 3 Arithmetic for Computers (Part 2)

Department of Electr rical Eng ineering, Chapter 3 Arithmetic for Computers (Part 2) 王振傑 (Chen-Chieh Wang) ccwang@mail.ee.ncku.edu.tw ncku edu Depar rtment of Electr rical Eng ineering, Feng-Chia Unive

### Number Systems and Computer Arithmetic

Number Systems and Computer Arithmetic Counting to four billion two fingers at a time What do all those bits mean now? bits (011011011100010...01) instruction R-format I-format... integer data number text

### Thomas Polzer Institut für Technische Informatik

Thomas Polzer tpolzer@ecs.tuwien.ac.at Institut für Technische Informatik Operations on integers Addition and subtraction Multiplication and division Dealing with overflow Floating-point real numbers VO

### Review: MIPS Organization

1 MIPS Arithmetic Review: MIPS Organization Processor Memory src1 addr 5 src2 addr 5 dst addr 5 write data Register File registers (\$zero - \$ra) bits src1 data src2 data read/write addr 1 1100 2 30 words

### Defining Performance. Performance 1. Which airplane has the best performance? Computer Organization II Ribbens & McQuain.

Defining Performance Performance 1 Which airplane has the best performance? Boeing 777 Boeing 777 Boeing 747 BAC/Sud Concorde Douglas DC-8-50 Boeing 747 BAC/Sud Concorde Douglas DC- 8-50 0 100 200 300

### Floating Point COE 308. Computer Architecture Prof. Muhamed Mudawar. Computer Engineering Department King Fahd University of Petroleum and Minerals

Floating Point COE 38 Computer Architecture Prof. Muhamed Mudawar Computer Engineering Department King Fahd University of Petroleum and Minerals Presentation Outline Floating-Point Numbers IEEE 754 Floating-Point

### Lecture 10: Floating Point, Digital Design

Lecture 10: Floating Point, Digital Design Today s topics: FP arithmetic Intro to Boolean functions 1 Examples Final representation: (-1) S x (1 + Fraction) x 2 (Exponent Bias) Represent -0.75 ten in single

### 5DV118 Computer Organization and Architecture Umeå University Department of Computing Science Stephen J. Hegner. Topic 3: Arithmetic

5DV118 Computer Organization and Architecture Umeå University Department of Computing Science Stephen J. Hegner Topic 3: Arithmetic These slides are mostly taken verbatim, or with minor changes, from those

### Arithmetic for Computers. Hwansoo Han

Arithmetic for Computers Hwansoo Han Arithmetic for Computers Operations on integers Addition and subtraction Multiplication and division Dealing with overflow Floating-point real numbers Representation

### Lecture 10: Floating Point, Digital Design

Lecture 10: Floating Point, Digital Design Today s topics: FP arithmetic Intro to Boolean functions 1 Examples Final representation: (-1) S x (1 + Fraction) x 2 (Exponent Bias) Represent -0.75 ten in single

### Chapter 3. Arithmetic Text: P&H rev

Chapter 3 Arithmetic Text: P&H rev3.29.16 Arithmetic for Computers Operations on integers Addition and subtraction Multiplication and division Dealing with overflow Floating-point real numbers Representation

### CO Computer Architecture and Programming Languages CAPL. Lecture 18 & 19

CO2-3224 Computer Architecture and Programming Languages CAPL Lecture 8 & 9 Dr. Kinga Lipskoch Fall 27 Single Cycle Disadvantages & Advantages Uses the clock cycle inefficiently the clock cycle must be

### ECE 154A Introduction to. Fall 2012

ECE 154A Introduction to Computer Architecture Fall 2012 Dmitri Strukov Lecture 10 Floating point review Pipelined design IEEE Floating Point Format single: 8 bits double: 11 bits single: 23 bits double:

### Floating Point Arithmetic

Floating Point Arithmetic ICS 233 Computer Architecture and Assembly Language Dr. Aiman El-Maleh College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals [Adapted from

### 3.5 Floating Point: Overview

3.5 Floating Point: Overview Floating point (FP) numbers Scientific notation Decimal scientific notation Binary scientific notation IEEE 754 FP Standard Floating point representation inside a computer

### Computer Architecture. Chapter 3: Arithmetic for Computers

182.092 Computer Architecture Chapter 3: Arithmetic for Computers Adapted from Computer Organization and Design, 4 th Edition, Patterson & Hennessy, 2008, Morgan Kaufmann Publishers and Mary Jane Irwin

### MEASURING COMPUTER TIME. A computer faster than another? Necessity of evaluation computer performance

Necessity of evaluation computer performance MEASURING COMPUTER PERFORMANCE For comparing different computer performances User: Interested in reducing the execution time (response time) of a task. Computer

### COMPUTER ORGANIZATION AND DESIGN

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 3 Arithmetic for Computers Arithmetic for Computers Operations on integers Addition and subtraction Multiplication

### Module 2: Computer Arithmetic

Module 2: Computer Arithmetic 1 B O O K : C O M P U T E R O R G A N I Z A T I O N A N D D E S I G N, 3 E D, D A V I D L. P A T T E R S O N A N D J O H N L. H A N N E S S Y, M O R G A N K A U F M A N N

### Floating Point Numbers

Floating Point Numbers Summer 8 Fractional numbers Fractional numbers fixed point Floating point numbers the IEEE 7 floating point standard Floating point operations Rounding modes CMPE Summer 8 Slides

### 1.3 Data processing; data storage; data movement; and control.

CHAPTER 1 OVERVIEW ANSWERS TO QUESTIONS 1.1 Computer architecture refers to those attributes of a system visible to a programmer or, put another way, those attributes that have a direct impact on the logical

### M1 Computers and Data

M1 Computers and Data Module Outline Architecture vs. Organization. Computer system and its submodules. Concept of frequency. Processor performance equation. Representation of information characters, signed

### Floating-point representations

Lecture 10 Floating-point representations Methods of representing real numbers (1) 1. Fixed-point number system limited range and/or limited precision results must be scaled 100101010 1111010 100101010.1111010

### Floating-point representations

Lecture 10 Floating-point representations Methods of representing real numbers (1) 1. Fixed-point number system limited range and/or limited precision results must be scaled 100101010 1111010 100101010.1111010

### Chapter 1. Instructor: Josep Torrellas CS433. Copyright Josep Torrellas 1999, 2001, 2002,

Chapter 1 Instructor: Josep Torrellas CS433 Copyright Josep Torrellas 1999, 2001, 2002, 2013 1 Course Goals Introduce you to design principles, analysis techniques and design options in computer architecture

### Performance, Power, Die Yield. CS301 Prof Szajda

Performance, Power, Die Yield CS301 Prof Szajda Administrative HW #1 assigned w Due Wednesday, 9/3 at 5:00 pm Performance Metrics (How do we compare two machines?) What to Measure? Which airplane has the

### Number Representations

Number Representations times XVII LIX CLXX -XVII D(CCL)LL DCCC LLLL X-X X-VII = DCCC CC III = MIII X-VII = VIIIII-VII = III 1/25/02 Memory Organization Viewed as a large, single-dimension array, with an

### Floating Point Numbers. Lecture 9 CAP

Floating Point Numbers Lecture 9 CAP 3103 06-16-2014 Review of Numbers Computers are made to deal with numbers What can we represent in N bits? 2 N things, and no more! They could be Unsigned integers:

### Lecture 13: (Integer Multiplication and Division) FLOATING POINT NUMBERS

Lecture 13: (Integer Multiplication and Division) FLOATING POINT NUMBERS Lecture 13 Floating Point I (1) Fall 2005 Integer Multiplication (1/3) Paper and pencil example (unsigned): Multiplicand 1000 8

### MIPS Integer ALU Requirements

MIPS Integer ALU Requirements Add, AddU, Sub, SubU, AddI, AddIU: 2 s complement adder/sub with overflow detection. And, Or, Andi, Ori, Xor, Xori, Nor: Logical AND, logical OR, XOR, nor. SLTI, SLTIU (set

### MIPS ISA AND PIPELINING OVERVIEW Appendix A and C

1 MIPS ISA AND PIPELINING OVERVIEW Appendix A and C OUTLINE Review of MIPS ISA Review on Pipelining 2 READING ASSIGNMENT ReadAppendixA ReadAppendixC 3 THEMIPS ISA (A.9) First MIPS in 1985 General-purpose

### Computer Organization and Structure. Bing-Yu Chen National Taiwan University

Computer Organization and Structure Bing-Yu Chen National Taiwan University Arithmetic for Computers Addition and Subtraction Gate Logic and K-Map Method Constructing a Basic ALU Arithmetic Logic Unit

### IC220 Slide Set #5B: Performance (Chapter 1: 1.6, )

Performance IC220 Slide Set #5B: Performance (Chapter 1: 1.6, 1.9-1.11) Measure, Report, and Summarize Make intelligent choices See through the marketing hype Key to understanding underlying organizational

### Response Time and Throughput

Response Time and Throughput Response time How long it takes to do a task Throughput Total work done per unit time e.g., tasks/transactions/ per hour How are response time and throughput affected by Replacing

### EE260: Logic Design, Spring n Integer multiplication. n Booth s algorithm. n Integer division. n Restoring, non-restoring

EE 260: Introduction to Digital Design Arithmetic II Yao Zheng Department of Electrical Engineering University of Hawaiʻi at Mānoa Overview n Integer multiplication n Booth s algorithm n Integer division

### Floating Point (with contributions from Dr. Bin Ren, William & Mary Computer Science)

Floating Point (with contributions from Dr. Bin Ren, William & Mary Computer Science) Floating Point Background: Fractional binary numbers IEEE floating point standard: Definition Example and properties

### Course web site: teaching/courses/car. Piazza discussion forum:

Announcements Course web site: http://www.inf.ed.ac.uk/ teaching/courses/car Lecture slides Tutorial problems Courseworks Piazza discussion forum: http://piazza.com/ed.ac.uk/spring2018/car Tutorials start

### CS6303 Computer Architecture Regulation 2013 BE-Computer Science and Engineering III semester 2 MARKS

CS6303 Computer Architecture Regulation 2013 BE-Computer Science and Engineering III semester 2 MARKS UNIT-I OVERVIEW & INSTRUCTIONS 1. What are the eight great ideas in computer architecture? The eight

### Designing for Performance. Patrick Happ Raul Feitosa

Designing for Performance Patrick Happ Raul Feitosa Objective In this section we examine the most common approach to assessing processor and computer system performance W. Stallings Designing for Performance

### Performance COE 403. Computer Architecture Prof. Muhamed Mudawar. Computer Engineering Department King Fahd University of Petroleum and Minerals

Performance COE 403 Computer Architecture Prof. Muhamed Mudawar Computer Engineering Department King Fahd University of Petroleum and Minerals What is Performance? How do we measure the performance of

### CMCS Mohamed Younis CMCS 611, Advanced Computer Architecture 1

CMCS 611-101 Advanced Computer Architecture Lecture 9 Pipeline Implementation Challenges October 5, 2009 www.csee.umbc.edu/~younis/cmsc611/cmsc611.htm Mohamed Younis CMCS 611, Advanced Computer Architecture

### CSE 141 Computer Architecture Summer Session Lecture 3 ALU Part 2 Single Cycle CPU Part 1. Pramod V. Argade

CSE 141 Computer Architecture Summer Session 1 2004 Lecture 3 ALU Part 2 Single Cycle CPU Part 1 Pramod V. Argade Reading Assignment Announcements Chapter 5: The Processor: Datapath and Control, Sec. 5.3-5.4

### CPE300: Digital System Architecture and Design

CPE300: Digital System Architecture and Design Fall 2011 MW 17:30-18:45 CBC C316 Number Representation 09212011 http://www.egr.unlv.edu/~b1morris/cpe300/ 2 Outline Recap Logic Circuits for Register Transfer

### Floating point. Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties. Next time. !

Floating point Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties Next time! The machine model Chris Riesbeck, Fall 2011 Checkpoint IEEE Floating point Floating

### Computer Organisation CS303

Computer Organisation CS303 Module Period Assignments 1 Day 1 to Day 6 1. Write a program to evaluate the arithmetic statement: X=(A-B + C * (D * E-F))/G + H*K a. Using a general register computer with

### ECE260: Fundamentals of Computer Engineering

Arithmetic for Computers James Moscola Dept. of Engineering & Computer Science York College of Pennsylvania Based on Computer Organization and Design, 5th Edition by Patterson & Hennessy Arithmetic for

### UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Digital Computer Arithmetic ECE 666

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer Arithmetic ECE 666 Part 4-C Floating-Point Arithmetic - III Israel Koren ECE666/Koren Part.4c.1 Floating-Point Adders

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

Another Improvement Save on space: Put multiplier in product saves on speed: only single shift needed Figure: Improved hardware for multiplication Signed Multiplication Multiply the positives Negate result

### xx.yyyy Lecture #11 Floating Point II Summary (single precision): Precision and Accuracy Fractional Powers of 2 Representation of Fractions

CS61C L11 Floating Point II (1) inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #11 Floating Point II 2007-7-12 Scott Beamer, Instructor Sony & Nintendo make E3 News www.nytimes.com Review

### 361 div.1. Computer Architecture EECS 361 Lecture 7: ALU Design : Division

361 div.1 Computer Architecture EECS 361 Lecture 7: ALU Design : Division Outline of Today s Lecture Introduction to Today s Lecture Divide Questions and Administrative Matters Introduction to Single cycle

### Floating-Point Arithmetic

Floating-Point Arithmetic if ((A + A) - A == A) { SelfDestruct() } L11 Floating Point 1 What is the problem? Many numeric applications require numbers over a VERY large range. (e.g. nanoseconds to centuries)

### EE878 Special Topics in VLSI. Computer Arithmetic for Digital Signal Processing

EE878 Special Topics in VLSI Computer Arithmetic for Digital Signal Processing Part 4-B Floating-Point Arithmetic - II Spring 2017 Koren Part.4b.1 The IEEE Floating-Point Standard Four formats for floating-point

### UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Digital Computer Arithmetic ECE 666

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer Arithmetic ECE 666 Part 4-B Floating-Point Arithmetic - II Israel Koren ECE666/Koren Part.4b.1 The IEEE Floating-Point

### Floating Point Representation in Computers

Floating Point Representation in Computers Floating Point Numbers - What are they? Floating Point Representation Floating Point Operations Where Things can go wrong What are Floating Point Numbers? Any

### CS 61C: Great Ideas in Computer Architecture Performance and Floating Point Arithmetic

CS 61C: Great Ideas in Computer Architecture Performance and Floating Point Arithmetic Instructors: Bernhard Boser & Randy H. Katz http://inst.eecs.berkeley.edu/~cs61c/ 10/25/16 Fall 2016 -- Lecture #17

### Floating-Point Arithmetic

Floating-Point Arithmetic if ((A + A) - A == A) { SelfDestruct() } Reading: Study Chapter 4. L12 Multiplication 1 Why Floating Point? Aren t Integers enough? Many applications require numbers with a VERY

### Computer and Information Sciences College / Computer Science Department CS 207 D. Computer Architecture

Computer and Information Sciences College / Computer Science Department CS 207 D Computer Architecture The Computer Revolution Progress in computer technology Underpinned by Moore s Law Makes novel applications

### Lecture 2: Computer Performance. Assist.Prof.Dr. Gürhan Küçük Advanced Computer Architectures CSE 533

Lecture 2: Computer Performance Assist.Prof.Dr. Gürhan Küçük Advanced Computer Architectures CSE 533 Performance and Cost Purchasing perspective given a collection of machines, which has the - best performance?

### DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING QUESTION BANK

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING QUESTION BANK SUBJECT : CS6303 / COMPUTER ARCHITECTURE SEM / YEAR : VI / III year B.E. Unit I OVERVIEW AND INSTRUCTIONS Part A Q.No Questions BT Level

### 4. What is the average CPI of a 1.4 GHz machine that executes 12.5 million instructions in 12 seconds?

Chapter 4: Assessing and Understanding Performance 1. Define response (execution) time. 2. Define throughput. 3. Describe why using the clock rate of a processor is a bad way to measure performance. Provide

### Foundations of Computer Systems

18-600 Foundations of Computer Systems Lecture 4: Floating Point Required Reading Assignment: Chapter 2 of CS:APP (3 rd edition) by Randy Bryant & Dave O Hallaron Assignments for This Week: Lab 1 18-600

### COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. 5 th. Edition. Chapter 1. Computer Abstractions and Technology

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 1 Computer Abstractions and Technology The Computer Revolution Progress in computer technology Underpinned by Moore

### TDT4255 Computer Design. Lecture 4. Magnus Jahre

1 TDT4255 Computer Design Lecture 4 Magnus Jahre 2 Chapter 3 Computer Arithmetic ti Acknowledgement: Slides are adapted from Morgan Kaufmann companion material 3 Arithmetic for Computers Operations on

### Lecture - 4. Measurement. Dr. Soner Onder CS 4431 Michigan Technological University 9/29/2009 1

Lecture - 4 Measurement Dr. Soner Onder CS 4431 Michigan Technological University 9/29/2009 1 Acknowledgements David Patterson Dr. Roger Kieckhafer 9/29/2009 2 Computer Architecture is Design and Analysis

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

Chapter 03: Computer Arithmetic Lesson 09: Arithmetic using floating point numbers Objective To understand arithmetic operations in case of floating point numbers 2 Multiplication of Floating Point Numbers

### Chapter 4. Operations on Data

Chapter 4 Operations on Data 1 OBJECTIVES After reading this chapter, the reader should be able to: List the three categories of operations performed on data. Perform unary and binary logic operations

### Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition. Carnegie Mellon

Carnegie Mellon Floating Point 15-213/18-213/14-513/15-513: Introduction to Computer Systems 4 th Lecture, Sept. 6, 2018 Today: Floating Point Background: Fractional binary numbers IEEE floating point

### Floating Point Puzzles. Lecture 3B Floating Point. IEEE Floating Point. Fractional Binary Numbers. Topics. IEEE Standard 754

Floating Point Puzzles Topics Lecture 3B Floating Point IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties For each of the following C expressions, either: Argue that

### Arithmetic. Chapter 3 Computer Organization and Design

Arithmetic Chapter 3 Computer Organization and Design Addition Addition is similar to decimals 0000 0111 + 0000 0101 = 0000 1100 Subtraction (negate) 0000 0111 + 1111 1011 = 0000 0010 Over(under)flow For

### UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Computer Architecture ECE 568

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Computer Architecture ECE 568 Sample Midterm I Questions Israel Koren ECE568/Koren Sample Midterm.1.1 1. The cost of a pipeline can

### Operations On Data CHAPTER 4. (Solutions to Odd-Numbered Problems) Review Questions

CHAPTER 4 Operations On Data (Solutions to Odd-Numbered Problems) Review Questions 1. Arithmetic operations interpret bit patterns as numbers. Logical operations interpret each bit as a logical values

### 3/12/2014. Single Cycle (Review) CSE 2021: Computer Organization. Single Cycle with Jump. Multi-Cycle Implementation. Why Multi-Cycle?

CSE 2021: Computer Organization Single Cycle (Review) Lecture-10b CPU Design : Pipelining-1 Overview, Datapath and control Shakil M. Khan 2 Single Cycle with Jump Multi-Cycle Implementation Instruction:

### COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 3. Arithmetic for Computers

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 3 Arithmetic for Computers Boolean Algebra Boolean algebra is the basic math used in digital circuits and computers.

### IEEE Standard for Floating-Point Arithmetic: 754

IEEE Standard for Floating-Point Arithmetic: 754 G.E. Antoniou G.E. Antoniou () IEEE Standard for Floating-Point Arithmetic: 754 1 / 34 Floating Point Standard: IEEE 754 1985/2008 Established in 1985 (2008)

### CS61C : Machine Structures

inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #11 Floating Point II Scott Beamer, Instructor Sony & Nintendo make E3 News 2007-7-12 CS61C L11 Floating Point II (1) www.nytimes.com Review

### The Sign consists of a single bit. If this bit is '1', then the number is negative. If this bit is '0', then the number is positive.

IEEE 754 Standard - Overview Frozen Content Modified by on 13-Sep-2017 Before discussing the actual WB_FPU - Wishbone Floating Point Unit peripheral in detail, it is worth spending some time to look at

### IEEE Standard 754 for Binary Floating-Point Arithmetic.

CS61C L11 Floating Point II (1) inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #11 Floating Point II 2005-10-05 There is one handout today at the front and back of the room! Lecturer

### Computer Performance. Reread Chapter Quiz on Friday. Study Session Wed Night FB 009, 5pm-6:30pm

Computer Performance He said, to speed things up we need to squeeze the clock Reread Chapter 1.4-1.9 Quiz on Friday. Study Session Wed Night FB 009, 5pm-6:30pm L15 Computer Performance 1 Why Study Performance?

### Floating Point Puzzles. Lecture 3B Floating Point. IEEE Floating Point. Fractional Binary Numbers. Topics. IEEE Standard 754

Floating Point Puzzles Topics Lecture 3B Floating Point IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties For each of the following C expressions, either: Argue that

### CpE 442 Introduction to Computer Architecture. The Role of Performance

CpE 442 Introduction to Computer Architecture The Role of Performance Instructor: H. H. Ammar CpE442 Lec2.1 Overview of Today s Lecture: The Role of Performance Review from Last Lecture Definition and

### Chapter 3. Arithmetic for Computers

Chapter 3 Arithmetic for Computers Arithmetic for Computers Operations on integers Addition and subtraction Multiplication and division Dealing with overflow Floating-point real numbers Representation

### Chapter 2 Float Point Arithmetic. Real Numbers in Decimal Notation. Real Numbers in Decimal Notation

Chapter 2 Float Point Arithmetic Topics IEEE Floating Point Standard Fractional Binary Numbers Rounding Floating Point Operations Mathematical properties Real Numbers in Decimal Notation Representation

### Giving credit where credit is due

CSCE 230J Computer Organization Floating Point Dr. Steve Goddard goddard@cse.unl.edu http://cse.unl.edu/~goddard/courses/csce230j Giving credit where credit is due Most of slides for this lecture are based

CS 33 Data Representation (Part 3) CS33 Intro to Computer Systems VIII 1 Copyright 2018 Thomas W. Doeppner. All rights reserved. Byte-Oriented Memory Organization 00 0 FF F Programs refer to data by address

### Instruction Pipelining Review

Instruction Pipelining Review Instruction pipelining is CPU implementation technique where multiple operations on a number of instructions are overlapped. An instruction execution pipeline involves a number

### Giving credit where credit is due

JDEP 284H Foundations of Computer Systems Floating Point Dr. Steve Goddard goddard@cse.unl.edu Giving credit where credit is due Most of slides for this lecture are based on slides created by Drs. Bryant

### Floating Point : Introduction to Computer Systems 4 th Lecture, May 25, Instructor: Brian Railing. Carnegie Mellon

Floating Point 15-213: Introduction to Computer Systems 4 th Lecture, May 25, 2018 Instructor: Brian Railing Today: Floating Point Background: Fractional binary numbers IEEE floating point standard: Definition

### System Programming CISC 360. Floating Point September 16, 2008

System Programming CISC 360 Floating Point September 16, 2008 Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Powerpoint Lecture Notes for Computer Systems: