Shop OBEX P1 Docs P2 Docs Learn Events
ASM Timing — Parallax Forums

ASM Timing

Simon AmplemanSimon Ampleman Posts: 19
edited 2007-12-08 13:07 in Propeller 1
Hello,

I see a 0.5 uSec difference on the oscilloscope between both of these two small asm codes, but I can't explain why. Can somebody help me?

This code :

······················· MOV OUTA,·#0
······················· MOV TIME, CNT
······················· ADD TIME, #4187
······················· WAITCNT TIME, #0
······················· NOP

Should take... 4 cycle + 4 cycle + 4 cycle + 5 cycles + 4187 cycles + 4·cycles = 4208, Am I right?

And this code :

······················· MOV OUTA,·#0
······················· MOV TIME, CNT
······················· ADD TIME, #2087
······················· WAITCNT TIME, #0
······················· MOV OUTA,·#1
······················· MOV TIME, CNT
······················· ADD TIME, #2087
······················· WAITCNT TIME, #0

Should take... 2 * (4 cycle + 4 cycle + 4 cycle + 5 cycles + 2087 cycles) = 4208 cycles.

Thank you.

Simon

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-12-08 07:28
    The 4187 and 2087 cycles begin from the MOV TIME,CNT — not from the WAITCNT.

    -Phil
  • AleAle Posts: 2,363
    edited 2007-12-08 07:32
    Assuming that in the first listing, after the NOP you have a MOV OUTA,#1 (or a loop)... there is a delay of 4+4197+5+4+4
    In the second the MOV OUTA,#x are separated only by 4+2087+5+4... I see about a half of cycles of difference,,, dont you ?
  • deSilvadeSilva Posts: 2,967
    edited 2007-12-08 13:07
    Simon,
    it is unclear where the strobe is in your first snippet.. After the NOP ? You most likely have a loop...
    Furthermore both snippets are not valid programs (#4268, #2087)

    The main reason for differences is what Phil says. For further background of interleaved pipeline timing and WHEN an action takes place (at the 6th cycle when re-writing the register) there are some remarks in my tutorial and - as far as I remember - there was an instructive thread some weeks ago...
Sign In or Register to comment.