Vault 7: Projects
This publication series is about specific projects related to the Vault 7 main publication.
© 2005-2011 Microchip Technology Inc. DS70157F-page 207
Section 5. Instruction Descriptions
Instruction
Descriptions
5
CPSEQ
Compare Wb with Wn, Skip if Equal (Wb = Wn)
Implemented in: PIC24F PIC24H PIC24E dsPIC30F dsPIC33F dsPIC33E
X X X X
Syntax: {label:} CPSEQ{.B} Wb, Wn
Operands: Wb ∈ [W0 ... W15]
Wn ∈ [W0 ... W15]
Operation: (Wb) – (Wn)
Skip if (Wb) = (Wn)
Status Affected: None
Encoding: 1110 0111 1www wB00 0000 ssss
Description: Compare the contents of Wb with the contents of Wn by performing the
subtraction (Wb) – (Wn), but do not store the result. If (Wb) = (Wn), the
next instruction (fetched during the current instruction execution) is
discarded and on the next cycle, a NOP is executed instead. If
(Wb) ≠ (Wn), the next instruction is executed as normal.
The ‘w’ bits select the address of the Wb source register.
The ‘B’ bit selects byte or word operation (‘0’ for word, ‘1’ for byte).
The ‘s’ bits select the address of the Wn source register.
Note: The extension .B in the instruction denotes a byte operation
rather than a word operation. You may use a .W extension to
denote a word operation, but it is not required.
Words: 1
Cycles: 1 (2 or 3 if skip taken)
Example 1:
002000 HERE:CPSEQ.BW0, W1; If W0 = W1 (Byte mode),
002002GOTOBYPASS; skip the GOTO
002004 . . .
002006 . . .
002008 BYPASS: . . .
00200A . . .
Before
Instruction
After
Instruction
PC 00 2000 PC 00 2002
W0 1001 W0 1001
W1 1000 W1 1000
SR 0000 SR 0000
Example 2:
018000 HERE: CPSEQ W4, W8; If W4 = W8 (Word mode),
018002 CALL _FIR; skip the subroutine call
018006 ...
018008 ...
Before
Instruction
After
Instruction
PC 01 8000 PC 01 8006
W4 3344 W4 3344
W8 3344 W8 3344
SR 0002 (Z = 1) SR 0002 (Z = 1)
Protego_Release_01_05-Related-OEM-Documentation-PIC24FJ64GA004-Programmers_Reference_Manual.pdf