Home About Projects PIC code SX code
Here is some code converted from the PIC collection and some more SX specific routines.

Please send any questions or comments to golovchenko@mail.ru, or the PICList (with the topic tag [SX]: in the subject).

Routine Name Size, instructions Max timing, cycles Temporary registers Notes
Multiplication
24 by 24 bits 29 537 1
Division
8 by 8 bits to 24 bit floating point 41 449 1
16 by 8 bits with Q16.16 fixed point result 39 491 1
24 by 16 bits 28 632 3
32 by 16 bits using 16 by 16 bits with a 16 bit result 36 377 2/4
48 by 24 bits (and one using CARRYX option) 59/51 1558/1366 5
48 by 23 bits 52 1366 4
Divide 14 bit integer using a fixed point divisor and result (7Q8 format) 27 295 0
Square Root
24 bit floating point 85 438 6 IEEE<>Microchip format conversion
12 bit integer 32 124 3
8 bit 20 70 2
8 bit fast 29 31 1 See also a faster one for PICs
8 bit small 10 135 0
Routine Name Size, instructions Max timing, cycles Temporary registers Notes
CORDIC
Vector magnitude, 16 bits 147 ~1700/850 4
Radix Conversion
16 bit binary to 5 digit decimal 73 251 0 strips a digit at a time
5 digit decimal to 16 bit binary 35 40 0
5 digit decimal (BCD) to 16 bit binary 23 358 1
Miscellaneous
8 bit random number generator 11 11 0 my version at the bottom
Delay exactly N cycles - - 0 scalable for any N size; at the bottom of the page
Wait for RTCC overflow with zero jitter 11 - 0 Used in main code for time critical apps; no prescaler
Test code detecting video horizontal sync using the built-in comparator and software PLL
Routine Name Size, instructions Max timing, cycles Temporary registers Notes

: "
"