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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCoreEventListener(CoreEventListener listener)
void
addSymbol(CoreMemory memory, int address, String symbol)
protected void
automaticSymbol(Instruction instruction)
void
fireCoreEvent(CoreEvent ev)
protected void
flashMemoryOverwritting(int address)
void
flushSymbols(CoreMemory memory)
abstract int
getInterruptVectorAddress(int vector)
getSymbol(CoreMemory memory, int address)
Get the symbol for an address if any exists.abstract void
abstract void
interrupt(int vector)
protected void
invalidData(Instruction data, int opcode)
protected void
invalidOpcode(Instruction instruction, int opcode)
protected void
invalidOpcode2(Instruction instruction, int opcode2)
abstract void
ioDebugRegisterDirty(boolean ioDebugRegisterDirty)
abstract void
loadEeprom(File ihexFilename)
abstract void
abstract void
loadProgram(Consumer<Instruction[]> loader)
Deprecated.abstract void
abstract long
millisToTicks(double time)
abstract int
pop()
Pop a value from stack.abstract void
void
programDump(BiConsumer<Integer,Instruction> consumer)
Deprecated.abstract void
push(int value)
Push a value onto stack.abstract void
protected void
registerDriver(Driver driver)
void
removeCoreEventListener(CoreEventListener listener)
void
removeSymbol(CoreMemory memory, int address)
abstract void
reset(ResetSources resetSource)
protected void
Propagate a reset of the core to the registered drivers.abstract void
run()
Run the program until a breakpoint or an interrupting event.abstract void
setCoreMode(RunningMode coreMode)
abstract void
setIndexRegisterValue(IRegisterIndex r, int value, boolean ext)
Set the value of the X, Y or Z index registerabstract void
setInstructionIndexRegisterValue(int value, boolean ext)
Set the value of the instruction index register value.abstract void
setProgramCounter(int address)
abstract void
setStackPointer(int address)
Set the value of the stack register.abstract void
abstract void
step()
Execute a single instruction.abstract void
stepOut()
Execute until execution of a RET/RETI instruction.abstract void
stepOver()
Execute until program counter is equal to next instruction address.protected void
Propagate the clock signal to the registered drivers.abstract double
ticksToMillis(long ticks)
protected void
unsupportedInstruction(InstructionSet entry)
protected void
unsupportedInstruction(InstructionSet entry, Instruction instruction)
abstract void
updateClockCyclesCounter(long clockCyclesCount)
abstract void
updateProgramCounter(int offset)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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)
-