Hi guys,
There's actually a couple of possible answers to this problem.
If x and y are both 8-bit signed integers, then the range for x and y is -128 (1000_0000b) to 127 (0111_1111b), so the largest possible value of x^2 or y^2 is 128^2 = 16384 (4000h = 0100_0000_0000_0000b) which requires 16-bits to represent. If you then add x^2 and y^2, you need an extra bit to represent the sum, so 17-bits is required.
If however, you limit the input range to symmetric signed integers, i.e., inputs are limited -127 to 127 (by converting any -128 codes into -127), then the largest possible value for x^2 or y^2 is 127^2 = 16129 (3F01h = 0011_1111_0000_0001h), which is still a 16-bit number, but the MSB (the second binary digit, since the first is the sign) is not set. This means that you can perform the accumulate x^2 + y^2 and not require 17-bits for the sum.
Another reason for using symmetric integers is that you often want to flip the sign on data, and flipping the sign on -128 gives 128, which requires 1-bit more to represent, i.e., 9-bits.
These types of DSP tricks are discussed here:
http://www.ovro.caltech.edu/~dwh/correlator/pdf/esc-320paper_hawkins.pdf (
http://www.ovro.caltech.edu/%7edwh/correlator/pdf/esc-320paper_hawkins.pdf)
Cheers,
Dave