Shop OBEX P1 Docs P2 Docs Learn Events
ABS doesn't set the carry bit — Parallax Forums

ABS doesn't set the carry bit

On the P2 the ABS instruction doesn't set the carry bit like it does on P1 when the source value is negative. It would be useful if the ABS instruction worked the same on the P2.

Comments

  • cgraceycgracey Posts: 14,133
    Dave, thanks for finding this. I just fixed it. It will be in the next release.
  • Good catch! My unit test also had this wrong. *sigh* That always makes me wonder what other ones are wrong...

    (note: There are a number of other P1<->P2 differences that we *do* know about.)
  • cgraceycgracey Posts: 14,133
    Among all the negating/NOT'ing instructions in that group, it was the only one that should have returned S[31], instead of the MSB of the negate/NOT.
  • cgracey wrote: »
    Among all the negating/NOT'ing instructions in that group, it was the only one that should have returned S[31], instead of the MSB of the negate/NOT.

    Seriously? It's 4am there! Do you ever sleep? Or is this like the fairy tale shoemaker... elves take over at night, and each morning the chipmaker wakes up to discover that several new instructions have been implemented.
  • cgraceycgracey Posts: 14,133
    Well, I'm tired and not being very productive. I should go to bed.

    I've been working on the smart pin circuit. It's hard to believe that when this part is done, the chip is basically done. We will need to test it for a while, though.
  • cgracey wrote: »
    Well, I'm tired and not being very productive. I should go to bed.

    I've been working on the smart pin circuit. It's hard to believe that when this part is done, the chip is basically done. We will need to test it for a while, though.

    Agreed. Now, go to bed! I'd rather you get more rest, take a little longer to finish the pins, and get it right the first time. Fewer bugs up front will save time in the long run!
  • cgraceycgracey Posts: 14,133
    Okay. I'm going. Thanks for your input.
  • @Chip, thanks for fixing this so quickly.

    @Seairth, could you post your unit test program? I'd like to run it under spinsim to see if it catches anything.
  • Dave Hein wrote: »
    could you post your unit test program? I'd like to run it under spinsim to see if it catches anything.

    https://github.com/Seairth/P2UnitTests

    Currently, each instruction is a separate unit test. It's a little tedious to test. At some point, I intend to consolidate these and switch the results output to serial. See the wiki for additional details. (I've also updated ABS to correct the two tests related to your discovery.)
  • Thanks, that looks good.
  • evanhevanh Posts: 15,126
    Hmm, going by what I see in Seairth's unit tests, I don't think I'm happy with RCL and RCR. I'm not seeing any wrap-around, they appear to be acting more like SAL and SAR respectively.
  • cgraceycgracey Posts: 14,133
    evanh wrote: »
    Hmm, going by what I see in Seairth's unit tests, I don't think I'm happy with RCL and RCR. I'm not seeing any wrap-around, they appear to be acting more like SAL and SAR respectively.

    ROR/ROL are the ones that wrap.
  • cgracey wrote: »
    evanh wrote: »
    Hmm, going by what I see in Seairth's unit tests, I don't think I'm happy with RCL and RCR. I'm not seeing any wrap-around, they appear to be acting more like SAL and SAR respectively.

    ROR/ROL are the ones that wrap.
    If RCL and RCR don't "rotate", should they be called SCL and SCR?

  • cgraceycgracey Posts: 14,133
    David Betz wrote: »
    cgracey wrote: »
    evanh wrote: »
    Hmm, going by what I see in Seairth's unit tests, I don't think I'm happy with RCL and RCR. I'm not seeing any wrap-around, they appear to be acting more like SAL and SAR respectively.

    ROR/ROL are the ones that wrap.
    If RCL and RCR don't "rotate", should they be called SCL and SCR?

    Maybe those names would be more appropriate.
  • jmgjmg Posts: 15,140
    cgracey wrote: »
    ROR/ROL are the ones that wrap.

    Do they include the CY ?

  • cgraceycgracey Posts: 14,133
    jmg wrote: »
    cgracey wrote: »
    ROR/ROL are the ones that wrap.

    Do they include the CY ?

    Only as output. The bits rotate within the long.
Sign In or Register to comment.