x86 Functional Simulator - 2025.2 English - UG1076

AI Engine Tools and Flows User Guide (UG1076)

Document ID
UG1076
Release Date
2025-11-20
Version
2025.2 English

Using functional simulation, you can verify design behavior when starting development on AI Engine graphs and kernels. Verification is useful for identifying errors in the design. For example, window sizes in the graph relate to the number of iterations in a kernel. Troubleshooting to see if every kernel in a large graph absorbs and generates the right number of samples can be time consuming and iterative.

The x86 simulator is an ideal choice to test, debug, and verify this behavior. The simulator provides fast iteration and a high level of data visibility. The x86 simulation does not provide timing, resource, or performance information. The x86 simulator runs exclusively on the tool development machine. This means the development machine defines its performance and memory use.

The AI Engine simulator fully models the memory of the graphs and kernels. This means that the memory space of the AI Engine limits the AI Engine simulator. Memory space does not limit the x86 simulator, which provides an almost unlimited number of debug printf()s, large arrays, and variables. When combined with the ability to single step through the kernel, you can quickly isolate and address complex design issues.

Several provided macros improve kernel debugging. You can use these macros with the x86 simulator, and leave them in the code for maintainability purposes. With the benefits of the x86 simulator come some trade offs. These trade off are as follows:

  • Several types of graph constructs are unsupported.
  • Cycle-accurate behavior between the AI Engine simulator and the x86 simulator might not match.
  • The x86 simulator does not replace the AI Engine simulator.
  • You must still run the AI Engine simulator on all designs to verify behavior and obtain performance information. Choose the tool that best suits your needs at each stage of project development.
Note: You can learn more about x86 simulation limitations in Limitations.

To run the x86 simulator, change the AI Engine compiler target to x86sim.

v++ -c --mode aie --target=x86sim graph.cpp

After the application is compiled for x86 simulation, invoke the x86 simulator using the following command.

x86simulator

To see the available x86simulator options, there is a help dialog displayed with x86simulator --help.

The AI Engine compiler produces the compiled binary for x86 native simulation in the Work directory (see Compiling an AI Engine Graph Application). The x86 simulator automatically starts the binary.

The following snippet of graph code specifies the input and the output files.

adf::input_plio in1=adf::input_plio::create("In", adf::plio_32_bits, "In1.txt");
adf::output_plio out1=adf::output_plio::create("Out", adf::plio_32_bits, "Out1.txt");

When running, the x86 simulator looks in the current working directory for In1.txt which is one of the inputs used by the ADF graph. Verify the design simulator to distinguish the output files for the x86 simulator from the output files for the AI Engine graphs and kernels. The current_working_dir/x86simulator_output/data/ contains the Out1.txt files.

If you use a comma separated value (CSV) input file, the input file name is changed to In1.csv.

Optionally, you can compare the output files produced by the simulator with a golden output ignoring white space differences.

diff –w <data>/golden.txt <data>/output.txt

You can visualize simulator logs and output in the Vitis IDE:

Figure 1. Log View
Figure 2. Simulator Output View

You can select which output to display using the Simulator Output View.