73Fermer75
SCPCDLe 30/01/2022 à 12:16
Si on prend l'exemple suivant :
Il faut 19 cycles.
InstructionCycle1Cycle2Cycle3
DSP_LSP_routine_interruption_I2S_pas_fin_de_sample_channel1:
store R26,(R28) ; stocke internal sample pointeur, a virgule Rr26 & Rr28 - Wr26
shrq #nb_bits_virgule_offset,R26 ; nouveau pointeur adresse sample partie entiere Rr26 Mr28 -
shrq #nb_bits_virgule_offset,R17 ; ancien pointeur adresse sample partie entiere Rr17 Cr26 MWrite
- Cr17 Wr26
move R26,R25 ; R25 = nouveau pointeur sample Rr26 - Wr17
- - Wr25
and R22,R17 ; ancien pointeur sample modulo 4 Rr22 & Rr17 - -
and R22,R26 ; nouveau pointeur sample modulo 4 Rr22 & Rr26 Cr17 -
movei #LSP_DSP_PAULA_AUD1DAT,R28 ; 4 octets actuels Rword1 Cr26 Wr17
Rword2 word1 Wr26
not R22 ; => %11 Rr22 - word2word1 > Wr28
load (R28),R19 ; R19 = octets actuels en stock Rr28 Cr22 -
and R22,R25 ; R25 = position octet à lire Rr22 & Rr25 Mr28 Wr22
- Cr25 Wr19
- - Wr25
cmp R17,R26 Rr17 & Rr26 - -
- Cflags -
jr eq,DSP_LSP_routine_interruption_I2S_pas_nouveau_long_word1 Rflags - Wflags
nop - ? > WPC -

En reorganisant juste les instructions, on réduit à 13cycles.
+2cycles si jamais on ne jumperai pas avec un besoin du résultat du and dans l'instruction suivante, mais ce n'ai pas le cas dans ton code.
Dans le cas d'un jump, il est "gratuit" vu que ça sera inclut dans les cycles du remplissage à nouveau du pipeline.

InstructionCycle1Cycle2Cycle3
DSP_LSP_routine_interruption_I2S_pas_fin_de_sample_channel1:
store R26,(R28) ; stocke internal sample pointeur, a virgule Rr26 & Rr28 - Wr26
movei #LSP_DSP_PAULA_AUD1DAT,R28 ; 4 octets actuels Rword1 Mr28 -
Rword2 word1 MWrite
load (R28),R19 ; R19 = octets actuels en stock Rr28 - word2word1 > Wr28
shrq #nb_bits_virgule_offset,R17 ; ancien pointeur adresse sample partie entiere Rr17 Mr28 -
shrq #nb_bits_virgule_offset,R26 ; nouveau pointeur adresse sample partie entiere Rr26 Cr17 Wr19
and R22,R17 ; ancien pointeur sample modulo 4 Rr22 & Rr17 Cr26 Wr17
and R22,R26 ; nouveau pointeur sample modulo 4 Rr22 & Rr26 Cr17 Wr26
not R22 ; => %11 Rr22 Cr26 Wr17
cmp R17,R26 Rr17 & Rr26 Cr22 Wr26
move R26,R25 ; R25 = nouveau pointeur sample Rr26 Cflags -
jr eq,DSP_LSP_routine_interruption_I2S_pas_nouveau_long_word1 Rflags - Wr26 Wflags
and R22,R25 ; R25 = position octet à lire Rr22 & Rr25 ? > WPC -

En remplaçant le movei par un movefa ou move simple, on pourrait gagner encore un cycle.

(je n'ai pas testé, mais sauf erreur de ma part, ça devrait marcher smile)