Binary Multiplier - More Advanced Approach: Signed Integers

More Advanced Approach: Signed Integers

If b had been a signed integer instead of an unsigned integer, then the partial products would need to have been sign-extended up to the width of the product before summing. If a had been a signed integer, then partial product p7 would need to be subtracted from the final sum, rather than added to it.

The above array multiplier can be modified to support two's complement notation signed numbers by inverting several of the product terms and inserting a one to the left of the first partial product term:

1 ~p0 p0 p0 p0 p0 p0 p0 p0 ~p1 +p1 +p1 +p1 +p1 +p1 +p1 +p1 0 ~p2 +p2 +p2 +p2 +p2 +p2 +p2 +p2 0 0 ~p3 +p3 +p3 +p3 +p3 +p3 +p3 +p3 0 0 0 ~p4 +p4 +p4 +p4 +p4 +p4 +p4 +p4 0 0 0 0 ~p5 +p5 +p5 +p5 +p5 +p5 +p5 +p5 0 0 0 0 0 ~p6 +p6 +p6 +p6 +p6 +p6 +p6 +p6 0 0 0 0 0 0 1 +p7 ~p7 ~p7 ~p7 ~p7 ~p7 ~p7 ~p7 0 0 0 0 0 0 0 ------------------------------------------------------------------------------------------------------------ P P P P P P P P P P P P P P P P

Where ~p represents the complement (opposite value) of p.

There are a lot of simplifications in the bit array above that are not shown and are not obvious. The sequences of one complemented bit followed by noncomplemented bits are implementing a two's complement trick to avoid sign extension. The sequence of p7 (noncomplemented bit followed by all complemented bits) is because we're subtracting this term so they were all negated to start out with (and a 1 was added in the least significant position). For both types of sequences, the last bit is flipped and an implicit -1 should be added directly below the MSB. When the +1 from the two's complement negation for p7 in bit position 0 (LSB) and all the -1's in bit columns 7 through 14 (where each of the MSBs are located) are added together, they can be simplified to the single 1 that "magically" is floating out to the left. For an explanation and proof of why flipping the MSB saves us the sign extension, see a computer arithmetic book.

Read more about this topic:  Binary Multiplier

Famous quotes containing the words advanced and/or signed:

    Only conservatives believe that subversion is still being carried on in the arts and that society is being shaken by it.... Advanced art today is no longer a cause—it contains no moral imperative. There is no virtue in clinging to principles and standards, no vice in selling or in selling out.
    Harold Rosenberg (1906–1978)

    You watched and you saw what happened and in the accumulation of episodes you saw the pattern: Daddy ruled the roost, called the shots, made the money, made the decisions, so you signed up on his side, and fifteen years later when the women’s movement came along with its incendiary manifestos telling you to avoid marriage and motherhood, it was as if somebody put a match to a pile of dry kindling.
    Anne Taylor Fleming (20th century)