Class Core

java.lang.Object
be.lmenten.avr.core.Core
All Implemented Interfaces:
CoreModel

public abstract class Core extends Object implements 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 Details

  • Constructor Details

    • Core

      protected Core()
  • Method Details

    • registerDriver

      protected void registerDriver(Driver driver)
      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

      public abstract void setStatusRegister(CoreStatusRegister sreg)
      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

      public abstract void setCoreMode(RunningMode coreMode)
      Parameters:
      coreMode -
    • reset

      public abstract void reset(ResetSources resetSource)
      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

      public abstract void setIndexRegisterValue(IRegisterIndex r, int value, boolean ext)
      Set the value of the X, Y or Z index register
      Parameters:
      r - the index register
      value - the value
      ext - 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 value
      ext - 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

      public abstract void loadFlash(File ihexFilename) throws IOException
      Throws:
      IOException
    • loadSram

      public abstract void loadSram(File ihexFilename) throws IOException
      Throws:
      IOException
    • loadEeprom

      public abstract void loadEeprom(File ihexFilename) throws IOException
      Throws:
      IOException
    • loadProgram

      @Deprecated public abstract void loadProgram(Consumer<Instruction[]> loader)
      Deprecated.
      Load a program using a user supplied method. Use this for debugging purpose only.

      !!! NO SUPPORT !!!

      Parameters:
      loader - the loader
    • programDump

      @Deprecated public void programDump(BiConsumer<Integer,​Instruction> consumer)
      Deprecated.
    • automaticSymbol

      protected void automaticSymbol(Instruction instruction)
    • getSymbol

      public String getSymbol(CoreMemory memory, int address)
      Get the symbol for an address if any exists.
      Specified by:
      getSymbol in interface CoreModel
      Parameters:
      memory - the memory zone
      address - the address
      Returns:
      the symbol or null
    • addSymbol

      public void addSymbol(CoreMemory memory, int address, String symbol)
      Parameters:
      memory -
      address -
      symbol -
    • removeSymbol

      public void removeSymbol(CoreMemory memory, int address)
      Parameters:
      memory -
      address -
    • flushSymbols

      public void flushSymbols(CoreMemory memory)
      Parameters:
      memory -
    • addCoreEventListener

      public void addCoreEventListener(CoreEventListener listener)
    • removeCoreEventListener

      public void removeCoreEventListener(CoreEventListener listener)
    • fireCoreEvent

      public void fireCoreEvent(CoreEvent ev)
    • unsupportedInstruction

      protected void unsupportedInstruction(InstructionSet entry)
    • unsupportedInstruction

      protected void unsupportedInstruction(InstructionSet entry, Instruction instruction)
    • invalidOpcode

      protected void invalidOpcode(Instruction instruction, int opcode)
    • invalidOpcode2

      protected void invalidOpcode2(Instruction instruction, int opcode2)
    • invalidData

      protected void invalidData(Instruction data, int opcode)
    • flashMemoryOverwritting

      protected void flashMemoryOverwritting(int address)