DSPRelated.com
Forums

Interrupt and decrement of CURLCNTR twice?

Started by kjayanth.rm May 23, 2003
hi,

We are observing the following on ADSP-21060 and ADSP-21160.

If an interrupt hits at the third last instrucion before the loop
termination, then the 'CURLCNTR' (Current loop counter) gets
decremented once on getting out of the ISR and once after
executing that instruction.

Example code:

Inst No
1 lnctr = r0, do REPEAT UNTIL LCE;
2 r0 = r0 + r1;
3 r1 = dm(i4,m7);
4 r4 = r1 + r0;
REPEAT:
5 dm(i4,m6) = r4;

If the interrupt hits on the instruction number 3, then 'CURLCNTR'
decrements after returning from the ISR, and repeats the decrement on
execution of instruction number 3. This will mean that the data sanity
is lost.

Please let me know if this is an anomaly. If this is so is there is
any work around for this.

thanks and regards,
jayanth




Hi
I think this is due to the loop restriction explained at the
page 3-24 of the users manual (21065Lprocessor). I think this is
applicable to other SHARC family members also. The restriction says
that " The last 3 instructions of a loop cannot be a branch (call,
jump or return). This rule has one exception - a non delayed CALL (no
DB modifier) paired with an RTS(LR) return from subroutine with loop
reentry modifier. You can use the non delayed CALL as one of the last
three instruction of a loop (except in a one instruction loop or a
two instruction, single iteration loop)." I think RTI instruction is
making problem for loop reentry from the interrupt ISR. I did not
found a similar situation in interrupts section of the processor
manual. I may be wrong, so please correct me also.
regards
ajith
--- In , "kjayanth.rm" <kjay@s...> wrote:
> hi,
>
> We are observing the following on ADSP-21060 and ADSP-21160.
>
> If an interrupt hits at the third last instrucion before the loop
> termination, then the 'CURLCNTR' (Current loop counter) gets
> decremented once on getting out of the ISR and once after
> executing that instruction.
>
> Example code:
>
> Inst No
> 1 lnctr = r0, do REPEAT UNTIL LCE;
> 2 r0 = r0 + r1;
> 3 r1 = dm(i4,m7);
> 4 r4 = r1 + r0;
> REPEAT:
> 5 dm(i4,m6) = r4;
>
> If the interrupt hits on the instruction number 3, then 'CURLCNTR'
> decrements after returning from the ISR, and repeats the decrement
on
> execution of instruction number 3. This will mean that the data
sanity
> is lost.
>
> Please let me know if this is an anomaly. If this is so is there is
> any work around for this.
>
> thanks and regards,
> jayanth