240-334 By Wannarat 240-334 Computer System Design Lecture 3 Wannarat Suntiamorntut.

Slides:



Advertisements
Similar presentations
Chapter Three.
Advertisements

1 Chapter Three Last revision: 4/17/ Arithmetic Where we've been: –Performance (seconds, cycles, instructions) –Abstractions: Instruction Set Architecture.
Chapter 3 Arithmetic for Computers. Exam 1 CSCE
Datorteknik IntegerMulDiv bild 1 MIPS mul/div instructions Multiply: mult $2,$3Hi, Lo = $2 x $3;64-bit signed product Multiply unsigned: multu$2,$3Hi,
©UCB CPSC 161 Lecture 6 Prof. L.N. Bhuyan
1 CONSTRUCTING AN ARITHMETIC LOGIC UNIT CHAPTER 4: PART II.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3: IT Students.
Chapter 3 Arithmetic for Computers. Multiplication More complicated than addition accomplished via shifting and addition More time and more area Let's.
Arithmetic CPSC 321 Computer Architecture Andreas Klappenecker.
Arithmetic CPSC 321 Computer Architecture Andreas Klappenecker.
361 div.1 Computer Architecture ECE 361 Lecture 7: ALU Design : Division.
Lecture 9 Sept 28 Chapter 3 Arithmetic for Computers.
1 Representing Numbers Using Bases Numbers in base 10 are called decimal numbers, they are composed of 10 numerals ( ספרות ) = 9* * *10.
Assembly Language and Computer Architecture Using C++ and Java
1  2004 Morgan Kaufmann Publishers Chapter Three.
1 Chapter 4: Arithmetic Where we've been: –Performance (seconds, cycles, instructions) –Abstractions: Instruction Set Architecture Assembly Language and.
1 Lecture 8: Binary Multiplication & Division Today’s topics:  Addition/Subtraction  Multiplication  Division Reminder: get started early on assignment.
Chapter Four Arithmetic and Logic Unit
Arithmetic I CPSC 321 Andreas Klappenecker. Administrative Issues Office hours of TA Praveen Bhojwani: M 1:00pm-3:00pm.
ECE 15B Computer Organization Spring 2010 Dmitri Strukov Lecture 6: Logic/Shift Instructions Partially adapted from Computer Organization and Design, 4.
1 ECE369 Chapter 3. 2 ECE369 Multiplication More complicated than addition –Accomplished via shifting and addition More time and more area.
1  1998 Morgan Kaufmann Publishers Chapter Four Arithmetic for Computers.
Chapter 3 Arithmetic for Computers. Arithmetic Where we've been: Abstractions: Instruction Set Architecture Assembly Language and Machine Language What's.
ECE 232 L9.Mult.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 9 Computer Arithmetic.
Lecture Objectives: 1)Explain the relationship between addition and subtraction with twos complement numbering systems 2)Explain the concept of numeric.
Arithmetic for Computers
1 Bits are just bits (no inherent meaning) — conventions define relationship between bits and numbers Binary numbers (base 2)
EGRE 426 Fall 09 Chapter Three
Computing Systems Basic arithmetic for computers.
ECE232: Hardware Organization and Design
Computer Organization and Architecture (AT70.01) Comp. Sc. and Inf. Mgmt. Asian Institute of Technology Instructor: Dr. Sumanta Guha Slide Sources: Patterson.
Lec 13Systems Architecture1 Systems Architecture Lecture 13: Integer Multiplication and Division Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan.
07/19/2005 Arithmetic / Logic Unit – ALU Design Presentation F CSE : Introduction to Computer Architecture Slides by Gojko Babić.
1 EGRE 426 Fall 08 Chapter Three. 2 Arithmetic What's up ahead: –Implementing the Architecture 32 operation result a b ALU.
1  1998 Morgan Kaufmann Publishers Arithmetic Where we've been: –Performance (seconds, cycles, instructions) –Abstractions: Instruction Set Architecture.
Lecture 6: Multiply, Shift, and Divide
Chapter 3 Arithmetic for Computers (Integers). Florida A & M University - Department of Computer and Information Sciences Arithmetic for Computers Operations.
Conversion to Larger Number of Bits Ex: Immediate Field (signed 16 bit) to 32 bit Positive numbers have implied 0’s to the left. So, put 16 bit number.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
05/03/2009CA&O Lecture 8,9,10 By Engr. Umbreen sabir1 Computer Arithmetic Computer Engineering Department.
Lecture notes Reading: Section 3.4, 3.5, 3.6 Multiplication
Csci 136 Computer Architecture II – Multiplication and Division
Mohamed Younis CMCS 411, Computer Architecture 1 CMSC Computer Architecture Lecture 11 Performing Division March 5,
Chapter 3 Arithmetic for Computers. Chapter 3 — Arithmetic for Computers — 2 Arithmetic for Computers Operations on integers Addition and subtraction.
1 ELEN 033 Lecture 4 Chapter 4 of Text (COD2E) Chapters 3 and 4 of Goodman and Miller book.
Computer Architecture Lecture Notes Spring 2005 Dr. Michael P. Frank Competency Area 4: Computer Arithmetic.
Addition, Subtraction, Logic Operations and ALU Design
CDA 3101 Spring 2016 Introduction to Computer Organization
순천향대학교 정보기술공학부 이 상 정 1 3. Arithmetic for Computers.
Prof. Hsien-Hsin Sean Lee
Computer Arthmetic Chapter Four P&H. Data Representation Why do we not encode numbers as strings of ASCII digits inside computers? What is overflow when.
9/23/2004Comp 120 Fall September Chapter 4 – Arithmetic and its implementation Assignments 5,6 and 7 posted to the class web page.
May 2, 2001System Architecture I1 Systems Architecture I (CS ) Lecture 11: Arithmetic for Computers * Jeremy R. Johnson May 2, 2001 *This lecture.
1 CPTR 220 Computer Organization Computer Architecture Assembly Programming.
Based on slides from D. Patterson and www-inst.eecs.berkeley.edu/~cs152/ COM 249 – Computer Organization and Assembly Language Chapter 3 Arithmetic For.
Computer System Design Lecture 3
Computer Arthmetic Chapter Four P&H.
Integer Multiplication and Division
MIPS mul/div instructions
Part II : Lecture III By Wannarat.
Morgan Kaufmann Publishers
Morgan Kaufmann Publishers
CDA 3101 Summer 2007 Introduction to Computer Organization
Lecture 8: Addition, Multiplication & Division
Lecture 8: Addition, Multiplication & Division
Arithmetic Logical Unit
Computer Architecture EECS 361 Lecture 6: ALU Design
Morgan Kaufmann Publishers Arithmetic for Computers
Presentation transcript:

By Wannarat Computer System Design Lecture 3 Wannarat Suntiamorntut

By Wannarat Arithmetic for Computer Implementing the Architecture

By Wannarat The numbers Binary number (base 2) numbers are finite (overflow) fraction and real number negative number e.g., No MIPS subi instruction, addi can add a negative number

By Wannarat Possible Representations Sign MagnitudeOne’s complementTwo’s complement 000 = = = = = = = = = = = = = = = = = = = = = = = = -1 Negative and Invert are different!

By Wannarat Addition & Subtraction { } = 0001 two’s complement = 0001 Overflow n-bit does not yield an n-bit number

By Wannarat Detecting overflow No overflow when add positive&negative No overflow when signs are the same for subtraction Overflow occur when : - add two positives yield a negative - add two negative gives a positive - subtract negative from positive and get negative - subtract positive from negative get a positive

By Wannarat Effect of Overflow Exception occur (Interrupt) - control jumps to predefined address for exception - Interrupted address is saved Don’t always to detect overflow - New MIPS instructions: addu, addiu...

By Wannarat ALU Build ALU support andi, ori instructions

By Wannarat Multiplexor Select one of the inputs to be output, base on control input

By Wannarat ALU for Addition instruction Cout = ab + bc in + ac in Sum = a xor b xor c in

By Wannarat ALU for Subtraction instruction Two’s complement approach : just negative b and ADD

By Wannarat Supporting slt

By Wannarat

MIPS Arithmetic Instruction format

By Wannarat Conclusion ALU in MIPS Use multiplexor to select output we want efficiently perform subtraction using two’s complement replicate 1-bit ALU to 32-bit ALU

By Wannarat Computation Problem :fast adder 32-bit ALU faster than 1-bit ALU? Carry-lookahead adder g = ab,p = a + b c1 = g0 + p0c0 c2 = g1 + p1c1c2 c3 = g2 + p2c2c3...

By Wannarat

Part II : Lecture III

By Wannarat Multiplication 0010(multiplicand) x1011 (multiplier) ????

By Wannarat Unsign Combinational Multiplier

By Wannarat Multiplication : First Version (Unsign)

By Wannarat Multiplication : First Version (contd.)

By Wannarat Analyze First Version 1 clock per cycle 50 % of bit in multiplicand always = 0 => 64-bit adder is wasted 0’s inserted in left of multiplicand as shifted => lead significant bits of product never changed once formed

By Wannarat Multiplication : Second Version

By Wannarat Multiplication : Second Version (Contd.)

By Wannarat Analyze Second Version Product register wasted space that exactly matches size of multiplier Combine Multiplier register and Product register

By Wannarat Multiplication : Third Version

By Wannarat Multiplication : Third Version (Contd.)

By Wannarat Analyze Third Version 2 steps per bit because multiplier & product combined MIPS registers Hi, Lo are left and right half of product

By Wannarat Booth’s Algorithm

By Wannarat Example : 2 x 7

By Wannarat Example : 2 x -3

By Wannarat Shifter : 2 kinds

By Wannarat Part III : Lecture III

By Wannarat Divide

By Wannarat Divide : First Version

By Wannarat Divide : First Version (Contd.)

By Wannarat Analyze First Version 50%bits in divisor always 0 =>1/2 of 64-bit adder is wasted => 1/2 divisor is wasted 1 step cannot produce a 1 in quotient bit => Switch order to shift first

By Wannarat Divide : Second Version

By Wannarat Divide : Second Version (Contd.)

By Wannarat Analyze Second Version Eliminate Quotient register by combining with Remainder as shifted left

By Wannarat Divide : Third Version

By Wannarat Divide : Third Version (Contd.)

By Wannarat Analyze Third Version Do Analyze by yourself

By Wannarat Floating Point : IEEE754

By Wannarat Floating-point Representation = -3/4 = -3/2 2 = -11/ 2 2 = -0.11= -1.1x 2 -1 = (-1) s x (1 + signifiand) x 2 (exponent-127) = (-1) x ( ) x 2 ( ) S E M 1-bit 8-bit 23-bit

By Wannarat Floating-point Addition x x10 -1 Step1 : Change exponent as : x = x 10 1 Step2 : Add significands (10) (10) (10) Sum = x 10 1

By Wannarat Floating-point Addition x x10 -1 Step3 : correct it (normalization) : x 10 1 = x 10 2 Step4 : Four digits for significand x 10 2

By Wannarat Example Floating- point Addition ( ) 0.5 = 1/2 = 1/2 1 = 0.1 x 2 0 = 1.00 x = -7/16 = -7/2 4 = = x 2 -2 step 1 : x 2 -1 step 2 : 1.0x ( x 2 -1 )=0.001 x 2 -1 step 3 : 1.0 x 2 -4 step 4 :

By Wannarat Multiplication Floating-point Study in Text Book by yourself.

By Wannarat Next on Lecture 4