4.4 Instruction Descriptions (A to BZ)
ADD | Add Wb and Ws | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | ADD.b | Wb, | 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: | S110 | 000L | dddd | ssss | pppq | qqww | wwUU | BU00 |
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.B | W5, W6, W7 | ; Add W5 to W6, store result in W7 ; (Byte mode) | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||||
W5 | AB00 | W5 | AB00 | |||||||||
W6 | 0030 | W6 | 0030 | |||||||||
W7 | FFFF | W7 | FF30 | |||||||||
SR | 0000 | SR | 0000 |
Example 2: | ADD | W5, W6, W7 | ; Add W5 to W6, store result in W7 ; (Word mode) | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | ||||||||||
W5 | AB00 | W5 | AB00 | ||||||||
W6 | 0030 | W6 | 0030 | ||||||||
W7 | FFFF | W7 | AB30 | ||||||||
SR | 0000 | SR | 0008 | (N = 1 ) |
ADD | Add ACCA to ACCB | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | ADD | A | |||||
B | ||||||||
Operands: | none | |||||||
Operation: | ACCA + ACCB → ACC(A or B) | |||||||
Status Affected: | OA, SA or OB, SB | |||||||
Encoding: | 0111 | 001A | UUUU | 1000 | ||||
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:1 | ADD | A | ;ACCA = ACCA + ACCB | ||
---|---|---|---|---|---|
Before execution | After execution | ||||
ACCA | 0x00_1022_2EE1_5633_9078 | ACCA | 0x00_3066_9207_9746_247B | ||
ACCB | 0x00_2044_6326_4112_9403 | ACCB | 0x00_2044_6326_4112_9403 |
ADD | Signed 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: | 1100 | 00AL | wwww | ssss | pppU | UUkk | kkkk | 1011 |
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:
| |||||||
I-Words: | 1 | |||||||
Cycles: | 1 |
Example:1 | ADD | w8, #1, B | ;ACCB = (w8>>1):32'b0+ ACCB ;Shift right ACCB by 1 | ||
---|---|---|---|---|---|
Before execution | After execution | ||||
w8 | 0x20446326 | w8 | 0x20446326 | ||
ACCB | 0x00_2044_6326_4112_9403 | ACCB | 0x00_3066_94B9_4112_9403 |
ADDC | Add 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: | S110 | 001L | dddd | ssss | pppq | qqww | wwUU | BU00 |
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 | ||||||||||
W0 | CC20 | W0 | CC20 | ||||||||
W1 | 0800 | W1 | 0801 | ||||||||
W2 | 1000 | W2 | 1001 | ||||||||
Data 0800 | AB25 | Data 0800 | AB25 | ||||||||
Data 1000 | FFFF | Data 1000 | FF46 | ||||||||
SR | 0001 | (C = 1 ) | SR | 0000 |
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 | ||||||||||
W1 | 1000 | W1 | 1002 | ||||||||
W2 | 2000 | W2 | 2002 | ||||||||
W3 | 0180 | W3 | 0180 | ||||||||
Data 1000 | 8000 | Data 1000 | 2681 | ||||||||
Data 2000 | 2500 | Data 2000 | 2500 | ||||||||
SR | 0001 | (C = 1 ) | SR | 0000 |
ADDC | Add 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: | 1110 | 001L | dddd | ssss | pppq | qqkk | kkkk | Bk10 |
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 | |||||||||
W0 | CC80 | W0 | CC80 | |||||||
W7 | 12C0 | W7 | 12C0 | |||||||
Data 12C0 | B000 | Data 12C0 | B09F | |||||||
SR | 0000 | (C = 0 ) | SR | 0008 | (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 | ||||||||||
W3 | 6006 | W3 | 6006 | ||||||||
W4 | 1000 | W4 | 0FFE | ||||||||
Data 0FFE | DDEE | Data 0FFE | 600D | ||||||||
Data 1000 | DDEE | Data 1000 SR | DDEE | ||||||||
SR | 0001 | (C = 1 ) | 0000 |
ADDC | Add 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: | 1100 | 001L | ssss | kkkk | kkkk | kkkk | kkkk | BU10 |
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 | ||||||||||||||||||
W7 | 12C0 | W7 | 12BF | ||||||||||||||||
SR | 0000 | (C = 0 ) | SR | 0009 | (N, C = 1 ) |
Example 2: | ADDC | #0xFF, W1 | ; Add 255 and C bit to W1 (Word mode) | |||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
W1 | 12C0 | W1 | 13C0 | |||||||
SR | 0001 | (C = 1 ) | SR | 0000 |
ADDC | Add f and Carry bit and Wn | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | ADDC.b | f, | 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: | 1110 | 001L | ssss | ffff | ffff | ffff | ffff | BD01 |
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 | |||||||||
WREG | CC60 | WREG | CC60 | |||||||
RAM100 | 8006 | RAM100 | 8067 | |||||||
SR | 0001 | (C = 1 ) | SR | 0000 |
Example 2: | ADDC | RAM200, WREG | ; Add RAM200 and C bit to the WREG ; (Word mode) | |||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
WREG | 5600 | WREG | 8A01 | |||||||
RAM200 | 3400 | RAM200 | 3400 | |||||||
SR | 0001 | (C = 1 ) | SR | 000C | (N, OV = 1 ) | |||||
ADD | Add Short Literal to Wn | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | ADD.l | lit5, | 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: | 0111 | 010k | kkkk | ssss | ||||
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 | |||||||||
W7 | 12C0 | W7 | 12BF | |||||||
SR | 0000 | SR | 0009 | (N, C = 1 ) |
Example 2: | ADD | #0xFF, W1 | ; Add 255 to W1 (Word mode) | |||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
W1 | 12C0 | W1 | 13BF | |||||||
SR | 0000 | SR | 0000 | |||||||
ADD | Add Ws and Short Literal | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | ADD.b | Ws, | 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: | 1110 | 000L | dddd | ssss | pppq | qqkk | kkkk | Bk10 |
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.B | W0, #0x1F, W7 | ; Add W0 and 31 (Byte mode) ; Store the result in W7 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | ||||||||||
W0 | 2290 | W0 | 2290 | ||||||||
W7 | 12C0 | W7 | 12AF | ||||||||
SR | 0000 | SR | 0008 | (N = 1 ) |
Example 2: | ADD | W3, #0x6, [--W4] | ; Add W3 and 6 (Word mode) ; Store the result in [--W4] | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | ||||||||||
W3 | 6006 | W3 | 6006 | ||||||||
W4 | 1000 | W4 | 0FFE | ||||||||
Data 0FFE | DDEE | Data 0FFE | 600C | ||||||||
Data 1000 | DDEE | Data 1000 | DDEE | ||||||||
SR | 0000 | SR | 0000 |
ADD | Add Literal to Wn | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | ADD.b | lit16, | 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: | 1100 | 000L | ssss | kkkk | kkkk | kkkk | kkkk | BU10 |
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 |
ADD | Add f and Wn | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | ADD.b | f | Wn | {,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: | 1110 | 000L | ssss | ffff | ffff | ffff | ffff | BD01 |
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.B | RAM100 | ; Add WREG to RAM100 (Byte mode) | |||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
WREG | CC80 | WREG | CC80 | |||||||
RAM100 | FFC0 | RAM100 | FF40 | |||||||
SR | 0000 | SR | 0005 | (OV, C = 1 ) |
Example 2: | ADD | RAM200, WREG | ; Add RAM200 to WREG (Word mode) | |||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
WREG | CC80 | WREG | CC40 | |||||||
RAM200 | FFC0 | RAM200 | FFC0 | |||||||
SR | 0000 | SR | 0001 | (C = 1 ) | ||||||
AND | AND Wb and Ws | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | AND.b | Wb, | Ws, | Wd | |||
AND.bz | [Ws], | [Wd] | ||||||
AND{.w} | [Ws++], | [Wd++] | ||||||
AND.l | [Ws--], | [Wd--] | ||||||
[++Ws], | [++Wd] | |||||||
[--Ws], | [--Wd] | |||||||
SR | SR | |||||||
Operands: | Wb ∈ [W0 ... W14]; Ws ∈ [W0 ... W15]; Wd ∈ [W0 ... W15] | |||||||
Operation: | (Wb).AND.(Ws) → Wd | |||||||
Status Affected: | N, Z | |||||||
Encoding: | S110 | 100L | dddd | ssss | pppq | qqww | wwUU | BU00 |
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:
| |||||||
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 | |||||||||
W0 | AA55 | W0 | AA55 | |||||||
W1 | 2211 | W1 | 2211 | |||||||
W2 | 1001 | W2 | 1002 | |||||||
Data 1000 | FFFF | Data 1000 | 11FF | |||||||
SR | 0000 | SR | 0000 |
Example 2: | AND | W0, [W1++], W2 | ; AND W0 and [W1], and ; store to W2 (Word mode) ; Post-increment W1 | |||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
W0 | AA55 | W0 | AA55 | |||||||
W1 | 1000 | W1 | 1002 | |||||||
W2 | 55AA | W2 | 2214 | |||||||
Data 1000 | 2634 | Data 1000 | 2634 | |||||||
SR | 0000 | SR | 0000 |
AND | AND Ws and 0’s Extended Short Literal | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | AND.b | Ws, | lit7, | Wd | |||
AND.bz [Ws], | [Wd] | |||||||
AND{.w} [Ws++], | [Wd++] | |||||||
AND.l | [Ws--], | [Wd--] | ||||||
[++Ws], | [++Wd] | |||||||
[--Ws], | [--Wd] | |||||||
SR | SR | |||||||
Operands: | Ws ∈ [W0 ... W15]; lit7 ∈ [0 ... 127]; Wd ∈ [W0 ... W15] | |||||||
Operation: | (Ws).AND.lit73 → Wd | |||||||
Status Affected: | N, Z (see note 1) | |||||||
Encoding: | 1110 | 100L | dddd | ssss | pppq | qqkk | kkkk | Bk10 |
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:
| |||||||
I-Words: | 1 | |||||||
Cycles: | 1 |
AND1 | AND Ws and 1’s Extended Short Literal | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | AND1.b | Ws, | lit7, | Wd | |||
AND1.bz [Ws], | [Wd] | |||||||
AND1{.w} [Ws++], | [Wd++] | |||||||
AND1.l | [Ws--], | [Wd--] | ||||||
[++Ws], | [++Wd] | |||||||
[--Ws], | [--Wd] | |||||||
SR | SR | |||||||
Operands: | Ws ∈ [W0 ... W15]; lit7 ∈ [0 ... 127]; Wd ∈ [W0 ... W15] | |||||||
Operation: | (Ws).AND.lit73 → Wd | |||||||
Status Affected: | N, Z (see note 1) | |||||||
Encoding: | 1110 | 110L | dddd | ssss | pppq | qqkk | kkkk | Bk10 |
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:
| |||||||
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 | |||||||||
W5 | 7FFFFFFF | W5 | 7FFFFFFF | |||||||
W7 | 12345678 | W7 | 7FFFFF9F | |||||||
SR | 0000 | SR | 0000 |
AND | AND Literal and Wn | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | AND.b | lit16, | Wn | ||||
AND.bz | SR | |||||||
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: | 1100 | 100L | ssss | kkkk | kkkk | kkkk | kkkk | BT10 |
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:
| |||||||
I-Words: | 1 | |||||||
Cycles: | 1 |
Example 1: | AND.B #0x83, W7 | ; AND 0x83 to W7 (Byte mode) | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
W7 | 12C0 | W7 | 1280 | |||||||
SR | 0000 | SR | 0008 | (N = 1 ) |
Example 2: | AND #0x333, W1 | ; AND 0x333 to W1 (Word mode) | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
W1 | 12D0 | W1 | 0210 | |||||||
SR | 0000 | SR | 0000 | |||||||
AND | And f and Wn | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | AND.b | f | ,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: | 1110 | 100L | ssss | ffff | ffff | ffff | ffff | BD01 |
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 | |||||||||
WREG | CC80 | WREG | CC80 | |||||||
RAM100 | FFC0 | RAM100 | FF80 | |||||||
SR | 0000 | SR | 0008 | (N = 1 ) |
Example 2: | AND RAM200, WREG | ; AND RAM200 to WREG (Word mode) | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
WREG | CC80 | WREG | 0080 | |||||||
RAM200 | 12C0 | RAM200 | 12C0 | |||||||
SR | 0000 | SR | 0000 | |||||||
ASR | Arithmetic 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: | S010 | 100L | dddd | ssss | pppq | qqUU | UUUU | B000 |
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 |
ASR | Arithmetic Shift Right f | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | ASR.b | f | {,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: | 1010 | 000L | dddd | ffff | ffff | ffff | ffff | BD01 |
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 | |||||||||
WREG | 0600 | WREG | 0611 | |||||||
RAM400 | 0823 | RAM400 | 0823 | |||||||
SR | 0000 | SR | 0001 | (C = 1 ) |
Example 2: | ASR RAM200 | ; ASR RAM200 (Word mode) | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
RAM200 | 8009 | RAM200 | C004 | |||||||
SR | 0000 | SR | 0009 | (N, C = 1 ) |
ASR | Arithmetic 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: | S010 | 000k | kkkk | dddd | pppq | qqss | ssUU | LU00 |
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:
|
Example 1: | ASR W0, #0x4, W1 | ; ASR W0 by 4 and store to W1 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
W0 | 060F | W0 | 060F | |||||||
W1 | 1234 | W1 | 0060 | |||||||
SR | 0000 | SR | 0000 |
Example 2: | ASR W0, #0x6, W1 | ; ASR W0 by 6 and store to W1 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
W0 | 80FF | W0 | 80FF | |||||||
W1 | 0060 | W1 | FE03 | |||||||
SR | 0000 | SR | 0008 | (N = 1 ) |
Example 3: | ASR W0, #0xF, W1 | ; ASR W0 by 15 and store to W1 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
W0 | 70FF | W0 | 70FF | |||||||
W1 | CC26 | W1 | 0000 | |||||||
SR | 0000 | SR | 0002 | (Z = 1 ) |
ASRM | Arithmetic 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: | 1110 | 000k | kkkk | dddd | pppU | UUss | ssUU | 0011 |
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 | |||||||
|
ASRM | Arithmetic 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: | 1110 | 001U | ssss | dddd | pppU | UUww | wwUU | 0011 |
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 |
ASR | Arithmetic 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: | 1010 | 100L | wwww | dddd | pppq | qqss | ssUU | B100 |
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]:
| |||||||
I-Words: | 1 | |||||||
Cycles: | 1 |
BRA C | Branch if Carry/Unsigned Greater Than or Equal | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BRA | C, | Label | ||||
{label:} | BRA | GEU, | ||||||
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: | 1010 | 101U | nnnn | nnnn | nnnn | nnnn | nnnn | 0010 |
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:1 | Address | Label | Instruction | Comment | ||
---|---|---|---|---|---|---|
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 execution | After execution | |||||
PC | 0x804000 | PC | 0x804030 | |||
w15 | 0x4500 | w15 | 0x4500 | |||
SR[7:0] | 8'b0000001 | (C = 1;) | SR[7:0] | 8'b0000001 | (C = 1;) |
BCLR | Bit Clear in Ws | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BCLR.b | Ws, | 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: | S100 | 000b | bbbb | ssss | pppU | UUUU | UUUU | LB00 |
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:
| |||||||
I-Words: | 1 or 0.5 | |||||||
Cycles: | 1 |
Example 1: | BCLR.B W2, #0x2 | ; Clear bit 3 in W2 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
W2 | F234 | W2 | F230 | |||||||
SR | 0000 | SR | 0000 |
Example 2: | BCLR [W0++], #0x0 | ; Clear bit 0 in [W0] ; Post-increment W0 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
W0 | 2300 | W0 | 2302 | |||||||
Data 2300 | 5607 | Data 2300 | 5606 | |||||||
SR | 0000 | SR | 0000 |
BCLR | Bit Clear in f | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BCLR.b | f, | bit3 | ||||
Operands: | bit3 ∈ [0 ... 7]; f ∈ [0 ... 1MB] | |||||||
Operation: | 0 → f[bit3] | |||||||
Status Affected: | None | |||||||
Encoding: | 1100 | 000b | ffff | ffff | ffff | ffff | ffff | bb01 |
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:
| |||||||
I-Words: | 1 | |||||||
Cycles: | 1 |
Example 1: | BCLR.B 0x800, #0x7 | ; Clear bit 7 in 0x800 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
Data 0800 | 66EF | Data 0800 | 666F | |||||||
SR | 0000 | SR | 0000 |
Example 2: | BCLR 0x400, #0x9 | ; Clear bit 9 in 0x400 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
Data 0400 | AA55 | Data 0400 | A855 | |||||||
SR | 0000 | SR | 0000 |
BFEXT | Bit 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: | 1111 | 100m | mmmm | ssss | pppc | ccww | wwcc | L111 |
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:
| |||||||
I-Words: | 1 | |||||||
Cycles: | 1 |
BFEXT | Bit 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 word | 1100 | 110U | ffff | ffff | ffff | ffff | ffff | 1001 |
2nd word | 1100 | 110L | UUUm | mmmm | UUUc | ccww | wwcc | 1101 |
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:
| |||||||
I-Words: | 2 | |||||||
Cycles: | 2 |
BFINS | Bit 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: | 1111 | 100m | mmmm | ssss | ppp c | ccww | wwcc | L011 |
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:
| |||||||
I-Words: | 1 | |||||||
Cycles: | 1 |
BFINS | Bit 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 word | 1100 | 110U | ffff | ffff | ffff | ffff | ffff | 0001 |
2nd word | 1100 | 110L | UUUm | mmmm | UUUc | ccww | wwcc | 0101 |
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:
| |||||||
I-Words: | 2 | |||||||
Cycles: | 2 |
BFINS | Bit 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 word | 1100 | 101U | UUUU | kkkk | kkkk | kkkk | kkkk | U001 |
2nd word | 1100 | 101m | mmmm | ssss | pppc | ccUU | UUcc | L101 |
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:
| |||||||
I-Words: | 2 | |||||||
Cycles: | 2 |
BRA GE | Branch if Signed Greater Than or Equal | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BRA | GE, | 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: | 1010 | 100U | nnnn | nnnn | nnnn | nnnn | nnnn | 0110 |
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:1 | Address | Label | Instruction | Comment | ||
---|---|---|---|---|---|---|
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 execution | After execution | |||||
PC | 0x804000 | PC | 0x804030 | |||
w15 | 0x4500 | w15 | 0x4500 | |||
SR[7:0] | 8'b0001100 | (N = 1; OV = 1) | SR[7:0] | 8'b0001100 | (N = 1; OV = 1) |
BRA GT | Branch if Signed Greater Than | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BRA | GT, | 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: | 1010 | 100U | nnnn | nnnn | nnnn | nnnn | nnnn | 0010 |
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:1 | Address | Label | Instruction | Comment | |||
---|---|---|---|---|---|---|---|
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 execution | After execution | ||||||
PC | 0x804000 | PC | 0x804030 | ||||
w15 | 0x4500 | w15 | 0x4500 | ||||
SR[7:0] | 8'b0001100 | (Z = 0;OV = 1; N=1) | SR[7:0] | 8'b0001100 | (Z = 0;OV = 1; N=1) |
BRA GTU | Branch if Unsigned Greater Than | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BRA | GTU, | 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: | 1010 | 111U | nnnn | nnnn | nnnn | nnnn | nnnn | 0110 |
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:1 | Address | Label | Instruction | Comment | ||
---|---|---|---|---|---|---|
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 execution | After execution | |||||
PC | 0x804000 | PC | 0x804030 | |||
w15 | 0x4500 | w15 | 0x4500 | |||
SR[7:0] | 8'b0000001 | (C = 1, Z = 0) | SR[7:0] | 8'b0000001 | (C = 1, Z = 0) |
BRA LE | Branch if Signed Less Than or Equal | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BRA | LE, | 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: | 1010 | 100U | nnnn | nnnn | nnnn | nnnn | nnnn | 1110 |
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:1 | Address | Label | Instruction | Comment | ||
---|---|---|---|---|---|---|
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 execution | After execution | |||||
PC | 0x804000 | PC | 0x804030 | |||
w15 | 0x4500 | w15 | 0x4500 | |||
SR[7:0] | 8'b0000010 | (Z = 1) | SR[7:0] | 8'b0000010 | (Z =1) |
BRA LEU | Branch if Unsigned Less Than or Equal | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BRA | LEU, | 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: | 1010 | 111U | nnnn | nnnn | nnnn | nnnn | nnnn | 0010 |
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:1 | Address | Label | Instruction | Comment | ||
---|---|---|---|---|---|---|
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 execution | After execution | |||||
PC | 0x804000 | PC | 0x804030 | |||
w15 | 0x4500 | w15 | 0x4500 | |||
SR[7:0] | 8'b0000000 | (Z = 0;C = 0) | SR[7:0] | 8'b0000000 | (Z = 0;C = 0) |
BRA LT | Branch if Signed Less Than | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BRA | LT, | 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: | 1010 | 100U | nnnn | nnnn | nnnn | nnnn | nnnn | 1010 |
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:1 | Address | Label | Instruction | Comment | ||
---|---|---|---|---|---|---|
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 execution | After execution | |||||
PC | 0x804000 | PC | 0x804030 | |||
w15 | 0x4500 | w15 | 0x4500 | |||
SR[7:0] | 8'b0000000 | (Z = 0;C = 0) | SR[7:0] | 8'b0000000 | (Z = 0;C = 0) |
BRA NC/LTU | Branch if Not Carry / Unsigned Less Than | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BRA | NC, | Label | ||||
{label:} | BRA | LTU, | ||||||
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: | 1010 | 101U | nnnn | nnnn | nnnn | nnnn | nnnn | 0110 |
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:1 | Address | Label | Instruction | Comment | ||
---|---|---|---|---|---|---|
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 execution | After execution | |||||
PC | 0x804000 | PC | 0x804030 | |||
w15 | 0x4500 | w15 | 0x4500 | |||
SR[7:0] | 8'b0000000 | (C = 0) | SR[7:0] | 8'b0000000 | (C = 0) |
BRA NN | Branch if Not Negative | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BRA | NN, | 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: | 1010 | 011U | nnnn | nnnn | nnnn | nnnn | nnnn | 0110 |
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:1 | Address | Label | Instruction | Comment | ||
---|---|---|---|---|---|---|
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 execution | After execution | |||||
PC | 0x804000 | PC | 0x804004 | (No Branch) | ||
w15 | 0x4500 | w15 | 0x4500 | |||
SR[7:0] | 8'b00001000 | (N = 1) | SR[7:0] | 8'b00001000 | (N = 1) |
Example:2 | Address | Label | Instruction | Comment | ||
---|---|---|---|---|---|---|
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 execution | After execution | |||||
PC | 0x804000 | PC | 0x804030 | |||
w15 | 0x4500 | w15 | 0x4500 | |||
SR[7:0] | 8'b00001000 | (N = 1) | SR[7:0] | 8'b00001000 | (N = 1) |
BRA NOV | Branch if Not Overflow | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BRA | NOV, | 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: | 1010 | 101U | nnnn | nnnn | nnnn | nnnn | nnnn | 1110 |
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:1 | Address | Label | Instruction | Comment | ||
---|---|---|---|---|---|---|
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 execution | After execution | |||||
PC | 0x804000 | PC | 0x804004 | (No Branch) | ||
w15 | 0x4500 | w15 | 0x4500 | |||
SR[7:0] | 8'b00000100 | (OV = 1) | SR[7:0] | 8'b00000100 | (OV = 1) |
BRA NZ | Branch if Not Zero | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BRA | NZ, | 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: | 1010 | 011U | nnnn | nnnn | nnnn | nnnn | nnnn | 1110 |
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:1 | Address | Label | Instruction | Comment | ||
---|---|---|---|---|---|---|
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 execution | After execution | |||||
PC | 0x804000 | PC | 0x804030 | |||
w15 | 0x4500 | w15 | 0x4500 | |||
SR[15:8] | 8'b00000000 | (Z = 0) | SR[15:8] | 8'b00000000 | (Z = 0) |
BRA OA | Branch if Overflow Accumulator A | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BRA | OA, | 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: | 1010 | 110U | nnnn | nnnn | nnnn | nnnn | nnnn | 0010 |
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:1 | Address | Label | Instruction | Comment | ||
---|---|---|---|---|---|---|
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 execution | After execution | |||||
PC | 0x804000 | PC | 0x804030 | |||
w15 | 0x4500 | w15 | 0x4500 | |||
SR[15:8] | 8'b10001000 | (OA, OAB = 1) | SR[15:8] | 8'b10001000 | (OA, OAB = 1) |
BRA OB | Branch if Overflow Accumulator B | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BRA | OB, | 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: | 1010 | 110U | nnnn | nnnn | nnnn | nnnn | nnnn | 0110 |
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:1 | Address | Label | Instruction | Comment | ||
---|---|---|---|---|---|---|
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 execution | After execution | |||||
PC | 0x804000 | PC | 0x804004 | (No Branch) | ||
w15 | 0x4500 | w15 | 0x4500 | |||
SR[15:8] | 8'b00000000 | (OB, OAB = 0) | SR[15:8] | 8'b00000000 | (OB, OAB = 0) |
BOOTSWP | Swap Active and Inactive Flash Address Space | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BOOTSWP | Ws | |||||
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 | 101U | UUUU | ssss | UUUU | UUUU | UUU1 | 0011 |
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:
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 OV | Branch if Overflow | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BRA | OV, | 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: | 1010 | 101U | nnnn | nnnn | nnnn | nnnn | nnnn | 1010 |
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:1 | Address | Label | Instruction | Comment | ||
---|---|---|---|---|---|---|
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 execution | After execution | |||||
PC | 0x804000 | PC | 0x804030 | |||
w15 | 0x4500 | w15 | 0x4500 | |||
SR[7:0] | 8'b00000100 | (OV = 1) | SR[7:0] | 8'b00000100 | (OV = 1) |
BRA | Branch Unconditionally | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BRA | Label | |||||
Operands: | Label is resolved by the linker to a signed word offset (slit20) | |||||||
Operation: | (PC+4) + 2*slit20 → PC | |||||||
Status Affected: | None | |||||||
Encoding: | 1010 | 111U | nnnn | nnnn | nnnn | nnnn | nnnn | 1010 |
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:1 | Address | Label | Instruction | Comment | |
---|---|---|---|---|---|
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 execution | After execution | ||||
PC | 0x804000 | PC | 0x804030 | ||
w15 | 0x4500 | w15 | 0x4500 |
Example:2 | Address | Label | Instruction | Comment | |
---|---|---|---|---|---|
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 execution | After execution | ||||
PC | 0x804000 | PC | 0x804034 | ||
w15 | 0x4500 | w15 | 0x4500 |
BRA | Computed Branch | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BRA | Wns | |||||
Operands: | Wns ∈ [W0 ... W14] | |||||||
Operation: | (PC + 4) + 2*Wns[19:0] → PC, NOP → Instruction Register. | |||||||
Status Affected: | None | |||||||
Encoding: | 1101 | 011U | UUUU | ssss | UUUU | UUUU | UUUU | 0010 |
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:1 | Address | Label | Instruction | Comment | |||
---|---|---|---|---|---|---|---|
0x803FFC | MOV.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 execution | After execution | ||||||
PC | 0x804000 | PC | 0x804030 | ||||
w15 | 0x4500 | w15 | 0x4500 |
BREAK | Break | |||||||
---|---|---|---|---|---|---|---|---|
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: | S111 | 001U | UUUU | 0010 | UUUU | UUUU | UUUU | UU00 |
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 SA | Branch if ACCA Saturation | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BRA | SA, | 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: | 1010 | 110U | nnnn | nnnn | nnnn | nnnn | nnnn | 1010 |
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:1 | Address | Label | Instruction | Comment | ||
---|---|---|---|---|---|---|
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 execution | After execution | |||||
PC | 0x804000 | PC | 0x804004 | (No Branch) | ||
w15 | 0x4500 | w15 | 0x4500 | |||
SR[15:8] | 8'b00000000 | (SA, SAB = 0) | SR[15:8] | 8'b00000000 | (SA, SAB = 0) |
BRA SB | Branch if ACCB Saturation | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BRA | SB, | 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: | 1010 | 110U | nnnn | nnnn | nnnn | nnnn | nnnn | 1110 |
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:1 | Address | Label | Instruction | Comment | ||
---|---|---|---|---|---|---|
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 execution | After execution | |||||
PC | 0x804000 | PC | 0x804030 | |||
w15 | 0x4500 | w15 | 0x4500 | |||
SR[15:8] | 8'b00010100 | (SB, SAB = 1) | SR[15:8] | 8'b00000010 | (SB, SAB = 1) |
BSET | Bit Set in Ws | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BSET.b | Ws, | 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: | S100 | 001b | bbbb | ssss | pppU | UUUU | UUUU | LB00 |
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:
| |||||||
I-Words: | 1 or 0.5 | |||||||
Cycles: | 1 |
Example 1: | BSET.B W3, #0x7 | ; Set bit 7 in W3 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
W3 | 0026 | W3 | 00A6 | |||||||
SR | 0000 | SR | 0000 |
Example 2: | BSET [W4++], #0x0 | ; Set bit 0 in [W4] ; Post-increment W4 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
W4 | 6700 | W4 | 6702 | |||||||
Data 6700 | 1734 | Data 6700 | 1735 | |||||||
SR | 0000 | SR | 0000 |
BSET | Bit Set f | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BSET.b | f, | bit3 | ||||
Operands: | bit3 ∈ [0 ... 7]; f ∈ [0 ... 1MB] | |||||||
Operation: | 1 → f<bit3> | |||||||
Status Affected: | None | |||||||
Encoding: | 1100 | 001b | ffff | ffff | ffff | ffff | ffff | bb01 |
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:
| |||||||
I-Words: | 1 | |||||||
Cycles: | 1 |
Example 1: | BSET.B 0x601, #0x3 | ; Set bit 3 in 0x601 | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | ||||||||||
Data 0600 | F234 | Data 0600 | FA34 | ||||||||
SR | 0000 | SR | 0000 |
Example 2: | BSET 0x444, #0xF | ; Set bit 15 in 0x444 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
Data 0444 | 5604 | Data 0444 | D604 | |||||||
SR | 0000 | SR | 0000 |
BSW | Bit Write in Ws | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BSW.bC | Ws, | 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: | S100 | 101L | wwww | ssss | pppU | UUUU | UUUG | BU00 |
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 | |||||||||
W2 | F234 | W2 | 7234 | |||||||
W3 | 111F | W3 | 111F | |||||||
SR | 0002 | (Z = 1 , C = 0 ) | SR | 0002 | (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 | |||||||||
W2 | E235 | W2 | E234 | |||||||
W3 | 0550 | W3 | 0550 | |||||||
SR | 0002 | (Z = 1 , C = 0 ) | SR | 0002 | (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 | |||||||||
W0 | 1000 | W0 | 1002 | |||||||
W6 | 34A3 | W6 | 34A3 | |||||||
Data 1002 | 2380 | Data 1002 | 2388 | |||||||
SR | 0001 | (Z = 0 , C = 1 ) | SR | 0001 | (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 | |||||||||
W1 | 1000 | W1 | 0FFE | |||||||
W5 | 888B | W5 | 888B | |||||||
Data 1000 | C4DD | Data 1000 | CCDD | |||||||
SR | 0001 | (C = 1 ) | SR | 0001 | (C = 1 ) |
BTG | Bit Toggle in Ws | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BTG.b | Ws, | 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: | S100 | 010b | bbbb | ssss | pppU | UUUU | UUUU | LB00 |
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:
| |||||||
I-Words: | 1 or 0.5 | |||||||
Cycles: | 1 |
BTG | Bit Toggle f | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BTG.b | f, | bit3 | ||||
Operands: | bit3 ∈ [0 ... 7]; f ∈ [0 ... 1MB] | |||||||
Operation: | (f)[bit3] → (f)[bit3] | |||||||
Status Affected: | None | |||||||
Encoding: | 1100 | 010b | ffff | ffff | ffff | ffff | ffff | bb01 |
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:
| |||||||
I-Words: | 1 | |||||||
Cycles: | 1 |
Example 1: | BTG W2, #0x0 | ; Toggle bit 0 in W2 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
W2 | F234 | W2 | F235 | |||||||
SR | 0000 | SR | 0000 |
Example 2: | BTG [W0++], #0x0 | ; Toggle bit 0 in [W0] ; Post-increment W0 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
W0 | 2300 | W0 | 2302 | |||||||
Data 2300 | 5606 | Data 2300 | 5607 | |||||||
SR | 0000 | SR | 0000 |
Example 3: | BTG.B 0x1001, #0x4 | ; Toggle bit 4 in 0x1001 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
Data 1000 | F234 | Data 1000 | E234 | |||||||
SR | 0000 | SR | 0000 |
Example 4: | BTG 0x1660, #0x8 | ; Toggle bit 8 in RAM660 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
Data 1660 | 5606 | Data 1660 | 5706 | |||||||
SR | 0000 | SR | 0000 |
BTST | Bit Test in Ws | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BTST.bC | Ws, | 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: | S100 | 011b | bbbb | ssss | pppU | UUUU | UUUG | LB00 |
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 | |||||||||
W0 | 1200 | W0 | 1202 | |||||||
Data 1200 | FFF7 | Data 1200 | FFF7 | |||||||
SR | 0001 | (C = 1 ) | SR | 0000 |
Example 2: | BTST.Z W0, #0x7 | ; Set Z = complement of bit 7 in W0 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
W0 | F234 | W0 | F234 | |||||||
SR | 0000 | SR | 0002 | (Z = 1 ) |
BTST | Bit Test f | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BTST.b | f, | bit3 | ||||
Operands: | bit3 ∈ [0 ... 7]; f ∈ [0 ... 1MB] | |||||||
Operation: | (f)[bit3] → Z | |||||||
Status Affected: | Z | |||||||
Encoding: | 1100 | 011b | ffff | ffff | ffff | ffff | ffff | bb01 |
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:
| |||||||
I-Words: | 1 | |||||||
Cycles: | 1 |
Example 1: | BTST.B 0x1201, #0x3 | ; Set Z = complement of ; bit 3 in 0x1201 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
Data 1200 | F7FF | Data 1200 | F7FF | |||||||
SR | 0000 | SR | 0002 | (Z = 1 ) |
Example 2: | BTST 0x1302, #0x7 | ; Set Z = complement of ; bit 7 in 0x1302 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
Data 1302 | F7FF | Data 1302 | F7FF | |||||||
SR | 0002 | (Z = 1 ) | SR | 0000 |
BTST | Bit Test/Set in Ws | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BTST.bC | Ws, | 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: | S100 | 100b | bbbb | ssss | pppU | UUUU | UUUG | LB00 |
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 | |||||||||
W0 | 1200 | W0 | 1202 | |||||||
Data 1200 | FFF7 | Data 1200 | FFFF | |||||||
SR | 0001 | (C = 1 ) | SR | 0000 |
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 | |||||||||
W0 | F234 | W0 | F2BC | |||||||
SR | 0000 | SR | 0002 | (Z = 1 ) |
BTSTS | Bit Test/Set f | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BTSTS.b | f, | bit3 | ||||
Operands: | bit3 ∈ [0 ... 7]; f ∈ [0 ... 1MB] | |||||||
Operation: | First (f)[bit3] → Z, then 1 → (f)[bit3] | |||||||
Status Affected: | Z | |||||||
Encoding: | 1100 | 100b | ffff | ffff | ffff | ffff | ffff | bb01 |
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:
| |||||||
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 1200 | F7FF | Data 1200 | FFFF | |||||||
SR | 0000 | SR | 0002 | (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 | |||||||||
RAM300 | 8050 | RAM300 | 8050 | |||||||
SR | 0002 | (Z = 1 ) | SR | 0000 |
BTST | Bit Test in Ws | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BTST.bC | Ws, | 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: | S100 | 110L | wwww | ssss | pppU | UUUU | UUUG | BU00 |
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 | |||||||||
W2 | F234 | W2 | F234 | |||||||
W3 | 2368 | W3 | 2368 | |||||||
SR | 0001 | (C = 1 ) | SR | 0000 |
Example 2: | BTST.Z [W0++], W1 | ; Set Z = complement of ; bit W1 in [W0], ; Post-increment W0 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Before Instruction | After Instruction | |||||||||
W0 | 1200 | W0 | 1202 | |||||||
W1 | CCC0 | W1 | CCC0 | |||||||
Data 1200 | 6243 | Data 1200 | 6243 | |||||||
SR | 0002 | (Z = 1 ) | SR | 0000 |
BRA Z | Branch if Zero | |||||||
---|---|---|---|---|---|---|---|---|
Syntax: | {label:} | BRA | Z, | 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: | 1010 | 011U | nnnn | nnnn | nnnn | nnnn | nnnn | 1010 |
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:1 | Address | Label | Instruction | Comment | ||
---|---|---|---|---|---|---|
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 execution | After execution | |||||
PC | 0x804000 | PC | 0x804030 | |||
w15 | 0x4500 | w15 | 0x4500 | |||
SR[7:0] | 8'b00000010 | (Z = 1) | SR[7:0] | 8'b00000010 | (Z = 1) |