How to output on multiple ports in parallel

  • version

    1.1.1

  • scope

    Example.

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

  • description

    How to output 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 driven in parallel on these ports.

The statement:

sync(out_port_a);

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

for(char c = 'A'; c <= 'Z'; ++c) {
  out_port_a <: (char) (c & 0xF0) >> 4;
  out_port_b <: (char) (c & 0x0F);
}

are both executed in the same clock period.