Compiling C Code - 2022.2 English

Vivado Design Suite User Guide: Logic Simulation (UG900)

Document ID
UG900
Release Date
2022-10-19
Version
2022.2 English

A new compiler executable, xsc, is provided to convert C code into an object code file and to link multiple object code files into a shared library (.a on Windows and .so on Linux). The xsc compiler is available in the <Vivado installation>/bin directory. You can use -sv_lib to pass the shared library containing your C code to the Vivado simulator/elaborator executable. The xsc compiler works in the same way as a C compiler, such as gcc. The xsc compiler:

  • Calls the LLVM clang compiler to convert C code into object code
  • Calls the GNU linker to create a shared library (.a on Windows and .so on Linux) from one or more object files corresponding to the C files

The shared library generated by the xsc compiler is linked with the Vivado simulator kernel using one or more newly added switches in xelab, as described below. The simulation snapshot created by xelab thus has ability to connect the compiled C code with compiled SystemVerilog code and effect communication between C and SystemVerilog.