Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile error when 12th bit of an immediate value is set #2

Closed
nishtahir opened this issue Sep 15, 2022 · 2 comments
Closed

Compile error when 12th bit of an immediate value is set #2

nishtahir opened this issue Sep 15, 2022 · 2 comments

Comments

@nishtahir
Copy link

Running this instruction seems to generate a compile error

addi x1, x0, 2048

file.s: Assembler messages:
file.s:6: Error: illegal operands `addi x1,x0,2048'

However, running this seems to work just fine.

addi x1, x0, 1024

OK!

I could be wrong, but I believe the immediate value should be 12 bits long.

@racerxdl
Copy link
Owner

You're correct, indeed it has 12 bit, but its a sign extended imediate value, so the range is - 2048 to 2047

@nishtahir
Copy link
Author

Oh, I see. I forgot that the assembly value is signed. Thanks for clearing that up for me 😄.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants