Shop OBEX P1 Docs P2 Docs Learn Events
[puzzle] back in line — Parallax Forums

[puzzle] back in line

kuronekokuroneko Posts: 3,623
edited 2012-04-01 08:25 in Propeller 1
Something I came across recently ...

You have 4 cogs with IDs N, N+1, N+2 and N+3. At some point they will be synchronised on a waitcnt. This also means that they may or may not by in sync with their respective hub window, e.g. if cog N+1 has its hub window immediately following the waitcnt then cog N just missed it (N+2 and N+3 would be fine). So executing a hubop would happen in the following order N+1, N+2, N+3, N.

What I'm looking for is a single piece of code (the same for each cog) which is run in each cog after the waitcnt which is then followed by a hubop (say a rdlong). Requirement being that said rdlongs are then executed in order N..N+3. The cogs know who they are, i.e. first or last in sequence. Ideally the carry flag isn't used.

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-03-31 22:47
    Well after trying it, I know one thing that does not work. It seemed so reasonable to assume that the hub access hardware used cnt to determine which cog's turn it is: i.e. (cnt >> 1) & 7. If that were the case, all you would have to do is make sure that the last four bits of the waitcnt sync value equaled the right magic number.

    But no.

    -Phil
  • kuronekokuroneko Posts: 3,623
    edited 2012-04-01 07:58
    To make it a bit easier I added a test program to the top post. Just fill in the relevant PASM sections and see if it works.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-04-01 08:25
    kuroneko wrote:
    To make it a bit easier ...
    With a four-channel scope, it's easier still. :)

    -Phil
Sign In or Register to comment.