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.
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
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.
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.
graph.run()the simulation runs forever. You need to press Ctrl+c twice to exit the simulator.
--simulation-cycle-timeoutoption to stop the simulator on the exact cycle. The total cycles that appear on the profiling report are same on each run.
<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.