Because Vitis HLS reuses the C test bench for RTL verification, it requires that the test bench and any associated files be denoted as test bench files when they are added to the Vitis HLS project. Files associated with the test bench are any files that are:
- Accessed by the test bench.
- Required for the test bench to operate correctly.
Examples of such files include the data files inA.dat and inB.dat in the example test bench. You must add these to the Vitis HLS project as test bench files.
The requirement for identifying test bench files in a Vitis HLS project does not require that the
design and test bench be in separate files (although separate files are
recommended). To demonstrate this, a new example is defined from the same code used
in Example Test Bench, except a new top-level
function is defined. In this example the function sumsub_func
is defined as the top-level function in the Vitis HLS project.
With the sumsub_func
function
defined as the top-level function, the higher-level function, hier_func
becomes part of the test bench, as it is the
calling function for sumsub_func
. The peer-level
shift_func
function is also now part of the
test bench, as it is a required part of the test. Even though these functions are in
the same code file as the top-level sumsub_func
function, they are part of the test bench.