Single thread at high speed?

Technical questions regarding the xTIMEcomposer, xSOFTip Explorer and Programming with XMOS.
User avatar
Juhizo
Member
Posts: 11
Joined: Thu Dec 10, 2009 10:16 pm
Location: Finland

Single thread at high speed?

Postby Juhizo » Sat Dec 12, 2009 2:30 pm

Hi,
is it possible to run single "thread" at full 400 MIPS speed on some core? I'll see from MIPS chart that four thread gets 100 mips each and so on, could these join to calculate single code without threading? And sorry about my bad english ;)
User avatar
Berni
Respected Member
Posts: 363
Joined: Thu Dec 10, 2009 10:17 pm

Postby Berni » Sat Dec 12, 2009 2:52 pm

Nope sadly you cant do that. You need to use threads to get all the MIPS.

You will get used to using threads once you work with it a while.
User avatar
Juhizo
Member
Posts: 11
Joined: Thu Dec 10, 2009 10:16 pm
Location: Finland

Postby Juhizo » Sat Dec 12, 2009 3:56 pm

Another question. I've modified VGA 8bpp code and want to do some maths to render graphics. I can't find solution to use sin, cos etc. operands inside XC file. Even including math includes.
Heater
Respected Member
Posts: 296
Joined: Thu Dec 10, 2009 10:33 pm

Postby Heater » Sat Dec 12, 2009 4:06 pm

XC does not support floating point types.

Do your float maths in C functions called from XC. Or have your main program in C making calls to XC functions to do the output.

You will have to cast to/from floats appropriately. But that has to happen to get onto the display anyway.

Alternatively, harder, find away to do what you want using fixed point arithmetic.
User avatar
Juhizo
Member
Posts: 11
Joined: Thu Dec 10, 2009 10:16 pm
Location: Finland

Postby Juhizo » Sat Dec 12, 2009 4:55 pm

Heater wrote:XC does not support floating point types.

Do your float maths in C functions called from XC. Or have your main program in C making calls to XC functions to do the output.

You will have to cast to/from floats appropriately. But that has to happen to get onto the display anyway.

Alternatively, harder, find away to do what you want using fixed point arithmetic.
Thanks, just found that myself from "Programming XC" PDF. Now have to learn how those calls must be done between XC and C. These things are just amazing, learning new things all the time :)
Heater
Respected Member
Posts: 296
Joined: Thu Dec 10, 2009 10:33 pm

Postby Heater » Sat Dec 12, 2009 5:10 pm

Normal calling from C to XC and vice-versa should be no problem as long as you don't use the unsupported XC types and pointers of course.

By the way, I just discovered that you can pass things like XC chanend and such into C and pass them back from C to XC. Have a look in compat.h

Very useful when you need your C code to input/output data on a channel at some point. Just pass the chanend in to C and have it pass that back to an XC function when it needs to do I/O.
yzoer
XCore Addict
Posts: 133
Joined: Tue Dec 15, 2009 10:23 pm

Postby yzoer » Tue Dec 15, 2009 10:57 pm

Fixed point is the way to go, particularly if you need performance. VDP-2 uses a single sine table with an extra 90 degrees worth of data tacked on the end to save space.

-Yvo

Who is online

Users browsing this forum: No registered users and 4 guests