Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

Unit 2: Booth's Multiplication & Division Algorithms

Lesson 6 of 17 in the free Logical Organization of Computer-II notes on Siksha Sarovar, written by Rohit Jangra.

2.1 Why Booth's Algorithm?

Naive shift-and-add multiplication adds the multiplicand once per 1-bit of the multiplier and cannot handle negative numbers directly. Booth's algorithm fixes both: it works natively in 2's complement, and it recodes runs of 1s — the run 0111 (7) becomes 1000 − 0001 (8 − 1), replacing three additions with one add and one subtract. Hardware: registers A (accumulator), Q (multiplier), an extra bit Q₋₁, register M (multiplicand), and an arithmetic shift right (ASR) of the combined A,Q,Q₋₁ — ASR preserves the sign bit of A, which is what keeps 2's complement semantics intact.

Decision rule (inspect Q₀Q₋₁ each cycle):

Q₀ Q₋₁MeaningAction before shifting
0 0 / 1 1middle of a runnothing
1 0start of a run of 1sA ← A − M
0 1end of a run of 1sA ← A + M

Then ASR(A, Q, Q₋₁); repeat n times for n-bit operands.

2.2 Full Worked Example: 7 × (−3), 4 Bits

M = 0111 (7), so −M = 1001. Q = 1101 (−3). Initially A = 0000, Q₋₁ = 0, count = 4.

CycleQ₀Q₋₁OperationAQQ₋₁
init000011010
11 0A ← A − M = 1001; then ASR110011101
20 1A ← A + M = 1100 + 0111 = 0011; ASR000111110
31 0A ← A − M = 0001 + 1001 = 1010; ASR110101111
41 1shift only; ASR111010111

Result = A,Q = 1110 1011. Check: invert → 0001 0100, +1 → 0001 0101 = 21, so the product is −21 = 7 × (−3). ✓

Traps that cost marks: (1) the shift is arithmetic — A's sign bit is copied, not zero-filled; (2) carries out of A during A ± M are discarded; (3) exactly n cycles, even when the last action is "shift only"; (4) Q₋₁ starts at 0.

2.3 Restoring Division

Setup for n-bit unsigned division: A = 0 (partial remainder), Q = dividend, M = divisor. Repeat n times: shift AQ left 1; A ← A − M; if A < 0 (sign bit 1) → restore A ← A + M and set Q₀ = 0, else Q₀ = 1. After n steps Q = quotient, A = remainder.

Worked: 7 ÷ 3 (Q = 0111, M = 0011, 4 cycles). Subtraction done as A + (−M), −M = 1101.

StepAfter SHL (A : Q)A − MDecisionAQ
10000 : 111_1101 (neg)restore, Q₀=000001110
20001 : 110_1110 (neg)restore, Q₀=000011100
30011 : 100_0000 (≥ 0)keep, Q₀=100001001
40001 : 001_1110 (neg)restore, Q₀=000010010

Quotient Q = 0010 = 2, remainder A = 0001 = 1. Indeed 7 = 3×2 + 1. ✓

2.4 Non-Restoring Division

Restoring wastes an addition whenever the trial subtraction fails. Non-restoring merges the restore with the next step:

  • If A ≥ 0: shift AQ left, then A ← A − M.
  • If A < 0: shift AQ left, then A ← A + M (instead of restore-then-subtract).
  • After each operation: Q₀ = 1 if A ≥ 0, else Q₀ = 0.
  • Final correction: if A ends negative, A ← A + M to fix the remainder.

Why it works: restoring then shifting then subtracting computes 2(A + M) − M = 2A + M — exactly what "shift then add M" does in one operation. Result: one add/sub per cycle guaranteed, versus up to two for restoring.

PropertyRestoringNon-restoring
Ops per iteration1 or 2 (sub + possible restore)exactly 1
Final correctionneverif remainder negative
Control logicsimplerslightly more complex

🎯 Exam Focus

  1. Multiply (−7) × 3 using Booth's algorithm with 4-bit operands; show the full A/Q/Q₋₁ table.
  2. Why does Booth's algorithm use arithmetic shift right instead of logical shift right?
  3. Explain how Booth recoding turns the multiplier 0111 into fewer ALU operations.
  4. Divide 13 by 4 using the restoring algorithm (A, Q, M registers); show every step.
  5. Derive why non-restoring division's "shift and add" is equivalent to restore-shift-subtract.
  6. Compare restoring and non-restoring division on operations per cycle and final correction.