How to input on multiple ports in parallel

  • version

    1.0.1

  • scope

    Example.

    This code is provided as example code for a user to base their code on.

  • description

    How to input on multiple ports in parallel

  • boards

    Unless otherwise specified, this example runs on the SliceKIT Core Board, but can easily be run on any XMOS device by using a different XN file.

By configuring more than one buffered port to be clocked from the same source, a single thread can cause data to be sampled in parallel on these ports.

The statement

sync(in_port_a);

causes the processor to wait until the next falling edge on which the last data in the buffer has been sampled for a full period, ensuring that the next instruction is executed just after a falling edge. This ensures that the subsequent two input statements in the loop

while(1) {
  in_port_a :> in_val_a;
  in_port_b :> in_val_b;
}

are both executed in the same clock period.