Package be.lmenten.avr.core
Class CoreMemoryCell
java.lang.Object
be.lmenten.avr.core.CoreMemoryCell
- Direct Known Subclasses:
CoreData
,Instruction
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAccessListener(AccessEventListener listener)
boolean
bit(int bit)
Get the state of a single bit.void
bit(int bit, boolean state)
Set the state of a single bit.boolean
bit0()
void
bit0(boolean state)
boolean
bit1()
void
bit1(boolean state)
boolean
bit2()
void
bit2(boolean state)
boolean
bit3()
void
bit3(boolean state)
boolean
bit4()
void
bit4(boolean state)
boolean
bit5()
void
bit5(boolean state)
boolean
bit6()
void
bit6(boolean state)
boolean
bit7()
void
bit7(boolean state)
protected void
fireAccessEvent(AccessEvent event)
protected void
fireExecuteAccessEvent(long tick)
protected void
fireReadAccessEvent(int oldData)
protected void
fireWriteAccessEvent(int oldData, int newData)
int
int
int
getData()
int
Get the full mask for this memory cell.abstract int
Get the size in bits of this memory cell.int
boolean
boolean
hasData()
boolean
boolean
isDirty()
boolean
boolean
boolean
int
Get the raw cell content.void
rawSetData(int data)
Set the cell content with no further action.void
recordExecuteAccess(Core core, Instruction instruction)
void
recordReadAccess(Core core, Instruction instruction)
void
recordWriteAccess(Core core, Instruction instruction)
void
removeAccessListener(AccessEventListener listener)
void
reset()
Reset this memory cell to its default state.void
setCellAddress(int address)
void
setData(int data)
void
void
setDirty(boolean dirty)
void
setExecuteAccessRecordingEnabled(boolean enabled)
void
setReadAccessRecordingEnabled(boolean enabled)
void
setWriteAccessRecordingEnabled(boolean enabled)
int
Get this cell content but no event is fired.void
silentSetData(int data)
Set this cell content but no event is fired.void
toParsedLine(ParsedAssemblerLine parsedLine)
abstract void
toParsedLine(Core core, ParsedAssemblerLine parsedLine)
toString()
boolean
-
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
- 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
- Parameters:
core
-instruction
-
-
recordWriteAccess
- Parameters:
core
-instruction
-
-
recordExecuteAccess
- Parameters:
core
-instruction
-
-
getAccessesIterator
- Returns:
-
getAccessesCount
public int getAccessesCount()- Returns:
-
wasAccessed
public boolean wasAccessed()- Returns:
-
addAccessListener
- Parameters:
listener
-
-
removeAccessListener
- Parameters:
listener
-
-
fireAccessEvent
- 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
- Parameters:
parsedLine
-
-
toParsedLine
- Parameters:
core
-parsedLine
-
-
toString
-