You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, in the Python-based Boneless assembler, there is no difference between specifying a register Rn and the integer n as an argument to an instruction. As a consequence, the instruction SLLI(R3, R2, 1) assembles the same as SLLI(R3, R2, R1). Unfortunately, the second version might mislead one into believing the instruction is shifting R2 by the value of R1 instead of by the constant 1. At least in my experience, this behavior easily creates hard-to-find bugs.
I suggest that using a register where a constant is expected and vice versa should be treated as an error. For problems where being able to interchange a register and its number are useful, the Rn object could have e.g. an attribute containing its number: R3.number == 3 and have e.g. a constructor that takes a register number: Rn(3) == R3. This would eliminate the source of accidental bugs and still allow the flexibility of interchanging registers with their numbers in the syntax.
The text was updated successfully, but these errors were encountered:
Currently, in the Python-based Boneless assembler, there is no difference between specifying a register Rn and the integer n as an argument to an instruction. As a consequence, the instruction
SLLI(R3, R2, 1)
assembles the same asSLLI(R3, R2, R1)
. Unfortunately, the second version might mislead one into believing the instruction is shifting R2 by the value of R1 instead of by the constant 1. At least in my experience, this behavior easily creates hard-to-find bugs.I suggest that using a register where a constant is expected and vice versa should be treated as an error. For problems where being able to interchange a register and its number are useful, the Rn object could have e.g. an attribute containing its number:
R3.number == 3
and have e.g. a constructor that takes a register number:Rn(3) == R3
. This would eliminate the source of accidental bugs and still allow the flexibility of interchanging registers with their numbers in the syntax.The text was updated successfully, but these errors were encountered: