Docsity

CAD-Based Digital Design - Computer Architecture - Notes | ECE 368, Study notes of Electrical and Electronics Engineering

Partial preview of the text

Download CAD-Based Digital Design - Computer Architecture - Notes | ECE 368 and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

ECE 368

Instructor: Shantanu Dutt CAD Based Logic Design

Department of Electrical and Computer Engineering

University of Illinois at Chicago

Lecture Notes # 6

Iterative Division TechniquesCOMPUTER ARITHMETIC:

Shantanu Dutt, UIC c

Division – Basics

Radix

^

division is essentially a trial-and-error process, in which the next

quotient bit is chosen from

 Example:

than/equal to the divisor, respectivelyor 1 depending on whether the partial remainder is less than or greater Binary division is much simpler, since the next quotient bit is either a 0

Integer division: Given 2 integers

the dividend and

the divisor, we

want to obtain an integer quotient

and an integer remainder

, s.t.

Integer–FP division: Given 2 integers

the dividend and

the divisor,

Division – SHR-Divisor Method

Start subtraction of

from left most position of

; SHR

for next

subtraction every iteration

 Pencil-paper division example:

Shantanu Dutt, UIC c

Division – SHL-Partial-Remainder Method

 Example:shifted left by one bit Instead of shifting the divisor right by 1 bit, the partial remainder can be

Shantanu Dutt, UIC c

Division – Handling

with 0’s in High-Order Bits (contd.)

Problem with

having higher order bits as 0s:

Method 1: ShiftTwo ways to tackle the problem:

to the left by

 bits (until its MSB is a 1), do the

division for



steps for an integer

(more steps for a FP

Shantanu Dutt, UIC c  Example:

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

bits that are all 0s.

Perform

division for

^ steps for an integer

and more steps for a FP

Shantanu Dutt, UIC c This is the type of division algorithm used in a computer  Example:

The adder/subtracter thus also needs to be

bits; see block diagram

NOTE: The extra bit is never required when both of divider given next.

and

have the same

number

^ of bits to start with (this does not count the

bits that are

added later to

Shantanu Dutt, UIC c

Division – Complete Algorithm # 1

Simple restoring division algorithm:

Accumulator

Q

M

out^ C (^1)

1

1

17 17−bit Add/Sub

Dividend D

Divisor V

XOR

17

17

17

Serial division for 16−bit unsigned numbers

T

From Control Unit From Control Unit

  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

^ and

  are



-bit

ones, with 0’s initially in their



’th bits.

Repeat the following steps

^ times:

  1. Shift AC-Q-T register combination left 1 bit (initially, this has the effect of adding on

0s to the left of the dividend)

  1. Perform

 

 

(subtract divisor from



-bit partial remainder

Division – Complete Algorithm # 2

previous algorithm to restore the old value ofNon-restoring division algorithm: An extra addition step is needed in the

  when the result of a sub-

  1. Same initialization as in restoring division.traction is negative. This step is eliminated in non-restoring division: for

to ^ do steps 2-4:

  1. If current Q[0] is 0 and this is not the 1st iteration2. Shift AC-Q-T register combination left 1 bit then perform

 

 

else perform

 

 

  1. If the result is negative, set



, otherwise set



endfor

  1. if

/* final restoration to get the correct remainder

This works because: Let6. Shift Q-T register combination left 1 bit /* get final quotient bit in Q */

be the contents of register AC-Q at the beginning

of the

^ th iteration. After a SHL and subtraction,

is computed.

In restoring division: If this result (

) is -ve, restoration and then an-

other subtraction in the next iteration gives us



In non-restoring division: If the result of the previous iteration (

) is

-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

Shantanu Dutt, UIC c correctly since restoring division is correct.tient as restoring division, though faster. Thus non-restoring division worksbit of the quotient. Thus non-restoring division will give us the same quo-as in restoring division, and based on this same result we determine the next