Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## avrora.sim
Class BaseInterpreter

    java.lang.Object
      avrora.sim.BaseInterpreter

All Implemented Interfaces:
  InstrVisitor, IORegisterConstants, State

Direct Known Subclasses:
  GenInterpreter

public abstract class BaseInterpreter
extends java.lang.Object
implements State, InstrVisitor

The `BaseInterpreter` class represents a base class of the legacy interpreter and the generated interpreter(s) that stores the state of the executing program, e.g. registers and flags, etc.

Nested Class Summary
`class` | `BaseInterpreter.AddressOutOfBoundsException`
`class` | `BaseInterpreter.NoSuchInstructionException`
`class` | `BaseInterpreter.PCAlignmentException`
`class` | `BaseInterpreter.PCOutOfBoundsException`

Nested classes inherited from class avrora.sim.State
`State.IOReg, State.RWIOReg`

Field Summary
`boolean` | `C`
`protected MainClock` | `clock`
`int` | `cyclesConsumed` The `cyclesConsumed` field stores the number of cycles consumed in doing a part of the simulation (e.g. executing an instruction or processing an interrupt).
`protected long` | `delayCycles` The `delayCycles` field tracks the number of cycles that the microcontroller is delayed.
`protected byte[]` | `flash_data`
`protected Instr[]` | `flash_instr`
`protected MulticastProbe` | `globalProbe` The `activeProbe` field stores a reference to a `MulticastProbe` that contains all of the probes to be fired before and after the main execution runLoop--i.e. before and after every instruction.
`boolean` | `H`
`boolean` | `I`
`protected boolean` | `innerLoop` The `innerLoop` field is a boolean that is used internally in the implementation of the interpreter.
`protected State.IOReg[]` | `ioregs`
`boolean` | `justReturnedFromInterrupt` The `justReturnedFromInterrupt` field is used internally in maintaining the invariant stated in the hardware manual that at least one instruction following a return from an interrupt is executed before another interrupt can be processed.
`boolean` | `N`
`int` | `nextPC` The `nextPC` field is used internally in maintaining the correct execution order of the instructions.
`protected int` | `pc`
`protected long` | `postedInterrupts`
`byte[]` | `regs`
`boolean` | `S`
`protected boolean` | `shouldRun` The `shouldRun` flag is used internally in the main execution runLoop to implement the correct semantics of `start()` and `stop()` to the clients.
`protected Simulator` | `simulator` The `simulator` field stores a reference to the simulator that this interpreter instance corresponds to.
`protected boolean` | `sleeping` The `sleeping` flag is used internally in the simulator when the microcontroller enters the sleep mode.
`protected byte[]` | `sram`
`protected int` | `sram_max`
`protected MulticastWatch[]` | `sram_probes`
`protected int` | `sram_start`
`protected State.IOReg` | `SREG_reg`
`boolean` | `T`
`boolean` | `V`
`boolean` | `Z`

Fields inherited from interface avrora.sim.State
`RESERVED`

Fields inherited from interface avrora.sim.IORegisterConstants
`ACSR, ADCH, ADCL, ADCSRA, ADMUX, ASSR, DDRA, DDRB, DDRC, DDRD, DDRE, DDRF, DDRG, EEARH, EEARL, EECR, EEDR, EICRA, EICRB, EIFR, EIMSK, ETIFR, ETIMSK, ICR1H, ICR1L, ICR3H, ICR3L, MCUCR, MCUCSR, NUM_REGS, OCDR, OCR0, OCR1AH, OCR1AL, OCR1BH, OCR1BL, OCR1CH, OCR1CL, OCR2, OCR3AH, OCR3AL, OCR3BH, OCR3BL, OCR3CH, OCR3CL, OSCCAL, PINA, PINB, PINC, PIND, PINE, PINF, PING, PORTA, PORTB, PORTC, PORTD, PORTE, PORTF, PORTG, RAMPZ, SFIOR, SPCR, SPDR, SPH, SPL, SPMCSR, SPSR, SREG, SREG_C, SREG_H, SREG_I, SREG_N, SREG_S, SREG_T, SREG_V, SREG_Z, TCCR0, TCCR1A, TCCR1B, TCCR1C, TCCR2, TCCR3A, TCCR3B, TCCR3C, TCNT0, TCNT1H, TCNT1L, TCNT2, TCNT3H, TCNT3L, TIFR, TIMSK, TWAR, TWBR, TWCR, TWDR, TWSR, UBRR0H, UBRR0L, UBRR1H, UBRR1L, UCSR0A, UCSR0B, UCSR0C, UCSR1A, UCSR1B, UCSR1C, UDR0, UDR1, WDTCR, XDIV, XMCRA, XMCRB`

Constructor Summary
`BaseInterpreter(Simulator simulator, Program p, int flash_size, int ioreg_size, int sram_size)`

Method Summary
`protected void` | `advanceCycles(long delta)`
`protected void` | `commit()`
`protected void` | `delay(long cycles)`
`void` | `disableInterrupts()`
`void` | `enableInterrupts()`
`Instr` | `getCurrentInstr()` The `getCurrentInstr()` method reads the instruction at the current program counter value (PC).
`long` | `getCycles()` The `getCycles()` method returns the clock cycle count recorded so far in the simulation.
`byte` | `getDataByte(int address)` The `getDataByte()` method reads a byte value from the data memory (SRAM) at the specified address.
`boolean` | `getFlag_C()` The `getFlag_C()` method returns the current value of the C bit in the status register as a boolean.
`boolean` | `getFlag_H()` The `getFlag_H()` method returns the current value of the H bit in the status register as a boolean.
`boolean` | `getFlag_I()` The `getFlag_I()` method returns the current value of the I bit in the status register as a boolean.
`boolean` | `getFlag_N()` The `getFlag_N()` method returns the current value of the N bit in the status register as a boolean.
`boolean` | `getFlag_S()` The `getFlag_S()` method returns the current value of the S bit in the status register as a boolean.
`boolean` | `getFlag_T()` The `getFlag_T()` method returns the current value of the T bit in the status register as a boolean.
`boolean` | `getFlag_V()` The `getFlag_V()` method returns the current value of the V bit in the status register as a boolean.
`boolean` | `getFlag_Z()` The `getFlag_Z()` method returns the current value of the Z bit in the status register as a boolean.
`Instr` | `getInstr(int address)` The `getInstr()` can be used to retrieve a reference to the `Instr` object representing the instruction at the specified program address.
`int` | `getInstrSize(int npc)` The `getInstrSize()` method reads the size of the instruction at the given program address.
`State.IOReg` | `getIOReg(int ioreg)` The `getIOReg()` method is used to retrieve a reference to the actual `IOReg` instance stored internally in the state.
`byte` | `getIORegisterByte(int ioreg)` The `getIORegisterByte()` method reads the value of an IO register.
`int` | `getPC()` The `getPC()` retrieves the current program counter.
`long` | `getPostedInterrupts()` The `getPostedInterrupts()` method returns a mask that represents all interrupts that are currently pending (meaning they are ready to be fired in priority order as long as the I flag is on).
`protected avrora.sim.BaseInterpreter.ProbedInstr` | `getProbedInstr(int addr)`
`byte` | `getProgramByte(int address)` The `getProgramByte()` method reads a byte value from the program (Flash) memory.
`byte` | `getRegisterByte(int reg)`
`byte` | `getRegisterByte(Register reg)` Read a general purpose register's current value as a byte.
`int` | `getRegisterUnsigned(int reg)`
`int` | `getRegisterUnsigned(Register reg)` Read a general purpose register's current value as an integer, without any sign extension.
`int` | `getRegisterWord(int reg)`
`int` | `getRegisterWord(Register reg)` Read a general purpose register pair as an unsigned word.
`int` | `getSP()` The `getSP()` method reads the current value of the stack pointer.
`byte` | `getSREG()` The `getSREG()` method reads the value of the status register.
`byte` | `getStackByte()` The `getStackByte()` method reads a byte from the address specified by SP+1.
`protected void` | `initializeIORegs()`
`protected void` | `insertBreakPoint(int addr)`
`void` | `insertProbe(Simulator.Probe p)` The `insertProbe()` method allows a probe to be inserted that is executed before and after every instruction that is executed by the simulator
`protected void` | `insertProbe(Simulator.Probe p, int addr)`
`protected void` | `insertWatch(Simulator.Watch p, int data_addr)`
`boolean` | `isSleeping()` The `isSleeping()` method returns whether the simulator is currently in a sleep mode.
`protected void` | `makeImpression(Program p)`
`protected avrora.sim.BaseInterpreter.ProbedInstr` | `makeProbedInstr(int addr)`
`byte` | `popByte()` The `popByte()` method pops a byte from the stack by reading from the address pointed to by SP+1 and incrementing the stack pointer.
`void` | `postInterrupt(int num)` The `postInterrupt()` method is generally only used within the simulator which does pre-processing of interrupts before it posts them into the internal `State` instance.
`void` | `pushByte(byte val)` The `pushByte()` method pushes a byte onto the stack by writing to the memory address pointed to by the stack pointer and decrementing the stack pointer.
`protected void` | `removeBreakPoint(int addr)`
`void` | `removeProbe(Simulator.Probe b)` The `removeProbe()` method removes a probe from the global probe table (the probes executed before and after every instruction).
`protected void` | `removeProbe(Simulator.Probe p, int addr)`
`protected void` | `removeWatch(Simulator.Watch p, int data_addr)`
`protected abstract void` | `runLoop()`
`void` | `setDataByte(int address, byte val)` The `setDataByte()` method writes a value to the data memory (SRAM) of the state.
`protected void` | `setInstr(Instr i, int address)`
`void` | `setIOReg(int ioreg, State.IOReg reg)` The `setIOReg` method installs the specified `IOReg` object to the specified IO register number.
`void` | `setIORegisterByte(int ioreg, byte val)` The `setIORegisterByte()` method writes a value to the specified IO register.
`void` | `setPostedInterrupts(long posted)`
`void` | `setRegisterByte(int reg, byte val)`
`protected void` | `setRegisterByte(Register reg, byte val)` The `setRegisterByte()` method writes a value to a general purpose register.
`void` | `setRegisterWord(int reg, int val)`
`protected void` | `setRegisterWord(Register reg, int val)` The `setRegisterWord` method writes a word value to a general purpose register pair.
`protected void` | `setSP(int val)` The `setSP()` method updates the value of the stack pointer.
`protected void` | `setSREG(byte val)` The `setSREG()` method writes the value of the status register.
`protected void` | `start()`
`void` | `stop()`
`void` | `unpostInterrupt(int num)` The `unpostInterrupt()` method is generally only used within the simulator which does pre-processing of interrupts before it posts them into the internal `State` instance.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface avrora.core.InstrVisitor
`visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit`

Field Detail

### pc

    protected int pc

### regs

    public final byte[] regs

### ioregs

    protected final State.IOReg[] ioregs

### sram

    protected byte[] sram

### sram_probes

    protected MulticastWatch[] sram_probes

### flash_instr

    protected Instr[] flash_instr

### flash_data

    protected byte[] flash_data

### postedInterrupts

    protected long postedInterrupts

### sram_start

    protected final int sram_start

### sram_max

    protected final int sram_max

### I

    public boolean I

### T

    public boolean T

### H

    public boolean H

### S

    public boolean S

### V

    public boolean V

### N

    public boolean N

### Z

    public boolean Z

### C

    public boolean C

### SREG_reg

    protected State.IOReg SREG_reg

### globalProbe

    protected final MulticastProbe globalProbe

  The `activeProbe` field stores a reference to a `MulticastProbe` that contains all of the probes to be fired before and after the main execution runLoop--i.e. before and after every instruction.

### innerLoop

    protected boolean innerLoop

  The `innerLoop` field is a boolean that is used internally in the implementation of the interpreter. When something in the simulation changes (e.g. an interrupt is posted), this field is set to false, and the execution loop (e.g. an interpretation or sleep loop) is broken out of.

### nextPC

    public int nextPC

  The `nextPC` field is used internally in maintaining the correct execution order of the instructions.

### cyclesConsumed

    public int cyclesConsumed

  The `cyclesConsumed` field stores the number of cycles consumed in doing a part of the simulation (e.g. executing an instruction or processing an interrupt).

### delayCycles

    protected long delayCycles

  The `delayCycles` field tracks the number of cycles that the microcontroller is delayed. Delay is needed because some devices pause execution of the program for some number of cycles, and also to implement random delay at the beginning of startup in multiple node scenarios to prevent artificial cycle-level synchronization.

### shouldRun

    protected boolean shouldRun

  The `shouldRun` flag is used internally in the main execution runLoop to implement the correct semantics of `start()` and `stop()` to the clients.

### sleeping

    protected boolean sleeping

  The `sleeping` flag is used internally in the simulator when the microcontroller enters the sleep mode.

### justReturnedFromInterrupt

    public boolean justReturnedFromInterrupt

  The `justReturnedFromInterrupt` field is used internally in maintaining the invariant stated in the hardware manual that at least one instruction following a return from an interrupt is executed before another interrupt can be processed.

### simulator

    protected final Simulator simulator

  The `simulator` field stores a reference to the simulator that this interpreter instance corresponds to. There should be a one-to-one mapping between instances of the `Simulator` class and instances of the `BaseInterpreter` class.

### clock

    protected final MainClock clock

Constructor Detail

### BaseInterpreter

    public BaseInterpreter(Simulator simulator,
                           Program p,
                           int flash_size,
                           int ioreg_size,
                           int sram_size)

Method Detail

### makeImpression

    protected void makeImpression(Program p)

### start

    protected void start()

### stop

    public void stop()

### runLoop

    protected abstract void runLoop()

### insertProbe

    protected void insertProbe(Simulator.Probe p,
                               int addr)

### insertProbe

    public void insertProbe(Simulator.Probe p)

  The `insertProbe()` method allows a probe to be inserted that is executed before and after every instruction that is executed by the simulator

  Parameters:
    `p` - the probe to insert

### removeProbe

    protected void removeProbe(Simulator.Probe p,
                               int addr)

### removeProbe

    public void removeProbe(Simulator.Probe b)

  The `removeProbe()` method removes a probe from the global probe table (the probes executed before and after every instruction). The comparison used is reference equality, not `.equals()`.

  Parameters:
    `b` - the probe to remove

### insertBreakPoint

    protected void insertBreakPoint(int addr)

### removeBreakPoint

    protected void removeBreakPoint(int addr)

### insertWatch

    protected void insertWatch(Simulator.Watch p,
                               int data_addr)

### removeWatch

    protected void removeWatch(Simulator.Watch p,
                               int data_addr)

### initializeIORegs

    protected void initializeIORegs()

### advanceCycles

    protected void advanceCycles(long delta)

### delay

    protected void delay(long cycles)

### getRegisterByte

    public byte getRegisterByte(int reg)

### getRegisterUnsigned

    public int getRegisterUnsigned(int reg)

### getRegisterWord

    public int getRegisterWord(int reg)

### getRegisterByte

    public byte getRegisterByte(Register reg)

  Read a general purpose register's current value as a byte.

  Specified by:
    `getRegisterByte` in interface `State`
  Parameters:
    `reg` - the register to read
  Returns:
    the current value of the register

### getRegisterUnsigned

    public int getRegisterUnsigned(Register reg)

  Read a general purpose register's current value as an integer, without any sign extension.

  Specified by:
    `getRegisterUnsigned` in interface `State`
  Parameters:
    `reg` - the register to read
  Returns:
    the current unsigned value of the register

### getRegisterWord

    public int getRegisterWord(Register reg)

  Read a general purpose register pair as an unsigned word. This method will read the value of the specified register and the value of the next register in numerical order and return the two values combined as an unsigned integer The specified register should be less than r31, because r32 (the next register) does not exist.

  Specified by:
    `getRegisterWord` in interface `State`
  Parameters:
    `reg` - the low register of the pair to read
  Returns:
    the current unsigned word value of the register pair

### setRegisterByte

    protected void setRegisterByte(Register reg,
                                   byte val)

  The `setRegisterByte()` method writes a value to a general purpose register. This is a destructive update and should only be called from the appropriate places in the simulator.

  Parameters:
    `reg` - the register to write the value to
    `val` - the value to write to the register

### setRegisterWord

    protected void setRegisterWord(Register reg,
                                   int val)

  The `setRegisterWord` method writes a word value to a general purpose register pair. This is a destructive update and should only be called from the appropriate places in the simulator. The specified register and the next register in numerical order are updated with the low-order and high-order byte of the value passed, respectively. The specified register should be less than r31, since r32 (the next register) does not exist.

  Parameters:
    `reg` - the low register of the pair to write
    `val` - the word value to write to the register pair

### setRegisterByte

    public void setRegisterByte(int reg,
                                byte val)

### setRegisterWord

    public void setRegisterWord(int reg,
                                int val)

### getSREG

    public byte getSREG()

  The `getSREG()` method reads the value of the status register. The status register contains the I, T, H, S, V, N, Z, and C flags, in order from highest-order to lowest-order.

  Specified by:
    `getSREG` in interface `State`
  Returns:
    the value of the status register as a byte.

### setSREG

    protected void setSREG(byte val)

  The `setSREG()` method writes the value of the status register. This method should only be called from the appropriate places in the simulator.

  Parameters:
    `val` -

### getDataByte

    public byte getDataByte(int address)

  The `getDataByte()` method reads a byte value from the data memory (SRAM) at the specified address.

  Specified by:
    `getDataByte` in interface `State`
  Parameters:
    `address` - the byte address to read
  Returns:
    the value of the data memory at the specified address
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - if the specified address is not the valid memory range

### getProgramByte

    public byte getProgramByte(int address)

  The `getProgramByte()` method reads a byte value from the program (Flash) memory. The flash memory generally stores read-only values and the instructions of the program. Care should be taken that the program memory at the specified address does not contain an instruction. This is because, in general, programs should not read instructions as data, and secondly, because no assembler is present in Avrora and therefore the actual byte value of an instruction may not be known.

  Specified by:
    `getProgramByte` in interface `State`
  Parameters:
    `address` - the byte address at which to read
  Returns:
    the byte value of the program memory at the specified address
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - if the specified address is not the valid program memory range

### setDataByte

    public void setDataByte(int address,
                            byte val)

  The `setDataByte()` method writes a value to the data memory (SRAM) of the state. This is generally meant for the simulator, related classes, and device implementations to use, but could also be used by debuggers and other tools.

  Parameters:
    `address` - the byte address at which to write the value
    `val` - the value to write

### getCurrentInstr

    public Instr getCurrentInstr()

  The `getCurrentInstr()` method reads the instruction at the current program counter value (PC).

  Returns:
    a reference to the `Instr` representing the instruction at the current program counter value

### getInstrSize

    public int getInstrSize(int npc)

  The `getInstrSize()` method reads the size of the instruction at the given program address. This is needed in the interpreter to compute the target of a skip instruction (an instruction that skips over the instruction following it).

  Parameters:
    `npc` - the program address of the instruction
  Returns:
    the size in bytes of the instruction at the specified program address

### getIORegisterByte

    public byte getIORegisterByte(int ioreg)

  The `getIORegisterByte()` method reads the value of an IO register. Invocation of this method causes an invocatiobn of the `.read()` method on the corresponding internal `IOReg` object, and its value returned.

  Specified by:
    `getIORegisterByte` in interface `State`
  Parameters:
    `ioreg` - the IO register number
  Returns:
    the value of the IO register

### setIOReg

    public void setIOReg(int ioreg,
                         State.IOReg reg)

  The `setIOReg` method installs the specified `IOReg` object to the specified IO register number. This method is generally only used in the simulator and in device implementations to set up the state correctly during initialization.

  Parameters:
    `ioreg` - the IO register number
    `reg` - the `IOReg`object to install``

### getIOReg

    public State.IOReg getIOReg(int ioreg)

  The `getIOReg()` method is used to retrieve a reference to the actual `IOReg` instance stored internally in the state. This is generally only used in the simulator and device implementations, and clients should probably not call this memory directly.

  Specified by:
    `getIOReg` in interface `State`
  Parameters:
    `ioreg` - the IO register number to retrieve
  Returns:
    a reference to the `IOReg` instance of the specified IO register

### setIORegisterByte

    public void setIORegisterByte(int ioreg,
                                  byte val)

  The `setIORegisterByte()` method writes a value to the specified IO register. This is generally only used internally to the simulator and device implementations, and client interfaces should probably not call this method.

  Parameters:
    `ioreg` - the IO register number to which to write the value
    `val` - the value to write to the IO register

### popByte

    public byte popByte()

  The `popByte()` method pops a byte from the stack by reading from the address pointed to by SP+1 and incrementing the stack pointer. This method, like all of the other methods that change the state, should probably only be used within the simulator. This method should not be called with an empty stack, as it will cause an exception consistent with trying to read non-existent memory.

  Returns:
    the value on the top of the stack

### pushByte

    public void pushByte(byte val)

  The `pushByte()` method pushes a byte onto the stack by writing to the memory address pointed to by the stack pointer and decrementing the stack pointer. This method, like all of the other methods that change the state, should probably only be used within the simulator.

  Parameters:
    `val` - the value to push onto the stack

### setSP

    protected void setSP(int val)

  The `setSP()` method updates the value of the stack pointer. Generally the stack pointer is stored in two IO registers `SPL` and `SPH`. This method should generally only be used within the simulator.

  Parameters:
    `val` -
  See Also:
    `IORegisterConstants`

### getCycles

    public long getCycles()

  The `getCycles()` method returns the clock cycle count recorded so far in the simulation.

  Specified by:
    `getCycles` in interface `State`
  Returns:
    the number of clock cycles elapsed in the simulation

### getPostedInterrupts

    public long getPostedInterrupts()

  The `getPostedInterrupts()` method returns a mask that represents all interrupts that are currently pending (meaning they are ready to be fired in priority order as long as the I flag is on).

  Specified by:
    `getPostedInterrupts` in interface `State`
  Returns:
    a mask representing the interrupts which are posted for processing

### getPC

    public int getPC()

  The `getPC()` retrieves the current program counter.

  Specified by:
    `getPC` in interface `State`
  Returns:
    the program counter as a byte address

### getFlag_I

    public boolean getFlag_I()

  The `getFlag_I()` method returns the current value of the I bit in the status register as a boolean.

  Specified by:
    `getFlag_I` in interface `State`
  Returns:
    the value of the flag

### getFlag_T

    public boolean getFlag_T()

  The `getFlag_T()` method returns the current value of the T bit in the status register as a boolean.

  Specified by:
    `getFlag_T` in interface `State`
  Returns:
    the value of the flag

### getFlag_H

    public boolean getFlag_H()

  The `getFlag_H()` method returns the current value of the H bit in the status register as a boolean.

  Specified by:
    `getFlag_H` in interface `State`
  Returns:
    the value of the flag

### getFlag_S

    public boolean getFlag_S()

  The `getFlag_S()` method returns the current value of the S bit in the status register as a boolean.

  Specified by:
    `getFlag_S` in interface `State`
  Returns:
    the value of the flag

### getFlag_V

    public boolean getFlag_V()

  The `getFlag_V()` method returns the current value of the V bit in the status register as a boolean.

  Specified by:
    `getFlag_V` in interface `State`
  Returns:
    the value of the flag

### getFlag_N

    public boolean getFlag_N()

  The `getFlag_N()` method returns the current value of the N bit in the status register as a boolean.

  Specified by:
    `getFlag_N` in interface `State`
  Returns:
    the value of the flag

### getFlag_Z

    public boolean getFlag_Z()

  The `getFlag_Z()` method returns the current value of the Z bit in the status register as a boolean.

  Specified by:
    `getFlag_Z` in interface `State`
  Returns:
    the value of the flag

### getFlag_C

    public boolean getFlag_C()

  The `getFlag_C()` method returns the current value of the C bit in the status register as a boolean.

  Specified by:
    `getFlag_C` in interface `State`
  Returns:
    the value of the flag

### getInstr

    public Instr getInstr(int address)

  The `getInstr()` can be used to retrieve a reference to the `Instr` object representing the instruction at the specified program address. Care should be taken that the address in program memory specified does not contain data. This is because Avrora does have a functioning disassembler and assumes that the `Instr` objects for each instruction in the program are known a priori.

  Specified by:
    `getInstr` in interface `State`
  Parameters:
    `address` - the byte address from which to read the instruction
  Returns:
    a reference to the `Instr` object representing the instruction at that address in the program

### setInstr

    protected void setInstr(Instr i,
                            int address)

### getStackByte

    public byte getStackByte()

  The `getStackByte()` method reads a byte from the address specified by SP+1. This method should not be called with an empty stack, as it will cause an exception consistent with trying to read non-existent memory.

  Specified by:
    `getStackByte` in interface `State`
  Returns:
    the value on the top of the stack

### getSP

    public int getSP()

  The `getSP()` method reads the current value of the stack pointer. Since the stack pointer is stored in two IO registers, this method will cause the invocation of the `.read()` method on each of the `IOReg` objects that store these values.

  Specified by:
    `getSP` in interface `State`
  Returns:
    the value of the stack pointer as a byte address

### isSleeping

    public boolean isSleeping()

  The `isSleeping()` method returns whether the simulator is currently in a sleep mode.

  Specified by:
    `isSleeping` in interface `State`
  Returns:
    true if the simulator is in a sleep mode; false otherwise

### unpostInterrupt

    public void unpostInterrupt(int num)

  The `unpostInterrupt()` method is generally only used within the simulator which does pre-processing of interrupts before it posts them into the internal `State` instance. This method causes the specified interrupt number to be removed from the pending list of interrupts Clients should not use this method directly.

  Parameters:
    `num` - the interrupt number to post

### setPostedInterrupts

    public void setPostedInterrupts(long posted)

### postInterrupt

    public void postInterrupt(int num)

  The `postInterrupt()` method is generally only used within the simulator which does pre-processing of interrupts before it posts them into the internal `State` instance. This method causes the specified interrupt number to be added to the pending list of interrupts Clients should not use this method directly.

  Parameters:
    `num` - the interrupt number to post

### enableInterrupts

    public void enableInterrupts()

### disableInterrupts

    public void disableInterrupts()

### getProbedInstr

    protected avrora.sim.BaseInterpreter.ProbedInstr getProbedInstr(int addr)

### makeProbedInstr

    protected avrora.sim.BaseInterpreter.ProbedInstr makeProbedInstr(int addr)

### commit

    protected void commit()

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD