|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
The State class represents the state of the simulator, including
the contents of registers and memory.
| Nested Class Summary | |
static interface |
State.IOReg
The IOReg interface models the behavior of an IO register.
|
static class |
State.RWIOReg
The RWIOReg class is an implementation of an IO register
that has the simple, default behavior of being able to read and write
just as a general purpose register or byte in SRAM. |
| Field Summary | |
static State.IOReg |
RESERVED
The RESERVED field of the state class represents an instance
of the IOReg interface that will not allow any writes to
this register to occur. |
| 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 |
| Method Summary | |
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. |
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). |
byte |
getProgramByte(int address)
The getProgramByte() method reads a byte value from
the program (Flash) memory. |
byte |
getRegisterByte(Register reg)
Read a general purpose register's current value as a byte. |
int |
getRegisterUnsigned(Register reg)
Read a general purpose register's current value as an integer, without any sign extension. |
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. |
boolean |
isSleeping()
The isSleeping() method returns whether the simulator is currently
in a sleep mode. |
| Field Detail |
public static final State.IOReg RESERVED
RESERVED field of the state class represents an instance
of the IOReg interface that will not allow any writes to
this register to occur. These reserved IO registers are specified in the
hardware manuals.
| Method Detail |
public long getPostedInterrupts()
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).
public byte getRegisterByte(Register reg)
reg - the register to read
public int getRegisterUnsigned(Register reg)
reg - the register to read
public int getRegisterWord(Register reg)
reg - the low register of the pair to read
public byte getSREG()
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.
public boolean getFlag_I()
getFlag_I() method returns the current value of the I bit
in the status register as a boolean.
public boolean getFlag_T()
getFlag_T() method returns the current value of the T bit
in the status register as a boolean.
public boolean getFlag_H()
getFlag_H() method returns the current value of the H bit
in the status register as a boolean.
public boolean getFlag_S()
getFlag_S() method returns the current value of the S bit
in the status register as a boolean.
public boolean getFlag_V()
getFlag_V() method returns the current value of the V bit
in the status register as a boolean.
public boolean getFlag_N()
getFlag_N() method returns the current value of the N bit
in the status register as a boolean.
public boolean getFlag_Z()
getFlag_Z() method returns the current value of the Z bit
in the status register as a boolean.
public boolean getFlag_C()
getFlag_C() method returns the current value of the C bit
in the status register as a boolean.
public byte getStackByte()
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.
public int getSP()
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.
public int getPC()
getPC() retrieves the current program counter.
public Instr getInstr(int address)
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.
address - the byte address from which to read the instruction
Instr object representing the instruction
at that address in the programpublic byte getDataByte(int address)
getDataByte() method reads a byte value from the data memory
(SRAM) at the specified address.
address - the byte address to read
java.lang.ArrayIndexOutOfBoundsException - if the specified address is not the valid
memory rangepublic byte getProgramByte(int address)
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.
address - the byte address at which to read
java.lang.ArrayIndexOutOfBoundsException - if the specified address is not the valid
program memory rangepublic byte getIORegisterByte(int ioreg)
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.
ioreg - the IO register number
public State.IOReg getIOReg(int ioreg)
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.
ioreg - the IO register number to retrieve
IOReg instance of the specified IO registerpublic long getCycles()
getCycles() method returns the clock cycle count recorded
so far in the simulation.
public boolean isSleeping()
isSleeping() method returns whether the simulator is currently
in a sleep mode.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||