m. taujanskas

-

> RISC-V to x86{-64} transpilation programming notes

Architectural notes

R-type contains fundamental fields which exist at their position in each subsequent format, unless replaced with an immediate specifier. The immediate specifiers (such as imm[19:12]) appear scrambled, but their indices correlate with similar indications in prior, i.e. J-type's imm[10:1] is contained within I-type's imm[11:0], and similarly for other types except the U-type format, which represents the upper half of an immediate. Keep in mind this is a hardware-level optimisation to minimise fan-out, as it preserves the ability to carry-through logic lines (?) across different formats since they share fields at the same positions. Same reasoning applied to the fundamental rd/rs*/etc. fields. - XLEN refers to the integer register width (either 32 or 64 bits,) unrelated to word size, which is 32 bits regardless.

Programming notes