Prev: Mysterious gain when designing a butterworth filter in MATLAB
Next: Tutorial on UTM coordinates?
From: Phil Martel on 29 Nov 2009 09:44 "ME1977" <esmaili.majid(a)gmail.com> wrote in message news:G5SdncHg97adgo_WnZ2dnUVZ_oCdnZ2d(a)giganews.com... > > >>"ME1977" <esmaili.majid(a)gmail.com> wrote in message >>news:fpKdncaeHNBH-5PWnZ2dnUVZ_qidnZ2d(a)giganews.com... >>> Hi all >>> I've written an assembly optimized program . it is fir filter . Always > its >>> input is constant but sometimes its output is not correct. >>> I think that all things is correct . >>> can anyone help me? >>> Thank you very much >>> >> >>Start by sending in a string of 0's. If your FIR is N terms long, after > N >>0's the FIR should put out 0's. Then send in a single 1 followed by > (N-1) >>0's. Your output should be the coefficients of the FIR. >> >>If it passes these tests, the FIR basicaly works. Then you just have to > >>make sure that the the inputs you give it do not cause an arithmetic >>overflow. >> >> Best wishes, >> --Phil >> >> >> > > > Hi > I know that FIR basicaly works. I created a loop that iterates 100 times > . > 99 times FIR output is correct and 1 times is incorrect . > I've tested all things , FIR coeff , .... all things were correct . > I didn't find bug . > I have another assembly optimized program . it is a logical function . > sometimes this bug appears in this function . > I guess that it is a random bug . > Thanks Look through your code for an occurrence of 99 and change it to 32767. This should reduce your error rate considerably. :-) Seriously, if your code works some of the time but not all there's something wrong. Ask yourself the following: Is '99' a metaphor? That is, does it work about 99% of the time or does it fail every 100th time? If it fails every 100th time (first time? last time? some particular time in between?), most likely something is not getting set up properly or cleared properly that one time Try looping a larger number of times. If it fails about 1% of the time but somewhat randomly with the same input data each time (I assume the data is considerably longer than 100 samples), then I would look for some kind of external event that purturbs the data or the algorithm. Perhaps some kind of timer interrupt steals too much time and your algorithm can not finish 1% of the time. Perhaps something is clobbering a global value once in a while. Writing optomized assembly is difficult. Can you get the FIR working 100% of the time in a more straightforward assembler or HLL code?
From: Michael Plante on 29 Nov 2009 18:37 >On 29 Nov, 08:13, "ME1977" <esmaili.ma...(a)gmail.com> wrote: >> >"ME1977" <esmaili.ma...(a)gmail.com> wrote in message >> >news:fpKdncaeHNBH-5PWnZ2dnUVZ_qidnZ2d(a)giganews.com... >> >> Hi all >> >> I've written an assembly optimized program . it is fir filter . Always >> its >> >> input is constant but sometimes its output is not correct. >> >> I think that all things is correct . >> >> can anyone help me? >> >> Thank you very much >> >> >Start by sending in a string of 0's. =A0If your FIR is N terms long, aft= >er >> N >> >0's the FIR should put out 0's. =A0Then send in a single 1 followed by >> (N-1) >> >0's. =A0Your output should be the coefficients of the FIR. >> >> >If it passes these tests, the FIR basicaly works. =A0Then you just have = >to >> >make sure that the the inputs you give it do not cause an arithmetic >> >overflow. >> >> > =A0 Best wishes, >> > =A0 --Phil >> >> Hi >> I know that FIR basicaly works. I created a loop that iterates 100 times >> . >> 99 times FIR output is correct and 1 times is incorrect . >> I've tested all things , FIR coeff , .... all things were correct . >> I didn't find bug . >> I have another assembly optimized program . it is a logical function . >> sometimes this bug appears in this function . >> I guess that it is a random bug . > >Then find out how the error behaves. Does it reappear if >you run a failing filter again, using the same data and >coeffcients? If so, debug that particular situation. If not, >look for noise sources and / or hardware errors that influence >internal states of the registers. One other possibility if it's not obviously reproducible (and if it is, but that case is much easier): you need to rule out stray pointers and the like. You didn't say what platform you're using, but there may be tools to help you there. Until you rule violations of the function declaration 'contract' out, some methods of unit testing may give very frustrating results. You might try filling unused memory (assuming this is some embedded platform lacking memory protection; if not, there are easier options) with known values and sweeping it: this might catch a write out of bounds. If improper areas are never modified, you should fill memory with a different value and see if the filter output changes. Put guard bytes around the I/O data and check them. Once you've ruled all that out, set up an automatic comparison against a working C implementation. Keep a notebook and record both the patterns that work and those that don't. I assume you've completely isolated the function in a testbench of some sort, and aren't just trying to integrate it with something insufficiently reproducible as the input, like an ADC. Again, you've given virtually no information, so the answers will be generic.
From: ME1977 on 1 Dec 2009 03:23 >>On 29 Nov, 08:13, "ME1977" <esmaili.ma...(a)gmail.com> wrote: >>> >"ME1977" <esmaili.ma...(a)gmail.com> wrote in message >>> >news:fpKdncaeHNBH-5PWnZ2dnUVZ_qidnZ2d(a)giganews.com... >>> >> Hi all >>> >> I've written an assembly optimized program . it is fir filter . >Always >>> its >>> >> input is constant but sometimes its output is not correct. >>> >> I think that all things is correct . >>> >> can anyone help me? >>> >> Thank you very much >>> >>> >Start by sending in a string of 0's. =A0If your FIR is N terms long, >aft= >>er >>> N >>> >0's the FIR should put out 0's. =A0Then send in a single 1 followed >by >>> (N-1) >>> >0's. =A0Your output should be the coefficients of the FIR. >>> >>> >If it passes these tests, the FIR basicaly works. =A0Then you just >have = >>to >>> >make sure that the the inputs you give it do not cause an arithmetic >>> >overflow. >>> >>> > =A0 Best wishes, >>> > =A0 --Phil >>> >>> Hi >>> I know that FIR basicaly works. I created a loop that iterates 100 >times >>> . >>> 99 times FIR output is correct and 1 times is incorrect . >>> I've tested all things , FIR coeff , .... all things were correct . >>> I didn't find bug . >>> I have another assembly optimized program . it is a logical function
First
|
Prev
|
Pages: 1 2 Prev: Mysterious gain when designing a butterworth filter in MATLAB Next: Tutorial on UTM coordinates? |