cognew synchronous or asynchronous?
TomUdale
Posts: 75
in Propeller 1
Hi All,
I have not been able to find this information in the documentation although I am sure it is there somewhere. When cognew copies the 512 word program into the new cog, who is doing that copying? Is the cog that calls cognew (i.e. the code is being pushed from hub memory onto the target cog) ? Or is some microcode on the target cog that is pulling the code from the hub memory.
I am wondering because I want to know if I can expect the target cog to be running after cognew or running some 1k's of instructions later.
All the best,
Tom
I have not been able to find this information in the documentation although I am sure it is there somewhere. When cognew copies the 512 word program into the new cog, who is doing that copying? Is the cog that calls cognew (i.e. the code is being pushed from hub memory onto the target cog) ? Or is some microcode on the target cog that is pulling the code from the hub memory.
I am wondering because I want to know if I can expect the target cog to be running after cognew or running some 1k's of instructions later.
All the best,
Tom
Comments
COG fills up, then program execute starts at address 0.
cognew/coginit returns immediately and the calling cog continues execution. As it does so the cog being started is loading its code from HUB and starts to execute it some time later.
I thought the timing of all this was described in the manual some place. If not it should be. But it looks like others have outlined the process above.
This is indeed what I was wondering. I knew it would take 512, give or take, hub memory reads to get the program into the cog but it was indeed unclear who was doing that work. Either the source or target cog seemed equally likely.
After re-reading Mike's post 3 times I now understand that it is neither. It is actually more like DMA with an external agent doing the job and then signaling the target.
One related question is if each cog image is always exactly 512 words (padded out as needed) or is there some length somewhere that tells how many words long the image actually is? From Mike's description it sounds like the image is always 512 words irrespective of how much code is actually in there.
Is this the case?
Thanks,
Tom
Actually, isn't it 496, given the special locations in the COG address space? I forget. Makes no odds really.
By the way, when I said "cognew/coginit returns immediately" that is true but remember that these are "hub ops" which use more clocks than normal cog instructions. See manual for details.
Best regards,
Tom
The Verilog code for the P1V is available here on the forum (somewhere).
I am fairly certain that the shadow registers are cleared because I use them in my debugger.
However, I think you may be correct (Mike) that 512 longs are read from hub because I seem to recall that the pc (program counter) wrap causes the coginit sequence to complete.
then the extra stuff that gets loaded doesn't matter and you can use it for other cogs and stuff (I think that's
the default behaviour with the tools anyway).