Skip to content

Latest commit

 

History

History

01-Vitis_Functional_Simulation

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

AMD logo

AMD Vitis™ System Design Tutorials

See Vitis™ Development Environment on amd.com

Vitis Functional Simulation

Version: Vitis 2026.2

Table of Contents

  1. Introduction
  2. Setup Instructions
  3. Available Examples
  4. AXI4-Stream, Packet Switching, and Width Conversion
  5. Standalone VFS Installation

Support

Introduction

Vitis Functional Simulation (VFS) allows you to functionally simulate AI Engine graphs and/or HLS kernels in both MATLAB® and Python™ environments on Linux. It presents simple APIs to compile and simulate your design. VFS is designed to be easy to use and provides a familiar environment for users who are already accustomed to using MATLAB or Python.

VFS Introduction

Varray

Vitis Functional Simulation (VFS) leverages "varray" (Vitis array), a module supporting all the data types available in AMD devices in both MATLAB and Python environments and allowing conversion and casting between the types.

Varray Introduction

For more information on Vitis Functional Simulation and Vitis array, refer to the Vitis Functional Simulation User Guide (UG1864).

Setup Instructions

Source the appropriate settings file:

[shell]% source <vitis_install_folder>/settings64.sh

Python

Launch Python (supports 3.9 to 3.14). The following modules are required:

  • numpy
  • scipy
  • matplotlib

To set up a virtual environment with all dependencies:

python3 -m venv my-venv
source my-venv/bin/activate
pip install --upgrade pip
pip install numpy scipy matplotlib

Then in your Python script:

import vfs
import varray as va

Alternatively, run ./create_venv.sh to create my-venv with these modules installed.

DSPLIB_ROOT (for DSP Library examples)

Some AIE examples (aie/firComplex, aie/FIRasyncRTP, aie_hls/channelizerPacketSwitching) use the Vitis DSP Library. Set the DSPLIB_ROOT environment variable to point to the DSP library root:

# Clone the library if you don't have it:
git clone https://github.com/Xilinx/Vitis_Libraries.git
export DSPLIB_ROOT=<path_to_Vitis_Libraries>/dsp

MATLAB

Launch MATLAB (supports 2025a, 2025b and 2026a).

Running the Examples

Each example has a python/test.py and a matlab/test.m script. Run them from their own directory, for example:

cd hls/SumOfFour/python && python3 test.py
cd hls/SumOfFour/matlab && matlab -batch test

To run all examples, use make run_python or make run_matlab from this directory. make clean removes the generated vfs_work directories.

Available Examples

This directory contains simple AI Engine Graphs and HLS kernels to show how to get started with VFS, as well as a more representative system example.

Example Description
varray Showcasing basic varray operations
aie/GraphMultiplyByComplex Simple design showcasing the basic structure of a VFS code
aie/bfloat16 Demonstrates partial data being passed to the AIE graph
aie/FIRasyncRTP Instantiation of a symmetric FIR filter with async RTP port from Vitis_Libraries
aie/firComplex Complex-data FIR filter using Vitis DSP Library with scipy validation
aie/multiplyWithPreproc Demonstrates passing preprocessor definitions (Xpreproc) to AIE compilation
aie/gmio Simple weighted-sum design that leverages GMIO
hls/SumOfFour Simple design showcasing the basic structure of a VFS code
hls/array_pointer_data_type Demonstrates a kernel with array and pointer inputs
hls/arrayOfHlsStreams Demonstrates using an HLS kernel where the ports are arrays of streams
hls/kernel_invert Demonstrates usage of the fixed-point varray data type
hls/complexArguments HLS kernel with complex data types (cuint32, cfloat)
hls/apfixArgument HLS kernel demonstrating ap_fixed / ap_ufixed fixed-point data types
hls/apintArguments HLS kernel using ap_int / ap_uint with stream interfaces
hls/floatArguments HLS kernel with float and double stream interfaces
hls/axisFrameSum AXI4-Stream HLS kernel that processes TLAST-delimited frames
hls/axisSideChannels AXI4-Stream side channels (TUSER, TID, TDEST) and a customized AXI4-Stream port with two elements per beat
aie_hls/64kifft 64k-point IFFT implemented using a 2D breakdown containing resources in both AI Engine and PL. Also includes a Jupyter notebook version. Link to original design.
aie_hls/channelizerPacketSwitching VFS testbench for the packet-switched filterbank of the AIE-ML Channelizer tutorial: 128-bit HLS packet sender, DSP Library TDM FIR on 64-bit packet-switched PLIOs, and 128-bit HLS packet receiver, with AXI4-Stream width conversion between them. Uses the Channelizer sources unchanged.
standalone_utility Package a standalone VFS installation with design sources for users without a full Vitis installation. See Standalone VFS Installation.

AXI4-Stream, Packet Switching, and Width Conversion

A varray can carry AXI4-Stream side channels alongside its data. Create one with axis=va.axis_config(...) (Python) or axis=varray.axis_config(...) (MATLAB), then read or set the side channels through arr.axis.tlast, .tkeep, .tuser, .tid, and .tdest. The AxisConfig column of getInputSpec() and getOutputSpec() shows the configuration each port expects.

  • HLS kernels: ports declared as hls::stream<ap_axiu<...>> or hls::stream<hls::axis<...>>, including customized hls::axis ports with only some signals enabled, take and return axis varrays. Plain stream ports take plain varrays.
  • AI Engine graphs: pktstream PLIO ports take and return axis varrays whose tdata_width equals the PLIO width. Use graph.getPacketIds() to read the packet IDs assigned by the AI Engine compiler, and varray.aiePacketUtils (pack_packets, unpack_packets, generate_packet_header, get_packet_id) to build and parse packet streams.
  • Width conversion: when PL and AI Engine interfaces have different widths (for example, a 128-bit HLS kernel feeding a 64-bit PLIO), v++ inserts an AXI4-Stream data width converter in hardware. In VFS, call va.convert_axis_width(arr, tdata_width) (Python) or varray.convert_axis_width(arr, tdata_width) (MATLAB) at that boundary. It repacks beats and remaps TKEEP and TLAST the same way as the converter. aie_hls/channelizerPacketSwitching shows the full flow.

For details, refer to the Vitis Functional Simulation User Guide (UG1864).

Standalone VFS Installation

Vitis includes create_vfs_standalone.sh, which creates a portable, self-contained installation (less than 4 GB) with only the components VFS needs to simulate HLS kernels, AI Engine graphs, and HDL IPs.

This lets an implementation engineer and an algorithm engineer work on the same design without both needing a full Vitis installation:

  • The implementation engineer owns the AI Engine graph and HLS kernel sources and has a full Vitis installation. They create the standalone installation and hand it off together with the design sources and VFS test scripts.
  • The algorithm engineer extracts the hand-off, then develops and runs Python or MATLAB scripts that simulate the actual implementation source. Any source update from the implementation engineer can be dropped into the same directory structure and re-simulated.

Implementation Engineer: Create the Hand-Off

standalone_utility/package_handoff.sh creates the standalone installation and bundles it with the selected examples into one archive:

source <Vitis_install_path>/settings64.sh
./standalone_utility/package_handoff.sh -o <output_dir>/vfs_handoff.tar.gz hls/SumOfFour aie/GraphMultiplyByComplex

Without example arguments, the script packages varray, hls/SumOfFour, and aie/GraphMultiplyByComplex. To reuse an installation you have already created with $XILINX_VITIS/functional_suite/create_vfs_standalone.sh <dest>, pass -s <dest>.

The archive contains:

vfs_handoff/
├── vfs_standalone/          # Standalone VFS installation (settings64.sh, settings64.csh)
├── create_venv.sh           # Python environment with numpy, scipy, matplotlib
├── standalone_utility/
│   └── run_example.sh       # Smoke test
└── <example>/               # src/, python/, matlab/ for each packaged example

Algorithm Engineer: Simulate Without Vitis

tar xzf vfs_handoff.tar.gz && cd vfs_handoff
./create_venv.sh && source my-venv/bin/activate
source vfs_standalone/settings64.sh
./standalone_utility/run_example.sh hls/SumOfFour aie/GraphMultiplyByComplex

settings64.sh adds VFS and varray to both PYTHONPATH and MATLABPATH, so launch MATLAB from the same shell. The examples then run exactly as with a full Vitis installation:

cd hls/SumOfFour/python && python3 test.py
cd hls/SumOfFour/matlab && matlab -batch test

The standalone installation is relocatable and is tied to the Vitis version it was created from (see vfs_standalone/README.txt).

Support

GitHub issues are used for tracking requests and bugs. For questions, go to Support.


Copyright © 2026 Advanced Micro Devices, Inc.

Terms and Conditions