would the pipeline cause this loop to be one off?
CJ
Posts: 470
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
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
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Parallax Forums - If you're ready to learn, we're ready to help.