avrora.stack
Class MutableState

java.lang.Object
  extended byavrora.stack.AbstractState
      extended byavrora.stack.MutableState
All Implemented Interfaces:
IORegisterConstants

public class MutableState
extends AbstractState
implements IORegisterConstants

The MutableState class represents an abstract state of the processor that is mutable. This is used in computation of next states, but is not used in the state space.

See Also:
AbstractArithmetic, StateCache

Field Summary
 
Fields inherited from class avrora.stack.AbstractState
av_EIMSK, av_REGISTERS, av_SREG, av_TIMSK, pc, primes
 
Fields inherited from interface avrora.stack.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
MutableState()
          The constructor of the MutableState class builds the default values of each of the registers and each IO register that is being modelled.
MutableState(int npc, char nSREG, char nEIMSK, char nTIMSK, char[] nregs)
           
 
Method Summary
 boolean equals(java.lang.Object o)
          The equals() method implements the standard java.lang.Object equality testing contract.
 int hashCode()
          The hashCode() method computes an integer hash code for this state.
 MutableState merge(MutableState s)
          The merge() method merges this abstract state with another abstract state and returns a new copy.
 void setFlag_C(char val)
          The setFlag_C() method updates the abstract value of the C flag.
 void setFlag_H(char val)
          The setFlag_H() method updates the abstract value of the H flag.
 void setFlag_I(char val)
          The setFlag_I() method updates the abstract value of the I flag.
 void setFlag_N(char val)
          The setFlag_N() method updates the abstract value of the N flag.
 void setFlag_S(char val)
          The setFlag_S() method updates the abstract value of the S flag.
 void setFlag_T(char val)
          The setFlag_T() method updates the abstract value of the T flag.
 void setFlag_V(char val)
          The setFlag_V() method updates the abstract value of the V flag.
 void setFlag_Z(char val)
          The setFlag_Z() method updates the abstract value of the Z flag.
 void setIORegisterAV(int num, char val)
          The setIORegisterAV() method writes the abstract value of an IO register.
 void setPC(int npc)
          The setPC() method updates the concrete value of the program counter.
 void setRegisterAV(Register r, char val)
          The setRegisterAV() method writes the abstract value of a register in the abstract state
 void setSREG_bit(int bit, char val)
          The writeSREG method updates one bit of the abstract value of the status register.
 void writeSREG(char val)
          The writeSREG method updates the abstract value of the status register.
 
Methods inherited from class avrora.stack.AbstractState
computeHashCode, copy, deepCompare, getFlag_C, getFlag_H, getFlag_I, getFlag_N, getFlag_S, getFlag_T, getFlag_V, getFlag_Z, getIORegisterAV, getPC, getRegisterAV, getRegisterAV, getSREG, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MutableState

public MutableState()
The constructor of the MutableState class builds the default values of each of the registers and each IO register that is being modelled. The default is that all registers are known zero, all IO registers are known zero, and the program counter is zero.


MutableState

public MutableState(int npc,
                    char nSREG,
                    char nEIMSK,
                    char nTIMSK,
                    char[] nregs)
Method Detail

merge

public MutableState merge(MutableState s)
The merge() method merges this abstract state with another abstract state and returns a new copy. This abstract state is not updated. The operation is a simple pointwise merging operation: each value is merged with its corresponding abstract value in the other abstract state.

Parameters:
s - the abstract state to merge with
Returns:
a new abstract state that represents the merged abstract states
See Also:
AbstractArithmetic

hashCode

public int hashCode()
The hashCode() method computes an integer hash code for this state. A good hash code is needed to make hashtables in StateSpace efficient.

Specified by:
hashCode in class AbstractState
Throws:
Avrora.InternalError

equals

public boolean equals(java.lang.Object o)
The equals() method implements the standard java.lang.Object equality testing contract.

Specified by:
equals in class AbstractState
Parameters:
o - the object to test equality against.
Throws:
Avrora.InternalError

setPC

public void setPC(int npc)
The setPC() method updates the concrete value of the program counter. The program counter is known in ever abstract state.

Parameters:
npc - the new concrete value of the program counter

writeSREG

public void writeSREG(char val)
The writeSREG method updates the abstract value of the status register.

Parameters:
val - the new abstract value to write to the status register.

setSREG_bit

public void setSREG_bit(int bit,
                        char val)
The writeSREG method updates one bit of the abstract value of the status register.

Parameters:
val - the new abstract value of the bit

setFlag_I

public void setFlag_I(char val)
The setFlag_I() method updates the abstract value of the I flag.

Parameters:
val - the new abstract bit of the flag

setFlag_T

public void setFlag_T(char val)
The setFlag_T() method updates the abstract value of the T flag.

Parameters:
val - the new abstract bit of the flag

setFlag_H

public void setFlag_H(char val)
The setFlag_H() method updates the abstract value of the H flag.

Parameters:
val - the new abstract bit of the flag

setFlag_S

public void setFlag_S(char val)
The setFlag_S() method updates the abstract value of the S flag.

Parameters:
val - the new abstract bit of the flag

setFlag_V

public void setFlag_V(char val)
The setFlag_V() method updates the abstract value of the V flag.

Parameters:
val - the new abstract bit of the flag

setFlag_N

public void setFlag_N(char val)
The setFlag_N() method updates the abstract value of the N flag.

Parameters:
val - the new abstract bit of the flag

setFlag_Z

public void setFlag_Z(char val)
The setFlag_Z() method updates the abstract value of the Z flag.

Parameters:
val - the new abstract bit of the flag

setFlag_C

public void setFlag_C(char val)
The setFlag_C() method updates the abstract value of the C flag.

Parameters:
val - the new abstract bit of the flag

setIORegisterAV

public void setIORegisterAV(int num,
                            char val)
The setIORegisterAV() method writes the abstract value of an IO register. If the register is being modelled, then its value will be updated. Otherwise, the write will be ignored.

Parameters:
num - the IO register number to be updated
val - the new abstract value of the IO register

setRegisterAV

public void setRegisterAV(Register r,
                          char val)
The setRegisterAV() method writes the abstract value of a register in the abstract state

Parameters:
r - the register to write
val - the new abstract value of the register