[resolved][puzzle] Carry on!
kuroneko
Posts: 3,623
What am I after this time? Find a way of determining whether you ran out of cogs using as little resources as possible. This includes s/w as well as h/w.
Comments
-Phil
This time you're right. That's way too heavy. But at least that gives us something to work on.
-Phil
As for the other two criterias, admittedly I was afraid of stating the obvious. Not much good if you tear down the whole system by doing a simple test.
- minimal to no impact on the running system, as stealthily as possible
- no resource leaks (rogue cogs)
Did I miss anything?Note, the test is done as part of your normal code so the PASM cog isn't started for the sake of the test.
Here's my test code:
-Phil
BTW, I'm guessing that, due to symmetry, clkset exhibits the same carry behavior, but I've not tested it.
That said, the latest manual specifies carry cleared for most of them. Go figure.
The documenters must've felt it was not important enough to note -- or else they just didn't know about it. But yes, saying "0" is different than saying "-". In any event, this is useful enough to deserve being a separate instruction: cogtest. Now where's that macro assembler?
-Phil
Fair enough. I was thinking more like that if you do a hub access anyway (as part of your code) you might as well force wc and look at it later.
-Phil
I'm surprised that rdxxxx and wrxxxx behave that way, too, since they're not in that group. But I would almost bet that if bit 2 of S in those instructions is a one, the carry flag will return lock status instead.
Now, here's a follow-on puzzle: Is there an easy, non-destuctive way to tell if a particular cog is being used? (I haven't come up with an answer, BTW, and suspect it can't be done without cognewing the remaining cogs and eliminating their IDs from a pre-populated list.)
-Phil
Touch
Now, what do the unimplemented instructions MUL (000100), MULS, ENC, ONES do?
IIRC they clear the destination register and therefore set Z if you wish (on my demoboard that is). But that was only from a quick test.