Skip to content

Add pseudo-instruction support (li, mv, j, ret, etc.) #2

@kevinamccorvon

Description

@kevinamccorvon

The example programs use pseudo-instructions like li, mv, j, ret but the assembler chokes on them. These are just conveniences that expand to real instructions. Need li (load immediate, expands to lui + addi), mv (move register, just addi rd, rs, 0), j (jump, becomes jal x0, offset), ret (return, jalr x0, ra, 0), nop (addi x0, x0, 0), call/tail (function calls using auipc + jalr), not (xori rd, rs, -1), neg (sub rd, x0, rs), seqz/snez (set if zero/not zero).

The tricky part is li because you need to split 32-bit immediates into upper 20 bits (lui) and lower 12 bits (addi). Once this works the example programs should actually assemble.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions