PASM issue
kurth
Posts: 14
in Propeller 1
I am unable to compile a NOP in PASM if there is a condition used.
Example: if_z_and_c nop (fails with "Expected an assembly instruction" message)
Is this a tool issue or a PASM limitation? I am using the Propeller Tool v2.6.3
Thanks!
Comments
Regardless of whether it's allowed or not, it's completely pointless. Even if it were allowed, it would be NOP whether the condition held of not. IOW, it would still use one instruction cycle, in either case.
-Phil
I am using the construct to make my code timing constants. I don't think that's pointless. I can use another instruction (like if_z or data, #0) but it is a bit confusing.
Are you saying that a conditional still requires 4 cycles, even if the op isn't executed? I did not get that from the documentation (or I'm an idiot)
Yes.
-Phil
Thanks Phil. I have been using STM32 parts for years, but I am using the Prop1 for a project because you can actually buy them! It's been a steep learning curve...
You can't use conditions on NOP because it is actually just an alias for
if_never rdbyte 0,0 nr
(which is equivalent to any if_never instruction, but this one happens to assemble to zero)You can get the same granularity, albeit at the expense of an extra instruction cycle by putting a conditional on an instruction that takes two cycles, viz:
If the condition holds, the tjz will execute, testing itself for a zero condition. Since the instruction itself is non-zero, the jump will not take place, thus requiring two instruction cycles. If the condition does not hold, the tjz will not execute, thus requiring one instruction cycle.
-Phil
Thanks for the insights. I re-read the Prop manual and found the info about conditionals taking 4 cycles. Doh!