How to Run the Rogue Co-Simulation in Vivado XSIM
Goal: Run the surf Rogue TCP/SideBand co-simulation inside Vivado xsim, either interactively in the GUI or in batch mode.
The co-simulation HDL and C sources live in the surf submodule under
simlink/; ruckus provides only the build and simulation orchestration
described here. Any simlink/... path below is relative to the surf
submodule root, not ruckus.
Note
This flow is GUI-interactive/local only and requires a licensed Vivado install. It has no CI coverage; verification is manual against a local Vivado + Rogue environment.
Prerequisites
libzmq >= 4.1.0andpkg-configon the build machine.A Rogue-environment Python shell for the peer script (it imports
pyrogue/rogue).Vivado 2023.1 or newer, the floor enforced by
VersionCheckin the co-sim pre-compile hook (vivado/run/pre/xsim.tcl). The latest tested Vivado release is tracked centrally byCheckVivadoVersion(see TCL API Reference), which warns when the active Vivado is newer; this page intentionally does not restate a version.A surf version that provides the
simlink/xsim/DPI backend. Older surf (legacyaxi/simlink/sim+srcVHPI layout) is VCS-only; usemake vcsthere.
Makefile Setup
Add the following to your project Makefile:
include $(TOP_DIR)/submodules/ruckus/system_vivado.mk
No additional variables are required. The co-sim hook is registered
unconditionally by project.tcl and is a fast no-op for any project that
doesn’t contain a Rogue co-sim source.
Note
make xsim and make gui automatically select the surf xsim DPI-C
backend (they export RUCKUS_SIM_BACKEND=xsim), so having Synopsys VCS
sourced in the same shell alongside Vivado (common in a combined setup
script) no longer misroutes the flow to the VCS/VHPI backend. Switching
between this xsim flow and make vcs in the same build directory swaps
the backend automatically; no make clean is needed.
Steps
Launch the GUI (or run batch xsim):
make guiFor a headless batch run, name your co-sim testbench and let the simulation free-run so the peer can connect and drive it:
make xsim VIVADO_PROJECT_SIM=<MyCoSimTb>
When
VIVADO_PROJECT_SIMis set, the batch path elaborates it as thesim_1top instead of the top set inruckus.tcl, so here it names the co-sim testbench. The run length isVIVADO_PROJECT_SIM_TIME, whose defaultallfree-runs until the testbench calls$finish/$stopor is interrupted. A co-sim testbench typically has neither, so the run does not self-terminate: background it, wait for theListening on ports N & N+1print, start the peer, then stop the simulation once the peer reports its result. To bound a run instead, pass a time value, e.g.VIVADO_PROJECT_SIM_TIME="1000 ns".Either target triggers ruckus’s pre-compile hook (
vivado/run/pre/xsim.tcl), which detects any ofRogueTcpStream.vhd,RogueTcpMemory.vhd, orRogueSideBand.vhdin the simulation sources and builds the combinedlibRogueSimLinkDpi.soviaxsc. The matching-sv_lib libRogueSimLinkDpielaboration binding is registered at project generation byvivado/sources.tcl, so there is no manual build step.Watch the console for the build and bind:
Confirm the
pkg-config/xscbuild messages appear with no errors, and, afterlaunch_simulation/run, the module’s one-timeListening on ports N & N+1print, which is the ready-for-peer signal.Start the matching Rogue peer script:
python3 <my_peer_script>.pyRun this in a separate terminal, pointed at the same host/port the testbench is listening on. Ruckus and the DPI hook are entirely automatic up to this point; starting the peer and, if switching modules, selecting the desired top-level testbench in the target’s
ruckus.tcl(set_property top) are the only manual steps.Observe the waveform:
Data movement between the DPI adapter and the peer confirms the round trip.
Key Variables
Variable |
Default |
Description |
|---|---|---|
|
(empty) |
Top module for Vivado simulation. When empty, the |
|
|
Simulation run length. The default |
There is no co-sim-specific variable: the DPI hook auto-registers and auto-detects, so the existing simulation variables above are the only ones relevant to this flow.
Troubleshooting
- “libzmq package was not found”
libzmq package was not found Please make sure that you have libzmq installed or have sourced the necessary rogue setup scripts
Install libzmq, or source the Rogue setup scripts that put it on
PKG_CONFIG_PATH, then re-runmake gui/make xsim.- “this surf has no simlink/xsim/ DPI co-simulation backend” at compile
The surf version in your project predates the xsim DPI backend (legacy
axi/simlink/sim+srcVHPI layout). The Vivado xsim co-sim requires a surf that providessimlink/xsim/. Usemake vcsfor VCS co-simulation with that surf version, or update surf.- “DPI function … not found” at elaboration
The
.sois stale,-sv_libwas not bound, or the module-detection guard did not fire because none of the three Rogue.vhdfiles are present in the simulation sources. Confirm the module’s source is in the sim compile order and re-run the build.- Waveform runs with no data movement
The peer script has not connected. Confirm it is running against the correct host/port pair and that push/pull directions are not swapped (see the port documentation under
simlink/in surf, starting fromsimlink/README.md).