Lint triage

From LNC0831/oh-my-fpga · View interactive version

Lint triage is an AI agent skill from the GitHub repository LNC0831/oh-my-fpga. Run RTL lint / methodology checks and triage each violation into a real fix vs a justified, documented waiver. Use when the user says "lint my RTL", "code quality", "review my RTL", "check my Verilog/VHDL", "any latches / unintended latches", "clean up warnings before synthesis", "is my design lint-

How to use this skill

Skill file

Lint Triage — RTL Lint & Methodology Violation Triage

A playbook for driving SynthPilot's lint/methodology tools to find real RTL

problems, then sorting every violation into one of three buckets: fix it,

waive it (with a stated justification), or ask the human. The deliverable

is a triaged report, not a green number. A lint run that is "clean" because real

violations were silenced is a failure of this skill.

This skill follows one discipline above all: **measure → classify → fix the

smallest safe thing → re-measure**. It never invents a tool, never downgrades a

severity to hide a problem, and never claims "lint clean" without fresh tool

output proving it on the current source.


When to use

unintended latches", "clean up warnings", or "is this design lint-clean".

teammate, to catch latches, incomplete sensitivity lists, width mismatches,

unconnected ports, blocking/non-blocking misuse, and methodology violations.

moved or masked).

for items that are intentional and safe.

When NOT to use

Use the timing-closure skill. check_async_reset here surfaces *reset-path

methodology* issues, not slack.

check_cdc_lint / report_cdc are a first screen only; deep CDC analysis is a

separate playbook. Lint-triage flags CDC violations and hands them off.

simulation (sim_*), not lint. Lint cannot tell you a correct-looking design

is functionally wrong.

stage, different tool.


Prerequisites (verify first)

Do not run any check until these pass. If one fails, stop and report it — do not

guess.

  1. MCP / Vivado reachable. Call test_connection. If it fails, the Tcl

server inside Vivado is not connected on TCP:9999 — report and stop.

  1. A project is open with sources. Call get_project_info and

list_source_files. If no project or no RTL sources, stop and ask the user to

open the project / point at the files.

  1. Top module is set (needed for elaboration-stage checks). If

get_project_info shows no top, call set_top_module only with a name the

user gave or that is unambiguous from list_source_files; otherwise ask.

  1. Know which stage you can reach. Syntax-stage checks need only sources.

Methodology-stage checks (run_full_lint_check, report_methodology,

get_lint_violations, check_latches, check_fsm, check_coding_style,

check_cdc_lint, check_simulation_mismatch) require an **open synthesized

design**. Plan to reach that stage in Step 3 — do not call those tools before

the design is open or they will error.


Methodology (numbered, real tool calls)

Work the stages in order. Each stage is cheaper/earlier than the next; do not

skip ahead, because a syntax error makes every later check meaningless.

Step 1 — Establish the file baseline

order produces phantom "undefined module" / black-box noise downstream;

fix ordering before trusting any later result.

bounded to ("lint-clean" means these files, this top, nothing more).

Step 2 — Syntax-stage checks (no synthesis required)

Run the checks that work directly on source. These are fast and catch the errors

that would otherwise abort synthesis:

genuinely intended black box / external IP).

If check_syntax reports errors, STOP the lint flow here. Classify and

surface the syntax errors (Step 5 table) and do not pretend later stages are

clean — you cannot run them on broken source.

Step 3 — Reach a synthesized design for methodology checks

Most high-value RTL lint (latches, FSM health, coding style, CDC, sim/synth

mismatch) requires an elaborated/synthesized netlist.

a tiny design prefer the async pattern: run_synthesis_async, then poll

get_run_status until complete (multi-minute operations must not block).

satisfies the prerequisite.)

lint findings (inferred latch, truncation, dropped logic) and corroborate the

dedicated checks.

If synthesis fails, the failure itself is the top-priority violation: capture it,

classify it (Step 5), and stop — there is nothing to lint on a netlist that

doesn't exist.

Step 4 — Methodology / RTL-quality checks (on the open synth design)

Run the methodology suite and the targeted RTL checks:

you will triage (each item has a check name / ID).

signal; an unintended latch is almost always a real bug.

synthesize (the worst class: it works in sim, fails in hardware).

For any violation you do not understand, pull detail with

report_lint_violation_detail(violation_id=...) before deciding what to do with

it. Never triage blind.

Step 5 — Triage every violation

For each violation, read its detail and place it in exactly one bucket using

the table below. Do not batch-waive. Do not batch-ignore. One verdict per item,

each with a one-line reason.

Step 6 — Apply the smallest safe change, one class at a time

sim/synth mismatches are RTL bugs — describe the exact edit (which signal, which

always/process block, default assignment vs full case, blocking vs non-blocking)

and let the human approve before you touch source with update_file /

replace_in_file. Use read_file_lines to ground the recommendation in the

real code.

intentional do you call

waive_lint_violation(check_name=..., reason="<why this is safe and intended>", objects=...).

The reason string is mandatory and must be a real justification, not "waived".

rule — not both), so the re-measure attributes cause to effect.

Step 7 — Re-measure (close the loop)

After each change class, re-run the relevant check on the current source/

netlist (re-synthesize if RTL changed) and diff the violation list. A fix is only

"done" when the violation it targeted is gone from fresh tool output and no new

violation appeared. Record before/after counts.


Classification / decision table

Map each violation to a cause and the smallest safe response. The default

verdict is FIX; WAIVE is allowed only with an explicit, true

justification; ASK when intent is unknown.

| Symptom / check | Likely cause | Smallest safe response | Default verdict |

|-----------------------------------------|-----------------------------------------------------------|----------------------------------------------------------------------------------------|-----------------|

| check_latches finds inferred latch | Incomplete if/case or missing default in comb logic | Recommend full assignment (default value / else / default:); confirm with read_file_lines | FIX (RTL) |

| check_port_width_mismatch | Instantiation port width ≠ signal width | Recommend resizing the signal/port; never widen blindly — verify intent | FIX (RTL) / ASK |

| check_unconnected_ports | Dangling port | If functionally required → FIX (connect); if intentionally unused → tie-off/objects waiver with reason | FIX / WAIVE |

| check_black_box | Missing file, typo'd name, OR intended external IP/stub | If missing → add file / fix check_compile_order; if intended → WAIVE with reason | FIX / WAIVE |

| check_simulation_mismatch | Init values, #delay, sensitivity-list, X-pessimism gaps | RTL fix — these are silent hardware bugs | FIX (RTL) |

| check_fsm unreachable/dead state | Unhandled case / wrong reset / dead code | Recommend handling or removing the state; do not waive a reachable hole | FIX (RTL) |

| check_coding_style violation | Blocking/non-blocking misuse, mixed assigns, style rule | If functional risk → FIX; if cosmetic & team-approved → WAIVE with reason | FIX / WAIVE |

| check_cdc_lint flag | Unsynchronized crossing / missing handshake | Hand to CDC sign-off; never waive a real crossing to clear lint | ASK / FIX |

| report_methodology / get_lint_violations generic item | Vivado methodology rule (e.g. SYNTH-/TIMING- family) | Read report_lint_violation_detail; fix or justify per the item | depends → triage |

| Rule is a known false positive for this design | Tool over-reports a safe pattern | WAIVE the specific check_name/objects with a reason naming why it's safe | WAIVE |

| Intent genuinely unknown | Can't tell if the construct is deliberate | Present the finding + options; hand back to human | ASK |


Iteration loop & STOP conditions

LOOP:
  1. Run the relevant check(s)            (Step 2 / Step 4)
  2. get_lint_violations  -> list
  3. For each item: report_lint_violation_detail -> classify (table)
  4. Apply ONE change class:
        - FIX  (recommend RTL edit, get approval, then update_file/replace_in_file)
        - WAIVE (waive_lint_violation with a real reason)   [reviewed items only]
  5. Re-synthesize if RTL changed; re-run the check          (Step 7)
  6. Diff before/after violation list
  -> repeat

STOP the loop when any of these is true:

every remaining item is an explicit, justified waiver in list_waivers. This is

the only "lint clean" you may claim — and only with the fresh output in hand.

trade-offs and hand back. Do not thrash trying to auto-resolve intent.

(architectural change, retiming logic, restructuring an FSM): surface the

recommendation and stop; do not silently apply it.

spawns new violations after two iterations. Stop, report the conflict, hand back.

to that stage; the lower stage owns the fix.


Safety rails (do not violate)

not call set_lint_severity to downgrade a check, disable_lint_rule, or

waive_lint_violation on an item that could be a genuine bug just to clear it.

A latch, width mismatch, CDC crossing, or sim/synth mismatch is presumed real

until proven intentional.

call carries a reason that explains why the construct is safe and intended —

scoped with objects to the specific cell/net where possible, never a blanket

waiver of an entire check. If you cannot articulate the justification, you may

not waive it; ask the user.

or scoping a waiver over rewriting RTL. Constraint/config/style fixes before

source edits; source edits before architectural changes.

(file, line range from read_file_lines, before/after) and get approval before

update_file / replace_in_file. Latch and mismatch fixes especially must be

reviewed.

REQUIRES fresh output from the relevant tool after the change, on the

current source/netlist. Never infer it from "I made the edit." If RTL changed,

re-synthesize before re-checking — stale netlist results are not evidence.

right skill. It does not pretend a CDC waiver or a severity downgrade closes a

timing/CDC issue.

needed capability is missing, say so plainly rather than inventing a tool.


Output

Deliver a triage report, not a verdict-by-assertion:

  1. Scope — files (list_source_files) + top module + the stage reached

(syntax-only vs synthesized). Every claim is bounded to this.

  1. Violation summary — counts by severity/check, before vs after, from

get_lint_violations / get_synthesis_warnings (fresh output, quoted/cited).

  1. Triage table — one row per violation: `check / ID | location | cause |

verdict (FIX / WAIVE / ASK) | action taken or recommended`.

  1. Fixes applied — only those the user approved; show before/after snippet

(read_file_lines) and the re-measured result proving the violation cleared.

  1. Waivers — the current list_waivers output, each with its justification.

Flag any waiver whose reason is weak so the human can revisit it.

  1. Open items / hand-offs — ASK-bucket items with options + trade-offs, and

anything routed to timing / CDC / DRC / simulation skills.

  1. Honest status line — e.g. "Lint clean on <files>/<top> at synthesis stage:

0 unwaived violations, N justified waivers (fresh get_lint_violations output

attached)." Never state "clean" without that fresh evidence; if blocked, say

exactly what blocks it and what decision you need from the user.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.