local (stack and result) alignment?
ags
Posts: 386
I realize that all locals (created on the stack in SPIN) and the result (return value from a method) are long-sized. Are they also long-aligned?
I'm wondering if it is guaranteed safe to pass the address of a local/result symbol to a cog through the par register. I understand the 2 LSBits of par are zeroed, in effect forcing long aligned addressing.
BTW, since a cog can address byte-aligned hub RAM, why was this done? Any why is the MSW of par zeroed? (Or are they? is the PASM entry point location stored in the high word?)
One more: is there a shadow register for par? Not sure how I could use it, other than similar to the
I'm wondering if it is guaranteed safe to pass the address of a local/result symbol to a cog through the par register. I understand the 2 LSBits of par are zeroed, in effect forcing long aligned addressing.
BTW, since a cog can address byte-aligned hub RAM, why was this done? Any why is the MSW of par zeroed? (Or are they? is the PASM entry point location stored in the high word?)
One more: is there a shadow register for par? Not sure how I could use it, other than similar to the
mov cnt,cnt add cnt,advance waitcnt cnt,nextpattern. Maybe for two interleaved wait states?
Comments
par is extracted from the coginit parameter register. Since the other 18bit are used for cogid and code address you only get 14bit payload. Period. And yes, there is a shadow[par].
I forgot about the cogid. That was the missing piece. So par uses 15 bits for PASM code memory location (don't need the MSB since it must be in RAM, which is only 32k address space), 14 bits for hub memory location for passing values (mailbox), and 3 bits for cogid.
Now I call that frugal bit utilization... :-)