What's with WAITX WC? (and also why MOVD-->SETD?)

RaymanRayman Posts: 9,945
edited 2019-12-04 - 17:52:53 in Propeller 2
I'm trying to decipher this instruction on the spreadsheet when Wx is specified...

Looks like it adds RND (I assume this means a random 32-bit number) to D.
First of all, why add D? Wouldn't that make no difference to the outcome?

Secondly, what good is this?
Wouldn't it have been better if D specified a right shift in RND up to 31 bits?

And, in a completely unrelated question:
Why did we (meaning Chip) change MOVD instruction name to SETD?
Prop Info and Apps: http://www.rayslogic.com/

Comments

  • WAITX doesn't actually do a +2 addition, that's just representative of the base execution time before any waiting has occurred. Yep, a right shift of RND could have been done when Wx set, an AND is cheaper in logic though.
    We have the vastness of the internet and yet billions of people decided to spend most of their time within a horribly designed, fake-news emporium of a website that sucks every possible piece of personal information out of you so it can sell it to others. And they see nothing wrong with that.
  • If Wx is specified WAITX waits (D & RND) cycles. In other words you can specify a wait of a random number of cycles. "WAITX #$F WC" will wait between 0 and 15 cycles (well actually between 2 and 17 cycles, because the WAITX instruction itself takes 2 cycles). Waiting a random amount of time could be pretty useful in situations where multiple cogs are trying to access the same resource; otherwise if they're all waiting in lockstep with the same delays then you can end up in some bad situations where one or more cogs are starved.
    FlexGUI, a GUI for programming the P1 and P2 in Spin, PASM, BASIC, and C.
    Help support its development at Patreon or PayPal.
  • Random wait is also useful in situations where you don't want to leak secret data through timing (since different data->different code path->different timing).
  • RaymanRayman Posts: 9,945
    edited 2019-12-04 - 20:05:48
    Ok, I see now, it's a bitwise "and"... I was thinking addition...
    That makes sense...
    Prop Info and Apps: http://www.rayslogic.com/
Sign In or Register to comment.