Docsity

Computer Achitecture and org - Fixed point division - Saritha, Study notes of Computer Architecture and Organization

Partial preview of the text

Download Computer Achitecture and org - Fixed point division - Saritha and more Study notes Computer Architecture and Organization in PDF only on Docsity!

Binary Division

Example (Paper and Pencil Method)

Divisor: B = 1 0 0 0 1 (^) 0 1 1 1 0 0 0 0 0 0

0 1 1 1 0 0 1 1 1 0 0 1 0 0 0 1 0 1 0 1 1 0 1 0 0 0 1 0 0 1 0 1 0 0 0 1 0 1 0 0 1 0 0 0 1 0 0 0 1 1 0

Quotient = Q Dividend = A 5 bits of A < B, quotient has 5 bits 6 bits of A ≥ B Shift right B and subtract; enter 1 in Q 6 bits of remainder ≥ B

Remainder < B, enter 0 in Q; shift right B Remainder ≥ B

Remainder < B, enter 0 in Q

Shift right B and subtract; enter 1 in Q

Shift right B and subtract; enter 1 in Q

Final remainder: 000110

Divisor B = 10001 B + 1 = 01111

Comment E A Q SC 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 1 0 1 1 0 1 0 1 1 0 0 0 0 1 1 0 1 1 0 0 0 0 1 0 0 1 1 1 1 0 0 1 0 1 0 0 1 0 1 0 0 0 1 1 0 1 0 1 0 0 0 1 1 0 0 1 1 1 1 1 1 0 0 1 0 0 1 1 0 1 0 0 0 1

Dividend: Shl EAQ Add B + 1 E = 1 Set Qn = 1 Shl EAQ Add B + 1 E = 1 Set Qn = 1 Shl EAQ Add B + 1 E = 0, leave Qn = 0 Add B

Signed – Magnitude Division

Divisor B = 10001 B + 1 = 01111

Comment E A Q SC

Shl EAQ Add B + 1 E = 0, leave Qn = 0 Add B Restore remainder Neglect E Remainder in A: Quotient in Q

Restore remainder Shl EAQ Add B + 1 E = 1 Set Qn = 1 (^1)

Example: (7)/(-3) 2’s complement division

Divisor M = 1101 = (-3) M + 1 = 0011

Comment A Q 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 1 1 0 1

0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 0

SC

Initial value Shl AQ Add

Restore Shl AQ

Sign of A before and after the operation are Sign of A and M are different so, A ← A + M different, so restore the value of A

Add 1 1 0 1 1 1 1 0

Restore Shl AQ Add

Set Q 0 = 1 Shl AQ Add

Restore

Example: (7)/(-3) 2’s complement division

Divisor M = 1101 = (-3) M + 1 = 0011

Comment A Q SC

Sign of A and M are different so, A ← A + M

Sign of A before and after the operation are same, so set Q 0 = 1

Sign of A before and after the operation are different, so restore the value of A

Signs of divisor and dividend are different Answer: quotient = 1110 (-2), remainder = 0001 (+1)

Procedure for square root - Similar to division restoring method

negative 00 01 10 00 01 10 01 00 01 10 01

Remainder = 00 00 0

q 1 q 2 1 1 0 1

q 3 q 4 = Q = 13 = A = 169 Subtract first test value 01 Answer positive; let q 1 = 1 Bring down next pair Subtract second test value 0q 101 Answer positive; let q 2 = 1 Bring down next pair Subtract third test value 00q 1 q 201 Answer negative; let q 3 = 0 Restore partial remainder Bring down next pair Subtract fourth test value 000q 1 q 2 q 301 Answer positive (zero); let q 4 = 1

Problems

• Perform signed-magnitude division and

two’s complement division on 139 and -

• Perform signed-magnitude division and

two’s complement division on 328 and 35

• Find the square root of 256

• Find the square root of 39