Package be.lmenten.avr.core
Class Core
java.lang.Object
be.lmenten.avr.core.Core
- All Implemented Interfaces:
CoreModel
Core is the user interface of the core. It exposes the setters and
control methods of the core. There are also all the methods not
directly related to simulation.
- Since:
- 1.0 - 2021 / 08 / 23
- Version:
- 1.0
- Author:
- Laurent Menten
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCoreEventListener(CoreEventListener listener)voidaddSymbol(CoreMemory memory, int address, String symbol)protected voidautomaticSymbol(Instruction instruction)voidfireCoreEvent(CoreEvent ev)protected voidflashMemoryOverwritting(int address)voidflushSymbols(CoreMemory memory)abstract intgetInterruptVectorAddress(int vector)getSymbol(CoreMemory memory, int address)Get the symbol for an address if any exists.abstract voidabstract voidinterrupt(int vector)protected voidinvalidData(Instruction data, int opcode)protected voidinvalidOpcode(Instruction instruction, int opcode)protected voidinvalidOpcode2(Instruction instruction, int opcode2)abstract voidioDebugRegisterDirty(boolean ioDebugRegisterDirty)abstract voidloadEeprom(File ihexFilename)abstract voidabstract voidloadProgram(Consumer<Instruction[]> loader)Deprecated.abstract voidabstract longmillisToTicks(double time)abstract intpop()Pop a value from stack.abstract voidvoidprogramDump(BiConsumer<Integer,Instruction> consumer)Deprecated.abstract voidpush(int value)Push a value onto stack.abstract voidprotected voidregisterDriver(Driver driver)voidremoveCoreEventListener(CoreEventListener listener)voidremoveSymbol(CoreMemory memory, int address)abstract voidreset(ResetSources resetSource)protected voidPropagate a reset of the core to the registered drivers.abstract voidrun()Run the program until a breakpoint or an interrupting event.abstract voidsetCoreMode(RunningMode coreMode)abstract voidsetIndexRegisterValue(IRegisterIndex r, int value, boolean ext)Set the value of the X, Y or Z index registerabstract voidsetInstructionIndexRegisterValue(int value, boolean ext)Set the value of the instruction index register value.abstract voidsetProgramCounter(int address)abstract voidsetStackPointer(int address)Set the value of the stack register.abstract voidabstract voidstep()Execute a single instruction.abstract voidstepOut()Execute until execution of a RET/RETI instruction.abstract voidstepOver()Execute until program counter is equal to next instruction address.protected voidPropagate the clock signal to the registered drivers.abstract doubleticksToMillis(long ticks)protected voidunsupportedInstruction(InstructionSet entry)protected voidunsupportedInstruction(InstructionSet entry, Instruction instruction)abstract voidupdateClockCyclesCounter(long clockCyclesCount)abstract voidupdateProgramCounter(int offset)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface be.lmenten.avr.core.CoreModel
getApplicationSectionBase, getApplicationSectionSize, getBootLoaderSectionBase, getBootLoaderSectionSize, getClockCyclesCounter, getCoreMode, getCurrentInstruction, getDefaultConfig, getDescriptor, getEepromCell, getExternalSramSize, getFlashCell, getFollowingInstruction, getFuseByte, getIndexRegisterValue, getInstructionIndexRegisterValue, getInterruptCount, getInterruptsCount, getIORegisterByAddress, getIORegisterByPhysicalAddress, getLockBits, getProgramCounter, getRegister, getRegister, getRegister, getSramCell, getStackPointer, getStatusRegisterCopy, ioDebugRegisterDirty, supportsBootLoaderSection, supportsExternalMemoryFeature, supportsInstruction
-
Field Details
-
flash
-
sram
-
eeprom
-
-
Constructor Details
-
Core
protected Core()
-
-
Method Details
-
registerDriver
- Parameters:
driver-
-
resetDrivers
protected void resetDrivers()Propagate a reset of the core to the registered drivers. -
tickDrivers
protected void tickDrivers()Propagate the clock signal to the registered drivers.
Note: this is called after every simulation of an instruction.
-
setStatusRegister
- Parameters:
sreg-
-
step
public abstract void step()Execute a single instruction. -
stepOver
public abstract void stepOver()Execute until program counter is equal to next instruction address.
This is typically used to step over a CALL/ICALL/EICALL/RCALL instruction.
-
stepOut
public abstract void stepOut()Execute until execution of a RET/RETI instruction. -
run
public abstract void run()Run the program until a breakpoint or an interrupting event. -
setProgramCounter
public abstract void setProgramCounter(int address)- Parameters:
address-
-
updateProgramCounter
public abstract void updateProgramCounter(int offset)- Parameters:
offset-
-
pushProgramCounter
public abstract void pushProgramCounter() -
popProgramCounter
public abstract void popProgramCounter() -
setCoreMode
- Parameters:
coreMode-
-
reset
- Parameters:
resetSource-
-
getInterruptVectorAddress
public abstract int getInterruptVectorAddress(int vector)- Parameters:
vector-- Returns:
-
interrupt
public abstract void interrupt(int vector)- Parameters:
vector-
-
updateClockCyclesCounter
public abstract void updateClockCyclesCounter(long clockCyclesCount)- Parameters:
clockCyclesCount-
-
millisToTicks
public abstract long millisToTicks(double time)- Parameters:
time-- Returns:
-
ticksToMillis
public abstract double ticksToMillis(long ticks)- Parameters:
ticks-- Returns:
-
ioDebugRegisterDirty
public abstract void ioDebugRegisterDirty(boolean ioDebugRegisterDirty)- Parameters:
ioDebugRegisterDirty-
-
setIndexRegisterValue
Set the value of the X, Y or Z index register- Parameters:
r- the index registervalue- the valueext- true for extended register
-
setInstructionIndexRegisterValue
public abstract void setInstructionIndexRegisterValue(int value, boolean ext)Set the value of the instruction index register value.- Parameters:
value- the valueext- this for extended register
-
setStackPointer
public abstract void setStackPointer(int address)Set the value of the stack register. This method abstracts differences among devices.- Parameters:
address- the stack pointer value
-
push
public abstract void push(int value)Push a value onto stack.- Parameters:
value- the value
-
pop
public abstract int pop()Pop a value from stack.- Returns:
- the value
-
installFakeBootLoader
public abstract void installFakeBootLoader() -
loadFlash
- Throws:
IOException
-
loadSram
- Throws:
IOException
-
loadEeprom
- Throws:
IOException
-
loadProgram
Deprecated.Load a program using a user supplied method. Use this for debugging purpose only.!!! NO SUPPORT !!!
- Parameters:
loader- the loader
-
programDump
Deprecated. -
automaticSymbol
-
getSymbol
Get the symbol for an address if any exists. -
addSymbol
- Parameters:
memory-address-symbol-
-
removeSymbol
- Parameters:
memory-address-
-
flushSymbols
- Parameters:
memory-
-
addCoreEventListener
-
removeCoreEventListener
-
fireCoreEvent
-
unsupportedInstruction
-
unsupportedInstruction
-
invalidOpcode
-
invalidOpcode2
-
invalidData
-
flashMemoryOverwritting
protected void flashMemoryOverwritting(int address)
-