The simplest form of tracing is to use a formatted printf() statement in the code for printing debug messages. Visual inspection of intermediate values and addresses can help you understand the progress of program execution. You can add printf() statements to your code to be processed during x86 simulation, and remove them or comment them out for hardware builds. To help identify which kernel is printing which line, the X86SIM_KERNEL_NAME macro can be useful.
This section talks about adding a printf() statement in the source code, compile and run x86simulator, and check the output in the console.
From the Vitis IDE, browse to the [AI Engine] component and expand Sources → kernels → click on
peak_detect.cc.Add
#include <adf/x86sim/x86simDebug.h>at the beginning of the source file andprintf("%s: %s, %d\n", __FUNCTION__, X86SIM_KERNEL_NAME, __LINE__);after for the loop.To compile the project, select the Build option under X86 SIMULATION in FLOW navigator.
To run the project, select the Run option under X86SIMULATION in Flow navigator.
The expected result is as follows.
Remove the added
printfstatement from thepeak_detect.ccfile to use it for other features.