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?

Postby Chendy » Thu Feb 07, 2013 3:44 pm

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: 768
Joined: Thu Dec 10, 2009 9:20 pm

Postby Ross » Thu Feb 07, 2013 8:54 pm

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

Postby Berni » Thu Feb 07, 2013 11:28 pm

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

Postby yzoer » Fri Feb 08, 2013 2:11 am

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

Postby Chendy » Sat Feb 09, 2013 7:20 pm

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

Who is online

Users browsing this forum: No registered users and 1 guest