Instruction timing between COGs
Cluso99
Posts: 18,069
Does anyone know how the COG instructions are aligned to the clock?
What I am after, is there a way to enforce 4 COGs to be offset by one clock cycle each?
I have a Data Logger (basically like the Dscope sample) which currently samples at 50nS (at 5MHz xtal). I'd like to interleave 4 COGs to get me 12.5nS.
I'll post the code soon
What I am after, is there a way to enforce 4 COGs to be offset by one clock cycle each?
I have a Data Logger (basically like the Dscope sample) which currently samples at 50nS (at 5MHz xtal). I'd like to interleave 4 COGs to get me 12.5nS.
I'll post the code soon
Comments
Launch cog1 with start_cnt as a starting point
Launch cog2 with start_cnt+1 as a starting point
Launch cog3 with start_cnt+2 as a starting point
Launch cog4 with start_cnt+3 as a starting point
In each cog, do a waitcnt first using the starting point that you gave it. Then they will all be in sync, each with it's own offset.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
If they all do hub access the same way, and they started in the proper order, all of the cogs will fall back into lock step after the hub accesses because even hub access is deterministic when timed properly.· When launching the cogs you might want to specify which cog is used by using·COGINIT instead of COGNEW.· Keep in mind that hub access windows come to each cog in a round-robin fashion, so the cog you start first should be the first one in line to get the hub, then the second one, etc.· I assume you are running identical code in each cog since you want them all synchronized.
I assume you only want 4 samples at a time at 12.5 ns intervals.· You can't sustain that rate because you need 16 clocks to read the sample,·increment your pointer, write·the sample·and then loop.· If you write to HUB memory it's even more.
Seems to me you would need 4 cogs just to sample at 50nS at a sustained rate, and that doesn't include hub access...unless I'm making some wrong assumptions.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Post Edited (Ken Peterson) : 5/16/2008 3:50:05 PM GMT
I get about 470 clear scan cycles per·cog (currently set at 450 with some debug statements).
So I want to be able to interleave 4 or join 4 end on end. It was the interleaving I was't sure about.
I know about the latency in hub access (I hope anyway).
Currently putting the code together·with the great VGA display·- already sending out formatted serially to the PC.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
All 32 I/O pins. I want to be able to either interleave 4 cogs or 4 sequentially to lengthen the no. of samples.
At the moment I am dumping them out the serial port after the samples have been obtained.
(added) Just sampling the pins at present - I am writing an 8 port serial driver in a single cog and want to be able the check the in and out timings. Then maybe some other things later. I have two proto boards and an FT2232C interface that drives both. I posted a topic last week about getting 2 IDE's working.
Post Edited (Cluso99) : 5/17/2008 4:12:09 AM GMT