I need to perform 64 and 128 bit operations with numbers made up of a sequence of bytes. I need to perform add and multiply on signed and unsigned numbers. Are add and multiply available in AVR-GCC for this type of numbers?
What I have done is to implement a MAC (multiply-accumulate) in an FPGA that is connected to my 'mega16 by means of SPI. (The SPI works, so it's only the GCC math libs I'm uncertain about.) The FPGA code is in development, and I really need to verify it. And generic tools aren't well suited for 128-bit numbers.
The FPGA MAC is designed to multiply signed 64-bit numbers and add (accumulate) those in a signed 128-bit register. I'd like my 'mega16 to generate random or sequenced input to the MAC, send them as bytes to the FPGA, perform a 64x64->128 multiply and a 128+128 addition, and then compare its own result to the one from the FPGA.
The MAC does
X = X + A * B
where X is signed 128-bit, and A and B are signed 64-bit. However, I'd like to access the individual bytes of X, A and B in order to send them back and forth over SPI.
This doesn't have to be very speedy, but it needs to be 100% correct about the numbers. I'd basically set the MCU up to throw numbers at the FPGA all night, and halt the process if it detects a flaw.
The MCU is connected to a PC over an UART, so I could do the verification on the PC side, but I'd prefer to do the whole thing in the MCU.