Iterative Division Techniques COMPUTER ARITHMETIC: Lecture Notes # 6. University of Illinois at Chicago

Similar documents
University of Illinois at Chicago. Lecture Notes # 13

Divide: Paper & Pencil

COMPUTER ARITHMETIC (Part 1)

9 Multiplication and Division

COMP 303 Computer Architecture Lecture 6

CPS 104 Computer Organization and Programming

carry in carry 1101 carry carry

EECS150 - Digital Design Lecture 13 - Combinational Logic & Arithmetic Circuits Part 3

Number Systems and Computer Arithmetic

By, Ajinkya Karande Adarsh Yoga

University of Illinois at Chicago. Lecture Notes # 10

Learning Objectives. Binary over Decimal. In this chapter you will learn about:

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

Chapter 5 : Computer Arithmetic

Module 2: Computer Arithmetic

Integer Multiplication. Back to Arithmetic. Integer Multiplication. Example (Fig 4.25)

Timing for Ripple Carry Adder

Organisasi Sistem Komputer

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

CPE300: Digital System Architecture and Design

Lecture 8: Addition, Multiplication & Division

9/6/2011. Multiplication. Binary Multipliers The key trick of multiplication is memorizing a digit-to-digit table Everything else was just adding

Chapter 5: Computer Arithmetic. In this chapter you will learn about:

World Inside a Computer is Binary

Homework 3. Assigned on 02/15 Due time: midnight on 02/21 (1 WEEK only!) B.2 B.11 B.14 (hint: use multiplexors) CSCI 402: Computer Architectures

Arithmetic Logic Unit

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

Experiment Objectives. 2. Preparation. 3. Tasks. 3.1 Task A: String to Integer Conversion

Arithmetic Processing

Introduction to Computers and Programming. Numeric Values

ECE260: Fundamentals of Computer Engineering

Binary Adders. Ripple-Carry Adder

Adding Binary Integers. Part 4. Negative Binary. Integers. Adding Base 10 Numbers. Adding Binary Example = 10. Arithmetic Logic Unit

COMPUTER ARCHITECTURE AND ORGANIZATION. Operation Add Magnitudes Subtract Magnitudes (+A) + ( B) + (A B) (B A) + (A B)

CO212 Lecture 10: Arithmetic & Logical Unit

CHW 261: Logic Design

Chapter 5: Computer Arithmetic

Adding Binary Integers. Part 5. Adding Base 10 Numbers. Adding 2's Complement. Adding Binary Example = 10. Arithmetic Logic Unit

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

CS 5803 Introduction to High Performance Computer Architecture: Arithmetic Logic Unit. A.R. Hurson 323 CS Building, Missouri S&T

NUMBER OPERATIONS. Mahdi Nazm Bojnordi. CS/ECE 3810: Computer Organization. Assistant Professor School of Computing University of Utah

An instruction set processor consist of two important units: Data Processing Unit (DataPath) Program Control Unit

CS 64 Week 1 Lecture 1. Kyle Dewey

UNIT-III COMPUTER ARTHIMETIC

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

Tailoring the 32-Bit ALU to MIPS

Lecture 2: Number Systems

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: The MIPS ISA (P&H ) Consulting hours. Milestone #1 (due 1/26)

Chapter 3. Arithmetic Text: P&H rev

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

ECE232: Hardware Organization and Design

Chapter 3 Arithmetic for Computers. ELEC 5200/ From P-H slides

Chapter 3: Arithmetic for Computers

CS/COE 0447 Example Problems for Exam 2 Spring 2011

CSE A215 Assembly Language Programming for Engineers

Integer Multiplication and Division

Math in MIPS. Subtracting a binary number from another binary number also bears an uncanny resemblance to the way it s done in decimal.

Computer Arithmetic Ch 8

Review of Last lecture. Review ALU Design. Designing a Multiplier Shifter Design Review. Booth s algorithm. Today s Outline

Computer Arithmetic Ch 8

Positional notation Ch Conversions between Decimal and Binary. /continued. Binary to Decimal

Numbering systems. Dr Abu Arqoub

Week 7: Assignment Solutions

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

Arithmetic and Bitwise Operations on Binary Data

Chapter 1 Review of Number Systems

MC1601 Computer Organization

UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS

Lecture 12 Integers. Computer and Network Security 19th of December Computer Science and Engineering Department

T02 Tutorial Slides for Week 2

ECE331: Hardware Organization and Design

Finite State Machine with Datapath

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

COMPUTER ORGANIZATION AND DESIGN

High Radix Division Ivor Page 1

Mnem. Meaning Format Operation Flags affected ADD Addition ADD D,S (D) (S)+(D) (CF) Carry ADC Add with ADC D,C (D) (S)+(D)+(CF) O,S,Z,A,P,C

Chapter 3: part 3 Binary Subtraction

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

A complement number system is used to represent positive and negative integers. A complement number system is based on a fixed length representation

Least Common Multiple (LCM)

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

EE292: Fundamentals of ECE

Division. Reverse Box Method

Integer Arithmetic. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

P( Hit 2nd ) = P( Hit 2nd Miss 1st )P( Miss 1st ) = (1/15)(15/16) = 1/16. P( Hit 3rd ) = (1/14) * P( Miss 2nd and 1st ) = (1/14)(14/15)(15/16) = 1/16

Chapter 2. Positional number systems. 2.1 Signed number representations Signed magnitude

Number Systems. Both numbers are positive

T insn-mem T regfile T ALU T data-mem T regfile

Arithmetic Operations on Binary Numbers

VTU NOTES QUESTION PAPERS NEWS RESULTS FORUMS Arithmetic (a) The four possible cases Carry (b) Truth table x y

Review: MULTIPLY HARDWARE Version 1. ECE4680 Computer Organization & Architecture. Divide, Floating Point, Pentium Bug

Fixed-Point Math and Other Optimizations

Semester Transition Point. EE 109 Unit 11 Binary Arithmetic. Binary Arithmetic ARITHMETIC

MACHINE LEVEL REPRESENTATION OF DATA

(+A) + ( B) + (A B) (B A) + (A B) ( A) + (+ B) (A B) + (B A) + (A B) (+ A) (+ B) + (A - B) (B A) + (A B) ( A) ( B) (A B) + (B A) + (A B)

Logic Design: Part 2

MIPS Integer ALU Requirements

Chapter 10 - Computer Arithmetic

Expression and Operator

Divide: Paper & Pencil CS152. Computer Architecture and Engineering Lecture 7. Divide, Floating Point, Pentium Bug. DIVIDE HARDWARE Version 1

Transcription:

1 ECE 368 CAD Based Logic Design Instructor: Shantanu Dutt Department of Electrical and Computer Engineering University of Illinois at Chicago Lecture Notes # 6 COMPUTER ARITHMETIC: Iterative Division Techniques c Shantanu Dutt, UIC 1

and an integer remainder Integer FP division: Given 2 integers the dividend and the divisor, Integer division: Given 2 integers want to obtain an integer quotient the dividend and the divisor, we, s.t. Binary division is much simpler, since the next quotient bit is either a 0 or 1 depending on whether the partial remainder is less than or greater than/equal to the divisor, respectively Radix division is essentially a trial-and-error process, in which the next quotient bit is chosen from Example: Division Basics 2

s.t. c Shantanu Dutt, UIC 3 We will talk about division of unsigned numbers first we want to obtain a floating-point (FP) or real quotient 3

4 Division SHR-Divisor Method Start subtraction offrom left most position of ; SHR for next subtraction every iteration Pencil-paper division example: c Shantanu Dutt, UIC 4

5 Division SHL-Partial-Remainder Method Instead of shifting the divisor right by 1 bit, the partial remainder can be shifted left by one bit Example: c Shantanu Dutt, UIC 5

c Shantanu Dutt, UIC 6 Note that is stored as a 4-bit # (0010) in the computer. The type of manual adjustment done in the above example of converting 4-bit subtractions into 2-bit ones (in general, -bit ones, where ) is not possible in a computer -bit subtractions to Another Example: Some higher order bits of the -bit divisor are 0s: Division Handling with 0 s in High-Order Bits 6

c Shantanu Dutt, UIC 7 Example: division for Method 1: Shift steps for an integer to the left by bits (until its MSB is a 1), do the (more steps for a FP ) Two ways to tackle the problem: Problem with having higher order bits as 0s: Division Handling with 0 s in High-Order Bits (contd.) 7

8 Division Handling with 0 s in High-Order Bits (contd.) Problem with having higher order bits as 0s: Method 2: Augment to the left by division for steps for an integer Example: bits that are all 0s. Perform more steps for a FP and This is the type of division algorithm used in a computer c Shantanu Dutt, UIC 8

and Thus need an extra bit in AC is to catch a 1 out of AC when the MSBs of the partial remainder are both 1s but Example for needing an extra bit to the left of the dividend to catch a 1 on a shift left (required when originally has more bits than (e.g., dividing an 8-bit number by a 6-bit one): Division A Caveat 9

10 The adder/subtracter thus also needs to be bits; see block diagram of divider given next. NOTE: The extra bit is never required when both and have the same number of bits to start with (this does not count the added later to ). bits that are c Shantanu Dutt, UIC 10

and 3. Perform ) 2. Shift AC-Q-T register combination left 1 bit (initially, this has the effect of adding on 0s to the left of the dividend) (subtract divisor from -bit partial remainder 1. To compute, store in the register, in the register and 0 in AC (Accumulator), and 0 in (holds the quotient bit before the shift left). Note that is an -bit register, while are -bit ones, with 0 s initially in their th bits. Repeat the following steps times: Serial division for 16 bit unsigned numbers 17 From Control Unit C out 17 bit Add/Sub 1 1 Accumulator Q M 1 17 17 XOR 17 Dividend D T Divisor V From Control Unit Simple restoring division algorithm: Division Complete Algorithm # 1 11

4. If the result is negative, set c Shantanu Dutt, UIC 12 NOTE: Notice similarity between hardware for A&S multiplication and division. The same hardware with additional control can be used for both purposes., otherwise set 5. If the result of step 2 is negative, restore the old value of AC by doing 12

This works because: Let be the contents of register AC-Q at the beginning for to do steps 2-4: 2. Shift AC-Q-T register combination left 1 bit 3. If current Q[0] is 0 and this is not the 1st iteration then perform else perform 4. If the result is negative, set, otherwise set endfor; 5. if /* final restoration to get the correct remainder */ 6. Shift Q-T register combination left 1 bit /* get final quotient bit in Q */ 1. Same initialization as in restoring division. Non-restoring division algorithm: An extra addition step is needed in the previous algorithm to restore the old value of when the result of a subtraction is negative. This step is eliminated in non-restoring division: Division Complete Algorithm # 2 13

c Shantanu Dutt, UIC 14 bit of the quotient. Thus non-restoring division will give us the same quotient as restoring division, though faster. Thus non-restoring division works correctly since restoring division is correct. -ve, we do not restore but in the th iteration we perform a SHL to get and then add to get. This gives us the same result in AC-Q as in restoring division, and based on this same result we determine the next of the th iteration. After a SHL and subtraction, is computed. In restoring division: If this result ( ) is -ve, restoration and then another subtraction in the next iteration gives us. In non-restoring division: If the result of the previous iteration ( ) is 14

15 Two s Complement Division (contd.) There are no simple division algorithms for 2 s complement #s unlike the case for multiplication This is primarily due to the difficulty in selecting the quotient bits in such a way that it has tthe correct +ve or -ve 2 s complement representation Thus the approach generally followed is to negate a -ve or, perform division and then negate the quotient if only one of or was -ve A more efficient division algorithm for 2 s complement #s is the SRT method (for Sweeney, Robertson and Tocher, its inventors); see Ref. text # 1 (Hennesey and Patterson) for this algorithm if interested c Shantanu Dutt, UIC 15