Rtl lint check

From babyworm/rtl-agent-team · View interactive version

Rtl lint check is an AI agent skill from the GitHub repository babyworm/rtl-agent-team. Lint RTL with Verilator, Verible, and slang; report-only quick check for 'run lint', pre-commit, or phase-gate verification (no fixing).

How to use this skill

Skill file

<Purpose>

Run three complementary lint tools on target RTL files via Bash CLI:

RTL files (rtl/) are linted with slang -Weverything for maximum strictness — this catches

IEEE 1800 §9.2.2.4 violations (e.g., always_ff + initial on same signal) that only VCS

enforces at compile time. TB files (sim/) use --allow-dup-initial-drivers for flexibility.

Report all violations with file, line, rule, and severity.

See references/verilator-warnings.md for detailed Verilator warning categories and waiver format.

</Purpose>

<Use_When>

</Use_When>

<Do_Not_Use_When>

</Do_Not_Use_When>

<Why_This_Exists>

Three complementary lint tools catch different issue classes:

Running all three gives comprehensive coverage: synthesizability + style + semantics.

</Why_This_Exists>

<Coding_Convention_Requirements>

Lint checks MUST enforce the project coding conventions (CLAUDE.md):

Note: Verible and slang may not catch all convention violations natively.

lint-checker MUST perform a supplementary grep-based check for naming conventions.

</Coding_Convention_Requirements>

<Execution_Policy>

</Execution_Policy>

<Steps>

  1. Identify target files (single file, directory, or glob)
  2. Run Verilator via Bash CLI (synthesizability lint):

```bash

verilator --lint-only -Wall -Wpedantic -sv {files}

```

  1. Run Verible via Bash CLI (style lint):

```bash

verible-verilog-lint --rules_config .verible_lint.cfg {files}

```

  1. Run slang via Bash CLI (semantic lint):

```bash

# RTL (maximum strictness — catches VCS ICPD errors):

slang -Weverything {rtl_files}

# TB (relaxed — allows initial + always_ff on same signal):

slang --allow-dup-initial-drivers {tb_files}

```

The run_lint.sh wrapper auto-detects RTL vs TB based on file paths.

4.5. If commercial lint signoff is requested, run SpyGlass lint:

```bash

lint/scripts/run_lint.sh --tool spyglass --top {top} -f rtl/filelist_top.f --outdir lint/lint

```

  1. Run supplementary convention checks via Bash CLI:
  1. Merge all results; report violations grouped by file then by severity
  2. Return PASS (zero violations) or FAIL (violation count + list)

</Steps>

<Tool_Usage>

Task(subagent_type="rtl-agent-team:lint-checker",
     prompt="Run Verilator, Verible, and slang lint on rtl/ via Bash CLI. Verilator: --lint-only -Wall -Wpedantic -sv. Verible: --rules_config .verible_lint.cfg. slang: -Weverything for RTL and --allow-dup-initial-drivers for TB. Also check naming conventions: i_/o_ port prefixes, {domain}_clk/{domain}_rst_n, logic not reg/wire, u_ instance prefix. Report all violations grouped by file and severity (Critical/Major/Minor). Return PASS or FAIL summary.")

</Tool_Usage>

<Examples>

<Good>

lint-checker runs all three tools via Bash CLI, finds 3 Verible style violations, 1 slang unused-variable warning,

and 2 convention violations (port data_i should be i_data, clk should be sys_clk in multi-domain context);

returns FAIL with exact line numbers and rule names.

</Good>

<Bad>

Running only one lint tool and claiming "lint clean" — misses semantic issues caught only by slang.

Not checking naming conventions — allows clk_i, data_o to pass lint despite project rules.

</Bad>

</Examples>

<Escalation_And_Stop_Conditions>

</Escalation_And_Stop_Conditions>

<Final_Checklist>

</Final_Checklist>

<Advanced>

Project lint config: .verible_lint.cfg in repo root. Override rules only with user approval.

slang --lint-only treats warnings as errors in CI mode.

Convention check script: {plugin_root}/skills/rtl-lint-check/scripts/check_conventions.sh — ready for CI integration.

See examples/lint-output-example.txt for sample merged lint output across all tools.

Verilator waiver file (.verilator.vlt) for intentional suppressions:

`verilator_config
lint_off -rule UNUSED -file "rtl/reserved/reserved.sv" -lines 10-15
lint_off -rule WIDTH -file "rtl/datapath/datapath.sv" -match "Operator *"

Generate waiver template: verilator --lint-only -Wall --waiver-output verilator.vlt rtl/*/*.sv

See references/verilator-warnings.md for complete warning reference.

</Advanced>

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.