Memory limits
jnogues
Posts: 25
Hi everybody!
I'm new in propeller and I don't understand the memory limit of propeller.
We have 32 k of main memory, but every Cog have 2k (512 long's).
I think than the limit of a program in a Cog is 512 (496 in Cog 0) spin instruccions.
If my progrmam is longer I need use another cog for some functions.
Is correct?
Regards.
Jaume Nogues
Barcelona
Spain
I'm new in propeller and I don't understand the memory limit of propeller.
We have 32 k of main memory, but every Cog have 2k (512 long's).
I think than the limit of a program in a Cog is 512 (496 in Cog 0) spin instruccions.
If my progrmam is longer I need use another cog for some functions.
Is correct?
Regards.
Jaume Nogues
Barcelona
Spain
Comments
-Phil
Spin source code is compiled to a bytecode, which stays in the 32k MainMemory. This code is executed by an Interpreter-code in a cog. Only this interpreter must fit in the 496 cog longs. The interpreter reads byte per byte from MainMemory, decodes the instructions and execute theme. This is not really fast, but allows very compact code, which can stay in the bigger MainMemory.
If you need faster code, then you can start also Assembly code direct in a cog. In this case you are limited to 496 assembly instructions in the cog memory (as long as you don't reload portions of the cog memory from MainMemory with Overlays or LMM).
Andy
You might not even fill 32K of HUB RAM.
SPIN programs are in HUB, and SPIN interpreter can be reloaded into extra cogs so you can run two spin programs at the same
time and speed, or more. That is like having extra chips helping with other programs BUT it is inside the same chip.
If you connect things like monitor, tv, keyboard, mouse, etc. then the driver for those things each might need a cog,
but you probably will not run out or even use all 8. With just one spin program doing something simple like blinking LEDs,
you can write a really long program (if you want to) and it runs in only one cog, the other 7 cogs never get used by that kind
of program, and only one program has all of the HUB to itself. (The way things work, the programs usually don't notice
each other even if they are sharing the hub memory. Each has its own code, data, variables and minds its own business.)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
VIRAND, If you spent as much time SPINNING as you do Trolling the Forums,
you'd have tons of awesome code to post!