A slave statement may be used in the guard of a select state

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm

A slave statement may be used in the guard of a select state

Post by Folknology »

This snippet

Code: Select all

transaction inArray ( chanend c , int data [] , int size ) {
  for ( int i =0; i < size ; i ++)
    c : > data [ i ];
}
Along with:
A slave statement may be used in the guard of a select statement, as in:

Code: Select all

       select {
          case slave { inArray ( c1 , packet , P_SIZE ); } :
            process ( packet );
            break ;
          case slave { inArray ( c2 , packet , P_SIZE ); } :
            process ( packet );
            break ;
       }
Is presented in the XC manual which I was revisiting to try and understand transactions and master slave concurrency. Unfortunately a 'main()' example is not provided for this version of the slave select. As such I am having trouble getting my head around how this works and in which kind of situation it might prove useful. I would appreciate someone with a better understanding of this filling in the blanks for me please. It might also help others confused by this part of the manual.

regards
Al
Last edited by Folknology on Tue May 25, 2010 5:26 pm, edited 1 time in total.


User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Post by lilltroll »

I have read that part many times in the manual as well - and I still haven't found "the light".
Probably not the most confused programmer anymore on the XCORE forum.
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm

Post by Folknology »

One thought occurred to me is this some form of transactional broadcast, that illusive 1 to many albeit in a specialised form?
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm

Post by Folknology »

Doug helped answer this in response to my queries around section 3.4 of the programming XC manual