Comment by sylware

4 months ago

I am coding my own wayland compositor, in rv64 assembly... running on x86_64 with a small interpreter.

I am currently only using the core ISA (no compressed instructions, not even the pseudo instructions), and I use a C preprocessor to avoid to get my code locked on the preprocessor of one assembler.

I started to code assembly when I was a teenager as it is not hard: only uncomfortable. Nowdays, with what seems a real global, no IP locks, ISA, RISC-V, it is very reasonable to write directly assembly, as (real and sane) standard assembly is extremely efficient at fighting planned obsolecence.

How did you validate correctness of your interpreter?

  • I have been using only basic RISC-V core machine instructions: the interpreter is beyond stupid, I did write it directly in x86_64 assembly.

    • Oh ok. I have been trying to write emulator and validating if instruction is correctly implemented in my code has been biggest pain point for me as I have no idea to get reference in something like instruction - opcode - context before execution - context after execution.

      Only thing which I have come up with is just step through the instructions on the MCU using compiled output from yarpgen, but problem here is that it wont generate code variable enough to test all the instructions, so there are going to be blind spots like i.e. float divisions, SIMD instructions etc.

      https://github.com/intel/yarpgen