[resolved][puzzle] close call
kuroneko
Posts: 3,623
You have two cogs A and B which happen to execute a cogstop on the opposite ID (A: cogstop B, B: cogstop A). Said instructions are executed as close together as possible (i.e. having cog B making its attempt a second later is out). What happens?
- A stops
- B stops
- both, A and B stop
Comments
This is a classic race condition.
Now, since Kuroneko posed the question, my gut also tells me that the real answer is, "It depends." And what I suspect it depends upon are the relative cog IDs of A and B and by how much the cogstop access window of one lags that of the other.
-Phil
The pipeline has 4 stages (needs 4 clocks), each HUB-window lasts for 2 clocks.
So, for me the question is whether the HUB instruction is prepared before the HUB window arrives and I would say yes. Otherwise 2 clocks would not be sufficient - 1 for setting the address, 1 for the action (read/write...). In other words the COGSTOP waits at stage 4 of the pipeline until the HUB-window arrives and the important things are already set in some HUB-internal registers (which instruction, which address...). So, for the actual HUB instruction execution the COG is not needed anymore.
That's why I currently would opt for 3 with the given precondition. I does not matter how far apart the HUB access-windows of the COGs are. As soon as the execution is started at the same CNT - maybe CNT+1 - both will stop.
I assume this has to do with the 1 instruction COG pipeline of the Prop 1? Or does it have to do with the Hub pipelining an instruction?
Disclaimer: This may be complete backspace but it explains observed behaviour, i.e. it's good enough for me. YMMV