Paradox - When does the Prop have time to run your Spin code?
Heater.
Posts: 21,230
After a few beers it is often the case that we come up with some really odd thoughts. This was last nights:
When you run your Spin code on a Prop you have:
1) The Propeller hardware, a COG.
2) The COG is filled with and running an instance of the Spin interpreter.
3) The byte codes of your compiled Spin program in HUB.
Now, as we see the COG is using 100% of it's time to run the Spin interpreter.
So...When does your Spin program get run? Clearly there is no left time for it:)
Cheers.
When you run your Spin code on a Prop you have:
1) The Propeller hardware, a COG.
2) The COG is filled with and running an instance of the Spin interpreter.
3) The byte codes of your compiled Spin program in HUB.
Now, as we see the COG is using 100% of it's time to run the Spin interpreter.
So...When does your Spin program get run? Clearly there is no left time for it:)
Cheers.
Comments
-Phil
Your Spin program is never run. What is happennig is that the Spin interpreter cog is simulating (in real time) what would happen if your Spin program was ever run!
Ross,
Man, that is some serious Zen.
Cluso,
Sadly, with the above in mind, all my bugs get faithfully simulated as well.
Graham
So, you have now two choices, either fix the bug itself or change the simulator to circumvent the bug.
1. A = B
2. A^2 = AB
3. A^2-B^2 = AB - B^2
4. (A+B)*(A-B) = B(A-B)
5. (A+B)*(A-B)/(A-B) = B
6. A+B = B
BUT from line 1, A=B so let A=1 then 1+1=1
So obviously the spin math interpreter is hosed!!!
It is not a bug, it is a feature that is simply missing the associated requirement. If your specs were complete you would have known that.
Remember to always misinterpret the request for a quote.
I have thought about that paradox before, and I agree that the intepreter code running in the cog would have no time to actually execute the spin code. I have looked in detail at the spin interpreter source posted by Parallax, and there's no way that that code could actually be intepreting and executing the spin bytecodes in hub RAM. The actual PASM code that gets loaded is scrambled in the ROM, so there is no evidence that this matches the intepreter source code that was posted.
I have studied the picture of the Prop die that shows the cogs, cog RAM and hub RAM. However, there seems to be areas in the picture that have no function. Collectively, I call these unidentified sections of the prop chip Area 51. My theory is the spin engine is actually implemented in the random logic in Area 51. Based on what I can piece together, the spin engine consists of a few thousand gates, has 8 16-bit registers and 8 32-bit registers, and it is clocked at 1/64th of the system clock rate, or 1.25 MHz.
Dave
Disclaimer: The above comments are not backed up by any facts. They are only random thoughts that would have been produced by drinking too many beers.
Chip discovered a rift in the fabric of existence where it's possible to harness computational power from the entropy of space.
"So nat'ralists observe, a flea
Hath smaller fleas that on him prey,
And these have smaller fleas that bite 'em,
And so proceed ad infinitum."
Yes, I see it all now, it's turtles all the way down!
http://en.wikipedia.org/wiki/Turtles_all_the_way_down
Wouldn't it be cool to execute some code on your "Paradox Impeller" ?
Of course you should make use of all 8 clogs.
/Ahle2
In reality, it's counter-clockwise.
Therefore, it has the results of the instructions first, so it doesn't have to do any decoding or executing or any other hard thing. It just sits there waiting for you to do something with the data. All the stuff on the chip is just decoration in case someone looks at it.
Maybe I've had a tad too much cold medicine?
Walter
-Phil
Trust the cog.
Use the cog.
Walter, I believe the cog's spin is actually anti-counter-clockwise.
The only way it can run code is to use post-predictive instruction execution.
Bean
It needs to be in Latin for maximum effect:
Cog crede.
Cog uti.
I'm sure there's a snappy Gregorian melody that it could be put to as well.
-Phil
Simple answer. What Parallax has created here is beyond the comprehension of mere mortal man. It is consistent with the finite mind trying to comprehend the infinite wonder of the cosmos. Just believe.
Or as I tell my wife, "Don't worry your pretty little head about it dahlin".
But it's a pro-peller. Therefore it must spin pro-counter-clockwise. If it was anti-counter-clockwise all the output data would get jammed into the input pins and cause a jam.
Walter
(that mantra is on my office wall now, BTW Latin version. Can't wait for the side discussions
OBC
Felis crede.
Felis uti.
-browz
Paul
But enough of that, the real answer is painfully obvious when you think about it:
The "prop" is actually a standard 32-bit micro with 64k of flash, that simply "fakes" having 8 cores using an incredibly complex system of interrupts.
Once you realise this, everything makes sense:
Q1: Why no on-chip non-volatile storage? A: Because if the programmer could access the flash the ruse would be revealed.
Q2: Why no native C? A: The prop runs C internally, but must run an interpreted language because of the answer to Q1.
Q3: Why no interrupts? A: They are all used up to simulate "cogs" for us foolish simpletons who don't use "real" micros.
Obviously the prop must run C natively and use interrupts internally - I've read enough threads around here to see that it is impossible to have a "real" micro without them... apparently