Wondering about memory modes and multiple cogs
4x5n
Posts: 745
I've finally far enough along with a project I'm working on using spin to be able to spend some time with C and with luck C++.
The first thing that came up has to do with the various memory modes. My question (for now and I'm sure I'll have more in time) is if I have a largish program that doesn't fit in it's entirety in a cog but has a number of subroutines that will fit in a single cog and is intended to run in that single cog. If I compile the program in lmm mode or one of the xmm modes is the compiler "smart" enough to load the entire subroutine into cog memory and run it there?
The first thing that came up has to do with the various memory modes. My question (for now and I'm sure I'll have more in time) is if I have a largish program that doesn't fit in it's entirety in a cog but has a number of subroutines that will fit in a single cog and is intended to run in that single cog. If I compile the program in lmm mode or one of the xmm modes is the compiler "smart" enough to load the entire subroutine into cog memory and run it there?
Comments
By default in LMM and XMMC modes, the compiler will have the kernel load small routines of 128 bytes or less into COG and run them. You can also flag XMM functions to run as LMM with HUBTEXT.
128B isn't a lot of code for a subroutine.
BTW - I'm not referring to a simple call in the same cog but a subroutine started in it's own cog with "coginit" (or its equivalent) I should be able to get more then 128 bytes of PASM launched into it's own COG!
Think of it as FAST caching. So, if you have some small loop that needs to run ultra fast, then this feature helps.
If you want to start a cog with .cogc code then that is different. Then you have the full 496 longs, minus register space.
Thanks,