riscemu.CPU module¶
RiscEmu (c) 2021 Anton Lydike
SPDX-License-Identifier: MIT
This file contains the CPU logic (not the individual instruction sets). See instructions/InstructionSet.py for more info on them.
-
class
riscemu.CPU.
CPU
(conf: riscemu.Config.RunConfig, instruction_sets: List[Type[riscemu.instructions.InstructionSet.InstructionSet]])¶ Bases:
object
This class represents a single CPU. It holds references to it’s mmu, registers and syscall interrupt handler.
It is initialized with a configuration and a list of instruction sets.
-
__init__
(conf: riscemu.Config.RunConfig, instruction_sets: List[Type[riscemu.instructions.InstructionSet.InstructionSet]])¶ Creates a CPU instance.
- Parameters
conf – An instance of the current RunConfiguration
instruction_sets – A list of instruction set classes. These must inherit from the InstructionSet class
-
get_tokenizer
(tokenizer_input)¶ Returns a tokenizer that respects the language of the CPU
- Parameters
tokenizer_input – an instance of the RiscVTokenizerInput class
-
load
(e: riscemu.Executable.Executable)¶ Load an executable into Memory
-
run_loaded
(le: riscemu.Executable.LoadedExecutable)¶ Run a loaded executable
-
continue_from_debugger
(verbose=True)¶ called from the debugger to continue running
- Parameters
verbose – If True, will print each executed instruction to STDOUT
-
step
()¶ Execute a single instruction, then return.
-
run_instruction
(ins: LoadedInstruction)¶ Execute a single instruction
- Parameters
ins – The instruction to execute
-
all_instructions
() → List[str]¶ Return a list of all instructions this CPU can execute.
-