i wonder how it works to have all #4 cores operating on the same XS1_PORT_1A 1-bit port?
As it is incomplete in the document i used this one for tests:
Code: Select all
#include <stdio.h>
#include <platform.h>
port p[4] = {
on stdcore [0] : XS1_PORT_1A,
on stdcore [1] : XS1_PORT_1A,
on stdcore [2] : XS1_PORT_1A,
on stdcore [3] : XS1_PORT_1A
};
void node ( chanend input, chanend output, port p, int n)
{
for (int i = 0; i<10; ++i) {
int val;
if (n == 0) {
// source & drain of data
val = i;
output <: val;
printf("%d: generate %d\n", n, val);
input :> val;
printf("%d: consume %d\n", n, val);
}
else {
input :> val;
// printf("%d: rcv %d\n", n, val);
val = val*2;
// printf("%d: snd %d\n", n, val);
output <: val;
}
}
}
int main ( void ) {
chan c [4];
par ( int i=0; i <4; i ++) {
on stdcore [i] : node(c[i], c[(i+1)%4], p[i], i);
}
return 0;
}
Frank