Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
XMOS
    XMOS XS1 Chip
XC programming language



                  Ruben Vandamme

                  Christophe Schollier...
Introduction
      ●   XMOS XS1 chip
          ●   multicore,
              multithreaded chip
          ●   event-driven
...
Multicore - multithreaded
                        ●   4 XCores/CPUs
                        ●   Max 8 threads per
        ...
Event driven
●   Threads can subscribe to events
    ●   a timer has past
    ●   a button is pushed
    ●   another threa...
Concurrency support
                                     ●   Par
par                                      ●   runs functio...
Communication between threads
void sender ( chanend output )
{
                                  ●   Channels & chanends
 ...
Channels in hardware
                         ●   Communication
                             ●   in a single XCore
       ...
Sum + Divide
                                               ●   Pipeline
           54321
                            ...
Sum + Divide (2)
void init(chanend outi){                       init
    outi <: 5;
}
                                    ...
Sum + Divide (3)

int main(void)
                                               ●   Steps can concurrently
{
    chan star...
Select statement
                                  ●   ≠ switch statement
select                                ●   all ca...
Bounded buffer
                            data                   data
                                       buffer




 ...
Bounded buffer (2)
                                          ●   Timers
void producerprocess(chanend buffer){
    for(int ...
Bounded buffer (3)
void boundedbuffer(chanend producer, chanend consumer){
    int moreSignal;
    int buffer[12];
    int...
Bounded buffer (4)

int main(void){

    chan producer, consumer;

    par
    {
          on stdcore[0] : boundedbuffer( ...
Purpose
●   Architecture designed for
    ●   DSP
    ●   audio, video
    ●   networking


●   Port Scheme
    ●   allow ...
Questions ?




              17
Upcoming SlideShare
Loading in …5
×

XMOS XS1 and XC

1,717 views

Published on

Published in: Technology

XMOS XS1 and XC

  1. 1. XMOS XMOS XS1 Chip XC programming language Ruben Vandamme Christophe Scholliers Coen De Roover 1
  2. 2. Introduction ● XMOS XS1 chip ● multicore, multithreaded chip ● event-driven ● similar to Transputer ● XC ● allows use of special features of the chip ● based upon CSP ● C/C++ support 2
  3. 3. Multicore - multithreaded ● 4 XCores/CPUs ● Max 8 threads per XCore ● ↔ java threads ● message passing ● preemptive scheduling ● Every XCore has I/O ● JTAG for debugging 3 Source: XMOS
  4. 4. Event driven ● Threads can subscribe to events ● a timer has past ● a button is pushed ● another thread wants to send data ● Supported in hardware ● no need for interrupts ● with extra event conditions 4
  5. 5. Concurrency support ● Par par ● runs functions in { on stdcore[0] : function1(); parallel/interleaved (fork) on stdcore[1] : function2(); } ... ● ends when all functions have returned (join) ● assign a thread to a core 5
  6. 6. Communication between threads void sender ( chanend output ) { ● Channels & chanends output<:1; } ● mapping by compiler void receiver ( chanend input ) { ● two way int i; input:>i; printf("%d",i); ● blocking } void main() ● Write to channel { chan channel; ● chanend <: value par { sender(channel); ● Read from channel receiver(channel); } return 0; ● chanend :> variable } ● Printf() ● shows data in IDE 6
  7. 7. Channels in hardware ● Communication ● in a single XCore ● to another XCore ● to another XS chip ● Transparant but increasing latency 7 Source: XMOS
  8. 8. Sum + Divide ● Pipeline 54321 ● sum f 5 : =3 divide 5 ● 321 f 3 : =2 3 init start sum calc divide end result 5 5+4..+1=15 15/5=3 3 8 Source: Parallel Processing (The Transputer and Occam), A. Carling
  9. 9. Sum + Divide (2) void init(chanend outi){ init outi <: 5; } outi void sum(chanend ins, chanend outs){ int max, sum = 0; ins:>max; ins for (int i = 0 ; i <= max ; i++) sum+=i; divide outs<:max; outs<:sum; } outs void divide(chanend divi, chanend divo){ int average, sum, max; divi divi:>max; divi:>sum; average = sum/max; sum divo<:average; } divo void result(chanend resi){ int result; resi resi:>result; printf("result: %d", result); } result 9
  10. 10. Sum + Divide (3) int main(void) ● Steps can concurrently { chan start, calc, par end; ● But communication is { on stdcore[0] : init(start); blocking on stdcore[1] : sum(start, calc); on stdcore[2] : average(calc, end); on stdcore[3] : result(end); } return 0; } 10
  11. 11. Select statement ● ≠ switch statement select ● all case predicates are evaluated { case a == 1 => input1 :> c: ... ● boolean guard => input resource break; case a == 2 => input2 :> c: ... ● Select an alternative if break; } ... ● Boolean guard evaluates to true ● Checks whether resource is ready, but does not block ● Selection is non-deterministic but fair 11
  12. 12. Bounded buffer data data buffer producer consumer more ● Asynchronous producer & consumer ● Bounded together with a buffer ● Used when producing rate ≠ consuming rate 12 Source: Communicating Sequential Processes, C.A.R Hoare
  13. 13. Bounded buffer (2) ● Timers void producerprocess(chanend buffer){ for(int i = 0 ; i<= 15 ; i++){ ● wait until a specified time buffer <: i; } printf("producing %dn", i); ● read the current time } void consumerprocess(chanend buffer){ timer tc; ● not reset int i, t = CONSUMER_DELAY; while(1){ ● can be used in select to tc when timerafter(t) :> void; t += CONSUMER_DELAY; create a timeout buffer <: 1; // more signal buffer :> i; printf("consuming %dn", i); ● supported in hardware } } 13
  14. 14. Bounded buffer (3) void boundedbuffer(chanend producer, chanend consumer){ int moreSignal; int buffer[12]; int inp = 0; int outp = 0; while(1){ select{ case inp < outp + 12 => producer :> buffer[inp % 12]: inp++; break; case outp < inp => consumer :> moreSignal: consumer <: buffer[outp % 12]; outp++; break; } } } 0 1 2 3 4 5 6 7 8 9 10 11 1 1 1 1 outp=3 inp=7 14
  15. 15. Bounded buffer (4) int main(void){ chan producer, consumer; par { on stdcore[0] : boundedbuffer( producer, consumer ); on stdcore[1] : consumerprocess( consumer); on stdcore[2] : producerprocess( producer ); } return 0; } 15
  16. 16. Purpose ● Architecture designed for ● DSP ● audio, video ● networking ● Port Scheme ● allow usage of XC features via Scheme ● XMOS challenge 16
  17. 17. Questions ? 17

×