
1. Re: signed multiplication
user_14586677 Dec 2, 2014 4:40 AM (in response to soha.gh)Looks like result sign extended into 32 bits.
Regards, Dana.

2. Re: signed multiplication
soha.gh Dec 2, 2014 10:01 AM (in response to soha.gh)all of the 32 bits are incorrect when signed multiply is execute

3. Re: signed multiplication
user_1377889 Dec 2, 2014 10:46 AM (in response to soha.gh)But you are aware of the fact that the result represents a number between 1 and 1 ?
Bob

4. Re: signed multiplication
user_1377889 Dec 2, 2014 1:44 PM (in response to soha.gh)A 24bit number has got six (6) hex digits and not only five (5) as your input to the filter is. The sign expansion will treat all your numbers as positive.
Bob

5. Re: signed multiplication
soha.gh Dec 2, 2014 10:36 PM (in response to soha.gh)yes, the 24'th bit is the sign bit
my first input is(0x23456) and my firs coefficient (in the end of my assembly code) is 0xcff001(negative nymber) and defined by dw 0xcff001 but the Mac output in the 10'th cycle is FFFF2C19 (this is incorrect result)

6. Re: signed multiplication
soha.gh Dec 2, 2014 10:40 PM (in response to soha.gh)yes,the 24'th bit is the sign bit
my first input in bus1 is 0x23456(positive number) and my coefficient is 0xcff001(negative number) and defined in the end of my assembly code
but the mac output in the 10'th cycle is FFFF2C19 and that is incorrect

7. Re: signed multiplication
user_1377889 Dec 3, 2014 3:39 AM (in response to soha.gh)Since the digital filter in the PSoC is widely used and working without complains you should concentrate on interpreting the results you have got. In the datasheet on pg. 22 is described that the integer values have to be interpreted as values between 0.99999 and +0.99999 which in turn implies a scaling when two of the numbers are multiplied. Adding or subtracting works without scaling since the denominator is the same for both summands.
I calculated the numbers you provided using windows calculator (set to programmer's mode) and I got as result 0xffff2c1a.
Do not forget that you have to observe
1. expanding to qwords including the sign
2. scaling the result by dividing by 0x7fffff
Bob

8. Re: signed multiplication
soha.gh Dec 3, 2014 5:21 AM (in response to soha.gh)I can't understand the result of multiply is here and after deviding the result is 394c5
how you can get thjat answer?

9. Re: signed multiplication
user_1377889 Dec 3, 2014 5:49 AM (in response to soha.gh)0x23456 * 0xFFFFFFFFFFCFF001 = FFFFFF960C9CD456
FFFFFF960C9CD456 / 0x7FFFFF = FFFFFFFFFFFF2C1A
OK?
Bob

10. Re: signed multiplication
soha.gh Dec 3, 2014 6:04 AM (in response to soha.gh)yes,it's Ok
but my number is cff001 not 0xFFFFFFFFFFCFF001
I want to calculate the result of 0x23456*0xcff001

11. Re: signed multiplication
user_1377889 Dec 3, 2014 6:30 AM (in response to soha.gh)0xcff001 has to be sign extended to get a qword since bit 23 is on it is a negative number. and 0xfffffcff001 is quite the same.
Bob

12. Re: signed multiplication
soha.gh Dec 4, 2014 1:25 AM (in response to soha.gh)Thanks Bob,
Your answer was very helpfull for me
I have one question:
when I want to multiply(in decima) 5*5=25 what should i do?
I know that the DFB assmes a point after MSB, then I shoul put 0x805000 in Bus1 and 0x805000 in coefficient memory in my assembly code,
result of multiply is 3FB019000000(0x19=25,but what is teh 3FB in the first?) .
after dividing 3FB019000000 by 7FFFFF the result is 7F6032,this is the same as the simulator result but I want to obtain the real result of multiplicatin
I want to implement the algorithm with many filters,These filters have fixed coefficient for example one of this filter's cosfficient is 0.1294 0.2241 0.8365 0.4830
how I can get this coefficent anf achive the result of multiplication

13. Re: signed multiplication
user_1377889 Dec 4, 2014 1:36 AM (in response to soha.gh)You get the coefficients by multiplying your number 0.1294 by 0x7FFFFF which is
0.1294 * 8388607 = 1085486 (rounded) = 0x10902E
Negation delivers
 0x10902E = 0xEF6FD2
Bob

14. Re: signed multiplication
soha.gh Dec 8, 2014 10:22 AM (in response to soha.gh)Thank you so much Bob,
your help was great for me.I multiplied any coefficient by 7FFFFF and my output is correct for lowpass filtering.
my algorithm is here. I have been sucessed in lowpass filtering in any stage but I can't get the high pass filter the same as the matlab's result. the g is lowpass and the h is high pass and I have any filter coefficient from matlab toolbox
I just get the filter coefficient and then MACC with any input.
for lowpass filterin I get the correct result but for highpass I didn't.
for example my highpass filter's coefficient is 0.4830 0.8365 0.2241 0.1294
I don't know what is incorrect in my code