Closed Emoun closed 1 year ago
I hope that this is the correct execution! This is not a niche thing, as delay slots are part of the Patmos ISA definition. We need to check that we have the same number of delay slots in Patmos, pasim, the compiler, and in the handbook.
The delay slots for ret
seem to work properly. By niche, I meant the fact of executing a retnd
without having executed any call
.
The issue here is that retnd
also has delay slots in this specific circumstance even though it shouldn't. So there is definitely wrong execution here (for retnd
).
Ooh, this is bad! We need to check if this is pasim only.
Additional problems:
retnd
are invalid as instructions, pasim will throw an error (again, even though it should ignore them)
Take the following assembly program:
When it finishes, should have
r1=1337
however getsr1=1343
meaning the finaladd
s are being executed even if they shouldn't. If we replaceretnd
withret
(and remove theadd
s) we get the expected result.I know this is a niche situation, as in real code you should never have a return without first a call. However, since it works as expected with
ret
, and the current behavior is definitely wrong, a fix is justified.