Propeller Memory Configuration
Vega256
Posts: 197
Hey,
If the Propeller deals in 32-bit longs, then if I declare two bytes next to one another, does the Propeller allocate two longs and just use the first eight bits of them or allocate two successive bytes within one long?
If the Propeller deals in 32-bit longs, then if I declare two bytes next to one another, does the Propeller allocate two longs and just use the first eight bits of them or allocate two successive bytes within one long?
Comments
For a long, the least two significant bits are assumed to be zero. For a word, the least significant bit is zero. For bytes, all bits are significant.
In the COG, there is only LONG addressing.
The variables are arranged long, word, byte at compile time. There aren't empty bytes between each byte variable. In your example the two bytes are within one long.
Individual bytes are addressable in hub RAM. Cog RAM is addressable only by longs.
Edit: PHead bet me to it. And did a better job explaining things.
If you want to pass a long value and the address of an array of bytes (another long value), you could do something like: This way, myLongValue and myAddressValue are both longs and follow each other in memory. The WAITCNT is there to make sure the COGNEW has a chance to finish before startUpAll exits and the local variables are used for something else. It takes around 100us for a new cog to be started.