avrora.sim.mcu
Class ReprogrammableCodeSegment

java.lang.Object
  extended byavrora.sim.Segment
      extended byavrora.sim.CodeSegment
          extended byavrora.sim.mcu.ReprogrammableCodeSegment

public class ReprogrammableCodeSegment
extends CodeSegment

The ReprogrammableCodeSegment class represents a flash segment that stores code. This segment can be updated during execution. It supports probing instructions in the flash segment and updating them. This implementation uses special instructions that automatically disassemble themselves from the machine code representation when they are accessed, allowing dynamic update and execution of machine code.


Nested Class Summary
 class ReprogrammableCodeSegment.DisassembleInstr
          The DisasssembleInstr class represents an instruction that is used by the interpreter to support dynamic code update.
static class ReprogrammableCodeSegment.Factory
          The ReprogrammableCodeSegment.Factory class represents a class capable of creating a new code segment for a new interpreter.
 
Nested classes inherited from class avrora.sim.CodeSegment
CodeSegment.CodeSharer, CodeSegment.DefaultFactory, CodeSegment.ProbedInstr
 
Nested classes inherited from class avrora.sim.Segment
Segment.AddressOutOfBoundsException, Segment.ErrorReporter, Segment.Sharer
 
Field Summary
 
Fields inherited from class avrora.sim.CodeSegment
codeSharer, MISALIGNED_INSTR, NO_INSTR, segment_instr
 
Fields inherited from class avrora.sim.Segment
errorReporter, interpreter, name, segment_data, segment_watches, sharer, size, value
 
Constructor Summary
ReprogrammableCodeSegment(java.lang.String name, int size, BaseInterpreter bi, Segment.ErrorReporter er, int pagesize)
          The constructor for the ReprogrammableCodeSegment creates a new instance with the specified name, with the specified size, connected to the specified microcontroller, with the given page size.
 
Method Summary
protected  void resetBuffer()
          The resetBuffer() method resets the temporary buffer used for the SPM instruction to its default value.
 void update()
          The update() method is called by the interpreter when the program executes an instruction that updates the program memory.
 
Methods inherited from class avrora.sim.CodeSegment
getInstr, insertProbe, load, readInstr, removeProbe, replaceInstr, shareCode, writeInstr
 
Methods inherited from class avrora.sim.Segment
get, insertWatch, read, removeWatch, set, share, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReprogrammableCodeSegment

public ReprogrammableCodeSegment(java.lang.String name,
                                 int size,
                                 BaseInterpreter bi,
                                 Segment.ErrorReporter er,
                                 int pagesize)
The constructor for the ReprogrammableCodeSegment creates a new instance with the specified name, with the specified size, connected to the specified microcontroller, with the given page size.

Parameters:
name - the name of the segment as a string
size - the size of the segment in bytes
bi - the the interpreter the code segment is attached to
er - the error reporter consulted for out of bounds accesses
pagesize - the size of the page offset field of an address into the flash
Method Detail

update

public void update()
The update() method is called by the interpreter when the program executes an instruction that updates the program memory. For example, the SPM instruction.

Overrides:
update in class CodeSegment

resetBuffer

protected void resetBuffer()
The resetBuffer() method resets the temporary buffer used for the SPM instruction to its default value.