Stellarion
Tools

stellarion_find_duplicate_constraints [Pro · EDA]

Detect duplicate Quartus / Qsys constraint keys with conflicting values
This is a Pro tool that requires EDA mode (--mode eda). It uses the Eda license feature; a 180-day free trial starts automatically.

Finds places where the same constraint key is set in multiple sites — and flags the cases where the values diverge, which is config drift. Built on top of the Phase 4A argument extractor: every EDA call carries its key (e.g. the -name arg of set_global_assignment), value, and target (the -to arg).

When to Use

  • Pre-merge — confirm your branch hasn't introduced contradictory set_global_assignment values
  • Quarterly audit — find Quartus settings that have drifted across files (FPGA-family forks, copy-paste branches)
  • Before centralizing constraints — measure how many sites repeat each key
  • After a multi-branch merge — surface conflicts the merge silently kept one side of
  • For Qsys component renames — detect duplicate set_module_property NAME declarations

Parameters

ParameterTypeRequiredDefaultDescription
filePatternstringNoSubstring match on file path
categorystringNoFilter to a single EDA category (e.g. quartus_assignment)
minDuplicatesnumberNo2Only report keys repeated this many times or more
limitnumberNo50Maximum constraint groups to return
onlyTrueConflictsbooleanNofalseDrop namespace patterns and same-value boilerplate; keep only groups where some values repeat AND others differ — the real drift signal

Examples

All duplicate constraint groups

Show me every constraint that's set in multiple places.

Calls with defaults. Returns groups by (category, key) with all occurrences.

Real drift only

Find Quartus config drift — same key, different values.

Sets onlyTrueConflicts: true. Drops namespace patterns (every value distinct = unique-by-design) and pure boilerplate (every value identical = not drift). Keeps only mixed groups — these are the high-signal items.

Quartus assignments only

Just show me set_global_assignment conflicts.

Sets category: "quartus_assignment".

Scoped to a directory

Find drift inside scripts/common/syn.

Sets filePattern: "scripts/common/syn".

Threshold to top-of-list items

Show only keys repeated 5+ times.

Sets minDuplicates: 5.

Output Format

{
  "total_keys_examined": 306,
  "duplicate_count": 140,
  "conflicting_count": 111,
  "duplicates": [
    {
      "category": "quartus_assignment",
      "key": "FAMILY",
      "occurrences": 12,
      "distinct_values": 2,
      "conflicting": true,
      "instances": [
        { "file": "...", "caller": "...", "line": 10, "value": "Stratix 10", "target": null },
        { "file": "...", "caller": "...", "line": 22, "value": "Agilex",     "target": null }
      ]
    }
  ]
}

duplicates is sorted with conflicting groups first, then by occurrence count.

Reading the output

  • occurrences == distinct_values — every site has a unique value. Usually a namespace pattern (auto-generated unique names). Use onlyTrueConflicts: true to filter these out.
  • occurrences > distinct_values AND conflicting: true — real drift. The same key has both repeated values and divergent values. Refactor candidate.
  • distinct_values == 1 (with conflicting: false) — boilerplate. Same key, same value across many sites. Usually fine; can be a candidate for a shared helper.

Empirical baseline (OFS-fim-common)

Running on the OFS FIM Common Quartus codebase as a reference:

  • 306 keys examined
  • 140 duplicate groups at minDuplicates: 2
  • 111 conflicting at default; 41 real drift groups with onlyTrueConflicts: true

Notable finds in that corpus:

  • qsys_parameter / DATA_W — 45 occurrences, 11 distinct values (AXI bus-width drift)
  • quartus_assignment / host_if.m0 — 24 occurrences, 12 distinct values
  • qsys_fileset / QUARTUS_SYNTH — 30 occurrences, 3 distinct synth-fileset configs

Tips

  • Always start with onlyTrueConflicts: true. The default view is exhaustive but noisy.
  • The most actionable categories are quartus_assignment, qsys_module, and quartus_parameter — each has well-defined keys.
  • Pair with stellarion_find_eda_calls and stellarion_get_flow_graph for the full EDA architecture picture.
  • The output is structured — feed it into a refactor planner that emits a "centralize these N keys into a shared parameter file" PR.
  • Use the /eda-drift-check slash command (see Slash Commands) for an opinionated triage report.