Slowing Thread Speed

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
User avatar
Andy
Respected Member
Posts: 279
Joined: Fri Dec 11, 2009 1:34 pm

Slowing Thread Speed

Post by Andy »

Is there an easy way to slow the speed of a thread on a G4 device? I'd like to halve the operating speed from 100MHz to 50MHz and already have 4 threads running on the core.

I assume adding extra threads to slow the overall speed

Code: Select all

on stdcore[2]:
{
   while(1);
}
...
will not work as the loop will be optimised out in Release mode?


Heater
Respected Member
Posts: 296
Joined: Thu Dec 10, 2009 10:33 pm

Post by Heater »

You must be the first person in the history of computing that wants his processor to run slower!

Now I can see that slowing some processing might make it fit some timing constraints elsewhere but I'm fairly sure that slowing it down by loading up other threads is entirely the wrong way to go about it. It's like trying to make your car go slower by piling up sacks of concrete in the boot. Why not just take you foot off the gas?

The XMOS devices have timers that can be waited on when your code really needs to take a breather.

Things should be timed, synchronized and ordered in a systematic manner using the facilities available.
User avatar
Andy
Respected Member
Posts: 279
Joined: Fri Dec 11, 2009 1:34 pm

Post by Andy »

I should point out that I'm only looking for a quick method of testing a thread at lower speed... I'm not planning on actually slowing it down in the final application!
User avatar
trousers
Active Member
Posts: 44
Joined: Fri Dec 11, 2009 10:20 am
Contact:

Post by trousers »

You can change the system frequency in the XN.

If you haven't already copied the XN into your local directory, do that, then for each node, find the Node node and add two attributes: Oscillator="20Mhz" and SystemFrequency="200Mhz".

(Unless you're running on an XC-2, in which case you should use Oscillator="25Mhz", or a custom board where you should set it appropriately).

For example:

Code: Select all

<Node Id="0" Type="XS1-G4B-FB512" Oscillator="20Mhz" SystemFrequency="200Mhz">
Your reference clock will remain at 100Mhz.

IIRC this feature is working in all the 9.2.X releases.
Best friends with the code fairy.
User avatar
Andy
Respected Member
Posts: 279
Joined: Fri Dec 11, 2009 1:34 pm

Post by Andy »

Very useful, thanks.
Post Reply