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:

    How oft when men are at the point of death
    Have they been merry! which their keepers call
    A lightning before death: O, how may I
    Call this a lightning? O my love! my wife!
    Death, that hath sucked the honey of thy breath,
    Hath had no power yet upon thy beauty:
    Thou art not conquered; beauty’s ensign yet
    Is crimson in thy lips and in thy cheeks,
    And death’s pale flag is not advanced there.
    William Shakespeare (1564–1616)

    I remember a very important lesson that my father gave me when I was twelve or thirteen. He said, “You know, today I welded a perfect seam and I signed my name to it.” And I said, “But, Daddy, no one’s going to see it!” And he said, “Yeah, but I know it’s there.” So when I was working in kitchens, I did good work.
    Toni Morrison (b. 1931)