So there are a bunch of compiling methods/software's for the P2, from Basic to C; but how do they each fair in a pin toggling speed test.
I suspect PASM will destroy all, but will it ?
Anyone have a fast high speed frequency counter who can test each software at toggling a pin and record the results here?
Comments
Is using smartpins cheating? If not, then even the slowest P2 language can toggle a pin at the theoretical maximum rate of sysclk/2. The hard part of fast I/O on the P2 tends to be more a matter of getting the cog to dance in step with the smartpins rather than of just manually twiddling pins as fast as possible, which is nowhere near as fast.
I am thinking more of the compiled code than the direct ability of the P2.
That challenge is too easy for Flexspin. Flexspin will compile all its supported languages to the same sequence of instructions. Which will be the same speed as hand crafted Pasm. That's because there is primitives added in each language for the DRVx/FLTL instructions, eg: Spin uses PINH/PINL/PINT/PINF.
The only question mark is how to trigger the REP instruction compiler optimisation.
Here's the Pasm for bit-bashing at sysclock/4 pin frequency - Assuming it's running in cogRAM.
An equivalent (same speed) would be:
Yep, here's an example:
And the resulting compiled .p2asm:
So that CALLPA even automatically drops the loop into cogRAM for max speed.
The really interesting question is, how can you split a task into 8, which can run on 8 cogs in parallel? I have not yet seen a compiler, which can do this?
You haven't seen a compiler that can do this because, in the general case, it's mathematically impossible...
Nine women can't make a baby in one month.
Catalina can.
Here is a a trivial implementation of the Sieve of Eratosthenes, which Catalina speeds up by a factor of 4 by spreading the algorithm across multiple cogs (in general, the actual speed up factor depends on both the algorithm and the number of available cogs):
In the Catalina 'Parallelizer' documentation, you will find another example - speeding up a Fast Fourier Transform algorithm. In that case, the speed improvement is about 2.5 times.
Ross.
Ross,
Just been looking at Catalina. You've got something strange going on with the .TXT doc files. Every time Sometimes when you've used the double quote character, your editor seems to be inserting something not from ASCII. And it doesn't simply convert to ASCII in my editor.
Eg:
xcopy /e /i %LCCDIR%\demos %HOMEPATH%\demos\
EDIT: Ah, reply to this message to see it. Its code is 0x94.
EDIT2: Actually, might be just README_P2.TXT alone. I just happened to look at this one first.
Yes, I see what you mean. Some spurious binary characters have ended up in that file, with value 0x94. Only that file, it seems - probably from cutting and pasting characters from a terminal window.
Attached is the file with those characters removed.
Thanks,
Ross.
Oops: Forgot to add back in the double quotes - file updated again!
Thanks for the information!
Christof