Page 374 - Analog and Digital Filter Design
P. 374
Introduction to Digital Filters 3
By repeated additions we have:
001 1,111 1 (1 x 3Fh)
+ 1111,1100 (100h x 3Fh)
= 1,001 1,101 1
+ 11,1111.0000 (1,0000h x 3Fh)
= 101,0010,1011
+ 11 11,1100,0000 (100,OOOOh x 3Fh)
-
- 1,0100,1110,101 1
- 14EBh (This is correct)
-
Repeating the process with one negative number results in a wrong answer. For
example, multiplying 99h x 3Dh gives an answer of 24731, which is wrong. The
correct answer should be 99h x 3Dh = E775h. This is explained by the follow-
ing sequence of calculations. -103 x 61 = -6283 or -188Bh. Converting -188Bh
into a two’s complement form we have FFFFh - 188Bh + Ih = E775h, as
required.
How are negative numbers handled? DSP devices perform two’s complement
multiplication by sign-extending negative numbers. Sign-extending means
filling higher-order bits with logic 1 s. I will use the two numbers given in the
previous example, 99h and 3Dh. Taking 99h and sign-extending it gives:
1111,1111,1001,1001 in binary. In hexadecimal this is FF99h. Multiplying
FF99h x 3Dh results in an answer in the 32-bit accumulator that is 3CE775h.
Since this number extends beyond the required 16-bit number format, the eight
most significant bits (= 3C) fall off the end. The answer is then E775h, as
expected.
If both numbers are negative, multiplying them together produces a positive
answer. However, simply multiplying two negative two’s-complement numbers
together does not give the right answer. Neither does sign-extending both
numbers before multiplying.
For example, suppose two simple negative numbers are multiplied: -5 x -4 = 20.
Let #1 = -5 and #2 = -4. The two’s complement of these are #1’ and #2’. respec-
tively. If one number #2’ is sign-extended and then 2“ x #2 is added, the correct
result is obtained. Similarly, #1’ could have been sign-extended and then 2“ x #I
would need to be added.
Expressing these as +bit two’s complement numbers with an %bit
accumulator:

