Skip to content

Possible assembly issue with immediate in logic/arithmetic instructions #468

Description

@amarti-github

Hi there.

When using hexadecimal to write immediate value in logic/arithmetic instructions, if I try to write a negative value I get a out of range error. This is because the assembler don't read the immediate as twos complement number. For example, if I try with -1:
addi x10, x0, 0xfff -> error 4095 does not fit in 12 bit
I can use the negative sign: addi x10, x0, -0x001 -> it works.

For working with integer numbers is no a big a problem, but for logic instructions, where the immediate usually represent a mask without sign, it forces to make some calculations. For example:
ori x10, x10, 0xf00 must be written ori x10, x10, -256

It would be nice if it could be modified.

Thanks,

Toni

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions