Passing values between cogs
agodwin
Posts: 72
In some of the communication between cogs, I've assumed that a LONG will be read or written atomically : that the access is a single operation and will be completed within the hub access slot.
Can this be relied on, or do I have to use the semaphores for any such accesses ? I've assumed that I only need semaphores to protect accesses to multiple objects.
Are there any conditions when it won't be true : misaligned longs for instance ?
-adrian
Can this be relied on, or do I have to use the semaphores for any such accesses ? I've assumed that I only need semaphores to protect accesses to multiple objects.
Are there any conditions when it won't be true : misaligned longs for instance ?
-adrian
Comments
You can't access longs via long[noparse]/noparse or rdlong unless they are long aligned. I believe the architecture ignores the lowest 2 bits in the address for longs, and the lowest bit for words. Variable declarations in the VAR and DAT sections automatically align based on the type you choose.
2) You can't access longs (or words) that are not on the appropriate boundary. All long addresses have their lower two bits ignored and all word addresses have their lower bit ignored.
3) You don't need semaphores for long/word access
-adrian