Printf() Macros - 2021.2 English

Versal ACAP AI Engine Programming Environment User Guide (UG1076)

Document ID
English (United States)
Release Date
2021.2 English

The x86 simulator executes multiple kernels in parallel on separate threads. This means that printf() debug messages can often be interleaved and non-deterministic when viewed in standard output. To help identify which kernel is printing which line the X86SIM_KERNEL_NAME macro can be useful. The following is an example showing how to combine it with printf().

Note: To use X86SIM_KERNEL_NAME you must include adf/x86sim/x86simDebug.h as shown in the following code.
#include <adf/x86sim/x86simDebug.h>

void simple(input_window_float * in, output_window_float * out) {
   for (unsigned i=0; i<NUM_SAMPLES;i++) {
       float val = window_readincr(in);
   static int count = 0;
   printf("%s: %s %d\n",__FILE__,X86SIM_KERNEL_NAME,++count);