Skip to content

Convert ethernet/RoCEv2 to pure VHDL, removing all generated Verilog and the 36 CRC table files - #1468

Open
ruck314 wants to merge 15 commits into
pre-releasefrom
roce-vhdl-refactor
Open

Convert ethernet/RoCEv2 to pure VHDL, removing all generated Verilog and the 36 CRC table files#1468
ruck314 wants to merge 15 commits into
pre-releasefrom
roce-vhdl-refactor

Conversation

@ruck314

@ruck314 ruck314 commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Motivation

PR #1465 bundles three changes into one merge: the Verilog to VHDL port, a functional rewrite (responder path, RDMA READ, multi queue pair), and a redesigned AXI-Lite map that breaks downstream PyRogue integrations. With the Verilog deleted there is no golden reference to attribute a failure to, and its validation suite lives outside surf, so surf CI gains no regression coverage.

This PR does only the port, bit-exact and register-compatible, and adds the cocotb suite surf was missing. Optimization comes after this PR, once the port has established a verified baseline to measure against: with one KCU105 and a full build per iteration.

Description

Convert ethernet/RoCEv2 from mixed Verilog/VHDL to pure VHDL. All 18 Bluespec-compiler-generated Verilog files and all 36 crc_tab_*.mem lookup tables are deleted, so the whole RoCEv2 stack can now be simulated with GHDL and cocotb, which was impossible while any Verilog remained because the apt ghdl build has no mixed-language support. Resource use drops on the RoCEv2_10GbeRudpKcu105Example build (LUT 88679 to 81168, FF 126004 to 113840, BRAM tiles 217 to 279.5 as the CRC tables move from LUT ROM into block RAM), timing closes with no failing endpoints, and the converted design has been validated on a KCU105.

Details

  • Hand-writes the 13 blue-lib Bluespec runtime primitives in VHDL rather than transpiling them, because CRegN5 intra-cycle read-after-write ordering and RWire valid-bit semantics need human judgment.
  • Translates the three generated blue-rdma modules to VHDL, each verified byte-regenerable from its unmodified Verilog source and compared cycle by cycle against it with zero mismatches before that source was deleted.
  • Replaces blue-crc outright with a native RoCEv2ICrc built on surf.CrcPkg, generating its lookup tables at elaboration from a deferred constant instead of reading the 36 .mem files. Send side drops from 6569 LUT / 7342 FF to 2147 LUT / 690 FF, receive side from 6582 LUT / 7170 FF to 2183 LUT / 705 FF.
  • Binds the translated transport layer into RoCEv2Engine.vhd as a direct VHDL entity, so the RDMA datapath is all-VHDL from the engine down.
  • Loads ethernet/RoCEv2 in ethernet/ruckus.tcl's non-Vivado branch, the one Ethernet subdirectory whose whole dependency closure is reachable without Vivado, so all 37 sources reach the GHDL import farm and make analysis covers them on every run.
  • Adds cocotb coverage for the AXI-Lite configurator, DCQCN rate control, the resize/endian-swap stage, both iCRC pipeline stages, the iCRC engine in both directions, all 9,216 entries of the generated CRC table constant, the RDMA core, and the assembled RoCEv2AxiStreamRdma top level, whose directed-write case walks a queue pair from RESET to RTS and checks the resulting frame field by field against a spec-derived reference.
  • Retires the record/replay equivalence harness that established the blue-rdma translations, along with roughly 1 MB of committed vectors, since it recorded from Verilog sources this change deletes and CI never installed iverilog to record with. blue-rdma/README.md keeps its conversion-time findings as history, separate from what runs on every push.
  • Excludes mkQP.vhd and mkTransportLayer.vhd from VSG, since both are regenerated rather than edited and exceed the file-length and line-length rules. They were the only two files in the repository reporting either rule.

Validation performed:

  • make MODULES="$PWD" analysis exited 0, analyzing 533 files including all 37 under ethernet/RoCEv2.
  • Full cocotb regression passed with CI's own invocation, pytest -n auto --dist=worksteal tests: 936 passed, 21 skipped, no failures. The skips are pre-existing and outside the changed directories.
  • tests/ethernet/RoCEv2 passed 32 items with no skips, 14 of them launching a GHDL simulation.
  • VSG reported no violations.
  • Flake8 passed for the changed Python.
  • Fifteen rocev2PrbsTest.py runs on a KCU105 across three configurations all exited 0 with a PASS verdict and zero receive errors.

ruck314 added 15 commits August 16, 2026 20:08
…VHDL

Nine Bluespec-generated Verilog primitives replaced by hand-written VHDL
equivalents: BypassWire, RWire, RWire0, RegN, RegUN, ConfigRegN, CRegN5,
CRegUN5, and Counter. Each was proven cycle-exact against its Verilog
original before the original was removed.
FIFO2, FIFO20, and SizedFIFO. A native surf.Fifo wrapper was built and
measured for SizedFIFO first; the reuse verdict rejected it, so a direct
translation ships instead.
A surf.TrueDualPortRam wrapper was built and measured first; the reuse
verdict rejected it, so a direct translation using a shared-variable
memory ships instead.
33,443 lines of Bluespec-compiler Verilog transpiled to VHDL. mkQP is the
leaf of the instantiation chain, not its summit, so it had to land first
for anything above it to elaborate. Proven bit-exact against the Verilog
original over random-scenario and directed goldens covering queue-pair
progression, receiver-not-ready, completion, and reset.
15,995 lines transpiled, binding mkQP through a component declaration.
Proven bit-exact through a full work-request-to-completion cycle.
3,944 lines transpiled, completing the three-level generated hierarchy.
The Verilog module declares mkAxiSTransportLayer with a capital S; the
emitted entity follows the input file stem, as the transpiler's own
output-naming rule requires. Proven bit-exact over AXI-Stream scenarios.
Replaces the Bluespec-generated blue-crc engine with hand-written VHDL.
The 36 lookup tables that shipped as separate .mem files are now a VHDL
constant in RoCEv2ICrcPkg, generated from the same recurrence and proven
against all 9,216 original values.
Both wrappers now instantiate the native VHDL engine. This removes the
last two Bluespec-generated Verilog files outside blue-rdma along with all
36 crc_tab_*.mem lookup tables.
The engine instantiated the transport layer through a component
declaration that existed only to reach a Verilog module. With the VHDL
entity in the same library, the declaration is no longer needed.
blue-rdma and blue-lib load as VHDL 2008 by directory. RoCEv2 is also
reachable in the non-Vivado path now: its whole dependency closure is
available without Vivado, unlike the other ethernet subdirectories, whose
ruckus.tcl files call loadIpCore over an .xci or .dcp.
mkQP.vhd and mkTransportLayer.vhd are machine-generated and must never be
hand-edited, so style findings against them are not actionable.
roce_test_utils gains an independent Python iCRC reference model, its
table generator, and an AXI-Stream protocol checker, with a simulator-free
self-test. path_selector coverage asserts that RoCEv2 source changes route
to the RoCEv2 suite.
Directed Send and Recv goldens covering every partial-beat width, the
zero-residue contract, random breadth under backpressure, corner coverage,
and reset recovery. A GHDL sweep proves the shipped table constant against
the reference recurrence, mutation-proven so it fails when the table is
wrong.
The instantiation closure is the whole converted directory plus the
blue-lib children, so elaborating and simulating it is a stronger gate
than any standalone analyze check. The directed case walks a queue pair
from RESET to RTS, posts a payload, and checks every field of the emitted
frame against a reference built independently of this RTL.
Each directory states what its files are, what was proven at conversion
time against Verilog sources that no longer ship here, which gates run
today, and what is not claimed.
@ruck314
ruck314 force-pushed the roce-vhdl-refactor branch from 41075b3 to f8a948e Compare August 17, 2026 03:17
@ruck314
ruck314 requested a review from FilMarini August 17, 2026 04:05
@ruck314
ruck314 marked this pull request as ready for review August 17, 2026 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant