riscemu.registers module

RiscEmu (c) 2023 Anton Lydike

SPDX-License-Identifier: MIT

class riscemu.registers.Registers(infinite_regs: bool = False)

Bases: object

Represents a bunch of registers

valid_regs = {'a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'fp', 'gp', 'ra', 's0', 's1', 's10', 's11', 's2', 's3', 's4', 's5', 's6', 's7', 's8', 's9', 'sp', 't0', 't1', 't2', 't3', 't4', 't5', 't6', 'tp', 'zero'}
float_regs = {'fa0', 'fa1', 'fa2', 'fa3', 'fa4', 'fa5', 'fa6', 'fa7', 'fs0', 'fs1', 'fs10', 'fs11', 'fs2', 'fs3', 'fs4', 'fs5', 'fs6', 'fs7', 'fs8', 'fs9', 'ft0', 'ft1', 'ft2', 'ft3', 'ft4', 'ft5', 'ft6', 'ft7'}
__init__(infinite_regs: bool = False)
dump(full: bool = False)

Dump all registers to stdout :param full: If True, floating point registers are dumped too

dump_reg_a()

Dump the a registers

set(reg: str, val: Int32, mark_set: bool = True) bool

Set a register content to val :param reg: The register to set :param val: The new value :param mark_set: If True, marks this register as “last accessed” (only used internally) :return: If the operation was successful

get(reg: str, mark_read: bool = True) Int32

Retuns the contents of register reg :param reg: The register name :param mark_read: If the register should be markes as “last read” (only used internally) :return: The contents of register reg

get_f(reg: str, mark_read: bool = True) Float32
set_f(reg: str, val: Union[float, Float32])
static named_registers()

Return all named registers :return: The list