🔧 Hardware Multiplication Algorithm

Interactive Visualizer for Signed-Magnitude Multiplication

What is Signed-Magnitude Multiplication?

This hardware algorithm performs multiplication of signed-magnitude data in digital computers. Unlike traditional shift-and-add methods that shift the multiplicand left, this approach shifts the partial product to the right, offering advantages in hardware design efficiency.

Hardware Architecture

Bs B register Sequence counter (SC) Complementer and parallel adder As E 0 A register Q register Qs (rightmost bit) Qn

Figure 1: Hardware configuration showing registers and data flow

Key Advantages

  • Efficient hardware implementation with right-shift operations
  • Separate sign and magnitude handling
  • Optimized register usage with combined EAQ register
  • Predictable execution time based on operand size

Algorithm Flowchart

Signed Magnitude Flowchart

Figure 2: Complete flowchart of the hardware multiplication algorithm

Hardware Components

B Register

Multiplicand Holder

Stores the number being multiplied. Remains constant throughout the multiplication process.

Q Register

Multiplier Holder

Initially holds the multiplier. Bits are tested one by one from right to left. Sign bit stored in Qₛ.

A Register

Accumulator

Accumulates the partial product. Initialized to zero and builds the most significant bits of the result.

E Register

1-bit Extension

Holds the carry-out from additions and participates in right-shift operations. Initialized to zero.

SC Counter

Sequence Counter

Tracks iterations. Initialized to n-1 (magnitude bits) and decremented each cycle until reaching zero.

Adder/Complementer

Arithmetic Unit

Performs addition of B to EA when required. Also handles sign bit logic using XOR operation.

Register Configuration

The combined E, A, and Q registers form a (2n+1)-bit register where the final product's magnitude resides. For n-bit operands, the result is a 2n-bit product with a separate sign bit.

Interactive Multiplication Simulator

Current Step:

Click Initialize to begin

E:
A:
Q:
B:
SC:
-

Detailed Algorithm Flow

Initialization Phase

  1. Load multiplicand into B register
  2. Load multiplier into Q register
  3. Calculate product sign: Aₛ ← Qₛ ⊕ Bₛ (XOR of sign bits)
  4. Clear A register to zero
  5. Clear E register to zero
  6. Set sequence counter: SC ← n-1

Iterative Loop (Repeats n-1 times)

Step 1: Check Multiplier Bit (Qₙ)

Condition Action
Qₙ = 1 Add B to EA: EA ← EA + B
Carry goes to E register
Qₙ = 0 No addition performed
EA remains unchanged

Step 2: Right Shift (shr EAQ)

  • E bit shifts into A₁ (MSB of A)
  • Aₙ (LSB of A) shifts into Q₁ (MSB of Q)
  • Qₙ (LSB of Q) shifts out
  • 0 shifts into E

Step 3: Update Counter

  • Decrement SC: SC ← SC - 1
  • If SC ≠ 0: Loop back to Step 1
  • If SC = 0: Terminate

Final Result

When SC reaches zero, the multiplication is complete:

  • A register: Most significant bits of product
  • Q register: Least significant bits of product
  • Aₛ: Sign of the product
  • Product: 2n-bit result in AQ
Start Learning Booth Multiplication