Shop OBEX P1 Docs P2 Docs Learn Events
would the pipeline cause this loop to be one off? — Parallax Forums

would the pipeline cause this loop to be one off?

CJCJ Posts: 470
edited 2007-09-12 15:39 in Propeller 1
loop: Wrlong cogptr, hubptr
        sub hubptr, #4
        DJNZ cogptr, #loop:



would the wrlong read cogptr before or after it was decremented by the DJNZ?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Parallax Forums - If you're ready to learn, we're ready to help.

Comments

  • KaioKaio Posts: 253
    edited 2007-09-12 14:17
    CJ,

    it will always read before decrement. But your code would only write the value of cogptr to the hub RAM. So if you would set cogptr to 5 at the begin it would write 5 to 1 sequential upwards in the hub RAM starting at the address where hubptr is pointing.

    Please have a look at the following thread where I was thinking to do the same as you.
    http://forums.parallax.com/showthread.php?p=656660

    The pipeline would not be a problem while it is "read source, read destination, read next instruction, write result". The source will be read first when the instruction will be executed.
    http://forums.parallax.com/showthread.php?p=611706

    Thomas

    Edit: added pipeline behavior

    Post Edited (Kaio) : 9/12/2007 2:27:59 PM GMT
  • CJCJ Posts: 470
    edited 2007-09-12 15:39
    I see the fundamental flaw in my code now, thanks

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Parallax Forums - If you're ready to learn, we're ready to help.
Sign In or Register to comment.