Expand description
mul_tree — a word multiply as an aligned tree of adds. The product a · x mod 2^w is the sum of the w partial
products x[i] ? a << i : 0; the tree adds them pairwise, level by level, each add only as wide as the bits it can
still change (a partial product shifted by i is zero below bit i, and nothing above bit w − 1 survives), and
a register can follow any level. On a fabric with carry chains every add is one chain and nothing multiplies; cut
after every level, no stage holds more than one add.
Structs§
- MulTree
- The tree of one multiply: its declarations and combinational assignments, its registers with the value each takes every clock, the signal holding the product after the last level, and the clocks from its operands to it.
Functions§
- mul_
tree - The product
a · x mod 2^widthof thewidth-bit Verilog expressionsaandx, its signals named afterprefix, registered after each levellevelfor whichcut(level)holds (the last level’s sum is the product). - mul_
tree_ levels - The levels of the tree over
widthpartial products: the pairwise adds that bring them down to one.