Lecture 10: Floating Point, Digital Design

Similar documents
Lecture 10: Floating Point, Digital Design

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

Floating Point Arithmetic

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

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

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

Chapter 3. Arithmetic Text: P&H rev

Computer Organization and Levels of Abstraction

Lecture 14: Recap. Today s topics: Recap for mid-term No electronic devices in midterm

Thomas Polzer Institut für Technische Informatik

LECTURE 4. Logic Design

CO Computer Architecture and Programming Languages CAPL. Lecture 15

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

Computer Organization and Levels of Abstraction

CSE 2021 Computer Organization. Hugh Chesser, CSEB 1012U W4-W

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

Boolean Algebra. Chapter 3. Boolean Algebra. Chapter 3 Arithmetic for Computers 1. Fundamental Boolean Operations. Arithmetic for Computers

3.5 Floating Point: Overview

Slide Set 11. for ENCM 369 Winter 2015 Lecture Section 01. Steve Norman, PhD, PEng

Arithmetic. Chapter 3 Computer Organization and Design

Chapter 3 Arithmetic for Computers (Part 2)

COMPUTER ORGANIZATION AND DESIGN

Arithmetic for Computers. Hwansoo Han

CS222: Processor Design

TDT4255 Computer Design. Lecture 4. Magnus Jahre

9 Floating-Point. 9.1 Objectives. 9.2 Floating-Point Number Representation. Value = ± (1.F) 2 2 E Bias

Cache Organizations for Multi-cores

Format. 10 multiple choice 8 points each. 1 short answer 20 points. Same basic principals as the midterm

Bawar Abid Abdalla. Assistant Lecturer Software Engineering Department Koya University

Chapter 3. Arithmetic for Computers

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

ECE 2030D Computer Engineering Spring problems, 5 pages Exam Two 8 March 2012

Chapter 3. Arithmetic for Computers

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

ECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010

Bawar Abid Abdalla. Assistant Lecturer Software Engineering Department Koya University

Floating Point Arithmetic

Chapter 3. Arithmetic for Computers

Divide: Paper & Pencil

ENGIN 112 Intro to Electrical and Computer Engineering

Experimental Methods I

Computer Organisation CS303

Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates. Invitation to Computer Science, C++ Version, Third Edition

ECE331: Hardware Organization and Design

CS Computer Architecture. 1. Explain Carry Look Ahead adders in detail

Computer Architecture Set Four. Arithmetic

Von Neumann Architecture

Circuit analysis summary

Chapter 3: Arithmetic for Computers

SYNERGY INSTITUTE OF ENGINEERING & TECHNOLOGY,DHENKANAL LECTURE NOTES ON DIGITAL ELECTRONICS CIRCUIT(SUBJECT CODE:PCEC4202)

ECE331: Hardware Organization and Design

Recitation Session 6

Digital Logic Design Exercises. Assignment 1

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

1. Prove that if you have tri-state buffers and inverters, you can build any combinational logic circuit. [4]

Lecture 8: Addition, Multiplication & Division

Computer Systems. Binary Representation. Binary Representation. Logical Computation: Boolean Algebra

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

Binary Adders: Half Adders and Full Adders

Floating Point Numbers. Lecture 9 CAP

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

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

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

Propositional Calculus. Math Foundations of Computer Science

Read this before starting!

Level 2: The Hardware World Chapters 4 and 5 (topics of other cs courses)

Part III The Arithmetic/Logic Unit. Oct Computer Architecture, The Arithmetic/Logic Unit Slide 1

Systems Architecture

MODULE 5 - COMBINATIONAL LOGIC

Software and Hardware

COMP combinational logic 1 Jan. 18, 2016

Review: MIPS Organization

Chapter 4. The Processor. Instruction count Determined by ISA and compiler. We will examine two MIPS implementations

EC2303-COMPUTER ARCHITECTURE AND ORGANIZATION

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

Chapter Three. Digital Components

Two-Level CLA for 4-bit Adder. Two-Level CLA for 4-bit Adder. Two-Level CLA for 16-bit Adder. A Closer Look at CLA Delay

ECE 341 Midterm Exam

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

CS/COE 0447 Example Problems for Exam 2 Fall 2010

Read this before starting!

Floating-Point Arithmetic

Floating-Point Arithmetic

Boolean Analysis of Logic Circuits

ECE232: Hardware Organization and Design

Dr. Chuck Cartledge. 10 June 2015

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

Number Systems and Computer Arithmetic


Chapter 3. Boolean Algebra and Digital Logic

CS61C Floating Point Operations & Multiply/Divide. Lecture 9. February 17, 1999 Dave Patterson (http.cs.berkeley.edu/~patterson)

Review 1/2 Big Idea: Instructions determine meaning of data; nothing inherent inside the data Characters: ASCII takes one byte

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

Assignment (3-6) Boolean Algebra and Logic Simplification - General Questions

ECE 154A Introduction to. Fall 2012

s complement 1-bit Booth s 2-bit Booth s

ECE260: Fundamentals of Computer Engineering

CPE300: Digital System Architecture and Design

Floating Point Arithmetic

Chapter 3 Arithmetic for Computers

Transcription:

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 and double-precision formats Single: (1 + 8 + 23) Double: (1 + 11 + 52) What decimal number is represented by the following single-precision number? 1 1000 0001 01000 0000 2

Examples Final representation: (-1) S x (1 + Fraction) x 2 (Exponent Bias) Represent -0.75 ten in single and double-precision formats Single: (1 + 8 + 23) 1 0111 1110 1000 000 Double: (1 + 11 + 52) 1 0111 1111 110 1000 000 What decimal number is represented by the following single-precision number? 1 1000 0001 01000 0000-5.0 3

FP Addition Consider the following decimal example (can maintain only 4 decimal digits and 2 exponent digits) 9.999 x 10 1 + 1.610 x 10-1 Convert to the larger exponent: 9.999 x 10 1 + 0.016 x 10 1 Add 10.015 x 10 1 Normalize 1.0015 x 10 2 Check for overflow/underflow Round 1.002 x 10 2 Re-normalize 4

FP Addition Consider the following decimal example (can maintain only 4 decimal digits and 2 exponent digits) 9.999 x 10 1 + 1.610 x 10-1 Convert to the larger exponent: 9.999 x 10 1 + 0.016 x 10 1 Add 10.015 x 10 1 Normalize 1.0015 x 10 2 Check for overflow/underflow Round 1.002 x 10 2 Re-normalize If we had more fraction bits, these errors would be minimized 5

FP Multiplication Similar steps: Compute exponent (careful!) Multiply significands (set the binary point correctly) Normalize Round (potentially re-normalize) Assign sign 6

MIPS Instructions The usual add.s, add.d, sub, mul, div Comparison instructions: c.eq.s, c.neq.s, c.lt.s. These comparisons set an internal bit in hardware that is then inspected by branch instructions: bc1t, bc1f Separate register file $f0 - $f31 : a double-precision value is stored in (say) $f4-$f5 and is referred to by $f4 Load/store instructions (lwc1, swc1) must still use integer registers for address computation 7

Code Example float f2c (float fahr) { return ((5.0/9.0) * (fahr 32.0)); } (argument fahr is stored in $f12) lwc1 $f16, const5 lwc1 $f18, const9 div.s $f16, $f16, $f18 lwc1 $f18, const32 sub.s $f18, $f12, $f18 mul.s $f0, $f16, $f18 jr $ra 8

Fixed Point FP operations are much slower than integer ops Fixed point arithmetic uses integers, but assumes that every number is multiplied by the same factor Example: with a factor of 1/1000, the fixed-point representations for 1.46, 1.7198, and 5624 are respectively 1460, 1720, and 5624000 More programming effort and possibly lower precision for higher performance 9

Subword Parallelism ALUs are typically designed to perform 64-bit or 128-bit arithmetic Some data types are much smaller, e.g., bytes for pixel RGB values, half-words for audio samples Partitioning the carry-chains within the ALU can convert the 64-bit adder into 4 16-bit adders or 8 8-bit adders A single load can fetch multiple values, and a single add instruction can perform multiple parallel additions, referred to as subword parallelism 10

Digital Design Basics Two voltage levels high and low (1 and 0, true and false) Hence, the use of binary arithmetic/logic in all computers A transistor is a 3-terminal device that acts as a switch V V V 0 Conducting 0 V Non-conducting 0 0 11

Logic Blocks A logic block has a number of binary inputs and produces a number of binary outputs the simplest logic block is composed of a few transistors A logic block is termed combinational if the output is only a function of the inputs A logic block is termed sequential if the block has some internal memory (state) that also influences the output A basic logic block is termed a gate (AND, OR, NOT, etc.) We will only deal with combinational circuits today 12

Truth Table A truth table defines the outputs of a logic block for each set of inputs Consider a block with 3 inputs A, B, C and an output E that is true only if exactly 2 inputs are true A B C E 13

Truth Table A truth table defines the outputs of a logic block for each set of inputs Consider a block with 3 inputs A, B, C and an output E that is true only if exactly 2 inputs are true A B C E 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 1 1 1 1 0 Can be compressed by only representing cases that have an output of 1 14

Boolean Algebra Equations involving two values and three primary operators: OR : symbol +, X = A + B X is true if at least one of A or B is true AND : symbol., X = A. B X is true if both A and B are true NOT : symbol, X = A X is the inverted value of A 15

Boolean Algebra Rules Identity law : A + 0 = A ; A. 1 = A Zero and One laws : A + 1 = 1 ; A. 0 = 0 Inverse laws : A. A = 0 ; A + A = 1 Commutative laws : A + B = B + A ; A. B = B. A Associative laws : A + (B + C) = (A + B) + C A. (B. C) = (A. B). C Distributive laws : A. (B + C) = (A. B) + (A. C) A + (B. C) = (A + B). (A + C) 16

DeMorgan s Laws A + B = A. B A. B = A + B Confirm that these are indeed true 17

Pictorial Representations AND OR NOT Source: H&P textbook What logic function is this? Source: H&P textbook 18

Boolean Equation Consider the logic block that has an output E that is true only if exactly two of the three inputs A, B, C are true 19

Boolean Equation Consider the logic block that has an output E that is true only if exactly two of the three inputs A, B, C are true Multiple correct equations: Two must be true, but all three cannot be true: E = ((A. B) + (B. C) + (A. C)). (A. B. C) Identify the three cases where it is true: E = (A. B. C) + (A. C. B) + (C. B. A) 20

Sum of Products Can represent any logic block with the AND, OR, NOT operators Draw the truth table For each true output, represent the corresponding inputs as a product The final equation is a sum of these products A B C E 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 1 1 1 1 0 (A. B. C) + (A. C. B) + (C. B. A) Can also use product of sums Any equation can be implemented with an array of ANDs, followed by an array of ORs 21

Title Bullet 22