PC -- Program Counter
LustInBlack
Posts: 22
Yep, is there a way to get the value of the PC !?
I know of a way, but a direct way is possible!???
I could do a jumpret and get it from there, but that sounds like x86: call Bob Bob: pop eax (where eax is the EIP value)
I didn't see any reference to PC, looks like I didn't read correctly, or we don't have access to this Register...
I see some use with the PC, it is surely COG dependant, then, we could use this value as a synchronizer ...
If two cogs run the same exact code, they could wait for PC and continue what they are doing..
With relative displacement of PC, cogs could be synchronized in different phase..
Sounds like CNT, however, CNT is more volatile I believe, since HUB operations can happen, and code
isn't necessarily executed at the same exact time (resolution).
Also, I really miss the sbi and cbi instructions from AVR, is there some useful instruction that can be use to replace them!?
I just do "OR" and "AND" instruction to replace them, but I don't like it that much, I need to reserve longs for pin
assignments....
I know of a way, but a direct way is possible!???
I could do a jumpret and get it from there, but that sounds like x86: call Bob Bob: pop eax (where eax is the EIP value)
I didn't see any reference to PC, looks like I didn't read correctly, or we don't have access to this Register...
I see some use with the PC, it is surely COG dependant, then, we could use this value as a synchronizer ...
If two cogs run the same exact code, they could wait for PC and continue what they are doing..
With relative displacement of PC, cogs could be synchronized in different phase..
Sounds like CNT, however, CNT is more volatile I believe, since HUB operations can happen, and code
isn't necessarily executed at the same exact time (resolution).
Also, I really miss the sbi and cbi instructions from AVR, is there some useful instruction that can be use to replace them!?
I just do "OR" and "AND" instruction to replace them, but I don't like it that much, I need to reserve longs for pin
assignments....
Comments
There is no equivalent to the sbi and cbi instructions. All bit access you have to do with 32 bit words. OR and ANDN would be the closest things, but, as you mentioned, you do need a mask word. If you're lucky (or careful), you can use the low order 9 bits and an immediate mask.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
This is cheating, of course, since "$" is a compile-time constant. But since the Propeller doesn't do relative addressing, the code is unlikely ever to execute from other than its absolute assembled location. Even in the future, when relocatable blocks of code are linked in a separate step, the linker should fill in the value of "$".
-Phil
My idea is : send the PC on the HUB with a wrlong instruction to signal other COGS where I am currently executing instructions..
For example, I have COG #1 that runs at PC 40. COG #2 executes at PC44 (same code) ..
I want them to sync together, if the instruction waitcogpc(1, #44) existed, this could synchronize my COG ..
.. There are many different ways to synch cogs, but I feel this would be the most efficient..
For now, I would do it, inefficient, using wrlong in shared variables..
Poking the variable with a rdlong in RAM each start of loop to see where other cogs are situated..
Wait for slowest cogs, or synch accesses between cogs...
Where CNT can synch cogs, it will fail on conditions and hub operations, where the synch will be lost..
It's like a delta, where you need to offset the error to get in synch..
PC will not, it will tell you (a cog) exactly where you need to be for synch operation..