Add Vivado xsim DPI-C co-simulation backend for RogueTcpStream, RogueTcpMemory, and RogueSideBand#1452
Open
ruck314 wants to merge 4 commits into
Open
Add Vivado xsim DPI-C co-simulation backend for RogueTcpStream, RogueTcpMemory, and RogueSideBand#1452ruck314 wants to merge 4 commits into
ruck314 wants to merge 4 commits into
Conversation
ruck314
force-pushed
the
cosim-xsim
branch
2 times, most recently
from
July 7, 2026 23:35
2ab50de to
0d40c56
Compare
ruck314
force-pushed
the
ci-RogueTcpMemoryWrap-RogueTcpStreamWrap
branch
from
July 8, 2026 18:45
2c97b87 to
a1e7ee7
Compare
Add a third axi/simlink/ co-simulation backend -- Vivado xsim via SystemVerilog DPI-C -- alongside the existing GHDL (VHPIDIRECT) and VCS (VHPI) paths. A forwarding VHDL entity -> SV DPI leaf -> C adapter chain implements RogueTcpStream, RogueTcpMemory, and RogueSideBand, reusing the shared axi/simlink/shared/*Core.h ZeroMQ cores unchanged. All three link into one combined RogueTcpDpi.so via xsc. Additive only -- the GHDL/VCS backends and the cocotb regression are untouched. axi/simlink/ruckus.tcl selects the backend from RUCKUS_SIM_BACKEND (set by the ruckus make target: make xsim/gui -> xsim, make vcs -> vcs), falling back to GHDLFLAGS/VCS_VERSION sniffing for older ruckus. Sniffing VCS_VERSION alone is unreliable because users commonly source both Vivado and VCS in one setup script, which would otherwise load the vcs/ VHPI backend during a Vivado xsim run. Sibling-backend sources are purged from a reused Vivado project before loading the selected one (guarded by VIVADO_VERSION, since get_files/remove_files are Vivado-only and GHDL has no persistent project to clean), so switching backends no longer requires "make clean". On Vivado <= 2024.1 the bundled gcc-9.3.0 xsc link step uses its own binutils via -B and does not search the host multiarch lib dir, so the link fails with 'cannot find crti.o / -lzmq / -lm'. Point the startfile (-B) and library (-L) search at the active gcc's lib dir, derived portably via 'gcc -print-file-name=crti.o' (/usr/lib/x86_64-linux-gnu on Debian/Ubuntu, /usr/lib64 on RHEL). Harmless on Vivado >= 2024.2, whose xsc already resolves these. Add axi/simlink/README.md describing the three interchangeable backends and how to run the xsim co-sim in the GUI, linked from axi/README.md. Ignore the xsim/xsc build outputs in .gitignore and tidy a few stale cocotb test comments (JESD204B RX/TX register tests and the AXI Stream batcher test). Verified end-to-end against Vivado 2025.2 + the rogue_v6.13.0 conda env: the RogueTcpStream loopback demo exchanges PRBS frames through the DPI and reports rxErrors == 0 (byte-correct marshalling).
bengineerd
requested changes
Jul 15, 2026
bengineerd
left a comment
Contributor
There was a problem hiding this comment.
Requesting changes for per-instance DPI state and runnable usage documentation. The focused static checks and GHDL analysis are otherwise clean.
bengineerd
reviewed
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a Vivado xsim/SystemVerilog DPI-C co-simulation backend for
RogueTcpStream,RogueTcpMemory, andRogueSideBandalongside the existing GHDL/VHPIDIRECT and VCS/VHPI paths. The VHDL forwarding entities, SystemVerilog DPI leaves, and C adapters reuse the sharedaxi/simlink/shared/*Core.hZeroMQ models and link into oneRogueTcpDpi.sobuilt byxsc.Each elaborated model now owns an independent DPI
chandle, native model state, ZeroMQ context, and two-port endpoint pair. Explicit create/update/destroy APIs, normal/fallback cleanup, cross-model port collision checks, and multi-instance regressions support established multi-link users without changing the public VHDL interfaces or Rogue TCP wire formats.The xsim usage guide now references only checked-in examples and documents the clock/reset, unique-port, peer, and connected-and-draining transport requirements for external targets.
Details
This pull request is stacked on #1450 because it uses that pull request's backend split and shared C cores. It does not depend on #1450's later GHDL integer-handle implementation; after #1450 merges, this pull request can be retargeted to
pre-releaseand any real integration conflicts resolved then.The shared cores retain the established synchronous ZeroMQ send behavior used by VCS/VHPI and GHDL/VHPIDIRECT. Peers must be connected and draining before HDL produces outbound traffic. No-peer, saturation, linger, retry-queue, and worker-thread hardening is intentionally deferred to a separate cross-backend change so xsim does not acquire different transport semantics.
Validation:
rogue_v6.13.0environment; the Stream PRBS loopback reportedrxCount == 10andrxErrors == 0.xelab -dpiheadergenerated ABI. It skips explicitly when Vivado tools are unavailable; the new multi-instance xsim flow still needs a recorded Vivado-enabled run before merge.git diff --checkpass locally.Pairs with the ruckus-side
xsc/-sv_lib RogueTcpDpiorchestration in slaclab/ruckus#399.Related