There are two examples shipped with the Vivado Design Suite that can help you understand how to use DPI in Vivado simulator. Locate these in your installation directory, <vivado installation dir>/examples/xsim/systemverilog/dpi. Each includes a
README file that can help you get started. The examples include:
simple_import: simple import of pure function
simple_export: simple export of pure functionTip: When the return value of a function is computed solely on the value of its inputs, it is called a "pure function."