[Nottingham] A Little Coding Gem

Martin martin at ml1.co.uk
Thu Nov 15 22:22:09 UTC 2012


On 15/11/12 22:01, Camilo Mesias wrote:
> Back in the days of 8-bit micros the fastest way I could find to do that
> was a look-up table. I wonder if modern CPUs with fancy caches and
> pipelined architecture could go fastest that way or using the code
> snippet above...

Yep... Done that trick before now, even using an entire EPROM of old as
a sort of calibration table upon occasion... (Source parameters go onto
the address lines, answer is output on the data lines faster than the
Z80 can read the next instruction to read the EPROM result!)

Indeed, modern FPUs are part lookup table and part pipelined arithmetic
accumulators. I believe the infamous FDIV bug was from getting that
wrong for a few missing bits...

But...

Isn't that 'cheating'?

And can't we rattle off a surprisingly long series of CPU register
operations in the time needed for a single read of a system ram address?


I'm also wondering if that original code could be made even more
efficient and a general case for whatever register word length...

Cheers,
Martin

-- 
- ------------------ - ----------------------------------------
-    Martin Lomas    - OpenPGP (GPG/PGP) Public Key: 0xCEE1D3B7
- martin @ ml1 co uk - Import from   hkp://subkeys.pgp.net   or
- ------------------ - http:// ml1 .co .uk/martin_ml1_co_uk.gpg



More information about the Nottingham mailing list