Friday 3 June 2011

VFPv3/SIMD Assembler Progressing

The last couple of days have been spent full-time on the VFPv3 / SIMD assembler for BASIC.  It's now approaching a first complete version as I've been through a lot of tidying up and commenting.  Some SIMD instructions remain to add as it's a very large instruction set but all the major ones are there now.

The exercise in writing an assembler has been fantastic in getting an understanding of the instructions and their uses.  I've had to read through the variations of each instruction and the associated encoding formats.  The only headache has been errors and inconsistencies in the ARM reference manual.   I guess with everyone using C compilers these days few people delve into raw machine code.

The reason for all this work on VFP is to create a new 3D calculations library for TAG.  This has to run using hardware floating point to achieve the performance and accuracy we require.  We've decided not to go with Mesa Open GL now as it won't run fast enough and will take significant effort to get running.  However we will revisit it in future if time permits.  An open source driver for the PowerVR/SGX hardware may well end up in the Mesa code-base.

Today I also downloaded the RISC OS source and took a look at the BASIC source code.   The idea is to add the VFP and SIMD instructions to the BASIC assembler while learning about how it works to add language extensions.  Sadly the code appears poorly structured and documented.  Thankfully it isn't that large so it should be possible to digest what is going on.  I'll try and get my head around it after I've completed the VFP library.