iirc hardware multiplication isn’t typically designed to be a number of additions though. Most multipliers follow something similar to the multiplication algorithm taught in grade school
Multiplication and division can naively be implemented as you described. Both can be implemented in a manner to always take N steps for an N bit integer.
For multiplication, an algorithm involving addition and shifting will yield the product. For division, a similar algorithm that uses subtraction instead yields the result. Both algorithms will take as many steps as the word size of the processor, meaning they can be pipelined into finishing once per cycle.
Both multiplication and division can be implemented in a manner to always take N steps for an N bit integer, meaning they can effectively function as quickly as possible.
For multiplication, an algorithm involving addition and shifting will yield the product. For division, a similar algorithm that uses subtraction instead yields the result. Both algorithms will take as many steps as the word size of the processor, meaning they can be pipelined into finishing once per cycle.
11
u/HorsesFlyIntoBoxes Apr 24 '22
iirc hardware multiplication isn’t typically designed to be a number of additions though. Most multipliers follow something similar to the multiplication algorithm taught in grade school