Enum Class InstructionSet

java.lang.Object
java.lang.Enum<InstructionSet>
be.lmenten.avr.core.instruction.InstructionSet
All Implemented Interfaces:
Serializable, Comparable<InstructionSet>, Constable

public enum InstructionSet extends Enum<InstructionSet>
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Add with carry
    Add without carry
    Add immediate to word
    Logical AND
    Logical AND with immediate
    Arithmetic shift right
    Bit clear in SREG
    Bit load from T flag in SREG to bit in register
    Branch if bit in SREG is cleared
    Branch if bit in SREG is set
    Branch if carry is cleared
    Branch is carry is set
    Break
    Branch if equal
    Branch if greater or equal (signed)
    Branch if half carry flag is cleared
    Branch if half carry flag is set
    Branch if global interrupt is disabled
    Branch if global interrupt is enabled
    Branch if lower (unsigned)
    Branch if less than (signed)
    Branch if minus
    Branch if not equal
    Branch if plus
    Branch if same or higher (unsigned)
    Branch if T flag is cleared
    Branch if T flag is set
    Branch if overflow flag is cleared
    Branch if overflow flag is set
    Bit set in SREG
    Bit store from bit in register to T flag in SREG
    Long call to subroutine
    Clear bit in I/O register
    Clear bits in register
    Clear carry flag
    Clear half carry flag
    Clear global interrupt flag
    Clear negative flag
    Clear register
    Clear sign flag
    Clear T flag
    Clear overflow flag
    Clear zero flag
    One's complement
    Compare
    Compare with carry
    Compare with immediate
    Compare and skip if equal
    Decrement
    Data Encryption Standard
    Extended indirect call to subroutine
    Extended indirect jump
    Extended load program memory (to RO)
    Extended load program memory (to Rd)
    Logical Exclusive OR
    Fractional multiply unsigned
    Fractional multiply signed
    Fractional multiply signed with unsigned
    Indirect call to subroutine
    Indirect jump
    Load I/O location to register
    Increment
    Long jump
    Load and clear
    Load and set
    Load and toggle
    Load indirect from data space using index (SHADOWED)
    Load 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 X
    Load 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 displacement
    Load immediate to register
    Load direct
    Load direct (16 bits opcode)
    Load program memory (to R0)
    Load program memory (to Rd)
    Logical shift left
    Logical shift right
    Copy register
    Copy register word
    Multiply (unsigned)
    Multiply (signed)
    Multiply (signed with unsigned)
    Two's complement (negate)
    No operation
    Logical OR
    Logical OR with immediate
    Store register to I/O location
    Pop register from stack
    Push register onto stack
    Relative call to subroutine
    Return from subroutine
    Return from interrupt service routine
    Relative jump
    Rotate left through carry
    Rotate right through carry
    Subtract with carry
    Subtract immediate with carry
    Set bit in I/O register
    Skip if bit in I/O register cleared
    Skip if bit in I/O register set
    Subtract immediate from word
    Set bits in register
    Skip if bit in register is cleared
    Skip if bit in register is set
    Set carry flag
    Set half carry flag
    Set global interrupt flag
    Set negative flag
    Set all bits in register
    Set sign flag
    Set T flag
    Set overflow flag
    Set zero flag
    Set circuit in sleep mode
    Store program memory
    Store indirect to data space using index (SHADOWED !)
    Store 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 X
    Store 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 displacement
    Store direct (32 bits)
    Store direct
    Subtract without carry
    Subtract immediate
    Swap nibbles
    Test for zero or minus
    Watch dog reset
    Exchange
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Extract the value of an operand from an opcode.
     
     
    static int
     
    int
    Get the opcode mask.
    int
    Get the count of bits used for masking opcode
    int
    Get the opcode with operands masked out.
     
     
     
     
    boolean
     
    static void
    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
    Is this instruction 2 words wide.
    boolean
    Check if this instruction is an alias (i.e.
    static boolean
     
    boolean
    Check if this instruction is supported by the given core version.
    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.
     
    valueOf​(String name)
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • ADC

      public static final InstructionSet ADC
      Add with carry
    • ADD

      public static final InstructionSet ADD
      Add without carry
    • ADIW

      public static final InstructionSet ADIW
      Add immediate to word
    • AND

      public static final InstructionSet AND
      Logical AND
    • ANDI

      public static final InstructionSet ANDI
      Logical AND with immediate
    • ASR

      public static final InstructionSet ASR
      Arithmetic shift right
    • BCLR

      public static final InstructionSet BCLR
      Bit clear in SREG
    • BLD

      public static final InstructionSet BLD
      Bit load from T flag in SREG to bit in register
    • BRBC

      public static final InstructionSet BRBC
      Branch if bit in SREG is cleared
    • BRBS

      public static final InstructionSet BRBS
      Branch if bit in SREG is set
    • BREAK

      public static final InstructionSet BREAK
      Break
    • BRCC

      public static final InstructionSet BRCC
      Branch if carry is cleared
    • BRCS

      public static final InstructionSet BRCS
      Branch is carry is set
    • BREQ

      public static final InstructionSet BREQ
      Branch if equal
    • BRGE

      public static final InstructionSet BRGE
      Branch if greater or equal (signed)
    • BRHC

      public static final InstructionSet BRHC
      Branch if half carry flag is cleared
    • BRHS

      public static final InstructionSet BRHS
      Branch if half carry flag is set
    • BRID

      public static final InstructionSet BRID
      Branch if global interrupt is disabled
    • BRIE

      public static final InstructionSet BRIE
      Branch if global interrupt is enabled
    • BRLO

      public static final InstructionSet BRLO
      Branch if lower (unsigned)
    • BRLT

      public static final InstructionSet BRLT
      Branch if less than (signed)
    • BRMI

      public static final InstructionSet BRMI
      Branch if minus
    • BRNE

      public static final InstructionSet BRNE
      Branch if not equal
    • BRPL

      public static final InstructionSet BRPL
      Branch if plus
    • BRSH

      public static final InstructionSet BRSH
      Branch if same or higher (unsigned)
    • BRTC

      public static final InstructionSet BRTC
      Branch if T flag is cleared
    • BRTS

      public static final InstructionSet BRTS
      Branch if T flag is set
    • BRVC

      public static final InstructionSet BRVC
      Branch if overflow flag is cleared
    • BRVS

      public static final InstructionSet BRVS
      Branch if overflow flag is set
    • BSET

      public static final InstructionSet BSET
      Bit set in SREG
    • BST

      public static final InstructionSet BST
      Bit store from bit in register to T flag in SREG
    • CALL

      public static final InstructionSet CALL
      Long call to subroutine
    • CBI

      public static final InstructionSet CBI
      Clear bit in I/O register
    • CBR

      public static final InstructionSet CBR
      Clear bits in register
    • CLC

      public static final InstructionSet CLC
      Clear carry flag
    • CLH

      public static final InstructionSet CLH
      Clear half carry flag
    • CLI

      public static final InstructionSet CLI
      Clear global interrupt flag
    • CLN

      public static final InstructionSet CLN
      Clear negative flag
    • CLR

      public static final InstructionSet CLR
      Clear register
    • CLS

      public static final InstructionSet CLS
      Clear sign flag
    • CLT

      public static final InstructionSet CLT
      Clear T flag
    • CLV

      public static final InstructionSet CLV
      Clear overflow flag
    • CLZ

      public static final InstructionSet CLZ
      Clear zero flag
    • COM

      public static final InstructionSet COM
      One's complement
    • CP

      public static final InstructionSet CP
      Compare
    • CPC

      public static final InstructionSet CPC
      Compare with carry
    • CPI

      public static final InstructionSet CPI
      Compare with immediate
    • CPSE

      public static final InstructionSet CPSE
      Compare and skip if equal
    • DEC

      public static final InstructionSet DEC
      Decrement
    • DES

      public static final InstructionSet DES
      Data Encryption Standard
    • EICALL

      public static final InstructionSet EICALL
      Extended indirect call to subroutine
    • EIJMP

      public static final InstructionSet EIJMP
      Extended indirect jump
    • ELPM

      public static final InstructionSet ELPM
      Extended load program memory (to RO)
    • ELPM_Rd

      public static final InstructionSet ELPM_Rd
      Extended load program memory (to Rd)
    • EOR

      public static final InstructionSet EOR
      Logical Exclusive OR
    • FMUL

      public static final InstructionSet FMUL
      Fractional multiply unsigned
    • FMULS

      public static final InstructionSet FMULS
      Fractional multiply signed
    • FMULSU

      public static final InstructionSet FMULSU
      Fractional multiply signed with unsigned
    • ICALL

      public static final InstructionSet ICALL
      Indirect call to subroutine
    • IJMP

      public static final InstructionSet IJMP
      Indirect jump
    • IN

      public static final InstructionSet IN
      Load I/O location to register
    • INC

      public static final InstructionSet INC
      Increment
    • JMP

      public static final InstructionSet JMP
      Long jump
    • LAC

      public static final InstructionSet LAC
      Load and clear
    • LAS

      public static final InstructionSet LAS
      Load and set
    • LAT

      public static final InstructionSet LAT
      Load and toggle
    • LD

      public static final InstructionSet LD
      Load indirect from data space using index (SHADOWED)
    • LD_X

      public static final InstructionSet LD_X
      Load indirect from data space using index X
    • LD_mX

      public static final InstructionSet LD_mX
      Load indirect from data space using index -X
    • LD_Xp

      public static final InstructionSet LD_Xp
      Load indirect from data space using index X+
    • LD_mY

      public static final InstructionSet LD_mY
      Load indirect from data space using index -Y
    • LD_Yp

      public static final InstructionSet LD_Yp
      Load indirect from data space using index Y+
    • LD_mZ

      public static final InstructionSet LD_mZ
      Load indirect from data space using index -Z
    • LD_Zp

      public static final InstructionSet LD_Zp
      Load indirect from data space using index Z+
    • LDD

      public static final InstructionSet LDD
      Load indirect from data space using index and displacement
    • LDI

      public static final InstructionSet LDI
      Load immediate to register
    • LDS16

      public static final InstructionSet LDS16
      Load direct (16 bits opcode)
    • LDS

      public static final InstructionSet LDS
      Load direct
    • LPM

      public static final InstructionSet LPM
      Load program memory (to R0)
    • LPM_Rd

      public static final InstructionSet LPM_Rd
      Load program memory (to Rd)
    • LSL

      public static final InstructionSet LSL
      Logical shift left
    • LSR

      public static final InstructionSet LSR
      Logical shift right
    • MOV

      public static final InstructionSet MOV
      Copy register
    • MOVW

      public static final InstructionSet MOVW
      Copy register word
    • MUL

      public static final InstructionSet MUL
      Multiply (unsigned)
    • MULS

      public static final InstructionSet MULS
      Multiply (signed)
    • MULSU

      public static final InstructionSet MULSU
      Multiply (signed with unsigned)
    • NEG

      public static final InstructionSet NEG
      Two's complement (negate)
    • NOP

      public static final InstructionSet NOP
      No operation
    • OR

      public static final InstructionSet OR
      Logical OR
    • ORI

      public static final InstructionSet ORI
      Logical OR with immediate
    • OUT

      public static final InstructionSet OUT
      Store register to I/O location
    • POP

      public static final InstructionSet POP
      Pop register from stack
    • PUSH

      public static final InstructionSet PUSH
      Push register onto stack
    • RCALL

      public static final InstructionSet RCALL
      Relative call to subroutine
    • RET

      public static final InstructionSet RET
      Return from subroutine
    • RETI

      public static final InstructionSet RETI
      Return from interrupt service routine
    • RJMP

      public static final InstructionSet RJMP
      Relative jump
    • ROL

      public static final InstructionSet ROL
      Rotate left through carry
    • ROR

      public static final InstructionSet ROR
      Rotate right through carry
    • SBC

      public static final InstructionSet SBC
      Subtract with carry
    • SBCI

      public static final InstructionSet SBCI
      Subtract immediate with carry
    • SBI

      public static final InstructionSet SBI
      Set bit in I/O register
    • SBIC

      public static final InstructionSet SBIC
      Skip if bit in I/O register cleared
    • SBIS

      public static final InstructionSet SBIS
      Skip if bit in I/O register set
    • SBIW

      public static final InstructionSet SBIW
      Subtract immediate from word
    • SBR

      public static final InstructionSet SBR
      Set bits in register
    • SBRC

      public static final InstructionSet SBRC
      Skip if bit in register is cleared
    • SBRS

      public static final InstructionSet SBRS
      Skip if bit in register is set
    • SEC

      public static final InstructionSet SEC
      Set carry flag
    • SEH

      public static final InstructionSet SEH
      Set half carry flag
    • SEI

      public static final InstructionSet SEI
      Set global interrupt flag
    • SEN

      public static final InstructionSet SEN
      Set negative flag
    • SER

      public static final InstructionSet SER
      Set all bits in register
    • SES

      public static final InstructionSet SES
      Set sign flag
    • SET

      public static final InstructionSet SET
      Set T flag
    • SEV

      public static final InstructionSet SEV
      Set overflow flag
    • SEZ

      public static final InstructionSet SEZ
      Set zero flag
    • SLEEP

      public static final InstructionSet SLEEP
      Set circuit in sleep mode
    • SPM

      public static final InstructionSet SPM
      Store program memory
    • ST

      public static final InstructionSet ST
      Store indirect to data space using index (SHADOWED !)
    • ST_X

      public static final InstructionSet ST_X
      Store indirect to data space using index X
    • ST_mX

      public static final InstructionSet ST_mX
      Store indirect to data space using index -X
    • ST_Xp

      public static final InstructionSet ST_Xp
      Store indirect to data space using index X+
    • ST_mY

      public static final InstructionSet ST_mY
      Store indirect to data space using index -Y
    • ST_Yp

      public static final InstructionSet ST_Yp
      Store indirect to data space using index Y+
    • ST_mZ

      public static final InstructionSet ST_mZ
      Store indirect to data space using index -Z
    • ST_Zp

      public static final InstructionSet ST_Zp
      Store indirect to data space using index Z+
    • STD

      public static final InstructionSet STD
      Store indirect to data space using index and displacement
    • STS16

      public static final InstructionSet STS16
      Store direct
    • STS

      public static final InstructionSet STS
      Store direct (32 bits)
    • SUB

      public static final InstructionSet SUB
      Subtract without carry
    • SUBI

      public static final InstructionSet SUBI
      Subtract immediate
    • SWAP

      public static final InstructionSet SWAP
      Swap nibbles
    • TST

      public static final InstructionSet TST
      Test for zero or minus
    • WDR

      public static final InstructionSet WDR
      Watch dog reset
    • XCH

      public static final InstructionSet XCH
      Exchange
  • Method Details

    • values

      public static InstructionSet[] 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

      public static InstructionSet valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • lookup

      public static InstructionSet lookup(int opcode)
      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

      public Instruction newInstance(int opcode, Integer opcode2)
      Create an instance of the handle associated with this instruction.
      Parameters:
      opcode - instruction word
      opcode2 - second instruction word for 32 bits instructions
      Returns:
      the newly created instance
    • extractOperand

      public int extractOperand(InstructionSet.OperandType type, int opcode)
      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 extract
      opcode - the opcode value
      Returns:
      the operand value
    • insertOperand

      public int insertOperand(InstructionSet.OperandType type, int opcode, int value)
      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 extract
      opcode - the original opcode value
      value - 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

      public String getRawOpcode()
    • getRawStatusRegister

      public String 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

      public boolean isSupportedBy(CoreVersion version)
      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

      public String getAlias()
      Returns:
    • getSyntax

      public String getSyntax()
      Returns:
    • getDescription

      public String getDescription()
      Returns:
    • getRemark

      public String getRemark()
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Enum<InstructionSet>