64 bit math operations? Clock cycles per operation?

New to XMOS and XCore? Get started here.
User avatar
Chendy
Active Member
Posts: 46
Joined: Tue Nov 02, 2010 4:53 pm

64 bit math operations? Clock cycles per operation?

Post by Chendy »

Hi all,

I understand that 64x64 multiply, MAC and other math operations can be achieved through the c compiler (as they are not supported directly by the hardware):

http://www.xmos.com/discuss/viewtopic.php?f=6&t=809

But how long do the various math operations take?
... or where is the code so I can try and figure out how many operations each of the library function takes

I would appreciate any thoughts/advice on 64 bit math.

Senthil


User avatar
Ross
XCore Expert
Posts: 968
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

That is quite an old thread, you can use long long in xc now :)
User avatar
Berni
Respected Member
Posts: 363
Joined: Thu Dec 10, 2009 10:17 pm

Post by Berni »

You might be able to look at the disassembly of the code to see how many instructions that line translates in to, but if you want to know how fast it with optimizations on you can create a timer in xc. They count by default at 100MHz so if you create two variables and grab the timers value before and after the multiply operation and subtract the two you get how many cycles it tock to get there.(Might be a good idea to copy paste 10 multiplys and measure that so you get a more accurate reading)
yzoer
XCore Addict
Posts: 133
Joined: Tue Dec 15, 2009 10:23 pm

Post by yzoer »

Looking at the XS1-instruction manual, LADD takes two 32-bit values and a carry-in, resulting in a 32-bit result + carry out. So for a full 64-bits you would need two instructions (low and high part of 64-bit value). Assuming they execute in a single cycle each, so 2 clocks total.

LDIVU execution time is longer as there's just one division unit that's shared between all threads cores (still trying to get used to it).

LMUL/MACCU should all be single cycle IIRC but depending on the rev may need to be split up in multiple instructions.

-Yvo
User avatar
Chendy
Active Member
Posts: 46
Joined: Tue Nov 02, 2010 4:53 pm

Post by Chendy »

Can anybody link me to the relevant documentation please. I have not managed to find any documentation relating to 64 bit arithmetic.

ross commented:

'That is quite an old thread, you can use long long in xc now'

but that seems at odds with:

http://www.xmos.com/xs1-data-types