4.4 Instruction Descriptions (A to BZ)

ADDAdd Wb and Ws
Syntax:{label:}ADD.bWb,Ws,Wd
ADD.bz[Ws],[Wd]
ADD{.w}[Ws++],[Wd++]
ADD.l[Ws--],[Wd--]
[++Ws],[++Wd]
[--Ws],[--Wd]
Operands:Wb ∈ [W0 ... W15]; Ws ∈ [W0 ... W15]; Wd ∈ [W0 ... W15]
Operation:(Wb) + (Ws) → Wd
Status Affected:C, N, OV, Z
Encoding:S110000LddddsssspppqqqwwwwUUBU00
Description:Add the contents of the source register Ws and the contents of the base register Wb and place the result in the destination register Wd.

The ‘S’ bit selects instruction size.

The ‘L’ and ‘B’ bits select operation data width.

The ‘s’ bits select the source register.

The ‘d’ bits select the destination register.

The ‘p’ bits select the source addressing mode.

The ‘q’ bits select the destination addressing mode.

I-Words:1 or 0.5
Cycles:1
Example 1: ADD.BW5, W6, W7

; Add W5 to W6, store result in W7

; (Byte mode)

Before Instruction

After Instruction

W5AB00W5AB00
W60030W60030
W7FFFFW7FF30
SR0000SR0000
Example 2: ADDW5, W6, W7

; Add W5 to W6, store result in W7

; (Word mode)

Before Instruction

After Instruction

W5AB00W5AB00
W60030W60030
W7FFFFW7AB30
SR0000SR0008(N = 1)
ADDAdd ACCA to ACCB
Syntax:{label:}ADDA
B
Operands:none
Operation:ACCA + ACCB → ACC(A or B)
Status Affected:OA, SA or OB, SB
Encoding:0111001AUUUU1000
Description:Add ACCA to ACCB and write results to selected accumulator.

The ‘A’ bits specify the destination accumulator.

I-Words:0.5
Cycles:1
Example:1ADD A;ACCA = ACCA + ACCB
Before executionAfter execution
ACCA0x00_1022_2EE1_5633_9078ACCA0x00_3066_9207_9746_247B
ACCB0x00_2044_6326_4112_9403ACCB0x00_2044_6326_4112_9403
ADDSigned Add to Accumulator
Syntax:{label:}ADD{.w} Ws,{ Slit6, }A
ADD.l[Ws],B
[Ws++]
[Ws--]
[--Ws],
[++Ws],
[Ws+Wb],
Operands:Ws ∈ [W0 ... W15]; Wb ∈ [W0 ... W15]; Slit6 ∈ [-32 ... +31]
Operation:(ACC) + ShiftSlit6(Sign-extend(Ws)) → ACC
Status Affected:OA, SA or OB, SB
Encoding:110000ALwwwwsssspppUUUkkkkkk1011
Description:The operand contained at the Effective Address is assumed to be Q1.15 or Q1.31 fractional data for word and long data operations respectively. The operand is read, then automatically sign-extended and zero-backfilled to create a value the same size as the accumulator.

The value is then optionally (arithmetically) shifted before being added to the target accumulator.

The ‘L’ bit selects word or long word operation.

The ‘A’ bit specifies the destination accumulator.

The ‘s’ bits specify the source register Ws.

The ‘p’ bits select the source addressing mode.

The ‘w’ bits specify the offset register Wb.

The ‘k’ bits encode the optional operand Slit6 which determines the amount of the accumulator preshift; if the operand Slit6 is absent, the literal bit field is set to all 0’s.

Note:
  1. Positive values of operand Slit6 represent arithmetic shift right. 
Negative values of operand Slit6 represent shift left.
  2. This instruction operates in Long or Word mode only.
I-Words:1
Cycles:1
Example:1ADD w8, #1, B;ACCB = (w8>>1):32'b0+ ACCB ;Shift right ACCB by 1
Before executionAfter execution
w80x20446326w80x20446326
ACCB0x00_2044_6326_4112_9403ACCB0x00_3066_94B9_4112_9403
ADDCAdd Wb and Ws with Carry
Syntax:{label:}ADDC.b Wb,Ws,Wd
ADDC.bz[Ws],[Wd]
ADDC{.w}[Ws++],[Wd++]
ADDC.l[Ws--],[Wd--]
[++Ws],[++Wd]
[--Ws],[--Wd]
Operands:Wb ∈ [W0 ... W15]; Ws ∈ [W0 ... W15]; Wd ∈ [W0 ... W15]
Operation:(Wb) + (Ws) + (C) → Wd
Status Affected:C, N, OV, Z
Encoding:S110001LddddsssspppqqqwwwwUUBU00
Description:Add the contents of the source register Ws and the contents of the base register Wb and the Carry bit and place the result in the destination register Wd.

The Z bit is “sticky” (can only be cleared).

The ‘S’ bit selects instruction size.

The ‘L’ and ‘B’ bits select operation data width.

The ‘s’ bits select the source register.

The ‘w’ bits select the base register.

The ‘d’ bits select the destination register.

The ‘p’ bits select the source addressing mode.

The ‘q’ bits select the destination addressing mode.

I-Words:1 or 0.5
Cycles:1
Example 1: ADDC.B

W0,[W1++],[W2++]

; Add W0, [W1] and C bit (Byte mode)

; Store the result in [W2]

; Post-increment W1, W2

Before Instruction

After Instruction

W0CC20W0CC20
W10800W10801
W21000W21001
Data 0800AB25Data 0800AB25
Data 1000FFFFData 1000FF46
SR0001(C = 1)SR0000
Example 2:

ADDC

W3,[W2++],[W1++]

; Add W3, [W2] and C bit (Word mode)

; Store the result in [W1]

; Post-increment W1, W2

Before Instruction

After Instruction

W11000W11002
W22000W22002
W30180W30180
Data 10008000Data 10002681
Data 20002500Data 20002500
SR0001(C = 1)SR0000
ADDCAdd Ws and Short Literal with Carry
Syntax:{label:}ADDC.b Ws,lit7,Wd
ADDC.bz [Ws],[Wd]
ADDC.{w} [Ws++],[Wd++]
ADDC.l [Ws--],[Wd--]
[++Ws],[++Wd]
[--Ws],[--Wd]
Operands:Ws ∈ [W0 ... W15]; lit7 ∈ [0 ... 127]; Wd ∈ [W0 ... W15]
Operation:(Ws) + lit7 + (C) → Wd

Note: The literal is zero-extended to the selected data size of the operation

Status Affected:C, N, OV, Z
Encoding:1110001LddddsssspppqqqkkkkkkBk10
Description:Add the contents of the source register Ws, the zero-extended unsigned literal operand and the Carry bit; place the result in the destination register Wd.

The Z bit is “sticky” (can only be cleared).

The ‘L’ and ‘B’ bits select operation data width.

The ‘k’ bits provide the signed literal operand.

The ‘s’ bits select the source register.

The ‘d’ bits select the destination register.

The ‘p’ bits select the source addressing mode.

The ‘q’ bits select the destination addressing mode.

Note: Word (.w) and Zero-Extended Byte mode (.bz) mode with a register direct destination will 0 extend the result to 32-bits.
I-Words:1
Cycles:1
Example 1: ADDC.B

W0, #0x1F, [W7]

; Add W0, 31 and C bit (Byte mode)

; Store the result in [W7]

Before Instruction

After Instruction

W0CC80W0CC80
W712C0W712C0
Data 12C0B000Data 12C0B09F
SR0000(C = 0)SR0008(N = 1)
Example 2: ADDC

W3, #0x6, [--W4]

; Add W3, 6 and C bit (Word mode)

; Store the result in [--W4]

Before Instruction

After Instruction

W36006W36006
W41000W40FFE
Data 0FFEDDEEData 0FFE600D
Data 1000DDEE

Data 1000

SR

DDEE
SR0001(C = 1)0000
ADDCAdd Literal to Wn with Carry
Syntax:{label:}ADDC.b lit16,Wn
ADDC.bz
ADDC{.w}
ADDC.l
Operands:lit16 ∈ [0 ... 65535]; Wn ∈ [W0 ... W15]
Operation:(Wn) + lit16 + (C) → Wn

Note: The literal is zero-extended to the selected data size of the operation

Status Affected:C, N, OV, Z
Encoding:1100001LsssskkkkkkkkkkkkkkkkBU10
Description:Add the zero-extended literal operand to the contents of the Working register Wn and the Carry bit and place the result in the Working register Wn.

The Z bit is “sticky” (can only be cleared).

The ‘L’ and ‘B’ bits select operation data width.

The ‘s’ bits select the Working register.

The ‘k’ bits specify the signed literal operand.

I-Words:1
Cycles:1
Example 1: ADDC.B#0xFF, W7

; Add -1 and C bit to W7 (Byte mode)

Before

Instruction

After

Instruction

W712C0W712BF
SR0000(C = 0)SR0009(N, C = 1)
Example 2: ADDC#0xFF, W1

; Add 255 and C bit to W1 (Word mode)

Before Instruction

After Instruction

W112C0W113C0
SR0001(C = 1)SR0000
ADDCAdd f and Carry bit and Wn
Syntax:{label:}ADDC.bf,Wn{,WREG}
ADDC.bz
ADDC{.w}
ADDC.l
Operands:f ∈ [0 ... 64KB]; Wn ∈ [W0 ... W15]
Operation:(f) + (Wn) + (C)→ destination designated by D
Status Affected:C, N, OV, Z
Encoding:1110001LssssffffffffffffffffBD01
Description:Add the contents of the Working register and the Carry Flag and the contents of the file register and place the result in the destination designated by D. If the optional Wn destination is specified, D=0 and store result in Wn; otherwise, D=1 and store result in the file register.

The Z bit is “sticky” (can only be cleared).

The ‘L’ and ‘B’ bits select operation data width.

The ‘D’ bit selects the destination.

The ‘f’ bits select the address of the file register.

The ‘s’ bits select the Working register.

I-Words:1
Cycles:1
Example 1:

ADDC.B

RAM100

; Add WREG and C bit to RAM100

; (Byte mode)

Before

Instruction

After

Instruction

WREGCC60WREGCC60
RAM1008006 RAM1008067
SR0001(C = 1) SR0000
Example 2:

ADDC

RAM200, WREG

; Add RAM200 and C bit to the WREG

; (Word mode)

Before Instruction

After Instruction

WREG5600WREG8A01
RAM2003400 RAM2003400
SR0001(C = 1)SR000C(N, OV = 1)
ADDAdd Short Literal to Wn
Syntax:{label:}ADD.llit5,Wn
Operands:lit5 ∈ [0 ... 31]; Wn ∈ [W0 ... W15]
Operation:(Wn) + lit5 → Wn

Note: The literal is zero-extended to the selected data size of the operation

Status Affected:C, N, OV, Z
Encoding:0111010kkkkkssss
Description:Add the zero-extended literal operand to the contents of the Working register Wn and place the result in the Working register Wn. If literal >31 and/or word or byte operation is required, assemble as ADDLW instruction.

The ‘s’ bits select the Working register.

The ‘k’ bits specify the signed literal operand.

I-Words:0.5
Cycles:1
Example 1: ADD.B#0xFF, W7; Add -1 to W7 (Byte mode)

Before Instruction

After Instruction

W712C0W712BF
SR0000SR0009(N, C = 1)
Example 2: ADD#0xFF, W1; Add 255 to W1 (Word mode)

Before Instruction

After Instruction

W112C0W113BF
SR0000SR0000
ADDAdd Ws and Short Literal
Syntax:{label:}ADD.bWs,lit7,Wd
ADD.bz [Ws],[Wd]
ADD.{w} [Ws++],[Wd++]
ADD.l[Ws--],[Wd--]
[++Ws],[++Wd]
[--Ws],[--Wd]
Operands:Ws ∈ [W0 ... W15]; lit7 ∈ [0 ... 127]; Wd ∈ [W0 ... W15]
Operation:(Ws) + lit7 → Wd

Note: The literal is zero-extended to the selected data size of the operation

Status Affected:C, N, OV, Z
Encoding:1110000LddddsssspppqqqkkkkkkBk10
Description:Add the contents of the source register Ws and the zero-extended unsigned literal operand and place the result in the destination register Wd.

The ‘L’ and ‘B’ bits select operation data width.

The ‘k’ bits provide the literal operand.

The ‘s’ bits select the source register.

The ‘d’ bits select the destination register.

The ‘p’ bits select the source addressing mode.

The ‘q’ bits select the destination addressing mode.

I-Words:1
Cycles:1
Example 1: ADD.BW0, #0x1F, W7

; Add W0 and 31 (Byte mode)

; Store the result in W7

Before Instruction

After Instruction

W02290W02290
W712C0W712AF
SR0000SR0008(N = 1)
Example 2: ADDW3, #0x6, [--W4]

; Add W3 and 6 (Word mode)

; Store the result in [--W4]

Before Instruction

After Instruction

W36006W36006
W41000W40FFE
Data 0FFEDDEEData 0FFE600C
Data 1000DDEEData 1000DDEE
SR0000SR0000
ADDAdd Literal to Wn
Syntax:{label:}ADD.blit16,Wn
ADD.bz
ADD{.w}
ADD.l
Operands:lit16 ∈ [0 ... 65535]; Wn ∈ [W0 ... W15]
Operation:(Wn) + lit16 → Wn

Note: The literal is zero-extended to the selected data size of the operation

Status Affected:C, N, OV, Z
Encoding:1100000LsssskkkkkkkkkkkkkkkkBU10
Description:Add the zero-extended literal operand to the contents of the Working register Wn and place the result in the Working register Wn.

The ‘L’ and ‘B’ bits select operation data width.

The ‘s’ bits select the Working register.

The ‘k’ bits specify the signed literal operand.

I-Words:1
Cycles:1
ADDAdd f and Wn
Syntax:{label:}ADD.bfWn{,WREG}
ADD.bz
ADD{.w}
ADD.l
Operands:f ∈ [0 ... 64KB]; Wn ∈ [W0 ... W15]
Operation:(f) + (Wn) → destination designated by D
Status Affected:C, N, OV, Z
Encoding:1110000LssssffffffffffffffffBD01
Description:Add the contents of the Working register and the contents of the file register and place the result in the destination designated by D. If the optional Wn is specified, D = 0 and store result in Wn; otherwise, D = 1 and store result in the file register.

The ‘L’ and ‘B’ bits select operation data width.

The ‘D’ bit selects the destination.

The ‘f’ bits select the address of the file register.

The ‘s’ bits select the Working register.

I-Words:1
Cycles:1
Example 1: ADD.BRAM100

; Add WREG to RAM100 (Byte mode)

Before Instruction

After Instruction

WREGCC80WREGCC80
RAM100FFC0 RAM100FF40
SR0000SR0005(OV, C = 1)
Example 2: ADDRAM200, WREG

; Add RAM200 to WREG (Word mode)

Before Instruction

After Instruction

WREGCC80WREGCC40
RAM200FFC0 RAM200FFC0
SR0000SR0001(C = 1)
ANDAND Wb and Ws
Syntax:{label:}AND.bWb,Ws,Wd
AND.bz[Ws],[Wd]
AND{.w}[Ws++],[Wd++]
AND.l[Ws--],[Wd--]
[++Ws],[++Wd]
[--Ws],[--Wd]
SRSR
Operands:Wb ∈ [W0 ... W14]; Ws ∈ [W0 ... W15]; Wd ∈ [W0 ... W15]
Operation:(Wb).AND.(Ws) → Wd
Status Affected:N, Z
Encoding:S110100LddddsssspppqqqwwwwUUBU00
Description:Compute the AND of the contents of the source register Ws and the contents of the base register Wb and place the result in the destination register Wd.

The ‘S’ bit selects instruction size.

The ‘L’ and ‘B’ bits select operation data width.

The ‘s’ bits select the source register.

The ‘w’ bits select the base register.

The ‘d’ bits select the destination register.

The ‘p’ bits select the source addressing mode.

The ‘q’ bits select the destination addressing mode.

See and for modifier addressing information.

Note:
  1. When the SR is selected, SR data write will take priority over any SR update resulting from the AND operation.
  2. .bz data size/mode is disallowed when writing to the SR.
I-Words:1 or 0.5
Cycles:1
Example 1:

AND.B

W0, W1 [W2++]

; AND W0 and W1, and

; store to [W2] (Byte mode)

; Post-increment W2

Before Instruction

After Instruction

W0AA55W0AA55
W12211W12211
W21001W21002
Data 1000FFFF Data 100011FF
SR0000SR0000
Example 2: AND

W0, [W1++], W2

; AND W0 and [W1], and

; store to W2 (Word mode)

; Post-increment W1

Before Instruction

After Instruction

W0AA55W0AA55
W11000W11002
W255AAW22214
Data 10002634 Data 10002634
SR0000SR0000
ANDAND Ws and 0’s Extended Short Literal
Syntax:{label:}AND.bWs,lit7,Wd
AND.bz [Ws],[Wd]
AND{.w} [Ws++],[Wd++]
AND.l[Ws--],[Wd--]
[++Ws],[++Wd]
[--Ws],[--Wd]
SRSR
Operands:Ws ∈ [W0 ... W15]; lit7 ∈ [0 ... 127]; Wd ∈ [W0 ... W15]
Operation:(Ws).AND.lit73 → Wd
Status Affected:N, Z (see note 1)
Encoding:1110100LddddsssspppqqqkkkkkkBk10
Description:Compute the AND of the contents of the source register Ws and the zero-extended literal operand and place the result in the destination register Wd.

The ‘L’ and ‘B’ bits select operation data width.

The ‘k’ bits provide the unsigned literal operand.

The ‘s’ bits select the source register.

The ‘d’ bits select the destination register.

The ‘p’ bits select the source addressing mode.

The ‘q’ bits select the destination addressing mode.

Note:
  1. When the SR is selected, SR data write will take priority over any SR update resulting from the AND operation.
  2. .bz data size/mode is disallowed when writing to the SR.
  3. The literal is zero-extended to the selected data size of the operation.
I-Words:1
Cycles:1
AND1AND Ws and 1’s Extended Short Literal
Syntax:{label:}AND1.bWs,lit7,Wd
AND1.bz [Ws],[Wd]
AND1{.w} [Ws++],[Wd++]
AND1.l [Ws--],[Wd--]
[++Ws],[++Wd]
[--Ws],[--Wd]
SRSR
Operands:Ws ∈ [W0 ... W15]; lit7 ∈ [0 ... 127]; Wd ∈ [W0 ... W15]
Operation:(Ws).AND.lit73 → Wd
Status Affected:N, Z (see note 1)
Encoding:1110110LddddsssspppqqqkkkkkkBk10
Description:Compute the AND of the contents of the source register Ws and the ones-extended literal operand and place the result in the destination register Wd.

The ‘L’ and ‘B’ bits select operation data width.

The ‘k’ bits provide the unsigned literal operand.

The ‘s’ bits select the source register.

The ‘d’ bits select the destination register.

The ‘p’ bits select the source addressing mode.

The ‘q’ bits select the destination addressing mode.

Note:
  1. When the SR is selected, SR data write will take priority over any SR update resulting from the AND operation.
  2. .bz data size/mode is disallowed when writing to the SR.
  3. The literal is ones-extended to the selected data size of the operation.
I-Words:1
Cycles:1
Example 1:

AND1.l W5, #0x1F, W7

AND W5 and 1's extended 0x1F, and

; store to [W7] (long word mode)

; Post-increment W2

Before Instruction

After Instruction

W57FFFFFFFW57FFFFFFF
W712345678W77FFFFF9F
SR0000 SR0000
AND AND Literal and Wn
Syntax:{label:}AND.blit16,Wn
AND.bzSR
AND{.w}
AND.l
Operands:lit16 ∈ [0 ... 65536]; Wn ∈ [W0 ... W15]; Status Register (SR)
Operation:(Wn) .AND. lit163 → Wn or (SR) .AND. lit16 → SR
Status Affected:N, Z (see note 1)
Encoding:1100100LsssskkkkkkkkkkkkkkkkBT10
Description:Compute the AND of the literal operand and the contents of the Working register Wn or SR and place the result in the Working register Wn or SR.

The ‘L’ and ‘B’ bits select operation data width.

The ‘s’ bits select the Working register.

The ‘k’ bits specify the unsigned literal operand.

The ‘T’ bit selects between Ws (T = 0) and SR (T = 1) target registers.

Note:
  1. When the SR is selected, SR data write will take priority over any SR update resulting from the AND operation.
  2. .bz data size/mode is disallowed when writing to the SR.
  3. The literal is zero-extended to 32-bits for long word operations.
I-Words:1
Cycles:1
Example 1:

AND.B #0x83, W7

; AND 0x83 to W7 (Byte mode)

Before Instruction

After Instruction

W712C0W71280
SR0000SR0008(N = 1)
Example 2:

AND #0x333, W1

; AND 0x333 to W1 (Word mode)

Before Instruction

After Instruction

W112D0W10210
SR0000SR0000
ANDAnd f and Wn
Syntax:{label:}AND.bf,Wn{,WREG}
AND.bz
AND{.w}
AND.l
Operands:f ∈ [0 ... 64KB]; Wn ∈ [W0 ... W14]
Operation:(f).AND.(Wn) → destination designated by D
Status Affected:N, Z
Encoding:1110100LssssffffffffffffffffBD01
Description:Compute the AND of the contents of the Working register and the contents of the file register and place the result in the destination designated by D. If the optional Wn is specified, D=0 and store result in Wn; otherwise, D=1 and store result in the file register.

The ‘L’ and ‘B’ bits select operation data width.

The ‘D’ bit selects the destination.

The ‘f’ bits select the address of the file register.

The ‘s’ bits select the Working register.

I-Words:1
Cycles:1
Example 1: AND.B RAM100

; AND WREG to RAM100 (Byte mode)

Before Instruction

After Instruction

WREGCC80WREGCC80
RAM100FFC0 RAM100FF80
SR0000SR0008(N = 1)
Example 2: AND RAM200, WREG

; AND RAM200 to WREG (Word mode)

Before Instruction

After Instruction

WREGCC80WREG0080
RAM20012C0 RAM20012C0
SR0000SR0000
ASRArithmetic Shift Right by 1
Syntax:{label:}ASR.b Ws,Wd
ASR.bz[Ws],[Wd]
ASR{.w}[Ws++],[Wd++]
ASR.l[Ws--],[Wd--]
[++Ws],[++Wd]
[--Ws],[--Wd]
Operands:Ws ∈ [W0 ... W15]; Wd ∈ [W0 ... W15]
Operation:For long word operation:

(Ws[31]) → Wd[31], (Ws[31:1]) → Wd[30:0], (Ws[0]) → C

For word operation:

(Ws[15]) → Wd[15], (Ws[15:1]) → Wd[14:0], (Ws[0]) → C

For byte operation:

(Ws[7]) → Wd[7], (Ws[7:1]) → Wd[6:0], (Ws[0]) → C

Status Affected:C, N,Z
Encoding:S010100LddddsssspppqqqUUUUUUB000
Description:Arithmetic shift right the contents of the source register by one bit, placing the result in the destination register Wd.

Destination register direct Extended Byte or Word mode will zero-extend the result to 32-bits, then write to Wd.

The ‘S’ bit selects instruction size.

The ‘L’ and ‘B’ bits select operation data width.
 The ‘s’ bits select the source register.

The ‘w’ bits select the base register.

The ‘d’ bits select the destination register.

The ‘p’ bits select the source addressing mode.

The ‘q’ bits select the destination addressing mode.

I-Words:1 or 0.5
Cycles:1
ASRArithmetic Shift Right f
Syntax:{label:}ASR.bf{,Wnd}{,WREG}
ASR.bz
ASR{.w}
ASR.l
Operands:f ∈ [0 ... 64KB]; Wnd ∈ [W0 ... W14]
Operation:
For long word operation:

(f[31]) → Dest[31], (f[31]) → Dest[30],

(f[30:1]) → Dest[29:0], (f[0]) → C

For word operation:

(f[15]) → Dest[15], (f[15]) → Dest[14]

(f[14:1]) → Dest[13:0], (f[0]) → C

For byte operation:

(f[7]) → Dest[7:1], (f[7]) → Dest[6],

(f[6:1]) → Dest[5:0], (f[0]) → C

Status Affected:C, N, Z
Encoding:1010000LddddffffffffffffffffBD01
Description:Shift the contents of the file register f one bit to the right through the carry flag, and place the result in the destination designated by D. If the optional Wnd is specified, D=0 and store result in Wnd; otherwise, D=1 and store result in the file register.

The ‘L’ and ‘B’ bits select operation data width.

The ‘D’ bit selects the destination.

The ‘f’ bits select the address of the file register.

The ‘d’ bits select the Working register.

I-Words:1
Cycles:1
Example 1: ASR.B RAM400, WREG

; ASR RAM400 and store to WREG

; (Byte mode)

Before

Instruction

After

Instruction

WREG0600WREG0611
RAM4000823RAM4000823
SR0000SR0001 (C = 1)
Example 2: ASR RAM200

; ASR RAM200 (Word mode)

Before

Instruction

After

Instruction

RAM2008009RAM200C004
SR0000SR0009 (N, C = 1)
ASRArithmetic Shift Right by Short Literal
Syntax:{label:}ASR{.w}Ws, lit5,Wd
ASR.l[Ws],[Wd]
[Ws++],[Wd++]
[Ws--],[Wd--]
[++Ws],[++Wd]
[--Ws],[--Wd]
Operands:Ws ∈ [W0 ... W15]; lit5 ∈ [0...31]; Wd ∈ [W0 ... W15]
Operation:lit5[4:0]→ Shift_Val

For long word operation:

Ws[31] → Right shift input (arithmetic shift)

Ws[31:0], 32’b0 → Shift_In[63:0]

Arithmetic shift right Shift_In[63:0] by Shift_Val → Shift_Out[63:0]

Shift_Out[63:32] → Wd

For word operation:

Ws[15] → Right shift input (arithmetic shift)

{16{Ws[15]}}, Ws[15:0],32’b0 → Shift_In[63:0]

Arithmetic shift right Shift_In[63:0] by Shift_Val → Shift_Out[63:0]

Shift_Out[47:32] → Wd[15:0]

Status Affected:N,Z
Encoding:S010000kkkkkddddpppqqqssssUULU00
Description:

Arithmetic shift right the contents of the source register Ws by lit5 bits (up to 31 positions), placing the result in the destination Wd.

This instruction will generate the correct result for a word operation with any shift value in lit5. If lit5 > 15 and Ws[15] = 0, then Wd[15:0]=0x0000.
If lit5 > 15 and Ws[15] = 1, then Wd[15:0]=0xFFFF.

Register Direct Word mode will zero-extend the result to 32-bits, then write to Wd.

The ‘S’ bit selects instruction size.

The ‘L’ bit selects word or long word operation.

The ‘s’ bits select the source register.

The ‘d’ bits select the destination register.

The ‘p’ bits select the source addressing mode.

The ‘q’ bits select the destination addressing mode.

The ‘k’ bits provide the literal operand.

I-Words: 1 or 0.5 Cycles: 1

Note:
  1. This instruction only operates in Word or Long Word mode.
Example 1: ASR W0, #0x4, W1

; ASR W0 by 4 and store to W1

Before Instruction

After Instruction

W0060FW0060F
W11234W10060
SR0000SR0000
Example 2: ASR W0, #0x6, W1

; ASR W0 by 6 and store to W1

Before Instruction

After Instruction

W080FFW080FF
W10060W1FE03
SR0000SR0008(N = 1)
Example 3: ASR W0, #0xF, W1

; ASR W0 by 15 and store to W1

Before

Instruction

After

Instruction

W070FFW070FF
W1CC26W10000
SR0000SR0002 (Z = 1)
ASRMArithmetic Shift Right Multi-Precision by Short Literal
Syntax:{label:}ASRM{.l} Ws,lit5,Wnd
[Ws],
[Ws++],
[Ws--],
[++Ws],
[--Ws],
Operands:Ws ∈ [W0 ... W15]; lit5 ∈ [0...31]; Wnd ∈ [W1 ... W14]
Operation:lit5[4:0]→ Shift_Val

Ws[31] → Right shift input (arithmetic shift)

Ws[31:0], 32’b0 → Shift_In[63:0]

Arithmetic shift right Shift_In[63:0] by Shift_Val → Shift_Out[63:0]

Shift_Out[63:32] → Wnd

Shift_Out[31:0] | Wnd-1 → Wnd-1

Status Affected:N,Z
Encoding:1110000kkkkkddddpppUUUssssUU0011
Description:

Arithmetic shift right the contents of the source register Ws by lit5 bits (up to 31 positions), placing the result in the destination register Wnd. The register containing the next least significant data word will already contain an intermediate shift result. Bitwise OR this value with the data shifted out of Ws in order to create the final shift result, then update the corresponding destination register.

The Z bit is “sticky” (can only be cleared).

The ‘s’ bits select the source register.

The ‘d’ bits select the destination register.

The ‘p’ bits select the source addressing mode.

The ‘k’ bits provide the literal operand.

I-Words:1
Cycles:2
  1. Note: This instruction only operates in Long Word mode.
ASRMArithmetic Shift Right Multi-Precision by Wb
Syntax:{label:}ASRM{.l} Ws, Wb,Wnd
[Ws],
[Ws++],
[Ws--],
[++Ws],
[--Ws],
Operands:Ws ∈ [W0 ... W15]; Wb ∈ [W0 ...W15]; Wnd ∈ [W1 ... W14]
Operation:Wb[15:0]→ Shift_Val

Ws[31] → Right shift input (arithmetic shift)

Ws[31:0], 32’b0 → Shift_In[63:0]

Arithmetic shift right Shift_In[63:0] by Shift_Val → Shift_Out[63:0]

Shift_Out[63:32] → Wnd

Shift_Out[31:0] | Wnd-1 → Wnd-1

Status Affected:N,Z
Encoding:1110001UssssddddpppUUUwwwwUU0011
Description:Arithmetic shift right the contents of the source register Ws by Wb bits, placing the result in the destination register Wnd. The register containing the next least significant data word will already contain an intermediate shift result. Bitwise OR this value with the data shifted out of Ws in order to create the final shift result, then update the corresponding destination register or memory address.

The arithmetic right shift may be by any amount between 0 and 32 bits. Should the shift value held in Wb[15:0] exceed 2’d32, the shift value will saturate to 2’d32 for consistency. Any data held in Wb[31:16] will have no effect.

The Z bit is “sticky” (can only be cleared).

The ‘w’ bits select the base (shift count) register.

The ‘s’ bits select the source register.

The ‘d’ bits select the destination register.

The ‘p’ bits select the source addressing mode.

Note: This instruction only operates in Long Word mode.
I-Words:1
Cycles:2
ASRArithmetic Shift Right by Wb
Syntax:{label:}ASR.b Ws, Wb,Wd
ASR.bz[Ws],[Wd]
ASR{.w}[Ws++],[Wd++]
ASR.l[Ws--],[Wd--]
[++Ws],[++Wd]
[--Ws],[--Wd]
Operands:Ws ∈ [W0 ... W15]; Wb ∈ [W0 ...W15]; Wd ∈ [W0 ... W15]
Operation:Wb[15:0]→ Shift_Val

For long word operation:

Ws[31] → Right shift input (arithmetic shift)

Ws[31:0], 32’b0 → Shift_In[63:0]

Arithmetic shift right Shift_In[63:0] by Shift_Val → Shift_Out[63:0]

Shift_Out[63:32] → Wd

For word operation:

Ws[15] → Right shift input (arithmetic shift)

{16{Ws[15]}}, Ws[15:0],32’b0 → Shift_In[63:0]

Arithmetic shift right Shift_In[63:0] by Shift_Val → Shift_Out[63:0]

Shift_Out[47:32] → Wd[15:0]

For byte operation:

Ws<7> → Right shift input (arithmetic shift)

{24{Ws<7>}}, Ws[7:0],32’b0 → Shift_In[63:0]

Arithmetic shift right Shift_In[63:0] by Shift_Val → Shift_Out[63:0]

Shift_Out[39:32] → Wd[7:0]

Status Affected:N,Z
Encoding:1010100LwwwwddddpppqqqssssUUB100
Description:Arithmetic shift right the contents of the source register by Wb bits, placing the result in the destination register Wd.

This instruction will generate the correct result for any shift value in Wb[15:0]:

  • For a byte operation shift value > 7:
If Ws[7] = 0 then Wd[7:0]=0x00 else Wd[7:0]=0xFF
  • For a word operation shift value > 15:
If Ws[15] = 0 then Wd[15:0]=0x0000 else Wd[15:0]=0xFFFF
  • For a Long Word operation shift value > 31:
If Ws[31] = 0 then Wd[31:0]=0x00000000 else Wd[31:0]=0xFFFFFFFF

    Any data held in Wb[31:16] will have no effect.

    Destination register direct Extended Byte or Word mode will zero-extend the result to 32-bits, then write to Wd.

    The ‘L’ and ‘B’ bits select operation data width.
 The ‘s’ bits select the source register.

    The ‘w’ bits select the base (shift count) register.

    The ‘d’ bits select the destination register.

    The ‘p’ bits select the source addressing mode.

    The ‘q’ bits select the destination addressing mode.

I-Words:1
Cycles:1
BRA CBranch if Carry/Unsigned Greater Than or Equal
Syntax:{label:}BRAC,Label
{label:}BRAGEU,
Operands:Label is resolved by the linker to a signed word offset
Operation:Condition = C

If (condition) then {

If slit20 = 1 then skip next (16-bit) instruction

Else If (slit20 = 2 && next_op[31] = 1) then skip next (32-bit) instruction

Else (PC+4) + 2*slit20 → PC

}

Else no branch

Status Affected:None
Encoding:1010101Unnnnnnnnnnnnnnnnnnnn0010
Description:If the branch condition is met, then the instruction will either skip the next 16-bit or 32-bit instruction, or branch to any size of instruction with a forward or backward range of up to 1MB.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals two, the conditional branch will execute as a conditional skip of one 16-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals four, and the instruction after the branch is a 32-bit opcode (see note), the conditional branch will execute as a conditional skip of that 32-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If requirements for a conditional skip are not met, the 2’s complement byte offset value ‘2*slit20’ is added to the PC to create a new PS word address. Since the PC will have incremented to fetch the next instruction, the new address will be (PC+4) + 2*slit20.

Branch prediction is based on the direction of the branch. If the branch is backwards (negative), it will be predicted as taken. If the branch is forwards (positive), it will be predicted as not taken. The two instructions that follow the branch will then be speculatively executed in the predicted path until such time that the actual branch decision can be assessed. A correctly predicted branch will continue instruction execution in the same path unabated. An incorrectly predicted branch will abort the speculatively executed instructions and start execution from the correct path.

The ‘n’ bits are a signed literal that specifies the number of PS words offset from (PC+4).


Note: Should the byte offset equal fourF and instruction after the branch is a 16-bit opcode, a branch will occur (over the next two 16-bit ops) if the condition is met.
I-Words:1
Cycles:1 (2 or 3)
Note: The taken branch target instruction fetch is not executed if an exception is pending, making effective instruction execution time one cycle.
Example:1AddressLabelInstructionComment
0x804000 - BRA C, _CHECK_FAIL;Branch if (N&&OV)||(!N&&!OV), to0x804030(_CHECK_FAIL)
0x804004_PASS_CONDITION:SL.l w5, w6
. . .. . .
. . .. . .
. . .. . .
0x804030_CHECK_FAIL:MOV.l SR, W6; _CHECK_FAIL SubRoutine
. . . CP w6, w7
. . . . . .
Before executionAfter execution
PC0x804000PC0x804030
w150x4500w150x4500
SR[7:0]8'b0000001(C = 1;)SR[7:0]8'b0000001(C = 1;)
BCLRBit Clear in Ws
Syntax:{label:}BCLR.bWs,bit5
BCLR{.w}[Ws],
BCLR.l[Ws++],
[Ws--],
[++Ws],
[--Ws],
SR
Operands:Ws ∈ [W0 ... W15];

Byte: bit5 ∈ [0 ... 7];

Word: bit5 ∈ [0 ... 15];

Long word: bit5 ∈ [0 ... 31]

Operation:0 → Ws<bit5>
Status Affected:None (see Note 1)
Encoding:S100000bbbbbsssspppUUUUUUUUULB00
Description:Bit ‘bit5’ in register Ws is cleared.

The ‘S’ bit selects instruction size.

The ‘L’ and ‘B’ bits select operation data width.

The ‘b’ bits define value or bit5 of the bit position to be cleared (bit5[4:0] for the 16-bit opcode).

The ‘s’ bits select the source/destination register.

The ‘p’ bits select the source addressing mode.

Note:
  1. When targeting the SR, a bit within the SR will be cleared as a result of the instruction operation.
I-Words:1 or 0.5
Cycles:1
Example 1: BCLR.B W2, #0x2

; Clear bit 3 in W2

Before Instruction

After Instruction

W2F234W2F230
SR0000SR0000
Example 2: BCLR [W0++], #0x0

; Clear bit 0 in [W0]

; Post-increment W0

Before Instruction

After Instruction

W02300W02302
Data 23005607 Data 23005606
SR0000SR0000
BCLRBit Clear in f
Syntax:{label:}BCLR.bf,bit3
Operands:bit3 ∈ [0 ... 7]; f ∈ [0 ... 1MB]
Operation: 0 → f[bit3]
Status Affected:None
Encoding:1100000bffffffffffffffffffffbb01
Description:Bit ‘bit3’ in file register f is cleared.

The ‘w’ bits select value bit3 of the bit position to be cleared.

The ‘f’ bits select the address of the file register.

Note:
  1. This instruction operates in Byte mode only.
  2. The .b extension must be included with the opcode.
I-Words:1
Cycles:1
Example 1:BCLR.B 0x800, #0x7

; Clear bit 7 in 0x800

Before

Instruction

After

Instruction

Data 080066EFData 0800666F
SR0000SR0000
Example 2:BCLR 0x400, #0x9

; Clear bit 9 in 0x400

Before

Instruction

After

Instruction

Data 0400AA55Data 0400A855
SR0000SR0000
BFEXTBit Field Extract from Ws into Wb
Syntax:{label:}BFEXT{.w} bit5,wid6,Ws,Wb
BFEXT.l[Ws],
[Ws++],
[Ws--],
[++Ws],
[--Ws],
SR
Operands:Word: bit5 ∈ [0 .. 15]; wid6 ∈ [0 .. 16]

Long: bit5 ∈ [0 .. 31]; wid6 ∈ [0 .. 32]
Ws ∈ [W0 ... W15]; Wb ∈ [W0 ... W14]

Operation:See text
Status Affected:None
Encoding:1111100mmmmmsssspppcccwwwwccL111
Description:A bit field is extracted (copied) from (Ws), and written into Wb. The bit field data loaded into Wb starts at Wb[0], and all MSbs within Wb that are beyond the defined bit field width will be cleared.

The bit location within Ws of the LSb of the bit field to be extracted is defined by operand bit5. The width of the bit field is defined by operand wid6 and may be between zero and up to 16-bits (word operation) or 32-bits (long word operation).

Word mode will zero-extend the result to 32-bits prior to the write to Wb.

The ‘L’ bit selects word or long word operation.

The ‘w’ bits select the bit field destination register.

The ‘s’ bits select the data source register.

The ‘p’ bits select the source addressing mode.

The ‘ccccc’ bits define the bit field LSb position within the target word.

The ‘mmmmm’ bits define the bit field MSb position within the target word.

Note:
  1. Literal wid6 = 0 is a legal value for both long and word sized operations.
I-Words:1
Cycles:1
BFEXTBit Field Extract from f into Wb
Syntax:{label:}BFEXT{.w} bit5,wid6,f,Wb
BFEXT.l
Operands:bit5 ∈ [0 .. 31]; wid6 ∈ [0 .. 32]
Wb ∈ [W0 ... W14]; f ∈ [0 ... 1MB]
Operation:See text
Status Affected:None
Encoding:
1st word1100110Uffffffffffffffffffff1001
2nd word1100110LUUUmmmmmUUUcccwwwwcc1101
Description:A bit field is extracted (copied) from the file register address and written into Wb. The bit field data loaded into Wb starts at Wb[0], and all MSbs within Wb that are beyond the defined bit field width will be cleared.

The bit location within the file register of the LSb of the bit field to be extracted is defined by operand bit5. The width of the bit field is defined by operand wid6 and may be between 0 and up to 16-bits (word operation) or 32-bits (long word operation).

Word mode will zero-extended the result to 32-bits and then write to Wb.

The ‘L’ bit selects word or long word operation.

The ‘w’ bits select the bit field destination register.

The ‘f’ bits select the address of the source file register.

The ‘ccccc’ bits define the bit field LSb position within the target word.

The ‘mmmmm’ bits define the bit field MSb position within the target word.

Note:
  1. Literal wid6 = 0 is a legal value for both long and word sized operations.
  2. Accessible file address space is 1MB. LSb of ‘f’’ bits is 1’b0 for word operation. LS 2-bits of ‘f’ bits is 2’b00 for long word operation.
I-Words:2
Cycles:2
BFINSBit Field Insert from Wb into Ws
Syntax:{label:}BFINS{.w} bit5,wid6,Wb,Ws
BFINS.l[Ws]
[Ws++]
[Ws--]
[++Ws]
[--Ws]
SR
Operands:Word: bit5 ∈ [0 .. 15]; wid6 ∈ [0 .. 16]

Long: bit5 ∈ [0 .. 31]; wid6 ∈ [0 .. 32]
Wb ∈ [W0 ... W14]; Ws ∈ [W0 ... W15]

Operation:See text
Status Affected:None
Encoding:1111100mmmmmsssspppcccwwwwccL011
Description:A bit field is read from (Wb) and inserted (copied) into Ws. The bit field data sourced from Wb starts at Wb[0]. All MSbs within Wb that are beyond the defined bit field width are ignored and may be set to any value.

The inserted bit field will overwrite the bits already in Ws or SR (i.e., the instruction does not shift any existing bits to accommodate the new bit field).

The bit location within Ws of the LSb of the bit field to be inserted is defined by operand bit5. The width of the bit field is defined by operand wid6 and may be between zero and up to 16-bits (word operation) or 32-bits (long word operation).

Word mode will zero-extend a Ws register direct result write to 32-bits.

The ‘L’ bit selects word or long word operation.

The ‘w’ bits select the bit field source register.

The ‘s’ bits select the data source/destination register.

The ‘p’ bits select the source addressing mode.

The ‘ccccc’ bits define the bit field LSb position within the target word.

The ‘mmmmm’ bits define the bit field MSb position within the target word.

Note:
  1. Literal wid6 = 0 is a legal value for both long and word sized operations.
I-Words:1
Cycles:1
BFINSBit Field Insert from Wb into f
Syntax:{label:}BFINS{.w} bit5,wid6,Wb,f
BFINS.l
Operands:Word: bit5 ∈ [0 .. 15]; wid6 ∈ [0 .. 16]

Long: bit5 ∈ [0 .. 31]; wid6 ∈ [0 .. 32]
Wb ∈ [W0 ... W14]; f ∈ [0 ... 1MB]

Operation:See text
Status Affected:None
Encoding:
1st word1100110Uffffffffffffffffffff0001
2nd word1100110LUUUmmmmmUUUcccwwwwcc0101
Description:A bit field is read from (Wb) and inserted (copied) into the file register address. The bit field data sourced from Wb starts at Wb[0]. All MSbs within Wb that are beyond the defined bit field width are ignored and may be set to any value.

The inserted bit field will overwrite the bits already in the file register (i.e., the instruction does not shift any existing bits to accommodate the new bit field).

The bit location within the file register of the LSb of the bit field to be inserted is defined by operand bit5. The width of the bit field is defined by operand wid6 and may be between zero and up to 16-bits (word operation) or 32-bits (long word operation).

The ‘w’ bits select the bit field source register.

The ‘f’ bits select the source/destination file register.

The ‘ccccc’ bits define the bit field LSb position within the target word.

The ‘mmmmm’ bits define the bit field MSb position within the target word.

Note:
  1. Literal wid6 = 0 is a legal value for both long and word sized operations.
  2. Accessible file address space is 1MB. LSb of ‘f’’ bits is 1’b0 for word operation. LS 2-bits of ‘f’ bits is 2’b00 for long word operation.
I-Words:2
Cycles:2
BFINSBit Field Insert Literal into Ws
Syntax:{label:}BFINS{.w} bit5,wid6,lit16,Ws
BFINS.l[Ws]
[Ws++]
[Ws--]
[++Ws]
[--Ws]
Operands:bit5 ∈ [0 .. 31]; wid6 ∈ [0 .. 32]
lit16 ∈ [0 .. 65536]; Ws ∈ [W0 ... W15]
Operation:See text
Status Affected:None
Encoding:
1st word1100101UUUUUkkkkkkkkkkkkkkkkU001
2nd word1100101mmmmmsssspppcccUUUUccL101
Description:A bit field literal value is inserted (copied) into Ws. The bit field data sourced from the literal starts at the LSb of the literal. All MSbs within the literal value that are beyond the defined bit field width are ignored and may be set to any value.

The inserted bit field will overwrite the bits already in Ws (i.e., the instruction does not shift any existing bits to accommodate the new bit field).

The bit location within Ws of the LSb of the bit field to be inserted is defined by operand bit5. The width of the bit field is defined by operand wid6 and may be between zero and up to 16-bits (word operation) or 32-bits (long word operation).

Word mode will zero-extend a Ws register direct result write to 32-bits.

The ‘L’ bit selects word or long word operation.

The ‘k’ bits contain the bit field source value.

The ‘s’ bits select the source/destination register.

The ‘p’ bits select the source addressing mode.

The ‘ccccc’ bits define the bit field LSb position within the target word.

The ‘mmmmm’ bits define the bit field MSb position within the target word.

Note:
  1. Literal wid6 = 0 is a legal value for both long and word sized operations.
I-Words:2
Cycles:2
BRA GEBranch if Signed Greater Than or Equal
Syntax:{label:}BRAGE,Label
Operands:Label is resolved by the linker to a signed word offset (slit20)
Operation:Condition = (N&&OV)||(!N&&!OV)

If (condition) then {

If slit20 = 1 then skip next (16-bit) instruction

Else if (slit20 = 2 && next_op[31] = 1) then skip next (32-bit) instruction

Else (PC+4) + 2*slit20 → PC

}

Else no branch

Status Affected:None
Encoding:1010100Unnnnnnnnnnnnnnnnnnnn0110
Description:If the branch condition is met, then the instruction will either skip the next 16-bit or 32-bit instruction, or it will branch to any size of instruction with a forward or backward range of 1MB.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals two, the conditional branch will execute as a conditional skip of one 16-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals four and the instruction after the branch is a 32-bit opcode (see note), the conditional branch will execute as a conditional skip of that 32-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If requirements for a conditional skip are not met, the 2’s complement byte offset value ‘2*slit20’ is added to the PC to create a new PS word address. Since the PC will have incremented to fetch the next instruction, the new address will be (PC+4) + 2*slit20.

Branch prediction is based on the direction of the branch. If the branch is backwards (negative), it will be predicted as taken. If the branch is forwards (positive), it will be predicted as not taken. The two instructions that follow the branch will then be speculatively executed in the predicted path until such time that the actual branch decision can be assessed. A correctly predicted branch will continue instruction execution in the same path unabated. An incorrectly predicted branch will abort the speculatively executed instructions and start execution from the correct path.

The ‘n’ bits are a signed literal that specifies the number of PS words offset from (PC+4).

Note: Should the byte offset equal four and instruction after the branch is a 16-bit opcode, a branch will occur (over the next two 16-bit ops) if the condition is met.
I-Words:1
Cycles:1 (2 or 3)

The taken branch target instruction fetch is not executed if an exception is pending, making effective instruction execution time one cycle.

Example:1AddressLabelInstructionComment
0x804000 - BRA GE, _CHECK_FAIL;Branch if (N&&OV)||(!N&&!OV), to0x804030(_CHECK_FAIL)
0x804004_PASS_CONDITION:SL.l w5, w6
. . .. . .
. . .. . .
. . .. . .
0x804030_CHECK_FAIL:MOV.l SR, W6; _CHECK_FAIL SubRoutine
. . . CP w6, w7
. . . . . .
Before executionAfter execution
PC0x804000PC0x804030
w150x4500w150x4500
SR[7:0]8'b0001100(N = 1; OV = 1)SR[7:0]8'b0001100(N = 1; OV = 1)
BRA GTBranch if Signed Greater Than
Syntax:{label:}BRAGT,Label
Operands:Label is resolved by the linker to a signed word offset (slit20)
Operation:Condition = (!Z&&N&&OV)||(!Z&&!N&&!OV);

If (condition) then {

If slit20 = 1 then skip next (16-bit) instruction

Else if (slit20 = 2 && next_op[31] = 1) then skip next (32-bit) instruction

Else (PC+4) + 2*slit20 → PC

}

Else no branch

Status Affected:None
Encoding:1010100Unnnnnnnnnnnnnnnnnnnn0010
Description:If the branch condition is met, then the instruction will either skip the next 16-bit or 32-bit instruction, or it will branch to any size of instruction with a forward or backward range of 1MB.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals two, the conditional branch will execute as a conditional skip of one 16-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals four and the instruction after the branch is a 32-bit opcode (see note), the conditional branch will execute as a conditional skip of that 32-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If requirements for a conditional skip are not met, the 2’s complement byte offset value ‘2*slit20’ is added to the PC to create a new PS word address. Since the PC will have incremented to fetch the next instruction, the new address will be (PC+4) + 2*slit20.

Branch prediction is based on the direction of the branch. If the branch is backwards (negative), it will be predicted as taken. If the branch is forwards (positive), it will be predicted as not taken. The two instructions that follow the branch will then be speculatively executed in the predicted path until such time that the actual branch decision can be assessed. A correctly predicted branch will continue instruction execution in the same path unabated. An incorrectly predicted branch will abort the speculatively executed instructions and start execution from the correct path.

The ‘n’ bits are a signed literal that specifies the number of PS words offset from (PC+4).

Note: Should the byte offset equal four and instruction after the branch is a 16-bit opcode, a branch will occur (over the next two 16-bit ops) if the condition is met.
I-Words:1
Cycles:1 (2 or 3)
Note: The taken branch target instruction fetch is not executed if an exception is pending, making effective instruction execution time one cycle.
Example:1AddressLabelInstructionComment
0x804000 - BRA GT, _CHECK_FAIL;Branch if (!Z&&N&&OV)||(!Z&&!N&&!OV), to0x804030(_CHECK_FAIL)
0x804004_PASS_CONDITION:SL.l w5, w6
. . .. . .
. . .. . .
. . .. . .
0x804030_CHECK_FAIL:MOV.l SR, W6; _CHECK_FAIL SubRoutine
. . . CP w6, w7
. . . . . .
Before executionAfter execution
PC0x804000PC0x804030
w150x4500w150x4500
SR[7:0]8'b0001100(Z = 0;OV = 1; N=1)SR[7:0]8'b0001100(Z = 0;OV = 1; N=1)
BRA GTUBranch if Unsigned Greater Than
Syntax:{label:}BRAGTU,Label
Operands:Label is resolved by the linker to a signed word offset (slit20)
Operation:Condition = (C&&!Z);

If (condition) then {

If slit20 = 1 then skip next (16-bit) instruction

Else if (slit20 = 2 && next_op[31] = 1) then skip next (32-bit) instruction

Else (PC+4) + 2*slit20 → PC

}

Else no branch

Status Affected:None
Encoding:1010111Unnnnnnnnnnnnnnnnnnnn0110
Description:If the branch condition is met, then the instruction will either skip the next 16-bit or 32-bit instruction, or it will branch to any size of instruction with a forward or backward range of 1MB. Likewise, the literal is zero-extended to 32-bits for long-word instructions.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals two, the conditional branch will execute as a conditional skip of one 16-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals four, and the instruction after the branch is a 32-bit opcode (see note), the conditional branch will execute as a conditional skip of that 32-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If requirements for a conditional skip are not met, the 2’s complement byte offset value ‘2*slit20’ is added to the PC, to create a new PS word address. Since the PC will have incremented to fetch the next instruction, the new address will be (PC+4) + 2*slit20.

Branch prediction is based on the direction of the branch. If the branch is backwards (negative), it will be predicted as taken. If the branch is forwards (positive), it will be predicted as not taken. The two instructions that follow the branch will then be speculatively executed in the predicted path until such time that the actual branch decision can be assessed. A correctly predicted branch will continue instruction execution in the same path unabated. An incorrectly predicted branch will abort the speculatively executed instructions and start execution from the correct path.

The ‘n’ bits are a signed literal that specifies the number of PS words offset from (PC+4).

Note: Should the byte offset equal four and instruction after the branch is a 16-bit opcode, a branch will occur (over the next two 16-bit ops) if the condition is met.
I-Words:1
Cycles:1 (2 or 3)
Note: The taken branch target instruction fetch is not executed if an exception is pending, making effective instruction execution time one cycle.
Example:1AddressLabelInstructionComment
0x804000 - BRA GTU, _CHECK_FAIL; Branch if (C&&!Z), to0x804030(_CHECK_FAIL)
0x804004_PASS_CONDITION:SL.l w5, w6
. . .. . .
. . .. . .
. . .. . .
0x804030_CHECK_FAIL:MOV.l SR, W6; _CHECK_FAIL SubRoutine
. . . CP w6, w7
. . . . . .
Before executionAfter execution
PC0x804000PC0x804030
w150x4500w150x4500
SR[7:0]8'b0000001(C = 1, Z = 0)SR[7:0]8'b0000001(C = 1, Z = 0)
BRA LEBranch if Signed Less Than or Equal
Syntax:{label:}BRALE,Label
Operands:Label is resolved by the linker to a signed word offset (slit20)
Operation:Condition = Z||(N&&!OV)||(!N&&OV);

If (condition) then {

If slit20 = 1 then skip next (16-bit) instruction

Else if (slit20 = 2 && next_op[31] = 1) then skip next (32-bit) instruction

Else (PC+4) + 2*slit20 → PC

}

Else no branch

Status Affected:None
Encoding:1010100Unnnnnnnnnnnnnnnnnnnn1110
Description:If the branch condition is met, then the instruction will either skip the next 16-bit or 32-bit instruction, or it will branch to any size of instruction with a forward or backward range of 1MB.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals two, the conditional branch will execute as a conditional skip of one 16-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals four, and the instruction after the branch is a 32-bit opcode (see note), the conditional branch will execute as a conditional skip of that 32-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If requirements for a conditional skip are not met, the 2’s complement byte offset value ‘2*slit20’ is added to the PC to create a new PS word address. Since the PC will have incremented to fetch the next instruction, the new address will be (PC+4) + 2*slit20.

Branch prediction is based on the direction of the branch. If the branch is backwards (negative), it will be predicted as taken. If the branch is forwards (positive), it will be predicted as not taken. The two instructions that follow the branch will then be speculatively executed in the predicted path until such time that the actual branch decision can be assessed. A correctly predicted branch will continue instruction execution in the same path unabated. An incorrectly predicted branch will abort the speculatively executed instructions and start execution from the correct path.

The ‘n’ bits are a signed literal that specifies the number of PS words offset from (PC+4).

Note: Should the byte offset equal four and instruction after the branch is a 16-bit opcode, a branch will occur (over the next two 16-bit ops) if the condition is met.
I-Words:1
Cycles:1 (2 or 3)
Note: The taken branch target instruction fetch is not executed if an exception is pending, making effective instruction execution time one cycle.
Example:1AddressLabelInstructionComment
0x804000 - BRA LE, _CHECK_FAIL;Branch if Z||(N&&!OV)||(!N&&OV), to0x804030(_CHECK_FAIL)
0x804004_PASS_CONDITION:SL.l w5, w6
. . .. . .
. . .. . .
. . .. . .
0x804030_CHECK_FAIL:MOV.l SR, W6; _CHECK_FAIL SubRoutine
. . . CP w6, w7
. . . . . .
Before executionAfter execution
PC0x804000PC0x804030
w150x4500w150x4500
SR[7:0]8'b0000010(Z = 1)SR[7:0]8'b0000010(Z =1)
BRA LEUBranch if Unsigned Less Than or Equal
Syntax:{label:}BRALEU,Label
Operands:Label is resolved by the linker to a signed word offset (slit20)
Operation:Condition = !C||Z;

If (condition) then {

If slit20 = 1 then skip next (16-bit) instruction

Else if (slit20 = 2 && next_op[31] = 1) then skip next (32-bit) instruction

Else (PC+4) + 2*slit20 → PC

}

Else no branch

Status Affected:None
Encoding:1010111Unnnnnnnnnnnnnnnnnnnn0010
Description:If the branch condition is met, then the instruction will either skip the next 16-bit or 32-bit instruction, or it will branch to any size of instruction with a forward or backward range of 1MB. Likewise, the literal is zero-extended to 32-bits for long-word instructions.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals two, the conditional branch will execute as a conditional skip of one 16-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals four, and the instruction after the branch is a 32-bit opcode (see note), the conditional branch will execute as a conditional skip of that 32-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If requirements for a conditional skip are not met, the 2’s complement byte offset value ‘2*slit20’ is added to the PC to create a new PS word address. Since the PC will have incremented to fetch the next instruction, the new address will be (PC+4) + 2*slit20.

Branch prediction is based on the direction of the branch. If the branch is backwards (negative), it will be predicted as taken. If the branch is forwards (positive), it will be predicted as not taken. The two instructions that follow the branch will then be speculatively executed in the predicted path until such time that the actual branch decision can be assessed. A correctly predicted branch will continue instruction execution in the same path unabated. An incorrectly predicted branch will abort the speculatively executed instructions and start execution from the correct path.

The ‘n’ bits are a signed literal that specifies the number of PS words offset from (PC+4).

Note: Should the byte offset equal four and instruction after the branch is a 16-bit opcode, a branch will occur (over the next two 16-bit ops) if the condition is met.
I-Words:1
Cycles:1 (2 or 3)
Note: The taken branch target instruction fetch is not executed if an exception is pending, making effective instruction execution time one cycle.
Example:1AddressLabelInstructionComment
0x804000 - BRA LT, _CHECK_FAIL;Branch if !C||Z, to0x804030(_CHECK_FAIL)
0x804004_PASS_CONDITION:SL.l w5, w6
. . .. . .
. . .. . .
. . .. . .
0x804030_CHECK_FAIL:MOV.l SR, W6; _CHECK_FAIL SubRoutine
. . . CP w6, w7
. . . . . .
Before executionAfter execution
PC0x804000PC0x804030
w150x4500w150x4500
SR[7:0]8'b0000000(Z = 0;C = 0)SR[7:0]8'b0000000(Z = 0;C = 0)
BRA LTBranch if Signed Less Than
Syntax:{label:}BRALT,Label
Operands:Label is resolved by the linker to a signed word offset (slit20)
Operation:Condition = (N&&!OV)||(!N&&OV);

If (condition) then {

If slit20 = 1 then skip next (16-bit) instruction

Else if (slit20 = 2 && next_op[31] = 1) then skip next (32-bit) instruction

Else (PC+4) + 2*slit20 → PC

}

Else no branch

Status Affected:None
Encoding:1010100Unnnnnnnnnnnnnnnnnnnn1010
Description:If the branch condition is met, then the instruction will either skip the next 16-bit or 32-bit instruction, or it will branch to any size of instruction with a forward or backward range of 1MB.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals two, the conditional branch will execute as a conditional skip of one 16-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals four, and the instruction after the branch is a 32-bit opcode (see note), the conditional branch will execute as a conditional skip of that 32-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If requirements for a conditional skip are not met, the 2’s complement byte offset value ‘2*slit20’ is added to the PC to create a new PS word address. Since the PC will have incremented to fetch the next instruction, the new address will be (PC+4) + 2*slit20.

Branch prediction is based on the direction of the branch. If the branch is backwards (negative), it will be predicted as taken. If the branch is forwards (positive), it will be predicted as not taken. The two instructions that follow the branch will then be speculatively executed in the predicted path until such time that the actual branch decision can be assessed. A correctly predicted branch will continue instruction execution in the same path unabated. An incorrectly predicted branch will abort the speculatively executed instructions and start execution from the correct path.

The ‘n’ bits are a signed literal that specifies the number of PS words offset from (PC+4).

Note: Should the byte offset equal four and instruction after the branch is a 16-bit opcode, a branch will occur (over the next two 16-bit ops) if the condition is met.
I-Words:1
Cycles:1 (2 or 3)
Note: The taken branch target instruction fetch is not executed if an exception is pending, making effective instruction execution time one cycle.
Example:1AddressLabelInstructionComment
0x804000 - BRA LT, _CHECK_FAIL;Branch if !C||Z, to0x804030(_CHECK_FAIL)
0x804004_PASS_CONDITION:SL.l w5, w6
. . .. . .
. . .. . .
. . .. . .
0x804030_CHECK_FAIL:MOV.l SR, W6; _CHECK_FAIL SubRoutine
. . . CP w6, w7
. . . . . .
Before executionAfter execution
PC0x804000PC0x804030
w150x4500w150x4500
SR[7:0]8'b0000000(Z = 0;C = 0)SR[7:0]8'b0000000(Z = 0;C = 0)
BRA NC/LTUBranch if Not Carry / Unsigned Less Than
Syntax:{label:}BRANC,Label
{label:}BRALTU,
Operands:Label is resolved by the linker to a signed word offset (slit20)
Operation:Condition = !C

If (condition) then {

If slit20 = 1 then skip next (16-bit) instruction

Else If (slit20 = 2 && next_op[31] = 1) then skip next (32-bit) instruction

Else (PC+4) + 2*slit20 → PC

}

Else no branch

Status Affected:None
Encoding:1010101Unnnnnnnnnnnnnnnnnnnn0110
Description:If the branch condition is met, then the instruction will either skip the next 16-bit or 32-bit instruction, or branch to any size of instruction with a forward or backward range of 1MB.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals two, the conditional branch will execute as a conditional skip of one 16-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals four and the instruction after the branch is a 32-bit opcode (see note), the conditional branch will execute as a conditional skip of that 32-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If requirements for a conditional skip are not met, the 2’s complement byte offset value ‘2*slit20’ is added to the PC to create a new PS word address. Since the PC will have incremented to fetch the next instruction, the new address will be (PC+4) + 2*slit20.

Branch prediction is based on the direction of the branch. If the branch is backwards (negative), it will be predicted as taken. If the branch is forwards (positive), it will be predicted as not taken. The two instructions that follow the branch will then be speculatively executed in the predicted path until such time that the actual branch decision can be assessed. A correctly predicted branch will continue instruction execution in the same path unabated. An incorrectly predicted branch will abort the speculatively executed instructions and start execution from the correct path.

The ‘n’ bits are a signed literal that specifies the number of PS words offset from (PC+4).

Note: Should the byte offset equal four and instruction after the branch is a 16-bit opcode, a branch will occur (over the next two 16-bit ops) if the condition is met.
I-Words:1
Cycles:1 (2 or 3)
Note: The taken branch target instruction fetch is not executed if an exception is pending, making effective instruction execution time one cycle.
Example:1AddressLabelInstructionComment
0x804000 - BRA LTU, _CHECK_FAIL; Branch if SR.C == 0, to0x804030(_CHECK_FAIL)
0x804004_PASS_CONDITION:SL.l w5, w6
. . .. . .
. . .. . .
. . .. . .
0x804030_CHECK_FAIL:MOV.l SR, W6; _CHECK_FAIL SubRoutine
. . . CP w6, w7
. . . . . .
Before executionAfter execution
PC0x804000PC0x804030
w150x4500w150x4500
SR[7:0]8'b0000000(C = 0)SR[7:0]8'b0000000(C = 0)
BRA NNBranch if Not Negative
Syntax:{label:}BRANN,Label
Operands:Label is resolved by the linker to a signed word offset (slit20)
Operation:Condition = !N

If (condition) then {

If slit20 = 1 then skip next (16-bit) instruction

Else if (slit20 = 2 && next_op[31] = 1) then skip next (32-bit) instruction

Else (PC+4) + 2*slit20 → PC

}

Else no branch

Status Affected:None
Encoding:1010011Unnnnnnnnnnnnnnnnnnnn0110
Description:If the branch condition is met, then the instruction will either skip the next 16-bit or 32-bit instruction, or it will branch to any size of instruction with a forward or backward range of 1MB.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals two, the conditional branch will execute as a conditional skip of one 16-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals four, and the instruction after the branch is a 32-bit opcode (see note), the conditional branch will execute as a conditional skip of that 32-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If requirements for a conditional skip are not met, the 2’s complement byte offset value ‘2*slit20’ is added to the PC to create a new PS word address. Since the PC will have incremented to fetch the next instruction, the new address will be (PC+4) + 2*slit20.

Branch prediction is based on the direction of the branch. If the branch is backwards (negative), it will be predicted as taken. If the branch is forwards (positive), it will be predicted as not taken. The two instructions that follow the branch will then be speculatively executed in the predicted path until such time that the actual branch decision can be assessed. A correctly predicted branch will continue instruction execution in the same path unabated. An incorrectly predicted branch will abort the speculatively executed instructions and start execution from the correct path.

The ‘n’ bits are a signed literal that specifies the number of PS words offset from (PC+4).

Note: Should the byte offset equal four and instruction after the branch is a 16-bit opcode, a branch will occur (over the next two 16-bit ops) if the condition is met.
I-Words:1
Cycles:1 (2 or 3)
Note: The taken branch target instruction fetch is not executed if an exception is pending, making effective instruction execution time one cycle.
Example:1AddressLabelInstructionComment
0x804000 - BRA NN, _CHECK_FAIL; Branch if SR.N == 0, to0x804030(_CHECK_FAIL)
0x804004_PASS_CONDITION:SL.l w5, w6
. . .. . .
. . .. . .
. . .. . .
0x804030_CHECK_FAIL:MOV.l SR, W6; _CHECK_FAIL SubRoutine
. . . CP w6, w7
. . . . . .
Before executionAfter execution
PC0x804000PC0x804004(No Branch)
w150x4500w150x4500
SR[7:0]8'b00001000(N = 1)SR[7:0]8'b00001000(N = 1)
Example:2AddressLabelInstructionComment
0x804000 - BRA N, _CHECK_FAIL; Branch if SR.N == 1, to0x804030(_CHECK_FAIL)
0x804004_PASS_CONDITION:SL.l w5, w6
. . .. . .
. . .. . .
. . .. . .
0x804030_CHECK_FAIL:MOV.l SR, W6; _CHECK_FAIL SubRoutine
. . . CP w6, w7
. . . . . .
Before executionAfter execution
PC0x804000PC0x804030
w150x4500w150x4500
SR[7:0]8'b00001000(N = 1)SR[7:0]8'b00001000(N = 1)
BRA NOVBranch if Not Overflow
Syntax:{label:}BRANOV,Label
Operands:Label is resolved by the linker to a signed word offset (slit20)
Operation:Condition = !OV

If (condition) then {

If slit20 = 1 then skip next (16-bit) instruction

Else if (slit20 = 2 && next_op[31] = 1) then skip next (32-bit) instruction

Else (PC+4) + 2*slit20 → PC

}

Else no branch

Status Affected:None
Encoding:1010101Unnnnnnnnnnnnnnnnnnnn1110
Description:If the branch condition is met, then the instruction will either skip the next 16-bit or 32-bit instruction, or it will branch to any size of instruction with a forward or backward range of 1MB.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals two, the conditional branch will execute as a conditional skip of one 16-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals four and the instruction after the branch is a 32-bit opcode (see note), the conditional branch will execute as a conditional skip of that 32-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If requirements for a conditional skip are not met, the 2’s complement byte offset value ‘2*slit20’ is added to the PC to create a new PS word address. Since the PC will have incremented to fetch the next instruction, the new address will be (PC+4) + 2*slit20.

Branch prediction is based on the direction of the branch. If the branch is backwards (negative), it will be predicted as taken. If the branch is forwards (positive), it will be predicted as not taken. The two instructions that follow the branch will then be speculatively executed in the predicted path until such time that the actual branch decision can be assessed. A correctly predicted branch will continue instruction execution in the same path unabated. An incorrectly predicted branch will abort the speculatively executed instructions and start execution from the correct path.

The ‘n’ bits are a signed literal that specifies the number of PS words offset from (PC+4).

Note: Should the byte offset equal four and instruction after the branch is a 16-bit opcode, a branch will occur (over the next two 16-bit ops) if the condition is met.
I-Words:1
Cycles:1 (2 or 3)
Note: The taken branch target instruction fetch is not executed if an exception is pending, making effective instruction execution time one cycle.
Example:1AddressLabelInstructionComment
0x804000 - BRA NOV, _CHECK_FAIL; Branch if SR.OV == 0, to0x804030(_CHECK_FAIL)
0x804004_PASS_CONDITION:SL.l w5, w6
. . .. . .
. . .. . .
. . .. . .
0x804030_CHECK_FAIL:MOV.l SR, W6; _CHECK_FAIL SubRoutine
. . . CP w6, w7
. . . . . .
Before executionAfter execution
PC0x804000PC0x804004(No Branch)
w150x4500w150x4500
SR[7:0]8'b00000100(OV = 1)SR[7:0]8'b00000100(OV = 1)
BRA NZBranch if Not Zero
Syntax:{label:}BRANZ,Label
Operands:Label is resolved by the linker to a signed word offset (slit20)
Operation:Condition = !Z

If (condition) then {

If slit20 = 1 then skip next (16-bit) instruction

Else if (slit20 = 2 && next_op[31] = 1) then skip next (32-bit) instruction

Else (PC+4) + 2*slit20 → PC

}

Else no branch

Status Affected:None
Encoding:1010011Unnnnnnnnnnnnnnnnnnnn1110
Description:If the branch condition is met, then the instruction will either skip the next 16-bit or 32-bit instruction, or it will branch to any size of instruction with a forward or backward range of 1MB.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals two, the conditional branch will execute as a conditional skip of one 16-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals four, and the instruction after the branch is a 32-bit opcode (see note), the conditional branch will execute as a conditional skip of that 32-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If requirements for a conditional skip are not met, the 2’s complement byte offset value ‘2*slit20’ is added to the PC to create a new PS word address. Since the PC will have incremented to fetch the next instruction, the new address will be (PC+4) + 2*slit20.

Branch prediction is based on the direction of the branch. If the branch is backwards (negative), it will be predicted as taken. If the branch is forwards (positive), it will be predicted as not taken. The two instructions that follow the branch will then be speculatively executed in the predicted path until such time that the actual branch decision can be assessed. A correctly predicted branch will continue instruction execution in the same path unabated. An incorrectly predicted branch will abort the speculatively executed instructions and start execution from the correct path.

The ‘n’ bits are a signed literal that specifies the number of PS words offset from (PC+4).

Note: Should the byte offset equal four and instruction after the branch is a 16-bit opcode, a branch will occur (over the next two 16-bit ops) if the condition is met.
I-Words:1
Cycles:1 (2 or 3)
Note: The taken branch target instruction fetch is not executed if an exception is pending, making effective instruction execution time one cycle.
Example:1AddressLabelInstructionComment
0x804000 - BRA NZ, _CHECK_FAIL; Branch if SR.Z == 0, to0x804030(_CHECK_FAIL)
0x804004_PASS_CONDITION:SL.l w5, w6
. . .. . .
. . .. . .
. . .. . .
0x804030_CHECK_FAIL:MOV.l SR, W6; _CHECK_FAIL SubRoutine
. . . CP w6, w7
. . . . . .
Before executionAfter execution
PC0x804000PC0x804030
w150x4500w150x4500
SR[15:8]8'b00000000(Z = 0)SR[15:8]8'b00000000(Z = 0)
BRA OABranch if Overflow Accumulator A
Syntax:{label:}BRAOA,Label
Operands:Label is resolved by the linker to a signed word offset (slit20)
Operation:Condition = OA

If (condition) then {

If slit20 = 1 then skip next (16-bit) instruction

Else if (slit20 = 2 && next_op[31] = 1) then skip next (32-bit) instruction

Else (PC+4) + 2*slit20 → PC

}

Else no branch

Status Affected:None
Encoding:1010110Unnnnnnnnnnnnnnnnnnnn0010
Description:If the branch condition is met, then the instruction will either skip the next 16-bit or 32-bit instruction, or it will branch to any size of instruction with a forward or backward range of 1MB.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals two, the conditional branch will execute as a conditional skip of one 16-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals four and the instruction after the branch is a 32-bit opcode (see note), the conditional branch will execute as a conditional skip of that 32-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If requirements for a conditional skip are not met, the 2’s complement byte offset value ‘2*slit20’ is added to the PC to create a new PS word address. Since the PC will have incremented to fetch the next instruction, the new address will be (PC+4) + 2*slit20.

Branch prediction is based on the direction of the branch. If the branch is backwards (negative), it will be predicted as taken. If the branch is forwards (positive), it will be predicted as not taken. The two instructions that follow the branch will then be speculatively executed in the predicted path until such time that the actual branch decision can be assessed. A correctly predicted branch will continue instruction execution in the same path unabated. An incorrectly predicted branch will abort the speculatively executed instructions and start execution from the correct path.

The ‘n’ bits are a signed literal that specifies the number of PS words offset from (PC+4).

Note: Should the byte offset equal four and instruction after the branch is a 16-bit opcode, a branch will occur (over the next two 16-bit ops) if the condition is met.
I-Words:1
Cycles:1 (2 or 3)
Note: The taken branch target instruction fetch is not executed if an exception is pending, making effective instruction execution time one cycle.
Example:1AddressLabelInstructionComment
0x804000 - BRA OA, _CHECK_FAIL; Branch if SR.OA == 1, to 0x804030(_CHECK_FAIL)
0x804004_PASS_CONDITION:SL.l w5, w6
. . .. . .
. . .. . .
. . .. . .
0x804030_CHECK_FAIL:MOV.l SR, W6; _CHECK_FAIL SubRoutine
. . . CP w6, w7
. . . . . .
Before executionAfter execution
PC0x804000PC0x804030
w150x4500w150x4500
SR[15:8]8'b10001000(OA, OAB = 1)SR[15:8]8'b10001000(OA, OAB = 1)
BRA OBBranch if Overflow Accumulator B
Syntax:{label:}BRAOB,Label
Operands:Label is resolved by the linker to a signed word offset (slit20)
Operation:Condition = OB

If (condition) then {

If slit20 = 1 then skip next (16-bit) instruction

Else if (slit20 = 2 && next_op[31] = 1) then skip next (32-bit) instruction

Else (PC+4) + 2*slit20 → PC

}

Else no branch

Status Affected:None
Encoding:1010110Unnnnnnnnnnnnnnnnnnnn0110
Description:If the branch condition is met, then the instruction will either skip the next 16-bit or 32-bit instruction, or it will branch to any size of instruction with a forward or backward range of 1MB.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals two, the conditional branch will execute as a conditional skip of one 16-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals four and the instruction after the branch is a 32-bit opcode (see note), the conditional branch will execute as a conditional skip of that 32-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If requirements for a conditional skip are not met, the 2’s complement byte offset value ‘2*slit20’ is added to the PC to create a new PS word address. Since the PC will have incremented to fetch the next instruction, the new address will be (PC+4) + 2*slit20.

Branch prediction is based on the direction of the branch. If the branch is backwards (negative), it will be predicted as taken. If the branch is forwards (positive), it will be predicted as not taken. The two instructions that follow the branch will then be speculatively executed in the predicted path until such time that the actual branch decision can be assessed. A correctly predicted branch will continue instruction execution in the same path unabated. An incorrectly predicted branch will abort the speculatively executed instructions and start execution from the correct path.

The ‘n’ bits are a signed literal that specifies the number of PS words offset from (PC+4).

Note: Should the byte offset equal four and instruction after the branch is a 16-bit opcode, a branch will occur (over the next two 16-bit ops) if the condition is met.
I-Words:1
Cycles:1 (2 or 3)
Note: The taken branch target instruction fetch is not executed if an exception is pending, making effective instruction execution time one cycle.
Example:1AddressLabelInstructionComment
0x804000 - BRA OB, _CHECK_FAIL; Branch if SR.OA == 1, to 0x804030(_CHECK_FAIL)
0x804004_PASS_CONDITION:SL.l w5, w6
. . .. . .
. . .. . .
. . .. . .
0x804030_CHECK_FAIL:MOV.l SR, W6; _CHECK_FAIL SubRoutine
. . . CP w6, w7
. . . . . .
Before executionAfter execution
PC0x804000PC0x804004(No Branch)
w150x4500w150x4500
SR[15:8]8'b00000000(OB, OAB = 0)SR[15:8]8'b00000000(OB, OAB = 0)
BOOTSWPSwap Active and Inactive Flash Address Space
Syntax:{label:}BOOTSWPWs
Operands:Ws ∈ [W0 ... W14]
Operation:IF (cfg_bootswap_disable = 0)

IF Ws valid (see text)

1 * Z

IF (sec_dual_boot_active = 1)

NVMCON.P2ACTIV * NVMCON.P2ACTIV

1 * NVMCON.SOFTSWAP

ELSE no panel swap

ELSE 0 * Z (and no panel swap)

ELSE execute as 2 cycle NOP (and no panel swap)

Status Affected:Z (when BOOTSWP enabled)
Encoding:1111 101UUUUUssssUUUUUUUUUUU10011
Description:

If the BOOTSWP instruction is enabled (cfg_bootswap_disable = 0), it will confirm that Ws contains a valid Boot Sequence (BTSEQ) value (see note 1) before signaling the NVM Controller to execute a panel swap.

If Ws is valid and the device is operating in Dual Boot mode (sec_dual_boot_active = 1), the following will occur:

  1. Toggle the state of the NVMCON.P2ACTIV Status bit which will swap the Active and Inactive Flash address spaces within the PS address map.
  2. Set NVMCON.SOFTSWAP and Z = 1, indicating a successful panel swap. If Ws is valid but the device is not operating in Dual Boot mode, the Z-bit will still be set to 1’b1, but no panel swap will occur. If Ws is invalid, BOOTSWP will set Z = 0 (irrespective of whether the device is operating in Dual Boot mode or not), and no panel swap will occur. If the BOOTSWP instruction is not enabled, it will execute as a two cycle NOP instruction (the Z-bit will be unaffected and no panel swap will occur). The ‘s’ bits specify the source register Ws.
Note: It is required that the Inactive panel BTSEQ value be loaded into Ws prior to the execution of BOOTSWP.
I-Words:1
Cycles:2 + additional cycle(s) for PS memory instruction fetch from target space if Flash address space swap is successful.
BRA OVBranch if Overflow
Syntax:{label:}BRAOV,Label
Operands:Label is resolved by the linker to a signed word offset (slit20)
Operation:Condition = OV

If (condition) then {

If slit20 = 1 then skip next (16-bit) instruction

Else if (slit20 = 2 && next_op[31] = 1) then skip next (32-bit) instruction

Else (PC+4) + 2*slit20 → PC

}

Else no branch

Status Affected:None
Encoding:1010101Unnnnnnnnnnnnnnnnnnnn1010
Description:If the branch condition is met, then the instruction will either skip the next 16-bit or 32-bit instruction, or it will branch to any size of instruction with a forward or backward range of 1MB.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals two, the conditional branch will execute as a conditional skip of one 16-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals four and the instruction after the branch is a 32-bit opcode (see note), the conditional branch will execute as a conditional skip of that 32-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If requirements for a conditional skip are not met, the 2’s complement byte offset value ‘2*slit20’ is added to the PC to create a new PS word address. Since the PC will have incremented to fetch the next instruction, the new address will be (PC+4) + 2*slit20.

Branch prediction is based on the direction of the branch. If the branch is backwards (negative), it will be predicted as taken. If the branch is forwards (positive), it will be predicted as not taken. The two instructions that follow the branch will then be speculatively executed in the predicted path until such time that the actual branch decision can be assessed. A correctly predicted branch will continue instruction execution in the same path unabated. An incorrectly predicted branch will abort the speculatively executed instructions and start execution from the correct path.

The ‘n’ bits are a signed literal that specifies the number of PS words offset from (PC+4).

Note: Should the byte offset equal four and instruction after the branch is a 16-bit opcode, a branch will occur (over the next two 16-bit ops) if the condition is met.
I-Words:1
Cycles:1 (2 or 3)
Note: The taken branch target instruction fetch is not executed if an exception is pending, making effective instruction execution time one cycle.
Example:1AddressLabelInstructionComment
0x804000 - BRA OV, _CHECK_FAIL; Branch if SR.OV == 1, to 0x804030(_CHECK_FAIL)
0x804004_PASS_CONDITION:SL.l w5, w6
. . .. . .
. . .. . .
. . .. . .
0x804030_CHECK_FAIL:MOV.l SR, W6; _CHECK_FAIL SubRoutine
. . . CP w6, w7
. . . . . .
Before executionAfter execution
PC0x804000PC0x804030
w150x4500w150x4500
SR[7:0]8'b00000100(OV = 1)SR[7:0]8'b00000100(OV = 1)
BRABranch Unconditionally
Syntax:{label:}BRALabel
Operands:Label is resolved by the linker to a signed word offset (slit20)
Operation:(PC+4) + 2*slit20 → PC
Status Affected:None
Encoding:1010111Unnnnnnnnnnnnnnnnnnnn1010
Description:The program will branch unconditionally with a forward or backward range of 1MB.

The 2’s complement byte offset value ‘2*slit20’ (the PC offset) is added to the PC. Since the PC will have incremented to fetch the next instruction, the new address will be (PC+4) + 2*slit20.

The ‘n’ bits are a signed literal that specifies the number of PS words to branch from (PC+4).

I-Words:1
Cycles:1
Example:1AddressLabelInstructionComment
0x804000 - BRA _CHECK_FAIL; Branch to label _CEHCK_FAIL
0x804004_PASS_CONDITION:SL.l w5, w6
. . .. . .
. . .. . .
. . .. . .
0x804030_CHECK_FAIL:MOV.l SR, W6; _CHECK_FAIL SubRoutine
. . . CP w6, w7
. . . . . .
Before executionAfter execution
PC0x804000PC0x804030
w150x4500w150x4500
Example:2AddressLabelInstructionComment
0x804000 - BRA _CHECK_FAIL + 4; Branch to label _CEHCK_FAIL
0x804004_PASS_CONDITION:SL.l w5, w6
. . .. . .
. . .. . .
. . .. . .
0x804030_CHECK_FAIL:MOV.l SR, W6; _CHECK_FAIL SubRoutine
. . . CP w6, w7
. . . . . .
Before executionAfter execution
PC0x804000PC0x804034
w150x4500w150x4500
BRAComputed Branch
Syntax:{label:}BRAWns
Operands:Wns ∈ [W0 ... W14]
Operation:(PC + 4) + 2*Wns[19:0] → PC, NOP → Instruction Register.
Status Affected:None
Encoding:1101011UUUUUssssUUUUUUUUUUUU0010
Description:Computed branch with a forward or backward branch address range of 1MB.

The signed value in Wns[19:0] represents the PS (16-bit) word offset from the current PC. This value is multiplied by two to create a byte address that is then added to the contents of the PC to form the target address. Therefore, Wn must contain a signed value that specifies the number of PS words to offset from (PC+4) for the branch.

The ‘s’ bits select the source register.

Note: If Wns[31:19] is not all 0’s or all 1’s, an address error trap will be initiated.
I-Words:1
Cycles:2
Note: The branch target instruction fetch is not executed if an exception is pending, making effective instruction execution time one cycle.
Example:1AddressLabelInstructionComment
0x803FFCMOV.l #0x16, W7
0x804000 - BRA W7; Branch to offset contained in W7(0x804004 + 2*0x16)
0x804004_PASS_CONDITION:SL.l w5, w6
. . .. . .
. . .. . .
. . .. . .
0x804030_CHECK_FAIL:MOV.l SR, W6; _CHECK_FAIL SubRoutine
. . . CP w6, w7
. . . . . .
Before executionAfter execution
PC0x804000PC0x804030
w150x4500w150x4500
BREAKBreak
Syntax:{label:}BREAK
Operands:none
Operation:Application (User) Mode:

Execute as NOP

Debugger Mode:

Mission Mode: Stop user code execution.
 Debug Mode: Execute as NOP

Status Affected:None
Encoding:S111001UUUUU0010UUUUUUUUUUUUUU00
Description:BREAK will only execute as such when the device is operating in Mission mode. If encountered in any other mode, it will be executed as an NOP.

BREAK will stop user code execution and switch from Mission into Debug mode where it will execute the resident Debug Executive (DE). The User PC is not modified by this instruction. All exceptions (including traps) are blocked while executing BREAK and while in Debug mode.

In order to avoid possible hazards between Debug and Mission mode code, BREAK will execute two FNOPs prior to starting Debug mode execution. The total instruction cycle count includes these FNOPs.

The ‘S’ bit selects instruction size.

Note: 16-bit encoding (bold).
I-Words:1 or 0.5
Cycles:3
BRA SABranch if ACCA Saturation
Syntax:{label:}BRASA,Label
Operands:Label is resolved by the linker to a signed word offset (slit20)
Operation:Condition = SA

If (condition) then {

If slit20 = 1 then skip next (16-bit) instruction

Else if (slit20 = 2 && next_op[31] = 1) then skip next (32-bit) instruction

Else (PC+4) + 2*slit20 → PC

}

Else no branch

Status Affected:None
Encoding:1010110Unnnnnnnnnnnnnnnnnnnn1010
Description:If the branch condition is met, then the instruction will either skip the next 16-bit or 32-bit instruction, or it will branch to any size of instruction with a forward or backward range of 1MB.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals two, the conditional branch will execute as a conditional skip of one 16-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals four and the instruction after the branch is a 32-bit opcode (see note), the conditional branch will execute as a conditional skip of that 32-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If requirements for a conditional skip are not met, the 2’s complement byte offset value ‘2*slit20’ is added to the PC to create a new PS word address. Since the PC will have incremented to fetch the next instruction, the new address will be (PC+4) + 2*slit20.

Branch prediction is based on the direction of the branch. If the branch is backwards (negative), it will be predicted as taken. If the branch is forwards (positive), it will be predicted as not taken. The two instructions that follow the branch will then be speculatively executed in the predicted path until such time that the actual branch decision can be assessed. A correctly predicted branch will continue instruction execution in the same path unabated. An incorrectly predicted branch will abort the speculatively executed instructions and start execution from the correct path.

The ‘n’ bits are a signed literal that specifies the number of PS words offset from (PC+4).

Note: Should the byte offset equal four and instruction after the branch is a 16-bit opcode, a branch will occur (over the next two 16-bit ops) if the condition is met.
I-Words:1
Cycles:1 (2 or 3)
Note: The branch target instruction fetch is not executed if an exception is pending, making effective instruction execution time one cycle.
Example:1AddressLabelInstructionComment
0x804000 - BRA SA, _CHECK_FAIL; Branch if SR.SB == 1, to 0x804030(_CHECK_FAIL)
0x804004_PASS_CONDITION:SL.l w5, w6
. . .. . .
. . .. . .
. . .. . .
0x804030_CHECK_FAIL:MOV.l SR, W6; _CHECK_FAIL SubRoutine
. . . CP w6, w7
. . . . . .
Before executionAfter execution
PC0x804000PC0x804004(No Branch)
w150x4500w150x4500
SR[15:8]8'b00000000(SA, SAB = 0)SR[15:8]8'b00000000(SA, SAB = 0)
BRA SBBranch if ACCB Saturation
Syntax:{label:}BRASB,Label
Operands:Label is resolved by the linker to a signed word offset (slit20)
Operation:Condition = SB

If (condition) then {

If slit20 = 1 then skip next (16-bit) instruction

Else if (slit20 = 2 && next_op[31] = 1) then skip next (32-bit) instruction

Else (PC+4) + 2*slit20 → PC

}

Else no branch

Status Affected:None
Encoding:1010110Unnnnnnnnnnnnnnnnnnnn1110
Description:If the branch condition is met, then the instruction will either skip the next 16-bit or 32-bit instruction, or it will branch to any size of instruction with a forward or backward range of 1MB.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals two, the conditional branch will execute as a conditional skip of one 16-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals four and the instruction after the branch is a 32-bit opcode (see note), the conditional branch will execute as a conditional skip of that 32-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If requirements for a conditional skip are not met, the 2’s complement byte offset value ‘2*slit20’ is added to the PC to create a new PS word address. Since the PC will have incremented to fetch the next instruction, the new address will be (PC+4) + 2*slit20.

Branch prediction is based on the direction of the branch. If the branch is backwards (negative), it will be predicted as taken. If the branch is forwards (positive), it will be predicted as not taken. The two instructions that follow the branch will then be speculatively executed in the predicted path until such time that the actual branch decision can be assessed. A correctly predicted branch will continue instruction execution in the same path unabated. An incorrectly predicted branch will abort the speculatively executed instructions and start execution from the correct path.

The ‘n’ bits are a signed literal that specifies the number of PS words offset from (PC+4).

Note: Should the byte offset equal four and instruction after the branch is a 16-bit opcode, a branch will occur (over the next two 16-bit ops) if the condition is met.
I-Words:1
Cycles:1 (2 or 3)
Note: The branch target instruction fetch is not executed if an exception is pending, making effective instruction execution time one cycle.
Example:1AddressLabelInstructionComment
0x804000 - BRA SB, _CHECK_FAIL; Branch if SR.SB == 1, to 0x804030(_CHECK_FAIL)
0x804004_PASS_CONDITION:SL.l w5, w6
. . .. . .
. . .. . .
. . .. . .
0x804030_CHECK_FAIL:MOV.l SR, W6; _CHECK_FAIL SubRoutine
. . . CP w6, w7
. . . . . .
Before executionAfter execution
PC0x804000PC0x804030
w150x4500w150x4500
SR[15:8]8'b00010100(SB, SAB = 1)SR[15:8]8'b00000010(SB, SAB = 1)
BSETBit Set in Ws
Syntax:{label:}BSET.bWs,bit5
BSET{.w}[Ws],
BSET.l[Ws++],
[Ws--],
[++Ws],
[--Ws],
SR
Operands:Ws ∈ [W0 ... W15];

Byte: bit5 ∈ [0 ... 7];

Word: bit5 ∈ [0 ... 15];

Long word: bit5 ∈ [0 ... 31]

Operation:1 → Ws<bit5>
Status Affected:None (see note 2)
Encoding:S100001bbbbbsssspppUUUUUUUUULB00
Description:Bit ‘bit5’ in register Ws is set.

The ‘S’ bit selects instruction size.

The ‘L’ and ‘B’ bits select operation data width.

The ‘b’ bits define value or bit5 of the bit position to be cleared (bit5[4:0] for the 16-bit opcode).

The ‘s’ bits select the source/destination register.

The ‘p’ bits select the source addressing mode.

See for modifier addressing information.

Note:
  1. When targeting the SR, a bit within the SR will be set as a result of the instruction operation.
I-Words:1 or 0.5
Cycles:1
Example 1: BSET.B W3, #0x7

; Set bit 7 in W3

Before Instruction

After Instruction

W30026W300A6
SR0000SR0000
Example 2: BSET [W4++], #0x0

; Set bit 0 in [W4]

; Post-increment W4

Before Instruction

After Instruction

W46700W46702
Data 67001734 Data 67001735
SR0000SR0000
BSETBit Set f
Syntax:{label:}BSET.bf,bit3
Operands:bit3 ∈ [0 ... 7]; f ∈ [0 ... 1MB]
Operation: 1 → f<bit3>
Status Affected:None
Encoding:1100001bffffffffffffffffffffbb01
Description:Bit ‘bit3’ in file register f is set.

The ‘w’ bits select value bit3 of the bit position to be set.

The ‘f’ bits select the address of the file register.

Note:
  1. This instruction operates in Byte mode only.
  2. The .b extension must be included with the opcode.
  3. Accessible file address space is 1MB.
I-Words:1
Cycles:1
Example 1: BSET.B 0x601, #0x3

; Set bit 3 in 0x601

Before Instruction

After Instruction

Data 0600F234Data 0600FA34
SR0000SR0000
Example 2: BSET 0x444, #0xF

; Set bit 15 in 0x444

Before Instruction

After Instruction

Data 04445604Data 0444D604
SR0000SR0000
BSWBit Write in Ws
Syntax:{label:}BSW.bCWs,Wb
BSW.bZ[Ws],
BSW.{w}C [++Ws],
BSW.{w}Z [--Ws],
BSW.lC[Ws++],
BSW.lZ[Ws--],
Operands:Wb ∈ [W0 ... W14]; Ws ∈ [W0 ... W15]
Operation:If “.Z” option, then Z → Ws<(Wb)>

If “.C” option, then C → Ws<(Wb)>

Status Affected:None
Encoding:S100101LwwwwsssspppUUUUUUUUGBU00
Description:The bit number defined in Wb is written in Ws with the value of the C or Z bit. For byte, word and long word operations, the target bit number is defined by Wb[2:0], Wb[3:0] and Wb[4:0], respectively. Any bit within Wb, beyond those bits required to select the target bit, will be ignored and may be set to any value.

The ‘S’ bit selects instruction size.

The ‘L’ and ‘B’ bits select operation data width.

The ‘w’ bits select the bit select register.

The ‘G’ bit selects the Z or C flag bit as source (G = 0 selects Z flag).

The ‘s’ bits select the source register.

The ‘p’ bits select the source addressing mode.

I-Words:1 or 0.5
Cycles:1
Example 1: BSW.C W2, W3

; Set bit W3 in W2 to the value

; of the C bit

Before Instruction

After Instruction

W2F234W27234
W3111FW3111F
SR0002 (Z = 1, C = 0)SR0002 (Z = 1, C = 0)
Example 2: BSW.Z W2, W3

; Set bit W3 in W2 to the complement

; of the Z bit

Before Instruction

After Instruction

W2E235W2E234
W30550W30550
SR0002 (Z = 1, C = 0)SR0002 (Z = 1, C = 0)
Example 3: BSW.C [++W0], W6

; Set bit W6 in [W0++] to the value

; of the C bit

Before Instruction

After Instruction

W01000W01002
W634A3W634A3
Data 10022380Data 10022388
SR0001 (Z = 0, C = 1)SR0001 (Z = 0, C = 1)
Example 4: BSW.Z [W1--], W5

; Set bit W5 in [W1] to the

; complement of the Z bit

; Post-decrement W1

Before Instruction

After Instruction

W11000W10FFE
W5888BW5888B
Data 1000C4DDData 1000CCDD
SR0001 (C = 1)SR0001 (C = 1)
BTGBit Toggle in Ws
Syntax:{label:}BTG.bWs,bit5
BTG{.w}[Ws],
BTG.l[Ws++],
[Ws--],
[++Ws],
[--Ws],
SR
Operands:Ws ∈ [W0 ... W15];

Byte: bit5 ∈ [0 ... 7];

Word: bit5 ∈ [0 ... 15];

Long word: bit5 ∈ [0 ... 31]

Operation:(Ws)[bit5] → Ws[bit5]
Status Affected:None (see note 2)
Encoding:S100010bbbbbsssspppUUUUUUUUULB00
Description:Bit ‘bit5’ in register Ws is toggled.

The ‘S’ bit selects instruction size.

The ‘L’ and ‘B’ bits select operation data width.

The ‘b’ bits define value or bit5 of the bit position to be cleared (bit5[4:0] for the 16-bit opcode)

The ‘s’ bits select the source/destination register.

The ‘p’ bits select the source addressing mode.

Note:
  1. When targeting the SR, a bit within the SR will be toggled as a result of the instruction operation.
I-Words:1 or 0.5
Cycles:1
BTGBit Toggle f
Syntax:{label:}BTG.bf,bit3
Operands:bit3 ∈ [0 ... 7]; f ∈ [0 ... 1MB]
Operation:(f)[bit3] → (f)[bit3]
Status Affected:None
Encoding:1100010bffffffffffffffffffffbb01
Description:Bit ‘bit3’ in file register f is toggled.

The ‘w’ bits select value bit3 of the bit position to be cleared.

The ‘f’ bits select the address of the file register.

Note:
  1. This instruction operates in Byte mode only.
  2. The .b extension must be included with the opcode.
  3. Accessible file address space is 1MB.
I-Words:1
Cycles:1
Example 1: BTG W2, #0x0

; Toggle bit 0 in W2

Before Instruction

After Instruction

W2F234W2F235
SR0000SR0000
Example 2: BTG [W0++], #0x0

; Toggle bit 0 in [W0]

; Post-increment W0

Before Instruction

After Instruction

W02300W02302
Data 23005606 Data 23005607
SR0000SR0000
Example 3: BTG.B 0x1001, #0x4

; Toggle bit 4 in 0x1001

Before Instruction

After Instruction

Data 1000F234Data 1000E234
SR0000SR0000
Example 4: BTG 0x1660, #0x8

; Toggle bit 8 in RAM660

Before Instruction

After Instruction

Data 16605606Data 16605706
SR0000SR0000
BTSTBit Test in Ws
Syntax:{label:}BTST.bCWs,bit5
BTST.bZ[Ws],
BTST.{w}C [Ws++],
BTST.{w}Z [Ws--],
BTST.lC[++Ws],
BTST.lZ[--Ws],
Operands:Ws ∈ [W0 ... W15];

Byte: bit5 ∈ [0 ... 7];

Word: bit5 ∈ [0 ... 15];

Long word: bit5 ∈ [0 ... 31]

Operation:If “.Z” option, (Ws)[bit5] → Z

If “.C” option, (Ws)[bit5] → C

Status Affected:C or Z
Encoding:S100011bbbbbsssspppUUUUUUUUGLB00
Description:Bit ‘bit5’ in register Ws is tested. The Zero Flag contains the inversion of the bit or the Carry Flag contains the bit.

The ‘S’ bit selects instruction size.

The ‘L’ and ‘B’ bits select operation data width.

The ‘G’ bit selects the Z or C flag bit as source (G = 0 selects Z flag).

The ‘b’ bits define value or bit5 of the bit position to be cleared (bit5[4:0] for the 16-bit opcode).

The ‘s’ bits select the source/destination register.

The ‘p’ bits select the source addressing mode.

I-Words:1 or 0.5
Cycles:1
Example 1: BTST.C [W0++], #0x3

; Set C = bit 3 in [W0]

; Post-increment W0

Before Instruction

After Instruction

W01200W01202
Data 1200FFF7Data 1200FFF7
SR0001(C = 1)SR0000
Example 2: BTST.Z W0, #0x7

; Set Z = complement of bit 7 in W0

Before Instruction

After Instruction

W0F234W0F234
SR0000SR0002 (Z = 1)
BTSTBit Test f
Syntax:{label:}BTST.bf,bit3
Operands:bit3 ∈ [0 ... 7]; f ∈ [0 ... 1MB]
Operation:(f)[bit3] → Z
Status Affected:Z
Encoding:1100011bffffffffffffffffffffbb01
Description:Bit ‘bit3’ in file register f is tested, the Zero Flag bit is set if it is zero and cleared otherwise. The file register contents are unchanged.

The ‘b’ bits select value bit3 of the bit position to be cleared.

The ‘f’ bits select the address of the file register.

Note:
  1. This instruction operates in Byte mode only.
  2. The .b extension must be included with the opcode.
  3. Accessible file address space is 1MB.
I-Words:1
Cycles:1
Example 1: BTST.B 0x1201, #0x3

; Set Z = complement of

; bit 3 in 0x1201

Before Instruction

After Instruction

Data 1200F7FFData 1200F7FF
SR0000SR0002 (Z = 1)
Example 2: BTST 0x1302, #0x7

; Set Z = complement of

; bit 7 in 0x1302

Before Instruction

After Instruction

Data 1302F7FFData 1302F7FF
SR0002 (Z = 1) SR0000
BTSTBit Test/Set in Ws
Syntax:{label:}BTST.bCWs,bit5
BTST.bZ[Ws],
BTST.{w}C [Ws++],
BTST..{w}Z [Ws--],
BTST.lC[++Ws],
BTST..lZ[--Ws],
Operands:Ws ∈ [W0 ... W15];

Byte: bit5 ∈ [0 ... 7];

Word: bit5 ∈ [0 ... 15];

Long word: bit5 ∈ [0 ... 31]

Operation:if “.Z” option, first (Ws)[bit5] → Z, then 1 → Ws[bit5]

if “.C” option, first (Ws)[bit5] → C, then 1 → Ws[bit5]

Status Affected:C or Z
Encoding:S100100bbbbbsssspppUUUUUUUUGLB00
Description:Bit ‘bit5’ in register Ws is tested and then set.


For the “.Z” option, the Z Flag is set to the complement of the ‘bit5’ value prior to being set, and the C Flag is not modified. For the “.C” option, the C Flag is set to the ‘bit5’ value prior to being set, and the Z Flag is not modified.

The ‘S’ bit selects instruction size.

The ‘L’ and ‘B’ bits select operation data width.

The ‘G’ bit selects the Z or C Flag bit as source (G = 0 selects Z Flag).

The ‘b’ bits define value or bit5 of the bit position to be cleared.

The ‘s’ bits select the source/destination register.

The ‘p’ bits select the source addressing mode.

I-Words:1 or 0.5
Cycles:1
Example 1: BTSTS.C [W0++], #0x3

; Set C = bit 3 in [W0]

; Set bit 3 in [W0] = 1

; Post-increment W0

Before Instruction

After Instruction

W01200W01202
Data 1200FFF7Data 1200FFFF
SR0001(C = 1)SR0000
Example 2: BTSTS.Z W0, #0x7

; Set Z = complement of bit 7

; in W0, and set bit 7 in W0 = 1

Before Instruction

After Instruction

W0F234W0F2BC
SR0000SR0002 (Z = 1)
BTSTSBit Test/Set f
Syntax:{label:}BTSTS.bf,bit3
Operands:bit3 ∈ [0 ... 7]; f ∈ [0 ... 1MB]
Operation:First (f)[bit3] → Z, then 1 → (f)[bit3]
Status Affected:Z
Encoding:1100100bffffffffffffffffffffbb01
Description:Bit ‘bit3’ in file register f is tested and then set. The Z Flag is set to the complement of the ‘bit3’ value prior to being set.

The ‘w’ bits select value bit3 of the bit position to be test/set.

The ‘f’ bits select the address of the file register.

Note:
  1. This instruction operates in Byte mode only.
  2. The .b extension must be included with the opcode.
  3. Accessible file address space is 1MB.
I-Words:1
Cycles:1
Example 1: BTSTS.B 0x1201, #0x3

; Set Z = complement of bit 3 in 0x1201,

; then set bit 3 of 0x1201 = 1

Before Instruction

After Instruction

Data 1200F7FFData 1200FFFF
SR0000SR0002 (Z = 1)
Example 2: BTSTS 0x808, #15

; Set Z = complement of bit 15 in 0x808,

; then set bit 15 of 0x808 = 1

Before Instruction

After Instruction

RAM3008050RAM3008050
SR0002 (Z = 1) SR0000
BTSTBit Test in Ws
Syntax:{label:}BTST.bCWs,Wb
BTST.bZ[Ws],
BTST.{w}C [Ws++]
BTST.{w}Z [Ws--],
BTST.lC [++Ws],
BTST.lZ [--Ws],
Operands:Wb ∈ [W0 ... W14]; Ws ∈ [W0 ... W15]
Operation:if “.Z” option, (Ws)<(Wb)> → Z

if “.C” option, (Ws)<(Wb)> → C

Status Affected:C or Z
Encoding:S100110LwwwwsssspppUUUUUUUUGBU00
Description:The bit number defined in Wb is tested in source register Ws. For byte, word and long word operations, the target bit number is defined by Wb[2:0], Wb[3:0] and Wb[4:0], respectively. Any bit within Wb, beyond those bits required to select the target bit, will be ignored and may be set to any value.

For the “.Z” option, the Z Flag is set to the complement of the bit value tested, and the C Flag is not modified. For the “.C” option, the C Flag is set to the bit value tested, and the Z Flag is not modified. Wb[31:5] are ignored and may be set to any value.

The ‘S’ bit selects instruction size.

The ‘L’ and ‘B’ bits select operation data width.

The ‘w’ bits select the bit select register.

The ‘G’ bit selects the Z or C Flag bit as source (G = 0 selects Z Flag).

The ‘s’ bits select the source register.

The ‘p’ bits select the source addressing mode.

I-Words:1 or 0.5
Cycles:1
Example 1: BTST.C W2, W3

; Set C = bit W3 of W2

Before Instruction

After Instruction

W2F234W2F234
W32368W32368
SR0001 (C = 1)SR0000
Example 2:BTST.Z [W0++], W1

; Set Z = complement of

; bit W1 in [W0],

; Post-increment W0

Before Instruction

After Instruction

W01200W01202
W1CCC0W1CCC0
Data 12006243 Data 12006243
SR0002 (Z = 1)SR0000
BRA ZBranch if Zero
Syntax:{label:}BRAZ,Label
Operands:Label is resolved by the linker to a signed word offset (slit20)
Operation:Condition = Z

If (condition) then {

If slit20 = 1 then skip next (16-bit) instruction

Else if (slit20 = 2 && next_op[31] = 1) then skip next (32-bit) instruction

Else (PC+4) + 2*slit20 → PC

}

Else no branch

Status Affected:None
Encoding:1010011Unnnnnnnnnnnnnnnnnnnn1010
Description:If the branch condition is met, then the instruction will either skip the next 16-bit or 32-bit instruction, or it will branch to any size of instruction with a forward or backward range of 1MB.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals two, the conditional branch will execute as a conditional skip of one 16-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If the 2’s complement byte offset value ‘2*slit20’ (the PC offset) equals four and the instruction after the branch is a 32-bit opcode (see note), the conditional branch will execute as a conditional skip of that 32-bit instruction. This instruction will be speculatively executed as not skipped until such time that the branch decision can be determined.

If requirements for a conditional skip are not met, the 2’s complement byte offset value ‘2*slit20’ is added to the PC to create a new PS word address. Since the PC will have incremented to fetch the next instruction, the new address will be (PC+4) + 2*slit20.

Branch prediction is based on the direction of the branch. If the branch is backwards (negative), it will be predicted as taken. If the branch is forwards (positive), it will be predicted as not taken. The two instructions that follow the branch will then be speculatively executed in the predicted path until such time that the actual branch decision can be assessed. A correctly predicted branch will continue instruction execution in the same path unabated. An incorrectly predicted branch will abort the speculatively executed instructions and start execution from the correct path.

The ‘n’ bits are a signed literal that specifies the number of PS words offset from (PC+4).

Note: Should the byte offset equal four and instruction after the branch is a 16-bit opcode, a branch will occur (over the next two 16-bit ops) if the condition is met.
I-Words:1
Cycles:1 (2 or 3)
Note: The branch target instruction fetch is not executed if an exception is pending, making effective instruction execution time one cycle.
Example:1AddressLabelInstructionComment
0x804000 - BRA Z, _CHECK_FAIL; Branch if Z == 1, to 0x804030(_CHECK_FAIL)
0x804004_PASS_CONDITION:SL.l w5, w6
. . .. . .
. . .. . .
. . .. . .
0x804030_CHECK_FAIL:MOV.l SR, W6; _CHECK_FAIL SubRoutine
. . . CP w6, w7
. . . . . .
Before executionAfter execution
PC0x804000PC0x804030
w150x4500w150x4500
SR[7:0]8'b00000010(Z = 1)SR[7:0]8'b00000010(Z = 1)