Sub topic 12
Hardware Multiplication, Division, and Datapath Transfers
Assume you know binary arithmetic, two’s complement numbers, registers, memory, and basic logic circuits. This chapter focuses on how a processor performs multiplication and division through repeated additions, subtractions, and shifts.
Hardware multiplication and division
A simple hardware multiplier uses three main registers:
- Multiplicand register (M): stores the value being added.
- Multiplier register (Q): stores the value whose bits are examined.
- Accumulator (A): stores the partial product.
For each multiplier bit, the circuit checks the least significant bit of Q. If it is 1, the multiplicand is added to A. Then the combined A:Q pair shifts right. The process repeats once for every bit.
For example, to multiply an unsigned value by a four-bit multiplier:
- Set
Ato zero. - If
Q0 = 1, computeA <- A + M. - Shift the combined pair
A:Qright. - Repeat steps 2 and 3 for four cycles.
- The final
A:Qpair is the product.
The shift gives the next multiplier bit and doubles the place value of the multiplicand for the next cycle. Signed multiplication commonly uses Booth’s algorithm, which examines adjacent multiplier bits and can replace runs of additions with additions and subtractions.
Division uses a similar repeated-operation approach. A restoring divider keeps a partial remainder in A, a dividend in Q, and a divisor in M. Each cycle shifts the partial remainder and the next dividend bit into position, subtracts the divisor, and tests the result.
- If the subtraction is nonnegative, the quotient bit becomes
1. - If the subtraction is negative, the circuit restores the previous remainder and sets the quotient bit to
0.
After all cycles, Q contains the quotient and A contains the remainder.
Datapath and register transfer notation
A datapath is the collection of registers, buses, multiplexers, and arithmetic circuits that move and transform data. A register transfer describes one such movement using symbolic notation.
For a multiplication cycle, a simplified datapath might perform:
A <- A + M
A:Q <- shr(A:Q)
count <- count - 1The arrow means “load the destination with the value on the right.” These transfers occur only when the control unit activates the required signals. A register does not change merely because a value is present on a bus.
A datapath for multiplication or division usually includes an arithmetic logic unit, a combined shift path, a cycle counter, and condition logic. The control unit selects the operation for each clock cycle.
The same notation helps trace instructions such as R1 <- R2 + R3: the control unit enables the source registers onto the appropriate paths, configures the ALU for addition, and enables loading of R1.
Exercise
In an unsigned restoring divider, what happens when the trial subtraction of the divisor from the partial remainder is negative?
Show answer
The previous remainder is restored, and the current quotient bit is set to 0.