Edge triggering?

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
Woody
XCore Addict
Posts: 165
Joined: Wed Feb 10, 2010 2:32 pm

Post by Woody »

With the process thread written as is, how do you know if you receive the start time before the stop time?

I would replace the code you just posted with something more like this:

Code: Select all

void process(streaming chanend c_start, streaming chanend c_stop, streaming chanend c_data)
{
.....................
  c_start :> start:
  c_stop :> stop:
  temp = stop - start;
/
This way you can be sure that you have received the start time and the stop time before computing the delay.


JohnR
Experienced Member
Posts: 93
Joined: Fri Dec 11, 2009 1:39 pm

Post by JohnR »

Hi Woody,

Sorry to keep pestering you!

I have just looked at the generated assembly code. It seems to me that we have just too many lines to execute and then we have two threads to run.

The while forever loop in the stop_channel is

Code: Select all

         peek      r2, res[r0] 
          bf        r2, .L26 
          bu        .L25 
.L26:
.L37:
.L36:
          clre      
          mkmsk     r2, 0x1
          setd      res[r0], r2
          setc      res[r0], 0x11
          ldap      r11, .L30
          setv      res[r0], r11
          eeu       res[r0]
.xtabranch .L30
          waiteu    
.L30:
.L38:
.L41:
          getts     r3, res[r0] 
.L42:
          in        r2, res[r0] 
          bu        .L29 
This is repeated for the start code. I wonder if , rather than using separate threads, I wrote a single function that handled both stop and start, used a lot more registers to avoid reloading the various resource parameters every time, would we get rid of some of the time offset??

John.
JohnR
Experienced Member
Posts: 93
Joined: Fri Dec 11, 2009 1:39 pm

Post by JohnR »

Hi,

I had not read your last message before posting my message.

I tried your suggestion but I could not get it to work - I will try some more in a while.

John.
Post Reply