Have all cogs to be synchronized execute a WAITCNT such that all cogs execute the command at least 5 cycles before the count value occurs. This technique is only effective for cogs running assembly, since Spin requires central hub access and would serialize each cog running spin code.
Another technique would be to use WAITPE or WAITPNE if you want a master/slave arrangement, the master could be another cog or an external device.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1+1=10
Post Edited (Paul Baker) : 4/11/2006 3:53:26 PM GMT
One caviat to stress is that spin code cannot operate in true synchronization because each interpretor must fetch byte codes from the hub memory, which is serialized (each cog gains access to the hub in round robin fashion). Additionally spin commands are not equal execution paths (an addition does not take the same amount of time a multiplication takes), though if you synchronize each and every spin command, you could get a little closer to synchronization.
It all depends on how you define synchronization, and how much jitter you can get away with.
Agreed, it would depend on time scale, what you mean by sync. Two identical assembly programs could exactly synced, instruction for instruction. Whereas two identical Spin programs could be off by wherever the hub happened to be when the sync pulse came along, as much as 16 clock cycles latency. That isn't much on a glacial time scale. I've seen some interesting earlier threads here on this board about real problems in synchronization.
Comments
Another technique would be to use WAITPE or WAITPNE if you want a master/slave arrangement, the master could be another cog or an external device.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1+1=10
Post Edited (Paul Baker) : 4/11/2006 3:53:26 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
It all depends on how you define synchronization, and how much jitter you can get away with.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
1+1=10
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com