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

Instruction overwritten by MOVI in builtin editor #11

Open
f380cedric opened this issue Feb 12, 2021 · 2 comments
Open

Instruction overwritten by MOVI in builtin editor #11

f380cedric opened this issue Feb 12, 2021 · 2 comments

Comments

@f380cedric
Copy link

No description provided.

@parastuffs
Copy link
Collaborator

parastuffs commented Feb 12, 2021

This happen whenever we « assembly » the code.

movi 1, 0xFFFF
add 2,1,3
addi 2,2,2

becomes

lui 1,1023
addi 1,1,63
addi 2,2,2

This is the reason why we advise to write a NOP after a movi.

The code could be shifted, but how do we handle jumps? Should the compiler shift the jump address accordingly or do we assume the user knows what he's doing and appended a NOP after the MOVI?
The later is implemented at the moment.

Edit: In the ASM version of the simulator, the program instructions are shifted, though.

@f380cedric
Copy link
Author

This happen whenever we « assembly » the code.

movi 1, 0xFFFF
add 2,1,3
addi 2,2,2

becomes

lui 1,1023
addi 1,1,63
addi 2,2,2

This is the reason why we advise to write a NOP after a movi.

It only happens with the builtin editor. There is no issue when using IMPORT ROM.
I would expect that if it can work using IMPORT ROM, it could also work using the builtin editor.

The code could be shifted, but how do we handle jumps? Should the compiler shift the jump address accordingly or do we assume the user knows what he's doing and appended a NOP after the MOVI?
The later is implemented at the moment.

It is only the case with "absolute" jumps (no issue with labels).
I think that most users use jumps with labels anyway. So I think the later is fine.
If users use the (IMO quite inconvenient) "absolute" jump instead of using labels,
then it seems appropriate to make the assumption that they know what they are doing (i.e. MOVI is 2 instructions).

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