Re: XUF224 channel comms
Posted: Mon Feb 19, 2018 1:48 pm
We really need these information to understand where is the blocking issue and how to re-write the code to hope to get around this problem without adding too much latency.
The community of XMOS. The place to be when developing with XMOS technology.
https://www.xcore.com:443/
Code: Select all
// Tests the latency and throughput of xCONNECT
// xcc chanComms.xc XCORE-200-EXPLORER.xn -o chanComms.xe
#include <platform.h>
#include <stdio.h>
#include <xs1.h>
#define PACKET_SIZE 1024
void foo(streaming chanend c)
{
unsigned count = 0;
unsigned rxd = 0;
timer t;
int start_time, end_time, overhead_time;
t :> start_time; t :> end_time; overhead_time = end_time - start_time;
t :> start_time;
#pragma loop unroll
for (unsigned i = 0; i < PACKET_SIZE; i++) {
c <: count;
count++;
}
t :> end_time;
printf ("foo Tx : start = %d, period = %d cycles\n", start_time, end_time - start_time - overhead_time);
t :> start_time;
#pragma loop unroll
for (unsigned i = 0; i < PACKET_SIZE; i++) {
c :> rxd;
}
t :> end_time;
printf ("foo Rx : start = %d, period = %d cycles\n", start_time, end_time - start_time - overhead_time);
}
void bar(streaming chanend c)
{
unsigned count = 0;
unsigned rxd = 0;
timer t;
int start_time, end_time, overhead_time;
t :> start_time; t :> end_time; overhead_time = end_time - start_time;
t :> start_time;
#pragma loop unroll
for (unsigned i = 0; i < PACKET_SIZE; i++) {
c :> rxd;
}
t :> end_time;
printf ("bar Rx : start = %d, period = %d cycles\n", start_time, end_time - start_time - overhead_time);
t :> start_time;
#pragma loop unroll
for (unsigned i = 0; i < PACKET_SIZE; i++) {
c <: count;
count++;
}
t :> end_time;
printf ("bar Tx : start = %d, period = %d cycles\n", start_time, end_time - start_time - overhead_time);
}
int main(){
streaming chan c;
par{
on tile[0]:foo(c);
on tile[1]:bar(c);
// on tile[0]:bar(c);
}
return 0;
}