0% found this document useful (0 votes)
36 views

CD Module4 Part2

The document discusses integer division algorithms, including restoring and non-restoring division. It provides examples of how restoring division works step-by-step using binary numbers 11 and 3. Non-restoring division is also outlined. Additionally, the document explains the IEEE 32-bit floating point format and provides an example of converting the decimal number 97/128 into binary IEEE 32-bit format.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

CD Module4 Part2

The document discusses integer division algorithms, including restoring and non-restoring division. It provides examples of how restoring division works step-by-step using binary numbers 11 and 3. Non-restoring division is also outlined. Additionally, the document explains the IEEE 32-bit floating point format and provides an example of converting the decimal number 97/128 into binary IEEE 32-bit format.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

YCS4001: Computer

Organization & Architecture


Module 4: Arithmetic Logic
Unit Design (Part 2)

Soumya Majumdar
Integer division
● Division algorithm provides a quotient and a remainder when we divide two number.
● Two types: Slow algorithm and fast algorithm
● Restoring division: slow algorithm
● Non-restoring division: fast algorithm
Restoring division

Restoring division
● Step-1: First the registers are initialized with corresponding values (Q = Dividend, M = Divisor,
A = 0, n = number of bits in dividend)
● Step-2: Then the content of register A and Q is shifted left as if they are a single unit
● Step-3: Then content of register M is subtracted from A and result is stored in A
● Step-4: Then the most significant bit of the A is checked if it is 0 the least significant bit of Q is
set to 1 otherwise if it is 1 the least significant bit of Q is set to 0 and value of register A is
restored i.e the value of A before the subtraction with M
● Step-5: The value of counter n is decremented
● Step-6: If the value of n becomes zero we get of the loop otherwise we repeat from step 2
● Step-7: Finally, the register Q contain the quotient and A contain remainder
Restoring division
Example: Perform Division Restoring Algorithm

Dividend = 11

Divisor = 3
Restoring division
n M A Q Operation

4 00011 00000 1011 initialize

00011 00001 011_ shift left AQ

00011 11110 011_ A=A-M

Q[0]=0 And
00011 00001 0110
restore A

3 00011 00010 110_ shift left AQ

00011 11111 110_ A=A-M

00011 00010 1100 Q[0]=0


Restoring division
n M A Q Operation

2 00011 00101 100_ shift left AQ

00011 00010 100_ A=A-M

00011 00010 1001 Q[0]=1

1 00011 00101 001_ shift left AQ

00011 00010 001_ A=A-M

00011 00010 0011 Q[0]=1


Non-Restoring division

Non-Restoring division
● Step-1: First the registers are initialized with corresponding values (Q = Dividend, M = Divisor, A = 0,
n = number of bits in dividend)
● Step-2: Check the sign bit of register A
● Step-3: If it is 1 shift left content of AQ and perform A = A+M, otherwise shift left AQ and perform A =
A-M (means add 2’s complement of M to A and store it to A)
● Step-4: Again the sign bit of register A
● Step-5: If sign bit is 1 Q[0] become 0 otherwise Q[0] become 1 (Q[0] means least significant bit of
register Q)
● Step-6: Decrements value of N by 1
● Step-7: If N is not equal to zero go to Step 2 otherwise go to next step
● Step-8: If sign bit of A is 1 then perform A = A+M
● Step-9: Register Q contains quotient and A contains remainder.
IEEE Floating Point Format
● IEEE 754 standard for binary floating point arithmetic defines what is commonly referred to as
“IEEE floating point”.
● Following is 32-bit IEEE floating point format

N = 1.F × 2E-127
Where N = floating point number, F = fractional part in binary notation, E = exponent in bias

127 representation

● In the 32 bit IEEE format, 1 bit is allocated as the sign bit, the next 8 bits are allocated as the

exponent field, and the last 23 bits are the fractional parts of the normalized number.
IEEE Floating Point Format
Convert 9 97/128 into a IEEE 32 bit format.
IEEE Floating Point Format
1. Convert to base 2.

1001.1100001

2. Shift number to the form of 1.FFFFFF × 2E:

1.0011100001 × 23

3. Add 127 (excess 127 code) to exponent field and convert to binary:

3 + 127 = 130 = 10000010

4. Determine the sign bit. If a negative number, set to 1. Otherwise set to 0.


IEEE Floating Point Format
5. Now put the numbers together, using only the fractional part of the number represented by step 2

above (remove the 1. preceding the fractional part):

0 10000010 00111000010000000000000

in hex representation, this is

0100 0001 0001 1100 0010 0000 0000 0000

or in Hex format

411C2000

You might also like