Skip to content

Riscv debug

riscv_debug

RiscvDebugFunctions dataclass

Bases: InterpreterFunctions

Source code in xdsl/interpreters/riscv_debug.py
@dataclass
@register_impls
class RiscvDebugFunctions(InterpreterFunctions):
    @impl(riscv_debug.PrintfOp)
    def run_printf(
        self,
        interpreter: Interpreter,
        op: riscv_debug.PrintfOp,
        args: tuple[Any, ...],
    ):
        args = RiscvFunctions.get_reg_values(interpreter, op.operands, args)
        args = tuple(
            arg.value.data if isa(arg, IntegerAttr | FloatAttr) else arg for arg in args
        )
        print(op.format_str.data.format(*args), end="", file=interpreter.file)
        return ()

__init__() -> None

run_printf(interpreter: Interpreter, op: riscv_debug.PrintfOp, args: tuple[Any, ...])

Source code in xdsl/interpreters/riscv_debug.py
@impl(riscv_debug.PrintfOp)
def run_printf(
    self,
    interpreter: Interpreter,
    op: riscv_debug.PrintfOp,
    args: tuple[Any, ...],
):
    args = RiscvFunctions.get_reg_values(interpreter, op.operands, args)
    args = tuple(
        arg.value.data if isa(arg, IntegerAttr | FloatAttr) else arg for arg in args
    )
    print(op.format_str.data.format(*args), end="", file=interpreter.file)
    return ()