Class CoreMemoryCell

java.lang.Object
be.lmenten.avr.core.CoreMemoryCell
Direct Known Subclasses:
CoreData, Instruction

public abstract class CoreMemoryCell extends Object

The root of any data or instruction held in one of the memories of an Avr MCU.

Features:

  • dirty status
  • list of accesses
  • access events
  • bit level manipulation
Since:
1.0
Author:
Laurent Menten
  • Constructor Details

    • CoreMemoryCell

      public CoreMemoryCell(int address, int data)
      Parameters:
      address -
      data -
    • CoreMemoryCell

      public CoreMemoryCell(int address)
      Parameters:
      address -
    • CoreMemoryCell

      public CoreMemoryCell()
  • Method Details

    • reset

      public void reset()
      Reset this memory cell to its default state.
    • getDataWidth

      public abstract int getDataWidth()
      Get the size in bits of this memory cell.
      • 8 for data
      • 16 for code
      Returns:
    • getDataMask

      public final int getDataMask()
      Get the full mask for this memory cell.
      • The mask is 0b1111_1111 (0xFF) for data
      • The mask is 0b1111_1111_1111_1111 (0xFFFF) for code
      Returns:
    • hasCellAddress

      public boolean hasCellAddress()
      Returns:
    • setCellAddress

      public void setCellAddress(int address)
      Parameters:
      address -
    • getCellAddress

      public int getCellAddress()
      Returns:
    • hasInitialData

      public boolean hasInitialData()
      Returns:
    • getInitialData

      public int getInitialData()
      Returns:
    • hasData

      public boolean hasData()
      Returns:
    • setData

      public void setData(Value value)
      Parameters:
      value -
    • setData

      public void setData(int data)
      Parameters:
      data -
    • getData

      public int getData()
      Returns:
    • silentSetData

      public void silentSetData(int data)
      Set this cell content but no event is fired. The dirty status is updated.
      Parameters:
      data -
    • silentGetData

      public int silentGetData()

      Get this cell content but no event is fired.

      Returns:
    • rawSetData

      public void rawSetData(int data)
      Set the cell content with no further action. No event is fired and the dirty status is not updated.
      Parameters:
      data -
    • rawGetData

      public int rawGetData()
      Get the raw cell content. No event is fired and the data is return as-is.
      Returns:
    • isDirty

      public boolean isDirty()
      Returns:
    • setDirty

      public void setDirty(boolean dirty)
      Parameters:
      dirty -
    • setReadAccessRecordingEnabled

      public void setReadAccessRecordingEnabled(boolean enabled)
      Parameters:
      enabled -
    • setWriteAccessRecordingEnabled

      public void setWriteAccessRecordingEnabled(boolean enabled)
      Parameters:
      enabled -
    • setExecuteAccessRecordingEnabled

      public void setExecuteAccessRecordingEnabled(boolean enabled)
      Parameters:
      enabled -
    • isReadAccessRecordingEnabled

      public boolean isReadAccessRecordingEnabled()
      Returns:
    • isWriteAccessRecordingEnabled

      public boolean isWriteAccessRecordingEnabled()
      Returns:
    • isExecuteAccessRecordingEnabled

      public boolean isExecuteAccessRecordingEnabled()
      Returns:
    • recordReadAccess

      public void recordReadAccess(Core core, Instruction instruction)
      Parameters:
      core -
      instruction -
    • recordWriteAccess

      public void recordWriteAccess(Core core, Instruction instruction)
      Parameters:
      core -
      instruction -
    • recordExecuteAccess

      public void recordExecuteAccess(Core core, Instruction instruction)
      Parameters:
      core -
      instruction -
    • getAccessesIterator

      public ListIterator<Access> getAccessesIterator()
      Returns:
    • getAccessesCount

      public int getAccessesCount()
      Returns:
    • wasAccessed

      public boolean wasAccessed()
      Returns:
    • addAccessListener

      public void addAccessListener(AccessEventListener listener)
      Parameters:
      listener -
    • removeAccessListener

      public void removeAccessListener(AccessEventListener listener)
      Parameters:
      listener -
    • fireAccessEvent

      protected void fireAccessEvent(AccessEvent event)
      Parameters:
      event -
    • fireReadAccessEvent

      protected void fireReadAccessEvent(int oldData)
      Parameters:
      oldData -
    • fireWriteAccessEvent

      protected void fireWriteAccessEvent(int oldData, int newData)
      Parameters:
      oldData -
      newData -
    • fireExecuteAccessEvent

      protected void fireExecuteAccessEvent(long tick)
    • bit

      public boolean bit(int bit)
      Get the state of a single bit.
      Parameters:
      bit -
      Returns:
    • bit0

      public boolean bit0()
    • bit1

      public boolean bit1()
    • bit2

      public boolean bit2()
    • bit3

      public boolean bit3()
    • bit4

      public boolean bit4()
    • bit5

      public boolean bit5()
    • bit6

      public boolean bit6()
    • bit7

      public boolean bit7()
    • bit

      public void bit(int bit, boolean state)
      Set the state of a single bit.
      Parameters:
      bit -
      state -
    • bit0

      public void bit0(boolean state)
    • bit1

      public void bit1(boolean state)
    • bit2

      public void bit2(boolean state)
    • bit3

      public void bit3(boolean state)
    • bit4

      public void bit4(boolean state)
    • bit5

      public void bit5(boolean state)
    • bit6

      public void bit6(boolean state)
    • bit7

      public void bit7(boolean state)
    • toParsedLine

      public final void toParsedLine(ParsedAssemblerLine parsedLine)
      Parameters:
      parsedLine -
    • toParsedLine

      public abstract void toParsedLine(Core core, ParsedAssemblerLine parsedLine)
      Parameters:
      core -
      parsedLine -
    • toString

      public String toString()
      Overrides:
      toString in class Object