CD Module4 Part2
CD Module4 Part2
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
Q[0]=0 And
00011 00001 0110
restore A
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
1.0011100001 × 23
3. Add 127 (excess 127 code) to exponent field and convert to binary:
0 10000010 00111000010000000000000
or in Hex format
411C2000