Looks like result sign extended into 32 bits.
all of the 32 bits are incorrect when signed multiply is execute
But you are aware of the fact that the result represents a number between -1 and 1 ?
A 24-bit 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.
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)
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
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
I can't understand the result of multiply is here and after deviding the result is 394c5
how you can get thjat answer?
0x23456 * 0xFFFFFFFFFFCFF001 = FFFFFF960C9CD456
FFFFFF960C9CD456 / 0x7FFFFF = FFFFFFFFFFFF2C1A
but my number is cff001 not 0xFFFFFFFFFFCFF001
I want to calculate the result of 0x23456*0xcff001
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.
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
You get the coefficients by multiplying your number 0.1294 by 0x7FFFFF which is
0.1294 * 8388607 = 1085486 (rounded) = 0x10902E
- 0x10902E = 0xEF6FD2
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