dsPIC30F Family Reference Manual
DS70049C-page 2-28 © 2004 Microchip Technology Inc.
3. 1 Instruction Word, 2 or 3 Instruction Cycle Program Flow Changes:
These instructions include relative call and branch instructions, and skip instructions. When
an instruction changes the PC (other than to increment it), the program memory pre-fetch
data must be discarded. This makes the instruction take two effective cycles to execute, as
shown in Figure 2-14.
Figure 2-14: Instruction Flow – 1-Word, 2-Cycle (Program Flow Change)
Three cycles will be taken when a two-word instruction is skipped. In this case, the program
memory pre-fetch data is discarded and the second word of the two-word instruction is
fetched. The second word of the instruction will be executed as a NOP, as shown in
Figure 2-15.
Figure 2-15: Instruction Flow – 1-Word, 3-Cycle (2-Word Instruction Skipped)
4. 1 Instruction Word, 3 Instruction Cycles (RETFIE, RETURN, RETLW):
The RETFIE, RETURN and RETLW instructions, that are used to return from a subroutine
call or an Interrupt Service Routine, take 3 instruction cycles to execute, as shown in
Figure 2-16.
Figure 2-16: Instruction Flow – 1-Word, 3-Cycle (RETURN, RETFIE, RETLW)
TCY0TCY1TCY2TCY3TCY4TCY5
1. MOV.B #0x55,W0 Fetch 1 Execute 1
2. BTSC PORTA,#3 Fetch 2 Execute 2
Skip Taken
3. ADD.B PORTA (executed as FNOP) Fetch 3
Forced NOP
4. BRA SUB_1 Fetch 4 Execute 4
5. ADD.B PORTB (executed as FNOP) Fetch 5
Forced NOP
6. SUB_1: Instruction @ address SUB_1 Fetch SUB_1
TCY0TCY1TCY2TCY3TCY4TCY5
1. BTSC SR,#Z Fetch 1 Execute 1,
Skip Taken
2. GOTO LABEL Fetch 2
Forced NOP
(GOTO 2nd word) Fetch 2nd
word of
GOTO
2nd word
executed as
a NOP
3. BCLR PORTB,#3 Fetch 3 Execute 3
4. MOV W0,W1 Fetch 4 Execute 4
TCY0TCY1TCY2TCY3TCY4TCY5
1. MOV #0x55AA,W0 Fetch 1 Execute 1
2. RETURN Fetch 2 Execute 2
3. (instruction in old program flow) Fetch 3 Execute 2
4. MOV W0, W3 (instruction in new program flow) No Fetch Execute 2
5. MOV W3, W5 Fetch 4 Execute 4
Fetch 5