COGINIT captures new cog in D?

If D is not an immediate value, does COGINIT capture the newly-started cog's index in D? (like it does on P1?)

Comments

  • cgraceycgracey Posts: 13,176
    edited 2016-05-17 - 16:02:56
    If D is a register and WC is used, the next-available (newly started) cog gets written into D. This is intended for 'cognew' cases, where D[3] was set, going into the COGINIT, indictating that you wanted to start the first available cog, and WC was used, so that C would get set if there were no available cogs.
  • cgracey wrote: »
    If D is a register and WC is used, the next-available (newly started) cog gets written into D. This is intended for 'cognew' cases, where D[3] was set, going into the COGINIT, indictating that you wanted to start the first available cog, and WC was used, so that C would get set if there were no available cogs.

    Did you mean D[4]?

    So, given the following combinations (where D is not an immediate value):

    * D[4] not set, WC not set -> C is not altered, D is not altered
    * D[4] not set, WC is set -> C is set always set to 0, D is not altered
    * D[4] is set, WC not set -> C is not altered, D is not altered
    * D[4] is set, WC is set -> If cog is available, set C to 0 and D to new cog ID; otherwise set C to 1 and D is not altered.
  • Right, it's D[4].

    D is always altered if it is a register and WC is used, whether or not D[4] is set. Of course, if WC is used and D is a register, you'd certainly have D[4] set.
  • Okay. Full truth table:
    D mode  D[4]    WC      C   D (out)         Note
    ------- ------- ---     --- --------------- --------------------------------------------
    imm     0       0   ->  C   D               Always succeeds
    imm     0       1   ->  0   D               Always succeeds
    imm     1       0   ->  C   D               May fail, but result not captured
    imm     1       1   ->  0   D               Succeeded, don't know new cog ID
                        ->  1   D               Failed
    
    reg     0       0   ->  C   D               Always succeeds
    reg     0       1   ->  0   D[3:0]          Always succeeds
    reg     1       0   ->  C   D               May fail, but result not captured
    reg     1       1   ->  0   new cog ID      Succeeded, new cog ID captured
                        ->  1   undefined       Failed, D is still overwritten\
    

    Look correct?
Sign In or Register to comment.