mov vs rdlong
J^3
Posts: 121
Good Evening All,
From what I can see the difference between mov, and rdlong is that rdlong allows you to access global(hub) RAM, while mov only allows you to access cog RAM. Is this correct?
Also, is correct to say that data initialized in the DAT block is stored in cog RAM, and not global(hub) RAM?
Any feedback on these questions is appreciated,
Thanks
From what I can see the difference between mov, and rdlong is that rdlong allows you to access global(hub) RAM, while mov only allows you to access cog RAM. Is this correct?
Also, is correct to say that data initialized in the DAT block is stored in cog RAM, and not global(hub) RAM?
Any feedback on these questions is appreciated,
Thanks
Comments
When you start a COG, 2K of data is copied to the COG, from the HUB. If you've got stuff in the DAT section, it will be copied to the COG. So it actually exists in both at the moment the COG starts.
I appreciate the sanity check!
Thanks,
J^3
In rdxxx and wrxxx you always use byte-addresses!! The point is that the byte-addresses are alligned to a long or word by cutting away the least significant bit(s) - this is automatically done by the rdxxx/wrxxx instruction. So, HUB RAM is ONLY addressed with byte addresses and not with LONG or WORD addresses.
The difference?
Well, address-space of a 2kByte RAM is:
1. for byte addressing 0 - 2047 (this is how HUB RAM is addressed)
2. for word addressing 0 - 1024
3. for long addressing 0 - 512 (this is how COG RAM is addressed)
Example:
1. As rdlong uses byte addresses you access the 2nd long in HUB RAM with address 4 and not with address 1.
2. When moving something to the 2nd long in COG RAM you'd use address 1.
3. If you have a pointer into HUB RAM and you want to loop over LONGs you'd add 4 to the pointer position.
4. If you have a pointer into HUB RAM and you want to loop over WORDs you'd add 2 to the pointer position.