Package be.lmenten.avr.core.instruction
Enum Class InstructionSet
- All Implemented Interfaces:
Serializable
,Comparable<InstructionSet>
,Constable
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionAdd with carryAdd without carryAdd immediate to wordLogical ANDLogical AND with immediateArithmetic shift rightBit clear in SREGBit load from T flag in SREG to bit in registerBranch if bit in SREG is clearedBranch if bit in SREG is setBranch if carry is clearedBranch is carry is setBreakBranch if equalBranch if greater or equal (signed)Branch if half carry flag is clearedBranch if half carry flag is setBranch if global interrupt is disabledBranch if global interrupt is enabledBranch if lower (unsigned)Branch if less than (signed)Branch if minusBranch if not equalBranch if plusBranch if same or higher (unsigned)Branch if T flag is clearedBranch if T flag is setBranch if overflow flag is clearedBranch if overflow flag is setBit set in SREGBit store from bit in register to T flag in SREGLong call to subroutineClear bit in I/O registerClear bits in registerClear carry flagClear half carry flagClear global interrupt flagClear negative flagClear registerClear sign flagClear T flagClear overflow flagClear zero flagOne's complementCompareCompare with carryCompare with immediateCompare and skip if equalDecrementData Encryption StandardExtended indirect call to subroutineExtended indirect jumpExtended load program memory (to RO)Extended load program memory (to Rd)Logical Exclusive ORFractional multiply unsignedFractional multiply signedFractional multiply signed with unsignedIndirect call to subroutineIndirect jumpLoad I/O location to registerIncrementLong jumpLoad and clearLoad and setLoad and toggleLoad indirect from data space using index (SHADOWED)Load indirect from data space using index -XLoad indirect from data space using index -YLoad indirect from data space using index -ZLoad indirect from data space using index XLoad indirect from data space using index X+Load indirect from data space using index Y+Load indirect from data space using index Z+Load indirect from data space using index and displacementLoad immediate to registerLoad directLoad direct (16 bits opcode)Load program memory (to R0)Load program memory (to Rd)Logical shift leftLogical shift rightCopy registerCopy register wordMultiply (unsigned)Multiply (signed)Multiply (signed with unsigned)Two's complement (negate)No operationLogical ORLogical OR with immediateStore register to I/O locationPop register from stackPush register onto stackRelative call to subroutineReturn from subroutineReturn from interrupt service routineRelative jumpRotate left through carryRotate right through carrySubtract with carrySubtract immediate with carrySet bit in I/O registerSkip if bit in I/O register clearedSkip if bit in I/O register setSubtract immediate from wordSet bits in registerSkip if bit in register is clearedSkip if bit in register is setSet carry flagSet half carry flagSet global interrupt flagSet negative flagSet all bits in registerSet sign flagSet T flagSet overflow flagSet zero flagSet circuit in sleep modeStore program memoryStore indirect to data space using index (SHADOWED !)Store indirect to data space using index -XStore indirect to data space using index -YStore indirect to data space using index -ZStore indirect to data space using index XStore indirect to data space using index X+Store indirect to data space using index Y+Store indirect to data space using index Z+Store indirect to data space using index and displacementStore direct (32 bits)Store directSubtract without carrySubtract immediateSwap nibblesTest for zero or minusWatch dog resetExchange -
Method Summary
Modifier and TypeMethodDescriptionint
extractOperand(InstructionSet.OperandType type, int opcode)
Extract the value of an operand from an opcode.getAlias()
static int
int
Get the opcode mask.int
Get the count of bits used for masking opcodeint
Get the opcode with operands masked out.boolean
hasAlias()
static void
init()
For every InstructionSet entries, process the InstructionDescriptor annotation of the instruction handler implementations (using its class), then sort the entries based on its opcode mask for disassembler.int
insertOperand(InstructionSet.OperandType type, int opcode, int value)
Insert and operand value into an opcode.boolean
is32bits()
Is this instruction 2 words wide.boolean
isAlias()
Check if this instruction is an alias (i.e.static boolean
boolean
isSupportedBy(CoreVersion version)
Check if this instruction is supported by the given core version.static InstructionSet
lookup(int opcode)
Lookup an InstructionSet entry based on its opcode value.newInstance(int opcode, Integer opcode2)
Create an instance of the handle associated with this instruction.toString()
static InstructionSet
Returns the enum constant of this class with the specified name.static InstructionSet[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ADC
Add with carry -
ADD
Add without carry -
ADIW
Add immediate to word -
AND
Logical AND -
ANDI
Logical AND with immediate -
ASR
Arithmetic shift right -
BCLR
Bit clear in SREG -
BLD
Bit load from T flag in SREG to bit in register -
BRBC
Branch if bit in SREG is cleared -
BRBS
Branch if bit in SREG is set -
BREAK
Break -
BRCC
Branch if carry is cleared -
BRCS
Branch is carry is set -
BREQ
Branch if equal -
BRGE
Branch if greater or equal (signed) -
BRHC
Branch if half carry flag is cleared -
BRHS
Branch if half carry flag is set -
BRID
Branch if global interrupt is disabled -
BRIE
Branch if global interrupt is enabled -
BRLO
Branch if lower (unsigned) -
BRLT
Branch if less than (signed) -
BRMI
Branch if minus -
BRNE
Branch if not equal -
BRPL
Branch if plus -
BRSH
Branch if same or higher (unsigned) -
BRTC
Branch if T flag is cleared -
BRTS
Branch if T flag is set -
BRVC
Branch if overflow flag is cleared -
BRVS
Branch if overflow flag is set -
BSET
Bit set in SREG -
BST
Bit store from bit in register to T flag in SREG -
CALL
Long call to subroutine -
CBI
Clear bit in I/O register -
CBR
Clear bits in register -
CLC
Clear carry flag -
CLH
Clear half carry flag -
CLI
Clear global interrupt flag -
CLN
Clear negative flag -
CLR
Clear register -
CLS
Clear sign flag -
CLT
Clear T flag -
CLV
Clear overflow flag -
CLZ
Clear zero flag -
COM
One's complement -
CP
Compare -
CPC
Compare with carry -
CPI
Compare with immediate -
CPSE
Compare and skip if equal -
DEC
Decrement -
DES
Data Encryption Standard -
EICALL
Extended indirect call to subroutine -
EIJMP
Extended indirect jump -
ELPM
Extended load program memory (to RO) -
ELPM_Rd
Extended load program memory (to Rd) -
EOR
Logical Exclusive OR -
FMUL
Fractional multiply unsigned -
FMULS
Fractional multiply signed -
FMULSU
Fractional multiply signed with unsigned -
ICALL
Indirect call to subroutine -
IJMP
Indirect jump -
IN
Load I/O location to register -
INC
Increment -
JMP
Long jump -
LAC
Load and clear -
LAS
Load and set -
LAT
Load and toggle -
LD
Load indirect from data space using index (SHADOWED) -
LD_X
Load indirect from data space using index X -
LD_mX
Load indirect from data space using index -X -
LD_Xp
Load indirect from data space using index X+ -
LD_mY
Load indirect from data space using index -Y -
LD_Yp
Load indirect from data space using index Y+ -
LD_mZ
Load indirect from data space using index -Z -
LD_Zp
Load indirect from data space using index Z+ -
LDD
Load indirect from data space using index and displacement -
LDI
Load immediate to register -
LDS16
Load direct (16 bits opcode) -
LDS
Load direct -
LPM
Load program memory (to R0) -
LPM_Rd
Load program memory (to Rd) -
LSL
Logical shift left -
LSR
Logical shift right -
MOV
Copy register -
MOVW
Copy register word -
MUL
Multiply (unsigned) -
MULS
Multiply (signed) -
MULSU
Multiply (signed with unsigned) -
NEG
Two's complement (negate) -
NOP
No operation -
OR
Logical OR -
ORI
Logical OR with immediate -
OUT
Store register to I/O location -
POP
Pop register from stack -
PUSH
Push register onto stack -
RCALL
Relative call to subroutine -
RET
Return from subroutine -
RETI
Return from interrupt service routine -
RJMP
Relative jump -
ROL
Rotate left through carry -
ROR
Rotate right through carry -
SBC
Subtract with carry -
SBCI
Subtract immediate with carry -
SBI
Set bit in I/O register -
SBIC
Skip if bit in I/O register cleared -
SBIS
Skip if bit in I/O register set -
SBIW
Subtract immediate from word -
SBR
Set bits in register -
SBRC
Skip if bit in register is cleared -
SBRS
Skip if bit in register is set -
SEC
Set carry flag -
SEH
Set half carry flag -
SEI
Set global interrupt flag -
SEN
Set negative flag -
SER
Set all bits in register -
SES
Set sign flag -
SET
Set T flag -
SEV
Set overflow flag -
SEZ
Set zero flag -
SLEEP
Set circuit in sleep mode -
SPM
Store program memory -
ST
Store indirect to data space using index (SHADOWED !) -
ST_X
Store indirect to data space using index X -
ST_mX
Store indirect to data space using index -X -
ST_Xp
Store indirect to data space using index X+ -
ST_mY
Store indirect to data space using index -Y -
ST_Yp
Store indirect to data space using index Y+ -
ST_mZ
Store indirect to data space using index -Z -
ST_Zp
Store indirect to data space using index Z+ -
STD
Store indirect to data space using index and displacement -
STS16
Store direct -
STS
Store direct (32 bits) -
SUB
Subtract without carry -
SUBI
Subtract immediate -
SWAP
Swap nibbles -
TST
Test for zero or minus -
WDR
Watch dog reset -
XCH
Exchange
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
lookup
Lookup an InstructionSet entry based on its opcode value. This is done by checking the value against a reverse list of opcode values sorted by their mask weight.- Parameters:
opcode
- a binary opcode value (16 bits)- Returns:
- the InstructionSet entry or null
-
newInstance
Create an instance of the handle associated with this instruction.- Parameters:
opcode
- instruction wordopcode2
- second instruction word for 32 bits instructions- Returns:
- the newly created instance
-
extractOperand
Extract the value of an operand from an opcode. If the operand bits are scattered through the opcode, they will be packed into an usable value.- Parameters:
type
- the type of the operand to extractopcode
- the opcode value- Returns:
- the operand value
-
insertOperand
Insert and operand value into an opcode. If the operand bits are scattered through the opcode, they will be unpacked accordingly.- Parameters:
type
- the type of the operand to extractopcode
- the original opcode valuevalue
- the operand value- Returns:
- the new opcode value with operand
-
init
public static void init()For every InstructionSet entries, process the InstructionDescriptor annotation of the instruction handler implementations (using its class), then sort the entries based on its opcode mask for disassembler.This method SHOULD be called before any use of InstructionSet.
-
isInitialized
public static boolean isInitialized() -
getMaxMnemonicLength
public static int getMaxMnemonicLength() -
getRawOpcode
-
getRawStatusRegister
-
getOpcodeMaskValue
public int getOpcodeMaskValue()Get the opcode with operands masked out.- Returns:
- the opcode
-
getOpcodeMask
public int getOpcodeMask()Get the opcode mask.- Returns:
- the opcode mask
-
getOpcodeMaskSize
public int getOpcodeMaskSize()Get the count of bits used for masking opcode- Returns:
- the mask size
-
is32bits
public boolean is32bits()Is this instruction 2 words wide.- Returns:
- true for 2 words instruction
-
isSupportedBy
Check if this instruction is supported by the given core version.- Parameters:
version
- the core version to check against- Returns:
- true if this instruction is supported by the core
-
isAlias
public boolean isAlias()Check if this instruction is an alias (i.e. share the same opcode) for another instruction.- Returns:
- true if this instruction is an alias
-
hasAlias
public boolean hasAlias()- Returns:
-
getAlias
- Returns:
-
getSyntax
- Returns:
-
getDescription
- Returns:
-
getRemark
- Returns:
-
toString
- Overrides:
toString
in classEnum<InstructionSet>
-