跳到正文
cccskills
免费在 GitHub 公开

vexplain

Generate documentation for any RTL module from Verilog source files

中文简介正在准备中。当前显示原文说明。

实测评分 未实测

查看安装方法

包含的文件(1)

  • SKILL.md8.0 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Verilog Reader

Overview

This guide defines the workflow for generating documentation for a Verilog RTL module from its source files. The RTL is the ground truth: the generated document describes the module as implemented, accurately enough that another skill can instantiate, drive, and reason about it without reading the source (see .claude/skills/shared/ModuleDocContract.md).

Target Resolution & Name Derivation

The input is a single target module, identified by a file path or a module name. Resolve it to one top-level Verilog source file:

  • A path under ./rtl or ./lib is the target directly.
  • A bare module name resolves to ./rtl/<module>.v, or to a ./lib module — either ./lib/<module>.v (single-file) or ./lib/<module>/<module>.v (multi-file, where the top file shares the module's name).

The module name is the source file's base name. All output names derive from it, not from any partial path. Other .v files inside a multi-file ./lib/<mod>/ folder are submodules, not separate targets (see analysis order below).

If a single .v file declares more than one module, the target is the module whose name matches the file base name; the others are treated as submodules.

Before You Start — Re-run Safety

vexplain overwrites the module document. Two cases need care:

  • Existing doc — confirm first. An rtl/ doc/<module>.md may be a pre-implementation vdesign draft, and a lib/<module>.md is the canonical reference for a reusable module. Generating a missing doc is the intended use; overwriting an existing one is destructive — confirm with the user first, then regenerate wholesale from the RTL (now ground truth).
  • Unfilled backbone — stop. If the target RTL still contains //@ markers (vflow's incompleteness marker, CodingStyle §18), it is a vdesign backbone that vfill has not implemented. Stop and report; do not document empty logic. Pre-implementation intent is vdesign's job.

Step 1 - Analyze the Design

Read the target Verilog source file and determine the function of the RTL module.

Use .claude/skills/shared/CodingStyle.md to interpret signal names, bus interface prefixes, and FSM patterns in the code.

If the module instantiates submodules, follow this order:

  1. Check whether each submodule already has documentation.
  2. If documentation exists, use it to understand the submodule behavior.
  3. If documentation does not exist, read the submodule RTL code only as needed to understand the behavior of the target module.

Document only the target module. Do not duplicate documentation for submodules that are documented elsewhere — link to their <module>.md instead (ModuleDocContract Excluded Content).

After the analysis is complete, generate a new Markdown file according to the following output rules:

Output file rules:

  • The output file must use the same base name as the Verilog file (the module name).
  • The output file must use the .md extension.
  • If the target file is under ./rtl, place the output in ./doc/.
  • If the target file is under ./lib, place the output in the same folder as the Verilog file.

Step 2 - Required and Excluded Content

The generated documentation must follow the module documentation contract defined in .claude/skills/shared/ModuleDocContract.md — every required section, §1–§11, plus its Excluded Content rules.

Each section's facts live in a specific place in the RTL — extract them from there, never assume:

Contract sectionExtract from
§2 Parametersthe #(...) declaration for the actual defaults. Legal ranges and cross-parameter constraints: derive from how each parameter is used ($clog2, part-selects, replication — a bus sliced as [i*8 +: 8] implies a multiple-of-8 width). If a range cannot be inferred from the code, state the default as the only verified value — do not invent a range.
§3 Portsthe module declaration verbatim; each output's Reset Value from the reset branch of the always block that drives it.
§4 Interface Protocolthe handshake logic itself: what gates a transfer (valid && ready), whether outputs are registered or combinational relative to inputs, who may deassert what. Build the example-transaction cycle table by walking one real transaction through the implemented logic — including a stalled/back-pressured beat.
§5 Reset Behaviorthe reset compare (rst_n == RS_LV / !rst_n) and every assignment in the reset branch; note registers deliberately not reset (qualified-by-valid datapath regs, CodingStyle §5/§14).
§6 Timingcount the actual register stages from input to output (_ff registers, s0_/s1_ stage chains) — never copy a latency from a proposal or comment without confirming it in the logic.
§7/§8 Functional / FSMthe implemented behavior; FSM states from the localparam state encodings and the case transition logic, drawn as a mermaid stateDiagram-v2.
§9 Register Mapthe address decode — the case (addr) / if (addr == ...) in the write path and the read mux. Access type from the logic, not naming: write-decoded + readable = RW; read-mux-only = RO; write-decoded only = WO; self-clears on a read = RC; cleared by writing 1 = W1C. Reset values from the reset branch; word-vs-byte addressing from how the address is compared/shifted.
§10 Usage Constraintsthe guards the logic silently assumes: a config register sampled only in the IDLE state implies "configure before starting"; an input used without a holding register implies a stability requirement; the overflow/illegal-input paths show what is saturated, wrapped, dropped, or flagged.
§11 Instantiation Templatethe module declaration — mechanical; every port named, parameters at their declared defaults.

Step 3 - Self-check the Document

Before finishing, verify the document is an instantiation-accurate contract for the RTL — downstream skills drive the module from it without re-reading the source. Walk each port and parameter and confirm:

CheckPass condition
Ports complete & exactEvery port in the module declaration appears in the Ports table with matching name, direction, and width; none added, dropped, renamed, or re-widthed (ModuleDocContract §3).
Parameters complete & exactEvery parameter appears in the Parameters table with its actual default and a legal range; section omitted only if the module has none (§2).
Reset values consistentEach output's Reset Value column agrees with the reset logic in the RTL and with the Reset Behavior section (§3, §5).
Reset conventionReset is described as synchronous, active level stated against RS_LV where applicable (§5).
Timing derived from RTLLatency, pipeline depth, and throughput match the implemented register stages, not assumptions (§6).
Register map completeEvery CPU-accessible register in the RTL address decode appears in the Register Map (§9) with its address, access type (W1C/RC marked explicitly), and reset value; word/byte addressing stated. Section omitted only if the module has no registers.
Template instantiatesThe Instantiation Template (§11) matches the module declaration exactly — every port named, every parameter at its declared default.
Constraints capturedSequencing rules, input-stability assumptions, and error/boundary behavior visible in the RTL are stated in Usage Constraints (§10), or the section says "none" in one line.
Submodules linked, not duplicatedDocumented submodules are referenced by link; none re-documented inline (Excluded Content).
No excluded contentNo line-by-line code walkthrough or implementation internals (Excluded Content).

If any check fails, fix the document and re-run the check — do not leave the doc disagreeing with the RTL it describes.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

varch

免费

Decompose an IP requirement into submodules, define interfaces, and generate an architecture document plus per-module requirement files and a top-level skeleton

中文简介正在准备中。当前显示原文说明。

phamcuong21478/rtl-skills182026年6月10日 更新

vdebug

免费

Trace failing signals through the RTL hierarchy, classify root cause, and write a debug report per issue — no fix is proposed

中文简介正在准备中。当前显示原文说明。

phamcuong21478/rtl-skills182026年6月10日 更新

vdesign

免费

Generate a design proposal, documentation, and RTL backbone from a requirement file

中文简介正在准备中。当前显示原文说明。

phamcuong21478/rtl-skills182026年6月10日 更新

vdoc

免费

Aggregate all per-module documentation into a single comprehensive IP document

中文简介正在准备中。当前显示原文说明。

phamcuong21478/rtl-skills182026年6月10日 更新

vfill

免费

Implement Verilog code from an approved design proposal, then lint and simulate

中文简介正在准备中。当前显示原文说明。

phamcuong21478/rtl-skills182026年6月10日 更新

vflow

免费

Scan project state to determine phase completion, write flow_status.md, and orchestrate the full RTL design flow from architecture to documentation

中文简介正在准备中。当前显示原文说明。

phamcuong21478/rtl-skills182026年6月10日 更新

查看 phamcuong21478 的全部技能

报告此技能的问题