The following should build:
main.xc:
Code: Select all
#include <xs1.h>
#include <platform.h>
unsigned channel_input(chanend c)
{
unsigned x;
c :> x;
return x;
}
void xc1(chanend c)
{
c <: (unsigned) 1;
}
void xc2(chanend c)
{
c <: (unsigned) 2;
}
void c(chanend c1, chanend c2);
int main(){
chan ch1,ch2;
par{
on tile[1]: xc1(ch1);
on tile[1]: xc2(ch2);
on tile[1]: c(ch1,ch2);
}
}
cee.c:
Code: Select all
#include <xccompat.h>
#include <print.h>
#include <xs1.h>
unsigned channel_input(chanend c);
void c(chanend c1, chanend c2)
{
unsigned x;
x = channel_input(c1);
printintln(x);
x = channel_input(c2);
printintln(x);
}
build with: xcc main.xc cee.c -target=SLICEKIT-L16
run in the simulator with:
xsim a.xe
Gives the output: