Shop OBEX P1 Docs P2 Docs Learn Events
WAITPEQ Timing, Setup & Hold Times, etc. — Parallax Forums

WAITPEQ Timing, Setup & Hold Times, etc.

Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
edited 2009-06-18 12:09 in Propeller 1
Chip,

Given this code:

        [b]waitpeq[/b]   one, one
        [b]mov[/b]       dest, [b]ina[/b]
        ..
one     [b]long[/b]      1




and this diagram:

attachment.php?attachmentid=41516

can you indicate where ina is read by the mov? What are the port pin setup and hold times for the waitpeq relative to the clock? For the mov?

Thanks,
Phil
800 x 107 - 6K

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-05-03 18:12
    Four stage pipelines typically are read, decode, execute, write so mov should record ina the 3rd cycle of the clock for the instruction. Though Im not positive, I think it would be recorded at edge c.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    1+1=10
  • pjvpjv Posts: 1,903
    edited 2006-05-03 18:27
    Hi Phil;

    I'll try to answer part of this........... to the best of my recollection:

    When the waitpeq instruction is started, it stalls after its second clock. Then when the condition becomes true, the rise of A0, it takes three more clocks to finish the instruction, so that would consume clocks a,b,c. As Paul said, the next instruction wil read the port during the third clock, f.

    At this moment, I'm not recalling if instructions conclude on the rise or fall of the clock, but I'll check that out, and confirm my findings for you later today.

    Regrettably, I don't know the set-up and hold times; it would take a bunch of work to determine that emperically.

    Cheers,

    Peter (pjv)
  • cgraceycgracey Posts: 14,256
    edited 2006-05-04 04:20
    The COGs go through the following state sequence, advancing each clock cycle:

    0) read source N

    1) read destination N

    2) read instruction N+1

    x) any wait cycles go here (0...infinity clocks)

    3) write destination N (N=N+1, goto 0)

    So, the source is read 3 cycles before the destination result it written. This timing scheme gives the ALU·two clocks in which to settle after I, S, and D have been read.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Chip Gracey
    Parallax, Inc.
  • william chanwilliam chan Posts: 1,326
    edited 2006-05-04 07:32
    Can a cog wait on 2 or more pins simultaneously?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.fd.com.my
    www.mercedes.com.my
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2006-05-04 07:37
    Yes. It's done with a bitmask to select the pins you want to monitor. You can wait for the selected pins either to equal a certain pattern, or to differ from it.

    -Phil
  • MagIO2MagIO2 Posts: 2,243
    edited 2009-06-18 06:12
    Don't want to hitchhike the currently running WAITPEQ thread, so I digg this one out to ask my question ;o) ... and the question is only for understanding what's going on in a COG.

    1. Shouldn't 2) be read instruction N+1 and execute N ?
    2. For me this sounds like the start of a PASM needs one additional instruction because the first instruction is fetched with the first cycle but executed with the second cycle. So, is the PC maybe set to adress 511 at the beginning of PASM code execution?
  • RaymanRayman Posts: 14,839
    edited 2009-06-18 09:26
    I would imagine that the execute part really begins once the source is read... It's probably latched on step 2 so that the new instruction doesn't change it...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
  • MagIO2MagIO2 Posts: 2,243
    edited 2009-06-18 11:14
    @ray:
    Don't agree with that.

    0) To execute the instruction you need source and destination. If you say AND x,y it makes no sense to start execution if you did not read x yet.
    1) execute the instruction here would mean that you don't have to flush the pipeline for conditional jumps because in step 2 it would be clear which instruction to fetch next.
    So, for me 2) is the place where I'd expect the execution.
  • RaymanRayman Posts: 14,839
    edited 2009-06-18 12:03
    Well, I think it's a little philisophical... I think some some things are set when the new instruction is read, some things are set when the source is read, and the result appears shortly after the destination is read... I'm guessing the actual execution is asyncronous, and some instructions would take longer than other so settle to a result... But, unless there are hidden registers, I think the result has to be latched when the new instruction is read...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
  • AleAle Posts: 2,363
    edited 2009-06-18 12:09
    Hei,

    do not forget this discussion we had last year:

    http://forums.parallax.com/showthread.php?p=725782

    With oscillograms and all

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Visit the home of pPropQL: propeller.wikispaces.com/pPropQL
    pPropQL020: propeller.wikispaces.com/pPropQL
    OMU for the pPropQL/020 propeller.wikispaces.com/OMU
Sign In or Register to comment.