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:

    In the United States all business not transacted over the telephone is accomplished in conjunction with alcohol or food, often under conditions of advanced intoxication. This is a fact of the utmost importance for the visitor of limited funds ... for it means that the most expensive restaurants are, with rare exceptions, the worst.
    John Kenneth Galbraith (b. 1908)

    In 1869 he started his work for temperance instigated by three drunken men who came to his home with a paper signed by a saloonkeeper and his patrons on which was written “For God’s sake organize a temperance society.”
    —Federal Writers’ Project Of The Wor, U.S. public relief program (1935-1943)