avrora.sim
Class GenInterpreter
java.lang.Object
avrora.sim.BaseInterpreter
avrora.sim.GenInterpreter
- All Implemented Interfaces:
- InstrVisitor
- Direct Known Subclasses:
- DBBCInterpreter
- public class GenInterpreter
- extends BaseInterpreter
- implements InstrVisitor
The GenInterpreter
class is largely generated from the instruction specification. The
framework around the generated code (utilities) has been written by hand, but most of the code for each
instruction is generated. Therefore it is not recommended to edit this code extensively.
Nested Class Summary |
static class |
GenInterpreter.Factory
The Factory() class implements an interpreter factory that can create
a new interpreter for a new simulator instance with the given program. |
Fields inherited from class avrora.sim.BaseInterpreter |
bootPC, C, clock, cyclesConsumed, delayCycles, exceptionWatch, flash, globalProbe, H, I, innerLoop, interruptBase, interrupts, ioregs, justReturnedFromInterrupt, N, nextPC, NUM_REGS, pc, RAMPZ, registers, S, shared_instr, shouldRun, simulator, sleeping, SPH_reg, SPL_reg, sram, sram_max, sram_start, sram_watches, SREG, SREG_C, SREG_H, SREG_I, SREG_N, SREG_reg, SREG_S, SREG_T, SREG_V, SREG_Z, state, T, V, Z |
Constructor Summary |
protected |
GenInterpreter(Simulator s,
Program p,
MicrocontrollerProperties pr)
The constructor for the Interpreter class builds the internal data structures needed to
store the complete state of the machine, including registers, IO registers, the SRAM, and the flash.
|
Methods inherited from class avrora.sim.BaseInterpreter |
advanceClock, commit, delay, disableInterrupts, enableInterrupts, getDataByte, getInstr, getInstrSize, getInterruptBase, getInterruptTable, getInterruptVectorAddress, getIOReg, getIORegisterByte, getMainClock, getPC, getProgramByte, getRegisterByte, getRegisterByte, getRegisterUnsigned, getRegisterUnsigned, getRegisterWord, getRegisterWord, getSimulator, getSP, getSREG, insertExceptionWatch, insertIORWatch, insertProbe, insertProbe, insertWatch, installIOReg, popByte, pushByte, removeIORWatch, removeProbe, removeProbe, removeWatch, setBootPC, setEnabled, setInterruptBase, setPosted, setSP, start, stop, storeProgramMemory, writeDataByte, writeFlashByte, writeIORegisterByte, writeRegisterByte, writeRegisterByte, writeRegisterWord, writeRegisterWord, writeSREG |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
R0
public static final Register R0
R1
public static final Register R1
R2
public static final Register R2
R3
public static final Register R3
R4
public static final Register R4
R5
public static final Register R5
R6
public static final Register R6
R7
public static final Register R7
R8
public static final Register R8
R9
public static final Register R9
R10
public static final Register R10
R11
public static final Register R11
R12
public static final Register R12
R13
public static final Register R13
R14
public static final Register R14
R15
public static final Register R15
R16
public static final Register R16
R17
public static final Register R17
R18
public static final Register R18
R19
public static final Register R19
R20
public static final Register R20
R21
public static final Register R21
R22
public static final Register R22
R23
public static final Register R23
R24
public static final Register R24
R25
public static final Register R25
R26
public static final Register R26
R27
public static final Register R27
R28
public static final Register R28
R29
public static final Register R29
R30
public static final Register R30
R31
public static final Register R31
RX
public static final Register RX
RY
public static final Register RY
RZ
public static final Register RZ
GenInterpreter
protected GenInterpreter(Simulator s,
Program p,
MicrocontrollerProperties pr)
- The constructor for the
Interpreter
class builds the internal data structures needed to
store the complete state of the machine, including registers, IO registers, the SRAM, and the flash.
All IO registers are initialized to be instances of RWIOReg
. Reserved and special IO
registers must be inserted by the getIOReg()
and writeIOReg()
methods.
- Parameters:
s
- The simulator attached to this interpreterp
- the program to construct the state forpr
- the properties of the microcontroller being simulated
runLoop
protected void runLoop()
- Specified by:
runLoop
in class BaseInterpreter
step
public int step()
- Description copied from class:
BaseInterpreter
- The
step()
method steps this node forward one instruction or one clock cycle. The node may
execute an instruction, execute events, wake from sleep, take an interrupt, etc. In the case of multi-cycle
instructions, the node will execute until the end of the instruction. The number of cycles consumed is
returned by this method.
- Specified by:
step
in class BaseInterpreter
- Returns:
- the number of cycles consumed in executing one instruction or waking from an interrupt, etc
visit
public void visit(Instr.ADC i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.ADD i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.ADIW i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.AND i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.ANDI i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.ASR i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BCLR i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BLD i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BRBC i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BRBS i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BRCC i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BRCS i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BREAK i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BREQ i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BRGE i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BRHC i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BRHS i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BRID i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BRIE i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BRLO i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BRLT i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BRMI i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BRNE i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BRPL i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BRSH i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BRTC i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BRTS i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BRVC i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BRVS i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BSET i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.BST i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.CALL i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.CBI i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.CBR i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.CLC i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.CLH i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.CLI i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.CLN i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.CLR i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.CLS i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.CLT i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.CLV i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.CLZ i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.COM i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.CP i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.CPC i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.CPI i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.CPSE i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.DEC i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.EICALL i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.EIJMP i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.ELPM i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.ELPMD i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.ELPMPI i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.EOR i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.FMUL i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.FMULS i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.FMULSU i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.ICALL i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.IJMP i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.IN i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.INC i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.JMP i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.LD i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.LDD i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.LDI i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.LDPD i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.LDPI i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.LDS i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.LPM i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.LPMD i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.LPMPI i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.LSL i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.LSR i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.MOV i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.MOVW i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.MUL i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.MULS i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.MULSU i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.NEG i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.NOP i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.OR i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.ORI i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.OUT i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.POP i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.PUSH i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.RCALL i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.RET i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.RETI i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.RJMP i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.ROL i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.ROR i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SBC i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SBCI i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SBI i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SBIC i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SBIS i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SBIW i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SBR i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SBRC i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SBRS i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SEC i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SEH i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SEI i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SEN i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SER i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SES i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SET i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SEV i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SEZ i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SLEEP i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SPM i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.ST i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.STD i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.STPD i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.STPI i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.STS i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SUB i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SUBI i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.SWAP i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.TST i)
- Specified by:
visit
in interface InstrVisitor
visit
public void visit(Instr.WDR i)
- Specified by:
visit
in interface InstrVisitor
pushPC
public void pushPC(int npc)
popPC
public int popPC()
low
public static byte low(int val)
high
public static byte high(int val)
bit
public static byte bit(boolean val)
uword
public static int uword(byte low,
byte high)
extended
public int extended(int addr)
enterSleepMode
public void enterSleepMode()
- send the node to sleep
leaveSleepMode
public void leaveSleepMode()
- time to wake up