AI Engine SystemC Simulator - 2023.1 English

AI Engine Tools and Flows User Guide (UG1076)

Document ID
UG1076
Release Date
2023-06-23
Version
2023.1 English

The AMD Versal™ adaptive SoC AI Engine SystemC simulator (aiesimulator) includes the modeling of the global memory (DDR memory) and the network on chip (NoC) in addition to the AI Engine array. When the application is compiled using the SystemC simulation target, the AI Engine SystemC simulator can be invoked as follows.

aiesimulator –-pkg-dir=./Work
Important: Using AI Engine simulator requires the setup described in Setting Up the Vitis Tool Environment.

The various configuration and binary files are generated by the AI Engine compiler under the Work directory (see Compiling an AI Engine Graph Application) and specified using the --pkg-dir option to the simulator. The graph is initialized, run, and terminated by a control thread expressed in the main application. The AI Engine compiler compiles that control thread with a PS IP wrapper to be directly loaded into the simulator.

By default, the graph.run() option specifies a graph that runs forever. The AI Engine compiler generates code to execute the data flow graph in a perpetual While loop, thus simulation also runs perpetually. To create terminating programs for debugging, specify graph.run(<number_of_iterations>) in your graph code to limit the execution for the specified number of iterations. The specified number of iterations can be any positive integer value.

Note: graph::run(-1) specifies the graph that runs forever.

The AI Engine simulator command first configures the simulator as specified in the compiler generated Work/config/scsim_config.json file. This includes loading PL IP blocks and their connections, configuring I/O data file drivers, and configuring the NoC and global memory (DDR memory) connections. It then executes the specified PS application and finally exits the simulator.

The AI Engine simulator has an optional --profile option, which enables printfs in kernel code to appear on the console, and also generates profile information. Also, the --dump-vcd <filename> option generates a value change dump (VCD) for the duration of the simulation. The --simulation-cycle-timeout <number-of-cycles> can be used to exit the simulation after a given number of clock cycles.

Important: If you do not provide either the clock cycles or the number of runs to graph.run() the simulation runs forever. You need to press Ctrl+c twice to exit the simulator.
Tip: You might observe cycle count differences between simulation runs on the same design. This is because the simulator waits for a few seconds for all pending transactions (such as DMA) to finish. During this wait time, the simulator process is still ticking but can be context-switched by the OS and total cycles can be different for each run. To ensure that the total cycles are the same for each run, you should use the AI Engine simulator --simulation-cycle-timeout option to stop the simulator on the exact cycle. The total cycles that appear on the profiling report are same on each run.
Note: Do not include <iostream> in the kernel code to enable printfs. The use of #include <iostream> in the kernel code results in a compilation error for both the x86 simulator and the SystemC simulators.

Graphs and Sub-Graphs Simulation Run Times

On an AI Engine design consisting of a larger graph composed of smaller sub-graphs, it is recommended to simulate the individual sub graphs first. Once the sub-graphs are verified and meet requirements in terms of functionality and performance, simulation of the larger graph can be attempted. Typically, depending on the size of the sub graphs, simulation time for the larger graph might take longer.