Copy Cat Cog
Humanoido
Posts: 5,770
Is it possible to read one entire 2K Cog risc processor
and copy it to another location
like a place in HUB ram or a 64K EEPROM
where it could be used to run a program?
and copy it to another location
like a place in HUB ram or a 64K EEPROM
where it could be used to run a program?
Comments
If the DAT section of a spin program that started a cog has not been modified it could be used to start another cog.
What you could do is have some code in the running COG that would write out the contents of its own memory to a HUB buffer and then start a second COG to load and run that.
The COG process would "clone" itself into a second COG.
Such a clone code would be nice little exercise in PASM. I have not heard of anyone doing this yet.
I agree. It would be a great exercise. But wouldn't it just keep cloning to the other cogs if you dump from one to another... then another... then another....
The cloning I suggested acts rather like a Unix "fork" which starts a second process running a copy of the code of the first. When allowed to run away this is known as a "fork bomb".
I would anticipate that one would arrange to have the COG clone itself in response to some external command or other event.
Either the clones themselves or some master program would have to manage how many copies are created and prevent runaway.
Next challenge is to have a network of Propellers and have the clones "infect" all of the COGs on all of the Props.
I mean copy the cog, not the program it's running. I want to make a 9th cog in the HUB.
I guess one could write a COG simulation that runs on the Prop. But that simulation would have to be run by a COG so you have no gain in COG count.
To make a gain the simulation would have to simulate two COGs thwn you have a 9th COG. But now you have 2 simulated virtual COG and they will both be horrible slow.
You could probably compile spinsim to run on a COG and simulate a virtual Props 8 COGs. Then you would have 7 real COGs and 8 virtual COGs. Of course the spinsim code is big enough that it would have to run from external memory. Shall we say very slow and pointless.
You don't like ants do you?
It is said that the processing power in an ant's brain and a Macintosh II computer might be similar.
Oh yes, I guess LMM is that COG simulator I was talking about.
Loopy,
I don't buy that idea.
Given the trouble we humans have controlling 6 multi-jointed leg robots in real time with processors a lot more powerfull than a Mac II
Never mind absorbing all the ant sensors and performing its other higher level behaviors.
Counting neurons and equating to gates in a computer is not enough.
I like the idea of running eight cogs on a simulator in one cog so the prop chip has a total of 7 hard cogs and 8 soft cogs available, making a prop with 15 cogs, some faster, some slower.
How about running 2 cogs in a simulator on each of the 8 cogs so you could have 16 soft cogs available, or 3 simulated cogs/cog for 24 soft cogs, etc.
Definitely yes. If possible, I would like to use each hard cog to run its version of Propeller sim to create 8 soft cogs (in each hard cog) for a total of 64 soft cogs per Propeller chip. Is this possible?
We have say one COG running the LMM for them leaving 7 others. For a sum of 14 virtual + 7 real COGS = 21 COGS.
That's assuming you find a way to get all this loaded and started. For some definition of "works" this might just be doable.
Humanoido,
Sorry I said "slow and pointless", I should learn to stop throwing value judgements around.
But in a conversation with someone who has hundreds of Props connected together I have to then ask what use for this do you have in mind given that you have thousands of COGs at your disposal?
This is how some minis and mainframes used to work, using of course just one cpu.
While available cog and hub memory will impose some limits, those limits may not be as constrained as it seems at first glance. With re-entrant programs and each simulated cog executing the program on it's own data set it might be possible to have 64 simulated cogs. A very sharp programmer I met years ago ran a data entry business and had 8 terminals entering data to 8" floppy disk using a single 8080 S100 computer with 64K of ram. Essentially each terminal program consisted of a data area and a few lines of code that read the characters from the keyboard, called the main re-entrant program to process the character, and output any data returned to the terminal screen.