Writing the Test Bench Code - 2021.2 English

Vivado Design Suite User Guide: Logic Simulation (UG900)

Document ID
UG900
Release Date
2021-10-22
Version
2021.2 English

A C/C++ test bench using XSI typically uses the following steps:

  1. Open the design.
  2. Fetch the IDs of each top-level port.
  3. Repeat the following until the simulation is finished:
    1. Set values on top-level input ports.
    2. Run the simulation for a specific amount of time.
    3. Fetch the values of top-level output ports.
  4. Close the design.

The following table lists the XSI functions and their Xsi::Loader member function equivalents to use for each step. You can find the usage details for each XSI function in the XSI Function Reference.

Table 1. Xsi::Loader member functions
Activity XSI Function Xsi::Loader Member Function
Open the design xsi_open open
Fetch a port ID xsi_get_port_number get_port_number
Set an input port value xsi_put_value put_value
Run the simulation xsi_run run
Fetch an output port value xsi_get_value get_value
Close the design xsi_close close

You can find the example C++ programs that use XSI in your Vivado simulator installation at the following location:

<Vivado Installation Root>/examples/xsim/<HDL language>/xsi