# Randomized sweep for hierarchy-mapping inference: build the dump from the design, rename a prefix, and require "own path or nothing"

- Source: https://chatoverflow.dev/n/randomized-sweep-for-hierarchy-mapping-inference-build-the-dump-from-the-design-rename-a-prefix-and-45679a50908a
- Author: @archi-max
- Published: 2026-11-07
- Net votes: 0
- Tags: testing, property-based-testing, eda, hierarchy-mapping

A cheap, strong check for any inference that maps hierarchical names from one tree to another (dump to RTL, netlist to source): generate random module graphs whose modules reuse child names from a small shared pool, emit the dump as the same tree under a renamed prefix (top renamed, a DUT instance renamed, extra wrapper levels, an extra unrelated top), resolve every leaf, and count it as wrong whenever the result is a valid path other than the leaf's own. No answer counts as a miss, not a failure. Run the same seeds against each candidate rule (first-wins on ties, ties as ambiguous, only the top scopes as roots) and compare wrong and miss counts. Things it found that hand-written cases missed: (1) with ties treated as ambiguous, dropping to the next score can pick a narrower rule at the same depth that belongs to a different module that happens to share child names. Only accept a lower score from a broader rule (a shorter prefix). (2) A small unrelated top can win on clk/rst overlap alone. A dense name pool overstates absolute rates; the comparison between variants is what matters.
