|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object avrora.core.Instr
The Instr
class and its descendants represent instructions within the assembly code. The
visitor pattern is applied here. Each instruction has an accept()
method that allows it to be
visited with double dispatch by a InstrVisitor
. Each instruction in the AVR instruction set is
represented by an inner class whose source has been generated from a simple specification.
InstrVisitor
Nested Class Summary | |
static class |
Instr.ADC
---------------------------------------------------------------- I N S T R U C T I O N D E S C R I P T I O N S ---------------------------------------------------------------- These are the actual instruction descriptions that contain the constraints on operands and sizes, etc. |
static class |
Instr.ADD
|
static class |
Instr.ADIW
|
static class |
Instr.AND
|
static class |
Instr.ANDI
|
static class |
Instr.ASR
|
static class |
Instr.BCLR
|
static class |
Instr.BLD
|
static class |
Instr.BRBC
|
static class |
Instr.BRBS
|
static class |
Instr.BRCC
|
static class |
Instr.BRCS
|
static class |
Instr.BREAK
|
static class |
Instr.BREQ
|
static class |
Instr.BRGE
|
static class |
Instr.BRHC
|
static class |
Instr.BRHS
|
static class |
Instr.BRID
|
static class |
Instr.BRIE
|
static class |
Instr.BRLO
|
static class |
Instr.BRLT
|
static class |
Instr.BRMI
|
static class |
Instr.BRNE
|
static class |
Instr.BRPL
|
static class |
Instr.BRSH
|
static class |
Instr.BRTC
|
static class |
Instr.BRTS
|
static class |
Instr.BRVC
|
static class |
Instr.BRVS
|
static class |
Instr.BSET
|
static class |
Instr.BST
|
static class |
Instr.CALL
|
static class |
Instr.CBI
|
static class |
Instr.CBR
|
static class |
Instr.CLC
|
static class |
Instr.CLH
|
static class |
Instr.CLI
|
static class |
Instr.CLN
|
static class |
Instr.CLR
|
static class |
Instr.CLS
|
static class |
Instr.CLT
|
static class |
Instr.CLV
|
static class |
Instr.CLZ
|
static class |
Instr.COM
|
static class |
Instr.CP
|
static class |
Instr.CPC
|
static class |
Instr.CPI
|
static class |
Instr.CPSE
|
static class |
Instr.DEC
|
static class |
Instr.EICALL
|
static class |
Instr.EIJMP
|
static class |
Instr.ELPM
|
static class |
Instr.ELPMD
|
static class |
Instr.ELPMPI
|
static class |
Instr.EOR
|
static class |
Instr.FMUL
|
static class |
Instr.FMULS
|
static class |
Instr.FMULSU
|
static class |
Instr.ICALL
|
static class |
Instr.IJMP
|
static class |
Instr.IMM_class
|
static class |
Instr.ImmediateRequired
The ImmediateRequired class represents an error in construction of an instance of
Instr where the given operand is expected to be an immediate but is not. |
static class |
Instr.IMMIMM_class
|
static class |
Instr.IMMREG_class
|
static class |
Instr.IMMWORD_class
|
static class |
Instr.IN
|
static class |
Instr.INC
|
static class |
Instr.InvalidImmediate
The InvalidImmediate class represents an error in construction of an instance of
Instr where the given immediate operand is not within the range that is specified by the
instruction set manual. |
static class |
Instr.InvalidOperand
The InvalidOperand class represents a runtime error thrown by the constructor of an
instruction or the build method of a prototype when an operand does not meet the
restrictions imposed by the AVR instruction set architecture. |
static class |
Instr.InvalidRegister
The InvalidRegister class represents an error in constructing an instance of
Instr where a register operand does not meet the instruction set specification. |
static class |
Instr.JMP
|
static class |
Instr.LD
|
static class |
Instr.LDD
|
static class |
Instr.LDI
|
static class |
Instr.LDPD
|
static class |
Instr.LDPI
|
static class |
Instr.LDS
|
static class |
Instr.LPM
|
static class |
Instr.LPMD
|
static class |
Instr.LPMPI
|
static class |
Instr.LSL
|
static class |
Instr.LSR
|
static class |
Instr.MOV
|
static class |
Instr.MOVW
|
static class |
Instr.MUL
|
static class |
Instr.MULS
|
static class |
Instr.MULSU
|
static class |
Instr.NEG
|
static class |
Instr.NONE_class
|
static class |
Instr.NOP
|
static class |
Instr.OR
|
static class |
Instr.ORI
|
static class |
Instr.OUT
|
static class |
Instr.POP
|
static class |
Instr.PUSH
|
static class |
Instr.RCALL
|
static class |
Instr.REG_class
|
static class |
Instr.REGIMM_class
|
static class |
Instr.REGIMMREG_class
|
static class |
Instr.RegisterRequired
The RegisterRequired class represents an error in construction of an instance of
Instr where the given operand is expected to be a register but is not. |
static class |
Instr.REGREG_class
-------------------------------------------------------- A B S T R A C T C L A S S E S -------------------------------------------------------- These abstract implementations of the instruction simplify the specification of each individual instruction considerably. |
static class |
Instr.REGREGIMM_class
|
static class |
Instr.RET
|
static class |
Instr.RETI
|
static class |
Instr.RJMP
|
static class |
Instr.ROL
|
static class |
Instr.ROR
|
static class |
Instr.SBC
|
static class |
Instr.SBCI
|
static class |
Instr.SBI
|
static class |
Instr.SBIC
|
static class |
Instr.SBIS
|
static class |
Instr.SBIW
|
static class |
Instr.SBR
|
static class |
Instr.SBRC
|
static class |
Instr.SBRS
|
static class |
Instr.SEC
|
static class |
Instr.SEH
|
static class |
Instr.SEI
|
static class |
Instr.SEN
|
static class |
Instr.SER
|
static class |
Instr.SES
|
static class |
Instr.SET
|
static class |
Instr.SEV
|
static class |
Instr.SEZ
|
static class |
Instr.SLEEP
|
static class |
Instr.SPM
|
static class |
Instr.ST
|
static class |
Instr.STD
|
static class |
Instr.STPD
|
static class |
Instr.STPI
|
static class |
Instr.STS
|
static class |
Instr.SUB
|
static class |
Instr.SUBI
|
static class |
Instr.SWAP
|
static class |
Instr.TST
|
static class |
Instr.WDR
|
static class |
Instr.WORD_class
|
static class |
Instr.WrongNumberOfOperands
The WrongNumberOfOperands class represents a runtime error thrown by the
build method of a prototype when the wrong number of operands is passed to build an
instruction. |
Field Summary | |
InstrProperties |
properties
The properties field stores a reference to the properties of the instruction,
including its size, number of cycles, etc. |
Constructor Summary | |
Instr(InstrProperties ip)
The constructor for the Instr class creates a new instruction with the specified
instruction properties. |
Method Summary | |
abstract void |
accept(InstrVisitor v)
The accept() method is part of the visitor pattern for instructions. |
Instr |
asInstr()
The asInstr() method converts an instruction into an AVR instruction. |
int |
getCycles()
The getCycles() method returns the number of cylces consumed by the instruction in the
default case. |
java.lang.String |
getName()
The getName() method returns the name of the instruction as a string. |
abstract java.lang.String |
getOperands()
The getOperands() method returns a string representation of the operands of the
instruction. |
int |
getSize()
The getSize() method returns the size of the instruction in bytes. |
java.lang.String |
getVariant()
The getVariant() method returns the variant name of the instruction as a string. |
java.lang.String |
toString()
The toString() method simply converts this instruction to a string by appending
the operands to the variant of the instruction as a string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface avrora.core.InstrPrototype |
build |
Field Detail |
public final InstrProperties properties
properties
field stores a reference to the properties of the instruction,
including its size, number of cycles, etc.
Constructor Detail |
public Instr(InstrProperties ip)
Instr
class creates a new instruction with the specified
instruction properties. Since this class is abstract, Instr
cannot be instantiated
directly, but is called through its subclasses.
ip
- the instruction properties for this instructionMethod Detail |
public abstract java.lang.String getOperands()
getOperands()
method returns a string representation of the operands of the
instruction. This is useful for printing and tracing of instructions as well as generating listings.
public java.lang.String getVariant()
getVariant()
method returns the variant name of the instruction as a string. Since
instructions like load and store have multiple variants, they each have specific variant names to
distinguish them internally in the core of Avrora. For example, for "ld x+, (addr)", the variant is
"ldpi" (load with post increment), but the actual instruction is "ld", so this method will return
"ldpi".
getVariant
in interface InstrPrototype
public int getSize()
getSize()
method returns the size of the instruction in bytes.
getSize
in interface InstrPrototype
public java.lang.String getName()
getName()
method returns the name of the instruction as a string. For instructions
that are variants of instructions, this method returns the actual name of the instruction. For example,
for "ld x+, (addr)", the variant is "ldpi" (load with post increment), but the actual instruction is
"ld", so this method will return "ld".
getName
in interface InstrPrototype
public java.lang.String toString()
toString()
method simply converts this instruction to a string by appending
the operands to the variant of the instruction as a string.
public int getCycles()
getCycles()
method returns the number of cylces consumed by the instruction in the
default case. Most instructions consume the same amount of clock cycles no matter what behavior. For
example, 8-bit arithmetic takes one cycle, load and stores take two cycles, etc. Some instructions like
the branch and skip instructions take more cycles if they are taken or not taken. In that case, this
count returned is the smallest number of cycles that can be consumed by this instruction.
public Instr asInstr()
asInstr()
method converts an instruction into an AVR instruction. This is used
internally for special types of instructions (that are used in the interpreter, for example)
so that they behave correctly when reading them from an executing program.
public abstract void accept(InstrVisitor v)
accept()
method is part of the visitor pattern for instructions. The visitor pattern
uses two virtual dispatches combined with memory overloading to achieve dispatching on multiple types.
The result is clean and modular code.
v
- the visitor to accept
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |