⏳ This skill is pending AI review.

Scores will appear once the review pipeline completes.

version unknown

readable-verilog-generator

eriemon@eriemon⭐ 332 stars· last commit 2mo ago· 0 open issues

>-

Choose how to use this skill

You do not need every option. Choose the path your AI client supports. The stable page stays the same; versioned files are immutable.

1. Native installer

This listing has no registered native installer command. Use the complete package or source fallback below, depending on what your client supports.

Do not guess an installer command or replace an existing version without reviewing the diff.

2. Complete package recommended

Download the ZIP when available. It includes SKILL.md plus the references, security notes and version metadata.

No complete ProSkills package is published for this listing yet.

3. Prompt-only

Copy the prompt above when the agent can read the stable page or when you want to adopt the workflow without installing a skill.

Need only the instruction file?

Download SKILL.md only if your client requires a single file. The complete ZIP is safer for a full installation because it preserves the references and release context.

No path installs or executes anything by itself. Your agent still needs access to the project files. Before updating, compare the installed version and review the diff.

—/10

// RATINGS

⭐GitHub Stars
⭐⭐⭐ 332 on GitHubGitHub ↗

Popular

🟢ProSkills Score
—
📍

Not yet listed on ClawHub or SkillsMP

// README

Verilog Generator is an agent skill for practical Verilog-2001 work. It helps you create a module from a clear requirement, understand an existing RTL design, add semantic comments, repair a problem from real diagnostics, and run the checks that your task actually needs.

What it does

  • Turn a module requirement into readable, synthesizable Verilog-2001 RTL.
  • Explain an existing module through its ports, clock/reset behavior, state, timing, and data flow.
  • Add or improve semantic comments without silently changing RTL behavior.
  • Repair an existing design against a compiler, linter, simulator, or tool log.
  • Prepare a testbench scaffold or request real simulation results when the environment is available.

The skill keeps results honest: a static review, a simulation, a synthesis run, and a hardware result are reported separately. A check that did not run is never presented as a completed result.

Install

Ask your AI to install the skill from https://github.com/Eriemon/verilog-generator.

After installation, call the skill in the same conversation with $readable-verilog-generator or describe the Verilog task directly.

The v2.0.0 release package also includes install.ps1, install.sh, and install.bat beside SKILL.md for manual installation. Supported Harness targets are Codex (codex), Claude (claude), Gemini (gemini), and DeepSeek (deepseek). From the release directory, preview and install with one of these commands:

.\install.ps1 -Platform codex -DryRun -Json
.\install.ps1 -Platform codex -Json
./install.sh --platform codex --dry-run --json
./install.sh --platform codex --json
install.bat -Platform codex -DryRun -Json
install.bat -Platform codex -Json

Real wrapper writes automatically back up an existing target before replacement; DryRun never writes. Source directories without the configured release receipt are rejected. See references/skill/installation.md for the parameterized contract.

Before you start

Prepare only the material that matches your task:

What to prepare for a Verilog task

  • New module: purpose, module name, ports, clock and reset semantics, cycle-by-cycle behavior, protocol rules, boundary cases, and the checks you expect.
  • Existing RTL review: the .v files, relevant testbench or integration context, and the questions or risks you want reviewed.
  • Commenting or repair: the original RTL, the diagnostic or log, the intended behavior, and whether the change must be comment-only or may change logic.
  • Simulation or external validation: a usable testbench with expected outcomes, the simulator/tool environment, and any required project or remote access.

If something important is missing, the skill asks for it before making a consequential change.

How to call it

Use a normal request. These examples are ready to adapt:

Use $readable-verilog-generator to create a Verilog-2001 AXI-Stream packet counter.
First ask for any missing interface and timing details, then show me the module spec
and WaveDrom behavior preview before generating RTL.
Use $readable-verilog-generator to review this RTL for reset behavior, handshake
errors, width issues, naming, comments, and synthesis risks. Do not modify the file.
Use $readable-verilog-generator to add semantic comments to this Verilog file.
Preserve every RTL token and show the comment-only verification result.
Use $readable-verilog-generator to diagnose and repair this module from the
attached simulator log. Show the proposed change and validation results first.

Preview and confirm before generation

For a new module or a behavior-changing repair, ask for a preview before asking AI to write the final RTL. The preview should make these decisions visible:

Preview and confirmation before generation

  1. Interface, port directions, widths, clock, and reset behavior.
  2. State transitions, handshake conditions, data-path timing, and corner cases.
  3. At least one WaveDrom scenario that shows the intended cycle behavior.
  4. The checks that will be run and what each result can prove.

Confirm the preview only after the behavior matches your intent. If it does not, revise the requirement and preview again; do not treat an unconfirmed interpretation as the final design.

What you receive

Depending on the request, the handoff can include:

What you receive after the task

  • readable Verilog-2001 source (.v);
  • a same-name module specification (<module>_spec.md);
  • WaveDrom behavior files (.json5 and rendered .svg);
  • a testbench scaffold or updated testbench when requested;
  • review, repair, static-check, simulation, or tool reports showing only checks that actually ran;
  • a concise explanation of remaining assumptions, warnings, and unverified areas.

Review and deliver

Reviewable delivery

Review the generated files and the checks that actually ran before accepting the handoff. Keep assumptions and unverified areas visible.

Example result

The example below is a 32-bit AXI-Stream meter. It counts bytes only after a TVALID/TREADY transfer, counts packets on a transferred TLAST, and saturates instead of wrapping.

// AXI-Stream transaction detection
assign flag_transfer = i_axis_tvalid & i_axis_tready;
assign flag_packet_end = flag_transfer & i_axis_tlast;

always@(posedge i_axis_aclk or negedge i_axis_arstn)begin
	if(i_axis_arstn == 1'b0)begin
		cnt_packet_o <= 32'd0;
	end else if(i_clear == 1'b1)begin
		cnt_packet_o <= 32'd0;
	end else if(flag_packet_end == 1'b1)begin
		if(data_frame_sum[32] == 1'b0)begin
			cnt_packet_o <= data_frame_sum[31:0];
		end else begin
			cnt_packet_o <= 32'hFFFF_FFFF;
		end
	end
end

Open the complete commented source →

Example checkResult
Formatter ASTPASS
Readability, comments, naming, profilePASS
Errors0
Strict warnings0

This is an example static result for the published sample. It does not claim that a simulator, synthesis tool, hardware target, or remote environment ran.

Authors and citation

Jiyuan Liu and He Li · Southeast University(东南大学)· HIQC (Heterogeneous Intelligence and Quantum Computing Laboratory)

If this skill supports your research, teaching, or engineering work, cite CITATION.cff.

@software{liu_2026_verilog_generator,
  author       = {Jiyuan Liu and He Li},
  title        = {{Verilog Generator}: An Agent Skill for Verilog-2001 RTL Workflows},
  year         = {2026},
  version      = {2.0.0},
  date         = {2026-08-12},
  url          = {https://github.com/Eriemon/verilog-generator},
  license      = {Apache-2.0},
  note         = {Agent skill for readable Verilog-2001 RTL workflows}
}

// HOW IT'S BUILT

// FILES

419 files shipped with this skill. Inline text is the catalog copy. The upstream link is the source repository.

  • SKILL.md21 KB5f6cb9291a6dupstream ↗
    ---
    name: readable-verilog-generator
    description: >-
      Use when creating, writing, reviewing, annotating, repairing, refactoring, or validating readable Verilog RTL, including synthesizable Verilog-2001 .v files, existing-RTL analysis, semantic comment annotation, testbench scaffold planning, ASIC-quality review, local or remote Vivado/xsim validation, evidence-backed repair, and workflow trace diagnosis.
    ---
    
    # Readable Verilog Generator
    
    Generate, analyze, improve, and verify readable Verilog-2001 RTL through the bundled runtime under `scripts/python/`. Keep design RTL and verification testbenches in `.v` files, use `scripts/python/facade/verilog_api.py` for host integration, and treat formatter-AST and external-tool evidence as stronger than model self-assessment.
    
    ## Route
    
    - `create/write`: confirm the design contract, then use `requirements -> codegen_plan -> spec_document -> python -> rtl`.
    - `deep_review`: insert a non-empty structured review between the Python semantic model and RTL; it must cover interface, reset, timing/pipeline, handshake or FSM behavior, width, synthesis, testbench coverage, and risks.
    - `review/analyze`: remain read-only and report the eight public gate states before suggesting changes.
    - `annotate`: preserve an immutable normalized baseline, change only `//` comments, prove token equivalence from that baseline, and rerun the final deliverable gate.
    - `repair/refactor`: bind the task to real RTL, reproduce or validate the issue, and apply the smallest evidence-backed change.
    - `agentic_repair`: use the existing-RTL `verify_existing_verilog(...)` loop with an explicit `conservative`, `semi_auto`, or `auto_apply` choice.
    - `validate`: collect static or external evidence without implicitly editing RTL.
    
    - Load `references/workflows/verilog_dispatcher.md` before routing. Existing assets, logs, waveform clues, and mixed inputs use its read-only entry decision before any generation, validation, backup, or remote action.
    
    ## Install v2.0.0
    
    The package root contains `install.ps1`, `install.sh`, and `install.bat` beside this `SKILL.md`. They share the package-local Python backend and read only the generated installer projection under `assets/installer/` plus the same-level bootstrap descriptor. Platform IDs, root resolution, target templates, status text, exit codes, transaction policy, and verification cases are data-driven by `config/installer/`; do not add platform branches or current test values to code or comments.
    
    Install only from a versioned payload with the configured `RELEASE_RECEIPT.json`. Use `--DryRun`/`--dry-run` to validate without creating transaction resources; use replacement flags only when the target and overwrite intent are explicit. A transaction handles one platform and one target, preserves unlisted target files, writes an install receipt, and attempts rollback on failure. Unknown IDs and source directories without a valid release receipt fail closed. See `references/skill/installation.md` for the complete contract and parameterized invocation templates.
    
    ## Generate And Modify
    
    1. Confirm module name, ports, clock/reset, behavior, pipeline expectation, interface family, and verification cases.
    2. Use `regular` by default; use `deep_review` only when its extra review stage adds value; use `agentic_repair` only for existing RTL.
    3. Generate a Python semantic model before RTL in the staged workflow and use it as the testbench semantic contract.
    4. Select local interface and ADC/DAC family templates only when the confirmed design matches them; record every adaptation in the requirements and codegen plan.
    5. Keep batch execution generation-only, with one run directory per confirmed spec. Do not use batch mode for existing-RTL mutation or decision resume.
    6. Treat streaming as provider interaction only. The finalized response artifact remains the extraction source of truth.
    7. Run the strict generated-deliverable gate before downstream use. Optional lint and testbench helpers never replace it.
    
    Every module generated or modified by this skill must ship with a same-name `<module>_spec.md` companion. The canonical JSON contract accepts a single legacy module projection or a `modules` array, but each normalized module must declare a safe `.v` `rtl_path`, complete interface ports, clock/reset semantics, cycle behavior, constraints, corner cases, verification cases, and at least one `timing_diagrams` entry. A timing entry contains `id`, `title`, `scenario`, `description`, and WaveJSON with named signals. `python -m scripts.python.workflow.cli write-spec --spec <spec.json> --out-dir <artifact-root> [--source <rtl.v>] --language <zh|en>` writes `spec/<feature>/<module>_spec.md` plus sibling `spec/<feature>/waveforms/<module>_<scenario>.json5` and `.svg`. The `--source` form fails closed when a module or port is undeclared; the no-source form validates and renders only the confirmed spec and never infers behavior from RTL. All waveform rendering goes through the renderer runtime declared by the settings authority and fails closed when its configured Node/npm prerequisites, package identity, version, or executable are unavailable. A render failure stages diagnostics without overwriting the previous valid bundle.
    
    The default profile is `erie_strict`. Its authoritative naming, bilingual header, region, FSM, comment, port-order, runtime-message, and formatter-AST rules live in `references/rules/verilog-code-comment-naming-standard.md`, `references/rules/erie-style.md`, `references/rules/verilog-comment-placement.md`, and machine-readable assets. Do not duplicate those rule catalogs in this entry document.
    
    ## Quality
    
    Strict quality control is mandatory. ASIC quality review, independent static lint, and testbench scaffold are optional workflow steps selected only when the task needs their evidence. Optional helper tools are inside the workflow and never replace the generated-deliverable gate.
    
    Generated deliverables must pass the formatter-backed gate with zero errors and zero strict warnings. The public result matrix is exactly `compile`, `ast`, `readability`, `comment`, `naming`, `profile`, `testbench`, and `toolchain`; static compile evidence does not imply that an external simulator, synthesis, or remote validation ran.
    
    Verilog/SystemVerilog filenames must describe real function. Functional digits are valid; VG148 rejects only terminal version or meaningless numeric suffixes. A file recognized as a testbench by `tb_`, `_tb`, `testbench`, or an exact `tb`/`testbench`/`sim` directory must use the `tb_<function>.v` or `tb_<function>.sv` form; `_tb` is recognition evidence, not an allowed output name. When an ordinary design filename carries at least two independent testbench-content evidence groups, VG149 remains inconclusive until the user confirms `design` or `testbench` through `file_role_confirmations`. Confirming `testbench` does not waive the prefix rule: rename the file to the authority-selected `tb_<function>` form before it can pass. VG150 rejects configured workflow/evidence phrases on entity comments and high-confidence periodic unrelated tail families; it does not blacklist ordinary Chinese words or isolated functional descriptions. The full filename and comment contract lives in `references/rules/verilog-code-comment-naming-standard.md`, and gate/report semantics live in `references/rules/verilog-quality-gates.md`.
    
    Use strict mode for new or modified deliverables. `--non-strict --warn-only` is limited to historical reference-corpus analysis and never approves generated output. The formatter backend under `scripts/python/quality/formatter_backend/` is the parser source for quality checks; do not add a second Verilog parser.
    
    For comment-only work, normalize the original RTL once, annotate a copy, run the comment-only verifier with a required delta, run the final gate, and compare the final file again against the immutable baseline. Comments must not change RTL tokens, modules, ports, lvalues, resets, always targets, or instance connections. Reused generic entity comments do not satisfy semantic-comment coverage.
    
    When `VG097` cannot see an external XPM, UNISIM primitive, or project-generated IP interface, first consult the exact-name AMD-Xilinx primitive catalog in `assets/xilinx_primitive_semantics.json` and its detailed contract in `references/rules/xilinx-primitive-exemptions.md`. Keep the result `inconclusive` until a governed pure-interface `.v` source is supplied through the repeatable `--external-interface-source` option when the name is not cataloged or the profile conflicts. Use the registered `quality.external-interface-extract` command for explicit vendor-source module whitelists and `quality.external-interface-manifest` for reviewed project-IP contracts. Never infer that an unknown width is a mismatch, and never use a stub or primitive profile as simulation, synthesis, implementation, or hardware evidence.
    
    Generated RTL must remain synthesizable Verilog-2001. Prefer the governed interface templates for AXI-Stream, AXI4-Lite, AXI4, AHB, and APB; use complete combinational assignments and case defaults; avoid raw gated clocks; document CDC/reset assumptions; keep datapath and control timing-reviewable; and avoid generated `function` or `task` blocks when explicit logic is clearer for waveform debug. Every FSM must use three independent processes for the state register, procedural combinational next-state logic, and state output/task logic; a continuous `assign` to any next-state signal is forbidden. Every continuous or procedural combinational target must pass both the transitive source-cone limit and the configured real-operation budget, each defaulting to at most three. VG146/VG147 evaluate the complete source closure: formatter structured port associations bind child outputs into the parent cone, parameter/localparam specialization selects the materialized implementation, and each definition root, full instance path, specialization fingerprint, and static target remains an independent report identity. Output connections expand through known implementations; inout and unresolved-net boundaries never invent reverse ownership; all known wire/tri drivers are merged; and a clocked output Q cuts upstream expansion while its D input remains checked. The operation budget covers unary, binary, ternary, comparison, selector, control-decode, continuous-assign, combinational-process, clocked D-input, and elaborated `for` operations. Moving logic into `always @(*)` or directly into a clocked D expression does not bypass either gate. If `loop_presence=unknown`, VG146 and VG147 both apply and share the same lower-bound evidence: an over-limit known lower bound fails both, otherwise both remain inconclusive. When the operation budget fails, recommend pipeline registers, registered flags or predecode, or a multicycle FSM decomposition first, and disclose that these changes may alter visible latency; immutable-latency protocols require manual architecture review. Only an exact output bridge from an output port to a clocked internal `_o` `reg` is exempt from the source-cone rule. Detailed VG rules and ASIC review criteria remain authoritative in `references/rules/verilog-quality-gates.md` and `references/rules/asic-verilog-quality.md`.
    
    VG151-VG155 provide module-independent structural contracts. Parameter constraints are selected automatically from the identifiers in each restricted expression; `module`, `instance`, `hierarchy`, and `scope` fields are invalid. VG152 reports large dynamically selected packed storage with a configurable positive threshold and offers structured case/FSM, inferred-memory, or vendor-memory alternatives. VG153/VG154 expose read-without-driver and unused declaration evidence, including reg/wire/function/task facts. VG155 uses explicit top-level ready-valid role facts and requires both valid and ready for a transfer consumer; no target module name is part of these contracts.
    
    Before generating or repairing declarations, apply VG156-VG158 as design-time naming and comment constraints, not only as a final audit. VG156 checks every module/function/task variable declaration by underscore token: a token containing digits is valid only when its complete case-insensitive text appears in the governed protocol/algorithm/rate allowlist. VG157 forbids ordinary-comment version markers such as `v2` or `version 3`; only the formatter-recognized fixed bilingual header and revision-history range is exempt. VG158 repeatedly removes the governed direction/type prefixes and `_o`, then requires at least one functional token outside the closed meaningless-token set; unknown domain terms pass. The formatter must assign each declaration to exactly one region using the shared conflict priority, place the first group comment directly below its banner, place later group comments after exactly one blank line, leave no empty group, keep one trailing blank line per non-empty region, and produce byte-identical output on the second pass.
    
    ## Existing RTL
    
    - `analyze_existing_verilog(...)` owns structural analysis and durable design explanation.
    - `improve_existing_verilog(...)` owns controlled testbench, style, partition, merge, and optimization assist flows.
    - `compare_verilog_semantics(...)` owns equivalence, QoR, and transform-validation evidence.
    - `verify_existing_verilog(...)` owns log-driven verification, diagnosis, candidate patches, confirmation resume, and terminal closure.
    
    `optimize_assist` and `merge_assist` are assist-only by default and never silently accept or rewrite source RTL. `conservative` is report-only; `semi_auto` requires confirmation before overwrite; `auto_apply` is valid only after explicit selection and still downgrades non-eligible patch classes to confirmation. Preserve source and testbench backups, diff and decision artifacts, diagnostics, and terminal status exactly as specified by `references/workflows/workflow-contracts.md` and `references/integration/host-integration.md`.
    
    Existing-RTL diagnostic comment findings are advisory so compile, semantic, interface, and high-confidence lint failures remain visible. A report file being written is not success; blocker, warning, failed, toolchain, external-validation, or confirmation-blocked terminal states remain non-success.
    
    ## Dependencies And External Evidence
    
    Run dependency preflight before first use and before remote, Vivado, or Vitis work. Missing required dependencies require user approval before installation; if declined, continue only with self-contained static Verilog work and block remote/execute/implement claims. The required skill dependency remains `erie-remote-ssh`; the optional context-engineering group is the only recommended external skill group. No additional external skill suite is included. The required external renderer dependency, package identity, version, executable, and Node/npm floor are read from the settings authority; use `scripts/python/toolchain/wavedrom_runtime.py` with the `check`, `install --yes`, or `render` subcommand, never an ad-hoc package command. Prefer `vivado-developer` and `vitis-developer` for AMD-Xilinx, and `pds-developer` for PangoMicro. FPGA-Agent-Skills remains an explicit manual fallback.
    
    Compile, execute, simulation, synthesis, or implement readiness requires actual external evidence. Remote validation is preferred and must use `erie-remote-ssh`, a user-confirmed server, local-only server selection/configuration, and the remote workdir's `.settings/verilog.remote.json`. A configured default is only a recommendation. Multiple Vivado settings candidates require user selection. Do not silently fall back to local tools and do not add direct SSH/SCP logic.
    
    Remote validation runs are retained by default, including fixed remote-fixture reports. Cleanup occurs only when explicitly requested. Vivado xsim is the preferred simulator backend, followed by VCS+Verdi and then iverilog/vvp; yosys is implement-readiness evidence only. VCS+Verdi support is scripted backend invocation, not full GUI/session automation.
    
    ## Document And Command Registry
    
    Registration is enabled for this skill. Markdown remains the authoritative knowledge source. Editable command records live under `config/registry/commands/`; document responsibilities and search metadata have one owner in `config/registry/documents/catalog.json`; current duplicate and interface decisions live in `config/registry/governance/reviews.json`; `config/registry/registry.sqlite3` is a generated local FTS5 trigram index at the location required by the agents-md-generator gate. The skill runtime is self-contained and must not import or call an external `agents-md-generator` registry implementation.
    
    Document governance scans `SKILL.md` and every Markdown file below `references/`, recursively. It records one responsibility per document, knowledge pointers, exact and fuzzy duplicate adjudications, interface mappings, and content hashes. Remove only confirmed equivalent duplication; preserve structural repetition and every unique contract. Installed copies may query and check but must not mutate registry sources.
    
    Detailed command syntax, examples, prerequisites, outputs, exit codes, risk warnings, and relations are retrieved from the local registry:
    
    ```text
    python -m scripts.python.registry.query_registry ask "<question>" [--kind <kind>] [--category <name>] [--limit 1..10] [--json]
    ```
    
    The query is read-only and never executes returned commands. Exit codes are `0` for hits, `1` for no match, `2` for request errors, and `3` for a missing, corrupt, stale, or incompatible index. After JSON source changes, use registry instruction `registry.build`; never edit SQLite by hand. See `references/skill/script-guide.md` for the compact registry lifecycle.
    
    ## Verify
    
    The first outer command group is the generated-deliverable gate:
    
    ```text
    python -m scripts.python.validation.generated_deliverable_gate <rtl-file-or-dir> --json <report.json> --markdown <report.md>
    ```
    
    When either report option is omitted, the CLI writes both reports under the caller's current working directory: `reports/readable/deliverable_gate.json` and `reports/readable/deliverable_gate.md`. The focused quality CLI follows the same policy with `quality_gate.json` and `quality_gate.md`. Supplying one explicit path only overrides that format; JSON and Markdown paths must resolve to different files. Runtime reports must never be written back to the source or installed skill root.
    
    Both CLIs publish v3 reports and print compact `[Python]` finding lines containing the VG rule, status, confirmed location, concrete problem, and direct fix instruction. The JSON and Markdown files contain the full evidence, ordered repair steps, risk and human-review obligation, plus bad/good examples. Exit code `1` means the gate found RTL issues; exit code `2` means invocation, diagnostic-contract, or report-publication failure.
    
    The second outer command group is package validation:
    
    ```text
    python -m scripts.python.validation.validate_verilog_skill --settings .\config\defaults.json
    ```
    
    Run the smallest relevant checks while editing, then the governed final chain. The extended repository-regression, external-audit, and remote variants live in `references/integration/configuration.md` and registry instruction `validation.skill`. Local success does not replace requested remote pytest, simulator, synthesis, or installed-copy evidence. Never claim an unrun check passed.
    
    ## Resources
    
    - `references/skill/script-guide.md`: registry query, build, document-governance, and command-category contract.
    - `references/workflows/verilog_dispatcher.md`: task classification, public gate matrix, and safe repair boundary.
    - `references/workflows/workflow-contracts.md`: run artifacts, statuses, resume behavior, and trace semantics.
    - `references/integration/configuration.md`: paths, dependencies, remote settings, and validation configuration.
    - `references/integration/host-integration.md`: facade functions and host-owned execution boundaries.
    - `scripts/python/workflow/spec_document.py`: strict module contract, source cross-check, Markdown and WaveDrom bundle writer.
    - `scripts/python/toolchain/wavedrom_runtime.py`: pinned Node/npm/WaveDrom check, explicit install, and SVG renderer.
    - `references/rules/verilog-code-comment-naming-standard.md`: canonical readable RTL rule text.
    - `references/rules/verilog-quality-gates.md`: VG catalog and report semantics.
    - `references/rules/xilinx-primitive-exemptions.md`: exact AMD-Xilinx UNISIM/XPM/project-IP primitive inventory and VG097/VG132/VG146/VG147 boundary contract.
    - `references/rules/asic-verilog-quality.md`: ASIC quality review criteria and risk boundaries.
    - `references/rules/testbench-patterns.md`: self-checking testbench scaffold patterns.
    - `references/checklists/lint-checklist.md`: independent static lint review checklist.
    - `references/corpus/verilog-style-observations.md`: empirical ideal/bad corpus observations that do not override normative rules.
    - `references/checklists/verilog-readability-gate.md`: final human review.
    - `references/skill/skill-standards.md`: skill packaging and progressive-disclosure requirements.
    
    ## Boundaries
    
    - Do not generate non-Verilog hardware flows, C/C++ kernels, or alternate RTL dialects.
    - Do not invent source RTL, testbenches, logs, successful tool evidence, or repair confirmation.
    - Do not store caller run artifacts inside the skill; use caller-selected directories such as `reports/`.
    - Do not let optional helpers, model reviews, or registry query results replace actual quality or toolchain evidence.
    
  • assets/use_case_templates/jesd_adc/README.md699 Bfa7ef93228c8upstream ↗
    # JESD ADC Use-Case Template
    
    This bundle captures the recurring JESD204 receive pattern used by JESD ADC projects such as AD6676.
    
    ## Scope
    
    - JESD204 RX transceiver and link bring-up
    - Transport receive and channel packing
    - DMA-backed ADC capture
    - Board-level top and block-design scaffolding
    
    ## Parameterization Points
    
    - RX lane count
    - Number of converters
    - Sample width and samples per frame
    - Reference clock routing
    - Board family and DMA interconnect
    
    ## Provenance Notes
    
    - `common_bd.tcl` is distilled from the receive-side structure used by AD6676.
    - `system_top.v` is a compact board-facing wrapper that exposes JESD RX sideband clocks and valid/data output.
    
  • assets/use_case_templates/jesd_dac/README.md745 B502d401511c0upstream ↗
    # JESD DAC Use-Case Template
    
    This bundle captures the recurring JESD204 transmit pattern used by JESD DAC projects such as DAC_FMC_EBZ and the transmit side of DAQ3.
    
    ## Scope
    
    - JESD204 TX transceiver and link bring-up
    - Transport feed through upack and DAC FIFO
    - DMA-backed waveform playback
    - Board-level top and block-design scaffolding
    
    ## Parameterization Points
    
    - TX lane count
    - Number of converters
    - Sample width and samples per frame
    - FIFO depth and DMA width
    - Board family and transceiver settings
    
    ## Provenance Notes
    
    - `common_bd.tcl` keeps the TX-side structure used by DAC_FMC_EBZ and DAQ3.
    - `system_top.v` is a compact board-facing wrapper that exposes a waveform push input and lane clock output.
    
  • assets/use_case_templates/mxfe_mixed/README.md739 B18a8bef3ab51upstream ↗
    # MxFE Mixed Use-Case Template
    
    This bundle captures the recurring mixed RF ADC and RF DAC pattern used by MxFE projects such as AD9081 X-band designs.
    
    ## Scope
    
    - Coordinated RX and TX JESD paths
    - Shared RF transceiver tuning parameters
    - PMOD and FMC control sideband buses
    - TDD synchronization and enable signals
    
    ## Parameterization Points
    
    - RX and TX lane rates
    - Number of links
    - RX and TX samples per channel
    - PMOD or FMC control bus widths
    - TDD enable and synchronization strategy
    
    ## Provenance Notes
    
    - `common_bd.tcl` keeps the board-level orchestration pattern used by AD9081 X-band flows.
    - `system_top.v` is a compact wrapper that exposes RX and TX status, PMOD control, and TDD sideband hooks.
    
  • assets/use_case_templates/spi_adc/README.md925 B0da76651bc53upstream ↗
    # SPI ADC Use-Case Template
    
    This bundle captures the recurring board-level pattern used by SPI ADC projects such as AD40xx, AD469x, and AD7134.
    
    ## Scope
    
    - Triggered or periodic ADC conversion launch
    - SPI Engine style serial control path
    - BUSY edge capture or ODR handoff
    - DMA-backed sample collection into processor memory
    
    ## Parameterization Points
    
    - ADC resolution and packed sample width
    - Number of channels or SDI lanes
    - Sampling rate and SPI reference clock
    - Trigger policy: CNV pulse, ODR, or BUSY edge
    - Board family and GPIO banking
    
    ## Provenance Notes
    
    - `system_top.v` is distilled from the top-level wiring style used by AD469x-class SPI ADC projects.
    - `common_bd.tcl` combines the CNV/BUSY gating and DMA structure used across AD40xx, AD469x, and AD7134.
    - `system_bd.tcl` and `system_project.tcl` keep only the reusable board flow skeleton and remove project-specific noise.
    
  • assets/use_case_templates/spi_dac/README.md757 B5cfd2648a1b5upstream ↗
    # SPI DAC Use-Case Template
    
    This bundle captures the recurring board-level pattern used by SPI DAC projects such as AD5758 and AD5766.
    
    ## Scope
    
    - SPI DAC register and streaming control
    - Optional cyclic DMA feed for playback
    - GPIO sideband control such as fault, reset, and LDAC
    - Board-level top and block-design scaffolding
    
    ## Parameterization Points
    
    - DAC sample width
    - Number of DAC channels
    - DMA cyclic policy
    - GPIO sideband presence
    - Board family and voltage standard
    
    ## Provenance Notes
    
    - `system_top.v` follows the DAC sideband wiring style used by AD5758.
    - `common_bd.tcl` keeps the SPI Engine and DMA structure used by AD5766.
    - The project and constraint files are distilled to the minimum reusable skeleton.
    
  • README.md8.2 KB5ab33bfb247eupstream ↗
    <p align="center">
      <a href="README.md"><strong>English</strong></a>
      <span>&nbsp;|&nbsp;</span>
      <a href="README-CN.md">Chinese</a>
    </p>
    
    <p align="center">
      <img src="assets/readme/hero-overview.png" alt="Verilog Generator: from RTL intent to reviewable delivery" width="100%">
    </p>
    
    <p align="center">
      <a href="LICENSE"><img alt="Apache-2.0 license" src="https://img.shields.io/badge/license-Apache--2.0-2ad4ee"></a>
      <img alt="VERSION v2.0.0" src="https://img.shields.io/badge/version-v2.0.0-8ce85d">
      <img alt="Verilog-2001" src="https://img.shields.io/badge/RTL-Verilog--2001-ffb85c">
      <img alt="Agent skill" src="https://img.shields.io/badge/target-agent%20skill-8ce85d">
    </p>
    
    <p align="center">
      <strong>Readable RTL → clear behavior → reviewable delivery</strong><br>
      Give AI the design intent, review the behavior preview, and receive artifacts you can inspect and verify.
    </p>
    
    Verilog Generator is an agent skill for practical Verilog-2001 work. It helps you create a module from a clear requirement, understand an existing RTL design, add semantic comments, repair a problem from real diagnostics, and run the checks that your task actually needs.
    
    ## What it does
    
    - Turn a module requirement into readable, synthesizable Verilog-2001 RTL.
    - Explain an existing module through its ports, clock/reset behavior, state, timing, and data flow.
    - Add or improve semantic comments without silently changing RTL behavior.
    - Repair an existing design against a compiler, linter, simulator, or tool log.
    - Prepare a testbench scaffold or request real simulation results when the environment is available.
    
    The skill keeps results honest: a static review, a simulation, a synthesis run, and a hardware result are reported separately. A check that did not run is never presented as a completed result.
    
    ## Install
    
    > Ask your AI to install the skill from https://github.com/Eriemon/verilog-generator.
    
    After installation, call the skill in the same conversation with `$readable-verilog-generator` or describe the Verilog task directly.
    
    The v2.0.0 release package also includes `install.ps1`, `install.sh`, and `install.bat` beside `SKILL.md` for manual installation. Supported Harness targets are Codex (`codex`), Claude (`claude`), Gemini (`gemini`), and DeepSeek (`deepseek`). From the release directory, preview and install with one of these commands:
    
    ```text
    .\install.ps1 -Platform codex -DryRun -Json
    .\install.ps1 -Platform codex -Json
    ```
    
    ```bash
    ./install.sh --platform codex --dry-run --json
    ./install.sh --platform codex --json
    ```
    
    ```bat
    install.bat -Platform codex -DryRun -Json
    install.bat -Platform codex -Json
    ```
    
    Real wrapper writes automatically back up an existing target before replacement; `DryRun` never writes. Source directories without the configured release receipt are rejected. See `references/skill/installation.md` for the parameterized contract.
    
    ## Before you start
    
    Prepare only the material that matches your task:
    
    ![What to prepare for a Verilog task](assets/readme/project-facts.png)
    
    - **New module:** purpose, module name, ports, clock and reset semantics, cycle-by-cycle behavior, protocol rules, boundary cases, and the checks you expect.
    - **Existing RTL review:** the `.v` files, relevant testbench or integration context, and the questions or risks you want reviewed.
    - **Commenting or repair:** the original RTL, the diagnostic or log, the intended behavior, and whether the change must be comment-only or may change logic.
    - **Simulation or external validation:** a usable testbench with expected outcomes, the simulator/tool environment, and any required project or remote access.
    
    If something important is missing, the skill asks for it before making a consequential change.
    
    ## How to call it
    
    Use a normal request. These examples are ready to adapt:
    
    ```text
    Use $readable-verilog-generator to create a Verilog-2001 AXI-Stream packet counter.
    First ask for any missing interface and timing details, then show me the module spec
    and WaveDrom behavior preview before generating RTL.
    ```
    
    ```text
    Use $readable-verilog-generator to review this RTL for reset behavior, handshake
    errors, width issues, naming, comments, and synthesis risks. Do not modify the file.
    ```
    
    ```text
    Use $readable-verilog-generator to add semantic comments to this Verilog file.
    Preserve every RTL token and show the comment-only verification result.
    ```
    
    ```text
    Use $readable-verilog-generator to diagnose and repair this module from the
    attached simulator log. Show the proposed change and validation results first.
    ```
    
    ## Preview and confirm before generation
    
    For a new module or a behavior-changing repair, ask for a preview before asking AI to write the final RTL. The preview should make these decisions visible:
    
    ![Preview and confirmation before generation](assets/readme/design-profile.png)
    
    1. Interface, port directions, widths, clock, and reset behavior.
    2. State transitions, handshake conditions, data-path timing, and corner cases.
    3. At least one WaveDrom scenario that shows the intended cycle behavior.
    4. The checks that will be run and what each result can prove.
    
    Confirm the preview only after the behavior matches your intent. If it does not, revise the requirement and preview again; do not treat an unconfirmed interpretation as the final design.
    
    ## What you receive
    
    Depending on the request, the handoff can include:
    
    ![What you receive after the task](assets/readme/rule-rendering.png)
    
    - readable Verilog-2001 source (`.v`);
    - a same-name module specification (`<module>_spec.md`);
    - WaveDrom behavior files (`.json5` and rendered `.svg`);
    - a testbench scaffold or updated testbench when requested;
    - review, repair, static-check, simulation, or tool reports showing only checks that actually ran;
    - a concise explanation of remaining assumptions, warnings, and unverified areas.
    
    ## Review and deliver
    
    ![Reviewable delivery](assets/readme/evidence-guard.png)
    
    Review the generated files and the checks that actually ran before accepting the handoff. Keep assumptions and unverified areas visible.
    
    ## Example result
    
    The example below is a 32-bit AXI-Stream meter. It counts bytes only after a `TVALID`/`TREADY` transfer, counts packets on a transferred `TLAST`, and saturates instead of wrapping.
    
    ```verilog
    // AXI-Stream transaction detection
    assign flag_transfer = i_axis_tvalid & i_axis_tready;
    assign flag_packet_end = flag_transfer & i_axis_tlast;
    
    always@(posedge i_axis_aclk or negedge i_axis_arstn)begin
    	if(i_axis_arstn == 1'b0)begin
    		cnt_packet_o <= 32'd0;
    	end else if(i_clear == 1'b1)begin
    		cnt_packet_o <= 32'd0;
    	end else if(flag_packet_end == 1'b1)begin
    		if(data_frame_sum[32] == 1'b0)begin
    			cnt_packet_o <= data_frame_sum[31:0];
    		end else begin
    			cnt_packet_o <= 32'hFFFF_FFFF;
    		end
    	end
    end
    ```
    
    **[Open the complete commented source →](assets/examples/readme/axis_packet_meter.v)**
    
    | Example check | Result |
    | --- | ---: |
    | Formatter AST | `PASS` |
    | Readability, comments, naming, profile | `PASS` |
    | Errors | `0` |
    | Strict warnings | `0` |
    
    > This is an example static result for the published sample. It does not claim that a simulator, synthesis tool, hardware target, or remote environment ran.
    
    ## Authors and citation
    
    Jiyuan Liu and He Li · Southeast University(东南大学)· HIQC (Heterogeneous Intelligence and Quantum Computing Laboratory)
    
    If this skill supports your research, teaching, or engineering work, cite [CITATION.cff](CITATION.cff).
    
    ```bibtex
    @software{liu_2026_verilog_generator,
      author       = {Jiyuan Liu and He Li},
      title        = {{Verilog Generator}: An Agent Skill for Verilog-2001 RTL Workflows},
      year         = {2026},
      version      = {2.0.0},
      date         = {2026-08-12},
      url          = {https://github.com/Eriemon/verilog-generator},
      license      = {Apache-2.0},
      note         = {Agent skill for readable Verilog-2001 RTL workflows}
    }
    ```
    
    ---
    
    <p align="center">
      <a href="SKILL.md">Skill details</a>
      <span>&nbsp;&bull;&nbsp;</span>
      <a href="LICENSE">Apache License 2.0 (Apache-2.0)</a>
      <span>&nbsp;&bull;&nbsp;</span>
      <a href="CITATION.cff">Citation</a>
      <span>&nbsp;&bull;&nbsp;</span>
      <a href="mailto:<REDACTED_EMAIL>">Contact</a>
    </p>
    
  • scripts/__init__.py53 B5049e977b4fcupstream ↗
    """readable-verilog-generator 的脚本包根。"""
    
  • scripts/python/__init__.py55 B8e1a5466b1f8upstream ↗
    """按工作流域划分的 Python 入口集合。"""
    
  • scripts/python/corpus/analyze_verilog_style_corpus.py25 KB4e0dd80cef35upstream ↗
    #!/usr/bin/env python3
    """从理想和反例 Verilog 语料中提取可复现的风格统计指标。"""
    
    # future annotations 让类型提示保持静态用途,不影响脚本运行时兼容性。
    from __future__ import annotations
    
    # 标准库负责 CLI 参数、JSON 写入、正则提取、统计量和路径遍历。
    import argparse
    import json
    import re
    import statistics
    import sys
    from pathlib import Path
    from typing import Any, Iterable
    
    # 批量治理脚本不应在源码目录旁生成 __pycache__。
    sys.dont_write_bytecode = True  # 关闭当前脚本运行时的 pyc 写入
    
    # Verilog 源文件后缀集中维护,供目录递归筛选复用。
    SET_VERILOG_SUFFIXES = {".v", ".vh"}  # 允许进入语料统计的 Verilog 文件后缀
    
    # 端口声明正则保留旧脚本对 input/output/inout 行的宽松识别。
    RE_PORT_DECL = re.compile(  # 端口声明行匹配器
        r"^\s*(input|output|inout)\b(?P<body>.*?)(?:,|;)?\s*(?://.*)?$",  # 捕获方向后的声明主体
        re.MULTILINE,  # 允许从完整源码文本中逐行查找端口声明
    )
    
    # 标识符正则用于端口名和参数名的轻量文本提取。
    RE_IDENTIFIER = re.compile(r"[A-Za-z_][A-Za-z0-9_$]*")  # Verilog 普通标识符匹配器
    
    # 区域横幅只统计 Erie 模板认可的中文区域名称。
    STR_REGION_BANNER_PATTERN = (
        r"//[-\s]*(?:配置参数区域|状态参数区域|模块实例化信号|计数信号|状态机信号|"
        r"寄存器信号|标志信号|编码信号|译码信号|其他信号|输出信号|其他信号连线|"
        r"输出信号连线|输出信号处理区域|状态机区域|状态任务处理区域|主要任务处理区域|"
        r"生成块区域|参数检查区域|初始化区域|模块实例化区域)[-\s]*//"
    )  # 中文区域横幅正则文本
    
    # 区域横幅正则单独编译,避免每个文件重复解析长表达式。
    RE_REGION = re.compile(STR_REGION_BANNER_PATTERN)  # 中文区域横幅匹配器
    
    # 占位注释命中会降低风格分,帮助暴露模板未清理痕迹。
    RE_PLACEHOLDER_COMMENT = re.compile(  # 占位或模板化注释匹配器
        r"(?:端口信号注释|参数解释说明中文|默认值,?参数解释|必须要有的注释|此模板未使用|占位|placeholder)",  # 占位词组集合
        re.IGNORECASE,  # 同时识别英文 placeholder 的大小写变体
    )
    
    # Verilog 端口方向关键字不能被误当成端口名。
    SET_PORT_DIRECTIONS = {"input", "output", "inout"}  # 端口方向关键字集合
    
    # 读取语料时按项目常见编码优先级尝试。
    TUPLE_TEXT_ENCODINGS = ("utf-8", "utf-8-sig", "gb18030", "latin-1")  # 语料读取编码候选
    
    # 输出报告的数值字段顺序保持旧 JSON 结构。
    TUPLE_METRIC_FIELDS = (
        "lines",  # 源文件总行数指标
        "code_lines",  # 非注释代码行数指标
        "comment_lines",  # 含有 // 的行数指标
        "comment_density",  # 注释相对代码行的密度指标
        "tab_indented_lines",  # tab 缩进行数指标
        "space_indented_lines",  # 空格缩进行数指标
        "block_comment_markers",  # 块注释边界标记数量指标
        "ports",  # 端口声明数量指标
        "prefixed_ports",  # 带项目前缀端口数量指标
        "parameters",  # parameter 声明数量指标
        "c_parameters",  # C_ 前缀参数数量指标
        "region_banners",  # 中文区域横幅数量指标
        "has_bilingual_header",  # 双语头部是否存在的二值指标
        "placeholder_comment_hits",  # 占位注释命中数量指标
        "always_blocks",  # always 块数量指标
        "assigns",  # assign 语句数量指标
    )  # summary 区域逐项统计的指标字段
    
    # create_parser 只声明公开 CLI,不读取文件。
    def create_parser() -> argparse.ArgumentParser:
        """
        创建 Verilog 风格语料分析脚本的参数解析器。
    
        :param: 此函数不接收外部业务参数。
        :return: 已注册 ideal、bad、out 和 sample-size 参数的解析器。
        """
    
        # 描述文本沿用英文,保持既有 --help 风格。
        str_description = "Analyze style metrics from ideal/bad Verilog corpora."  # argparse 描述文本
    
        # parser 只承担命令行合同声明职责。
        parser = argparse.ArgumentParser(description=str_description)  # 语料分析参数解析器
    
        # ideal 指向正例语料根目录或单文件。
        parser.add_argument("--ideal", type=Path, required=True, help="Path to ideal Verilog corpus.")
    
        # bad 指向反例或压力语料根目录或单文件。
        parser.add_argument("--bad", type=Path, required=True, help="Path to bad/stress Verilog corpus.")
    
        # out 是 JSON 指标报告写入位置。
        parser.add_argument("--out", type=Path, required=True, help="Output JSON metrics path.")
    
        # sample-size 控制低风格分样本数量。
        parser.add_argument(
            "--sample-size",
            type=int,
            default=10,
            help="Number of lowest-style-signal samples to retain.",
        )
    
        # 返回完整解析器给 main 调用。
        return parser
    
    # iter_sources 统一处理单文件和目录语料输入。
    def iter_sources(path_root: Path) -> Iterable[Path]:
        """
        按稳定顺序产出输入根下的 Verilog 源文件。
    
        :param path_root: 语料根目录或单个 Verilog 文件路径。
        :return: 可迭代的 Verilog 源文件路径序列。
        """
    
        # 单文件输入只在后缀受支持时产出自身。
        if path_root.is_file():
    
            # 后缀判断使用小写以兼容大写扩展名。
            if path_root.suffix.lower() in SET_VERILOG_SUFFIXES:
    
                # yield 保持旧脚本对单文件输入的惰性行为。
                yield path_root
    
            # 单文件路径处理完毕后不再递归。
            return
    
        # 目录输入按路径名排序,保证报告可复现。
        for path_source in sorted(path_root.rglob("*")):
    
            # 只统计真实文件,跳过目录和非 Verilog 文本。
            if path_source.is_file() and path_source.suffix.lower() in SET_VERILOG_SUFFIXES:
    
                # 将候选源文件交给后续指标提取。
                yield path_source
    
    # read_text 以多编码尝试读取语料,避免单个遗留文件中断统计。
    def read_text(path_source: Path) -> tuple[str, str]:
        """
        读取 Verilog 文本并返回实际采用的编码名称。
    
        :param path_source: 待读取的 Verilog 文件路径。
        :return: 二元组,包含源码文本和解码编码标签。
        """
    
        # 原始字节只读取一次,后续在内存中尝试不同编码。
        bytes_raw = path_source.read_bytes()  # Verilog 文件原始字节
    
        # 编码候选按最常见到最兜底排序。
        for str_encoding in TUPLE_TEXT_ENCODINGS:
    
            # 解码失败时继续尝试下一个编码。
            try:
    
                # 成功解码后立即返回文本和编码标签。
                return bytes_raw.decode(str_encoding), str_encoding
    
            # UnicodeDecodeError 表示当前编码不适合该文件。
            except UnicodeDecodeError:
    
                # 继续尝试后续编码候选。
                continue
    
        # 最终兜底保留可读文本,避免极端文件打断批量报告。
        return bytes_raw.decode("latin-1", errors="replace"), "latin-1-replace"
    
    # strip_line_comment 用于区分代码内容和尾随单行注释。
    def strip_line_comment(str_line: str) -> str:
        """
        移除一行中字符串字面量外部的 Verilog 单行注释。
    
        :param str_line: 待分析的单行 Verilog 文本。
        :return: 去除行注释后的代码片段。
        """
    
        # 字符串状态避免把字符串内部的 // 误判成注释。
        bool_in_string = False  # 当前扫描位置是否位于双引号字符串内
    
        # index 从行首开始向后扫描。
        int_index = 0  # 当前字符偏移
    
        # 至少保留一个后续字符才能判断 //。
        while int_index < len(str_line) - 1:
    
            # 当前字符决定字符串状态和注释起点。
            str_char = str_line[int_index]  # 当前扫描字符
    
            # 双引号可能切换字符串状态。
            if str_char == '"':
    
                # 被反斜杠转义的双引号不结束字符串。
                bool_escaped = int_index > 0 and str_line[int_index - 1] == "\\"  # 当前引号是否被转义
    
                # 只有未转义引号才改变字符串状态。
                if not bool_escaped:
    
                    # 切换字符串内部/外部状态。
                    bool_in_string = not bool_in_string  # 更新后的字符串扫描状态
    
            # 字符串外部的 // 表示单行注释起点。
            if not bool_in_string and str_char == "/" and str_line[int_index + 1] == "/":
    
                # 返回注释之前的代码文本。
                return str_line[:int_index]
    
            # 普通字符推进一个位置。
            int_index += 1  # 下一处扫描偏移
    
        # 未发现行注释时返回原始行。
        return str_line
    
    # is_code_line 判断一行在剥离注释后是否仍包含代码。
    def is_code_line(str_line: str) -> bool:
        """
        判断 Verilog 源码行是否包含非注释代码。
    
        :param str_line: 待分析的单行 Verilog 文本。
        :return: True 表示该行剥离单行注释后仍有内容。
        """
    
        # 去除行注释和两端空白后再判定。
        str_stripped = strip_line_comment(str_line).strip()  # 去注释后的非空判断文本
    
        # bool 转换保持旧脚本的空行处理语义。
        return bool(str_stripped)
    
    # port_name_from_decl_body 从端口声明体内提取最后一个标识符作为端口名。
    def port_name_from_decl_body(str_body: str) -> str | None:
        """
        从端口声明正文中提取端口名。
    
        :param str_body: PORT_DECL_RE 捕获到的声明正文。
        :return: 识别到的端口名;无法识别时返回 None。
        """
    
        # 位宽范围不是端口名,先替换为空格。
        str_without_ranges = re.sub(r"\[[^\]]+\]", " ", str_body)  # 移除位宽范围后的声明体
    
        # 常见类型修饰符也不参与端口名候选。
        str_without_types = re.sub(  # 移除类型修饰符后的声明体
            r"\b(?:wire|reg|logic|signed|unsigned)\b",  # 端口声明类型修饰符集合
            " ",  # 用空格替换以保留标识符分隔边界
            str_without_ranges,  # 已移除位宽范围的端口声明体
        )
    
        # 标识符列表先初始化,再按方向关键字过滤。
        list_identifiers: list[str] = []  # 声明体内过滤方向关键字后的标识符
    
        # 正则扫描结果按声明文本顺序保留。
        for str_item in RE_IDENTIFIER.findall(str_without_types):
    
            # 方向关键字已经由正则前缀处理,不应进入端口名候选。
            if str_item not in SET_PORT_DIRECTIONS:
    
                # 追加真实端口名候选,最后一个候选会作为端口名。
                list_identifiers.append(str_item)
    
        # 没有标识符时无法可靠给出端口名。
        if not list_identifiers:
    
            # None 保持旧脚本对异常声明的跳过语义。
            return None
    
        # Verilog 声明中最后一个标识符通常是端口名。
        return list_identifiers[-1]
    
    # relative_path_text 让报告路径在语料根内保持相对形式。
    def relative_path_text(path_source: Path, path_root: Path) -> str:
        """
        生成报告中展示的源文件路径文本。
    
        :param path_source: 当前 Verilog 源文件路径。
        :param path_root: 用户传入的语料根路径。
        :return: 根内相对路径或原始路径文本。
        """
    
        # Python 3.9+ 的 is_relative_to 可避免异常式控制流。
        if path_source.is_relative_to(path_root):
    
            # 根内文件使用相对路径,报告在不同机器上更稳定。
            return str(path_source.relative_to(path_root))
    
        # 根外文件保留完整路径,避免丢失来源。
        return str(path_source)
    
    # metric_dict 提取单个文件的所有统计字段。
    def metric_dict(path_source: Path, path_root: Path) -> dict[str, Any]:
        """
        提取单个 Verilog 文件的风格统计字典。
    
        :param path_source: 待统计的 Verilog 源文件路径。
        :param path_root: 用户传入的语料根路径。
        :return: 与旧版 CorpusFileMetrics.to_dict 等价的指标字典。
        """
    
        # 文本读取同时记录实际编码,供报告排查语料来源差异。
        tuple_text_encoding = read_text(path_source)  # 源码文本和编码名称
    
        # 元组拆分让后续指标表达更清晰。
        str_text, str_encoding = tuple_text_encoding  # Verilog 源码文本和解码标签
    
        # splitlines 保持旧脚本不保留换行符的统计方式。
        list_lines = str_text.splitlines()  # 源文件按行拆分后的文本列表
    
        # 代码行统计只计算剥离行注释后仍非空的行。
        list_code_lines = [str_line for str_line in list_lines if is_code_line(str_line)]  # 非注释代码行列表
    
        # 注释行沿用旧脚本的简单 // 包含判断。
        list_comment_lines = [str_line for str_line in list_lines if "//" in str_line]  # 含有单行注释标记的行列表
    
        # 端口名称由所有端口声明行解析得到。
        list_ports = extract_ports(str_text)  # 当前文件识别出的端口名列表
    
        # 参数名称直接从 parameter 声明中提取。
        list_parameters = re.findall(r"\bparameter\s+([A-Za-z_][A-Za-z0-9_$]*)", str_text)  # parameter 名称列表
    
        # C_ 前缀参数列表先初始化,便于逐项解释筛选条件。
        list_c_parameters: list[str] = []  # C_ 前缀参数名称列表
    
        # C_ 命名比例需要从全部 parameter 名称中筛出命中项。
        for str_name in list_parameters:
    
            # C_ 前缀参数是 Erie 理想语料中的正向特征。
            if str_name.startswith("C_"):
    
                # 记录当前命中项,供后续参数比例计算。
                list_c_parameters.append(str_name)
    
        # 注释密度默认归零,避免空文件触发除零。
        float_comment_density = 0.0  # 注释行数相对代码行数的密度
    
        # 有代码行时才计算真实注释密度。
        if list_code_lines:
    
            # 注释行数沿用旧脚本的简单 // 行计数。
            float_comment_density = len(list_comment_lines) / len(list_code_lines)  # 有代码行时的注释密度
    
        # 相对路径文本保持报告跨环境可比较。
        str_report_path = relative_path_text(path_source, path_root)  # 报告中的文件路径文本
    
        # 英文头部标记来自 Erie 既有模板。
        str_english_header = "////////////////////////////////////English"  # 双语头部中的英文分隔线
    
        # 中文头部标记来自 Erie 既有模板。
        str_chinese_header = "///////////////////////////////////Chinese"  # 双语头部中的中文分隔线
    
        # 双语头部需要两个标记同时存在。
        int_has_bilingual_header = int(str_english_header in str_text and str_chinese_header in str_text)  # 双语头部命中标志
    
        # 指标字典字段名保持旧报告结构。
        return {
            "path": str_report_path,
            "encoding": str_encoding,
            "lines": len(list_lines),
            "code_lines": len(list_code_lines),
            "comment_lines": len(list_comment_lines),
            "comment_density": float_comment_density,
            "tab_indented_lines": sum(1 for str_line in list_lines if str_line.startswith("\t")),
            "space_indented_lines": sum(1 for str_line in list_lines if re.match(r" {2,}\S", str_line)),
            "block_comment_markers": str_text.count("/*") + str_text.count("*/"),
            "ports": len(list_ports),
            "prefixed_ports": sum(1 for str_name in list_ports if str_name.startswith(("i_", "o_", "io_"))),
            "parameters": len(list_parameters),
            "c_parameters": len(list_c_parameters),
            "region_banners": len(RE_REGION.findall(str_text)),
            "has_bilingual_header": int_has_bilingual_header,
            "placeholder_comment_hits": len(RE_PLACEHOLDER_COMMENT.findall(str_text)),
            "always_blocks": len(re.findall(r"\balways\s*@", str_text)),
            "assigns": len(re.findall(r"\bassign\b", str_text)),
        }
    
    # extract_ports 封装端口声明扫描,避免主统计函数过长。
    def extract_ports(str_text: str) -> list[str]:
        """
        从 Verilog 文本中提取端口名列表。
    
        :param str_text: 待扫描的 Verilog 源码文本。
        :return: 成功识别出的端口名列表。
        """
    
        # 端口列表按源码出现顺序保留。
        list_ports: list[str] = []  # 已识别端口名列表
    
        # 遍历所有方向声明匹配项。
        for match_port in RE_PORT_DECL.finditer(str_text):
    
            # 声明体中最后一个有效标识符视为端口名。
            str_name = port_name_from_decl_body(match_port.group("body"))  # 当前端口声明提取出的名称
    
            # 无法识别名称的声明不进入统计。
            if str_name:
    
                # 追加到端口列表供前缀覆盖统计使用。
                list_ports.append(str_name)
    
        # 返回当前文件全部端口名。
        return list_ports
    
    # summarize_number 对同一指标在语料中的分布做基本统计。
    def summarize_number(list_values: list[float]) -> dict[str, float]:
        """
        汇总一组数值的平均值、中位数和边界值。
    
        :param list_values: 待汇总的浮点数值列表。
        :return: 包含 avg、median、min、max 的统计字典。
        """
    
        # 空语料下所有数值汇总归零。
        if not list_values:
    
            # 保持旧 JSON 字段完整,便于下游读取。
            return {"avg": 0.0, "median": 0.0, "min": 0.0, "max": 0.0}
    
        # 平均值使用简单算术平均。
        float_avg = float(sum(list_values) / len(list_values))  # 指标平均值
    
        # 中位数交给标准库处理奇偶长度。
        float_median = float(statistics.median(list_values))  # 指标中位数
    
        # 最小值展示该指标在语料中的下界。
        float_min = float(min(list_values))  # 指标最小值
    
        # 最大值展示该指标在语料中的上界。
        float_max = float(max(list_values))  # 指标最大值
    
        # 返回字段名保持旧报告结构。
        return {
            "avg": float_avg,
            "median": float_median,
            "min": float_min,
            "max": float_max,
        }
    
    # style_signal 计算低风格样本排序用的启发式信号值。
    def style_signal(dict_item: dict[str, Any]) -> float:
        """
        根据单文件指标计算启发式风格信号。
    
        :param dict_item: metric_dict 产出的单文件指标字典。
        :return: 信号值越低表示越值得人工查看。
        """
    
        # 信号值从零开始累加正负特征。
        float_signal = 0.0  # 当前文件启发式风格信号
    
        # 有端口时,端口前缀比例作为正向特征。
        if dict_item["ports"]:
    
            # i_/o_/io_ 前缀越完整,信号值越偏向理想语料。
            float_signal += dict_item["prefixed_ports"] / dict_item["ports"]  # 端口命名前缀贡献
    
        # 有参数时,C_ 参数比例作为正向特征。
        if dict_item["parameters"]:
    
            # 项目参数前缀越完整,正例语料特征越明显。
            float_signal += dict_item["c_parameters"] / dict_item["parameters"]  # 参数命名前缀贡献
    
        # 注释密度按 1.0 封顶,避免超密注释支配信号值。
        float_signal += min(dict_item["comment_density"], 1.0)  # 注释密度贡献
    
        # 区域横幅按 4 个封顶,鼓励结构化但不过度奖励。
        float_signal += min(dict_item["region_banners"] / 4.0, 1.0)  # 区域横幅贡献
    
        # 双语头部是模板完整性的正向信号。
        float_signal += dict_item["has_bilingual_header"]  # 双语头部贡献
    
        # 块注释标记在该项目风格中通常是不鼓励的格式。
        float_signal -= min(dict_item["block_comment_markers"], 3) * 0.25  # 块注释扣分
    
        # 占位注释命中直接提示模板未清理。
        float_signal -= min(dict_item["placeholder_comment_hits"], 5) * 0.5  # 占位注释扣分
    
        # 空格缩进比例用于暴露和项目 tab 缩进偏好的偏差。
        float_signal -= min(dict_item["space_indented_lines"] / max(dict_item["lines"], 1), 1.0)  # 空格缩进扣分
    
        # 返回排序使用的最终信号值。
        return float_signal
    
    # corpus_report 汇总一个语料根的文件级指标和低信号样本。
    def corpus_report(path_root: Path, *, int_sample_size: int) -> dict[str, Any]:
        """
        生成单个语料根的汇总报告。
    
        :param path_root: 语料根目录或单个 Verilog 文件路径。
        :param int_sample_size: 需要保留的低风格信号样本数量。
        :return: 包含文件数、统计摘要、编码分布和低信号样本的字典。
        """
    
        # 文件级指标先全部收集,便于后续多字段汇总。
        list_metrics = [metric_dict(path_source, path_root) for path_source in iter_sources(path_root)]  # 单文件指标列表
    
        # 各字段统计摘要保持旧版 field_names 顺序。
        dict_summary: dict[str, dict[str, float]] = {}  # 每个数值指标的分布摘要
    
        # 逐字段展开统计,避免压缩推导式掩盖字段来源。
        for str_field in TUPLE_METRIC_FIELDS:
    
            # 当前字段值统一转为 float,供 summarize_number 计算。
            list_field_values = [float(dict_item[str_field]) for dict_item in list_metrics]  # 当前指标的文件级数值
    
            # 汇总结果写回与旧报告相同的字段名。
            dict_summary[str_field] = summarize_number(list_field_values)  # 当前指标的分布摘要
    
        # 编码分布用于发现混入的非 UTF-8 语料。
        dict_encodings: dict[str, int] = {}  # 编码名称到文件数量的映射
    
        # 遍历文件级指标累加编码计数。
        for dict_item in list_metrics:
    
            # 当前文件编码从 read_text 结果传入。
            str_encoding = dict_item["encoding"]  # 当前文件使用的解码标签
    
            # 计数采用 get 兼容首次出现的编码。
            dict_encodings[str_encoding] = dict_encodings.get(str_encoding, 0) + 1  # 更新后的编码文件数量
    
        # 低风格信号样本按启发式信号值升序截取。
        list_low_samples = sorted(list_metrics, key=style_signal)[:int_sample_size]  # 低风格信号样本列表
    
        # 样本条目附带 style_signal,方便人工复核排序原因。
        list_low_sample_reports: list[dict[str, Any]] = []  # 带风格信号的低信号样本报告
    
        # 样本报告逐个追加,便于说明 style_signal 的来源。
        for dict_item in list_low_samples:
    
            # 当前样本保留原指标并追加排序使用的信号值。
            dict_sample = dict_item | {"style_signal": style_signal(dict_item)}  # 单个低信号样本报告条目
    
            # 追加后的列表直接进入 JSON 报告。
            list_low_sample_reports.append(dict_sample)
    
        # 返回字段名保持旧 JSON 顶层结构。
        return {
            "file_count": len(list_metrics),
            "summary": dict_summary,
            "encodings": dict_encodings,
            "sample_low_style": list_low_sample_reports,
        }
    
    # main 串联 CLI 解析、报告构造和 JSON 写入。
    def main() -> int:
        """
        执行语料风格统计 CLI。
    
        :param: 此函数不接收外部业务参数,直接读取命令行。
        :return: 0 表示报告文件已成功写入。
        """
    
        # argparse 负责校验必填参数和基础类型。
        namespace_args: argparse.Namespace = create_parser().parse_args()  # 语料分析命令行参数
    
        # meta 说明报告只用于规则调参,不替代正式 RTL 质量门。
        str_report_note = (
            "Corpus traits are advisory; generated delivery RTL is enforced by "
            "scripts/python/quality/quality_gate.py and "
            "scripts/python/quality/formatter_ast.py."
        )  # 报告用途说明文本
    
        # meta 字段承载版本号和使用边界。
        dict_meta = {
            "version": 1,  # 报告格式版本
            "note": str_report_note,  # 报告用途说明
        }  # 报告元信息
    
        # 正例语料根解析为绝对路径,避免相对路径受工作目录影响。
        path_ideal_root = namespace_args.ideal.resolve()  # ideal 语料绝对路径
    
        # bad 语料同样规范化路径,防止报告受调用目录变化影响。
        path_bad_root = namespace_args.bad.resolve()  # 压力样本语料的规范化根路径
    
        # 最终报告顶层结构保持旧版 meta/ideal/bad 三段,方便下游兼容。
        dict_report = {
            "meta": dict_meta,  # 版本和用途边界
            "ideal": corpus_report(path_ideal_root, int_sample_size=namespace_args.sample_size),  # 正例语料统计
            "bad": corpus_report(path_bad_root, int_sample_size=namespace_args.sample_size),  # 反例语料统计
        }  # 待写入 JSON 报告载荷
    
        # 输出目录不存在时自动创建,保持旧 CLI 便利性。
        namespace_args.out.parent.mkdir(parents=True, exist_ok=True)
    
        # JSON 文件使用 UTF-8 和缩进,便于人工查看。
        namespace_args.out.write_text(
            json.dumps(dict_report, indent=2, ensure_ascii=False) + "\n",
            encoding="utf-8",
        )
    
        # 终端只输出简短状态,完整结构化数据写入文件。
        print(f"> INFO: [Python] Wrote corpus metrics to {namespace_args.out}")
    
        # 成功写入报告后返回 0。
        return 0
    
    # 脚本入口保持直接运行时的退出码传递。
    if __name__ == "__main__":
    
        # main 的返回值作为进程退出码。
        raise SystemExit(main())
    
  • scripts/python/existing_rtl/existing_rtl.py81 KB76c727033067upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/existing_rtl/existing_rtl_improvement.py110 KB7e490b91de37upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/existing_rtl/intervention.py8.3 KBe353540519e2upstream ↗
    """人工介入决策的归一化、适用范围判断和记忆条目生成。"""
    
    # 未来注解避免运行时解析复杂类型,保持轻量导入。
    from __future__ import annotations
    
    # 标准库类型:仅用于描述 JSON-like 字典中的任意值。
    from typing import Any
    
    # 公开入口把用户回答转换成 workflow 可持久化的决策和记忆。
    def resolve_intervention(intervention: dict[str, Any], answer: dict[str, Any]) -> tuple[dict[str, Any], dict[str, Any]]:
        """
        将一次人工介入回答整理为决策对象和决策记忆。
    
        :param intervention: workflow 生成的待确认问题,包含来源和问题文本。
        :param answer: 用户提交的回答对象,必须包含 decision、evidence、constraints 和 affected_subfunctions。
        :return: 二元组,第一项是 resolved decision,第二项是可写入 workflow state 的 memory。
        :raises ValueError: 当回答不是对象、缺少必要字段或 decision 为空时抛出。
        """
    
        # 先校验回答字段,避免写出不完整的人类决策记录。
        _validate_answer(answer)
    
        # affected_subfunctions 为空时默认影响全部子功能,保持旧流程的全局决策语义。
        list_affected = [str(item) for item in _as_list(answer.get("affected_subfunctions"))] or ["*"]  # 影响范围
    
        # 原始介入摘要单独命名,避免主决策对象变成难读的大字典。
        dict_source_intervention = {
            "primary_source": intervention.get("primary_source"),  # 原始介入来源
            "question": intervention.get("question"),  # 原始人工确认问题
        }  # 原始介入摘要对象
    
        # 决策对象保留原有 wire shape,供 workflow state 和报告继续读取。
        dict_decision: dict[str, Any] = {}  # 人工决策记录
    
        # 决策记录版本用于未来迁移兼容。
        dict_decision["version"] = 1  # 决策记录版本
    
        # 人工介入完成后固定进入 resolved 状态。
        dict_decision["status"] = "resolved"  # 人工介入已解决状态
    
        # 决策文本保持用户原文的字符串形式。
        dict_decision["decision"] = str(answer["decision"])  # 用户确认的决策文本
    
        # 证据字段归一化为列表,保留旧 wire shape。
        dict_decision["evidence"] = _as_list(answer.get("evidence", []))  # 用户提供的证据列表
    
        # 约束字段归一化为列表,供记忆摘要拼接。
        dict_decision["constraints"] = _as_list(answer.get("constraints", []))  # 用户确认的约束列表
    
        # 影响范围使用前面计算好的默认星号语义。
        dict_decision["affected_subfunctions"] = list_affected  # 决策影响的子功能范围
    
        # 原始介入摘要保留问题来源,便于审计人类决策链。
        dict_decision["source_intervention"] = dict_source_intervention  # 原始介入摘要
    
        # 记忆条目按影响范围展开,让后续阶段能按子功能匹配人类决策。
        dict_memory = {
            "version": 1,  # 记忆结构版本
            "entries": [  # workflow 可持久化的记忆条目列表
                {
                    "subfunction": subfunction_name,  # 记忆适用的子功能
                    "stage": "*",  # 决策适用于所有阶段
                    "error_signature": "human_decision",  # 人工决策的固定错误签名
                    "constraint": _constraint_text(dict_decision),  # 可读约束摘要
                    "decision": dict_decision["decision"],  # 原始决策文本
                }
                for subfunction_name in list_affected  # 决策影响范围逐项展开
            ],  # 按影响范围展开后的记忆条目集合
        }
    
        # 返回决策和记忆,调用方负责写入状态文件或报告。
        return dict_decision, dict_memory
    
    # workflow 在进入子功能阶段前用该函数判断已有人工决策是否命中。
    def decision_applies(decision: dict[str, Any] | None, subfunction: str | None) -> bool:
        """
        判断人工决策是否适用于指定子功能。
    
        :param decision: 已解析的人工决策对象;为空表示没有可用决策。
        :param subfunction: 当前子功能名称;为空时表示调用方处于全局上下文。
        :return: 当决策为空返回 False;当影响范围为空、包含 ``*``、处于全局上下文或命中子功能名时返回 True。
        """
    
        # 没有决策时不能套用任何人工约束。
        if not decision:
    
            # 返回不适用,保持调用方继续等待或触发人工介入。
            return False
    
        # 决策影响范围统一转字符串列表,兼容 JSON 中的数字或其他标量。
        list_affected = [str(item) for item in decision.get("affected_subfunctions", []) or []]  # 当前决策影响范围
    
        # 空范围、全局星号、全局上下文或显式子功能命中都视为适用。
        return not list_affected or "*" in list_affected or subfunction is None or str(subfunction) in list_affected
    
    # 回答校验集中在这里,保持 resolve_intervention 主流程直观。
    def _validate_answer(answer: dict[str, Any]) -> None:
        """校验人工介入回答是否包含生成决策所需的字段。
    
        参数:
            answer: 用户提交的人工介入回答对象。
    
        返回:
            无。
    
        异常:
            ValueError: 当回答不是对象、缺少字段或 decision 为空时抛出。
        """
    
        # 人工回答必须是 JSON object,列表或字符串都无法承载必要字段。
        if not isinstance(answer, dict):
    
            # 错误前缀遵循脚本输出规范,主体保留原英文诊断。
            raise ValueError("> ERR: [Python] Human intervention answer must be a JSON object.")
    
        # 必需字段缺失时一次性报告全部字段,方便用户补齐回答。
        list_missing = [
            field_name  # 缺失的必需字段名
            for field_name in ("decision", "evidence", "constraints", "affected_subfunctions")  # 必需字段枚举
            if field_name not in answer  # 当前回答缺失该字段
        ]  # 缺失字段列表
    
        # 缺字段的回答不能进入决策记忆,否则后续阶段会误用不完整约束。
        if list_missing:
    
            # 缺失字段列表保留原拼接格式,便于用户直接补齐。
            raise ValueError(
                "> ERR: [Python] Human intervention answer is missing required fields: " + ", ".join(list_missing)
            )
    
        # decision 文本为空时无法形成可审计的人类决策。
        if not str(answer.get("decision", "")).strip():
    
            # 空决策的诊断也保留英文主体,便于既有调用方识别原因。
            raise ValueError("> ERR: [Python] Human intervention answer decision must not be empty.")
    
    # 记忆约束摘要只拼接非空约束,避免空字符串污染报告。
    def _constraint_text(decision: dict[str, Any]) -> str:
        """把人工决策和非空约束合成为可写入记忆的摘要。
    
        参数:
            decision: 已解析的人工决策对象。
    
        返回:
            面向 prompt 记忆的人工决策摘要文本。
        """
    
        # 约束文本使用分号拼接,保留用户提供约束的顺序。
        str_constraints = "; ".join(str(item) for item in decision.get("constraints", []) if str(item).strip())  # 约束摘要
    
        # 有约束时把决策和约束同时写入记忆,便于后续 prompt 引用。
        if str_constraints:
    
            # 返回带约束的人工决策摘要。
            return f"Human decision: {decision['decision']}. Constraints: {str_constraints}."
    
        # 没有约束时只记录决策本身。
        return f"Human decision: {decision['decision']}."
    
    # JSON 字段兼容空值、列表和单项标量三种输入。
    def _as_list(value: Any) -> list[Any]:
        """把 JSON 字段值归一化为列表形态。
    
        参数:
            value: 可能为空、列表或单项标量的 JSON 字段值。
    
        返回:
            归一化后的列表对象;原列表输入保持原对象返回。
        """
    
        # 空值代表没有条目。
        if value is None:
    
            # 返回空列表,调用方不需要再判断 None。
            return []
    
        # 列表输入保留原有顺序和元素对象。
        if isinstance(value, list):
    
            # 返回原列表,保持旧行为不做深拷贝。
            return value
    
        # 标量输入提升为单元素列表,兼容简单回答格式。
        return [value]
    
  • scripts/python/existing_rtl/optimizer.py26 KBef66a94143ceupstream ↗
    """根据 workflow trace 生成下一轮 prompt 补丁和可复用记忆。"""
    
    # 延迟注解解析,避免运行期求值嵌套泛型。
    from __future__ import annotations
    
    # 标准库提供路径对象和 JSON-like 负载类型标注。
    from pathlib import Path
    from typing import Any
    
    # 运行时模块提供计划规范化和 trace 读取能力。
    from scripts.python.workflow.planning import decompose_spec
    from scripts.python.workflow.trace import read_trace
    
    # trace 文本约束规则保持旧版顺序,确保 prompt patch 输出稳定。
    CONSTRAINT_RULES: tuple[tuple[tuple[str, ...], str], ...] = (  # trace 关键词到 prompt 约束的映射表
        (
            ("dependency_issue", "undefined module", "undefined reference", "not declared"),  # 依赖或声明缺失迹象
            (
                "Re-check subfunction interface compatibility, dimensions, and dependency outputs "
                "before regenerating the failing module."
            ),  # 依赖失败后复核上下游接口的 prompt 约束
        ),
        (
            ("testbench", "main() entry point"),  # 测试平台或入口函数相关诊断
            (
                "Generate or repair a self-checking testbench with explicit PASS/FAIL behavior "
                "and coverage for every behavior item."
            ),  # testbench 失败后要求补齐自检覆盖的 prompt 约束
        ),
        (
            ("toolchain_issue", "required tool", "failed to start", "timed out"),  # 外部工具不可用或超时迹象
            (
                "Separate toolchain availability/configuration failures from code edits; "
                "only rewrite code when the tool output identifies code errors."
            ),  # 工具链异常和代码错误分流的 prompt 约束
        ),
        (
            ("placeholder", "todo", "fixme", "ellipsis"),  # 未完成代码占位痕迹
            "Remove all placeholders and produce complete executable code for every manifest file.",  # 完整实现约束
        ),
        (
            ("spec_issue", "expected output file is missing"),  # 规格或产物覆盖缺口
            (
                "Audit the plan outputs and evidence before code regeneration; "
                "missing requested files indicate a plan or manifest coverage issue."
            ),  # 缺失产物先回查计划覆盖的 prompt 约束
        ),
        (
            ("reviewability", "comment"),  # 注释可审查性相关信号
            (
                "Preserve the requested comment language and add same-line semantic comments for "
                "ports, signals, always blocks, assigns, testbench checks, and construct end lines."
            ),  # RTL 可审查性不足时使用的注释补强约束
        ),
        (
            ("fsm", "state register", "next-state"),  # 状态机结构缺口
            (
                "For RTL regeneration, use a three-block FSM with explicit state register, "
                "next-state logic, and output logic sections."
            ),  # 状态机结构失败后的 RTL 分块约束
        ),
        (
            ("semantic model", "run_tests"),  # Python 参考模型合同信号
            (
                "Preserve the Python semantic model API and mirror its deterministic "
                "verification vectors in the downstream testbench."
            ),  # 参考模型合同漂移时的向量同步约束
        ),
        (
            ("semantic output drift", "wrong_final_output"),  # 最终输出语义漂移
            (
                "When a final output mismatches the Python oracle, restate the exact output contract "
                "and regenerate only the logic responsible for those drift keys."
            ),  # 最终输出漂移时限制重生成范围的约束
        ),
        (
            ("checkpoint drift", "checkpoint_divergence"),  # 中间检查点漂移
            (
                "Preserve and compare intermediate checkpoints so the next attempt can localize "
                "the mismatch before the final output stage."
            ),  # 中间检查点漂移后的定位约束
        ),
        (
            ("case order drift", "case_order_drift"),  # 用例顺序漂移
            "Keep case ids and transcript order stable across Python oracle, vectors, and Verilog testbench output.",  # 用例顺序稳定约束
        ),
        (
            ("weak_test_oracle", "augment_tests"),  # 测试 oracle 覆盖不足
            "Strengthen boundary cases, negative cases, and checkpoint coverage before escalating to human debugging.",  # 测试增强约束
        ),
        (
            ("ambiguous_spec_rule",),  # 规格规则冲突
            (
                "Call out the conflicting spec rule explicitly and preserve the ambiguity "
                "for structured human resolution instead of guessing."
            ),  # 规格冲突进入人工确认前的保留约束
        ),
        (
            ("needs_human_intervention", "ask_human"),  # 人工介入信号
            (
                "Summarize the unresolved ambiguity as a precise hardware-design question "
                "before another generation attempt."
            ),  # 人工介入后收敛问题描述的约束
        ),
    )
    
    # 记忆签名规则保持旧版优先级,避免历史 trace 产出的 memory 顺序漂移。
    SIGNATURE_RULES: tuple[dict[str, Any], ...] = (  # 供_memory_entries把失败事件转换为可复用prompt记忆约束的规则序列
        {
            "source_terms": ("dependency_issue",),  # 依赖失败事件来源匹配词
            "text_terms": ("undefined module", "interface"),  # 接口或未定义模块文本
            "signature": "interface_or_dependency_mismatch",  # 接口依赖签名
            "constraint": (  # 接口依赖签名对应的 prompt memory 约束
                "Reconfirm upstream/downstream port names, dimensions, and subfunction dependency "
                "outputs before code generation."
            ),  # 接口依赖失败写入 memory 的复核提醒
        },
        {
            "source_terms": ("testbench_issue",),  # 测试平台失败事件来源匹配词
            "text_terms": ("testbench", "pass behavior", "fail behavior"),  # 自检行为文本
            "signature": "testbench_or_reference_vector_gap",  # testbench 覆盖签名
            "constraint": (  # testbench 覆盖签名对应的 prompt memory 约束
                "Generate self-checking PASS/FAIL tests that mirror the semantic model vectors "
                "and mention required verification cases."
            ),  # testbench 覆盖缺口写入 memory 的自检提醒
        },
        {
            "source_terms": (),  # 该规则只依赖 trace 文本
            "text_terms": ("semantic model", "run_tests"),  # 参考模型 API 文本
            "signature": "reference_model_contract_gap",  # 参考模型合同签名
            "constraint": "Preserve `run_tests()` and the Python CLI entrypoint, then mirror its vectors downstream.",  # 参考模型入口缺口写入记忆的保持约束
        },
        {
            "source_terms": (),  # 注释可审查性来自文本线索
            "text_terms": ("reviewability", "comment"),  # 注释质量相关文本
            "signature": "comment_reviewability_gap",  # 注释审查签名
            "constraint": (  # 注释可审查签名对应的 prompt memory 约束
                "Use the requested comment language and add same-line semantic comments for every "
                "RTL declaration, block, assign, construct end, and testbench case check."
            ),  # 注释审查失败写入 memory 的 RTL 注释提醒
        },
        {
            "source_terms": (),  # FSM 结构来自 trace 描述
            "text_terms": ("fsm", "state register", "next-state"),  # 状态机结构文本
            "signature": "rtl_fsm_structure_gap",  # FSM 结构签名
            "constraint": (  # FSM 结构签名对应的 prompt memory 约束
                "Use three-block RTL FSM style with state register, next-state logic, "
                "and output logic labels."
            ),  # FSM 结构缺口写入 memory 的样式提醒
        },
        {
            "source_terms": ("toolchain_issue",),  # 工具链类 error_sources
            "text_terms": ("required tool",),  # 缺少工具文本
            "signature": "toolchain_unavailable_or_failed",  # 工具链失败签名
            "constraint": (  # 工具链失败签名对应的 prompt memory 约束
                "Separate tool availability failures from code edits and rerun with "
                "the required readiness tool installed."
            ),  # 工具链失败写入 memory 的执行边界提醒
        },
        {
            "source_terms": ("spec_issue",),  # 规格失败事件来源匹配词
            "text_terms": ("evidence",),  # 证据覆盖文本
            "signature": "spec_or_evidence_gap",  # 规格证据签名
            "constraint": "Audit evidence coverage and requested outputs before regenerating implementation files.",  # 证据覆盖记忆
        },
        {
            "source_terms": (),  # 输出漂移来自语义报告文本
            "text_terms": ("semantic output drift", "wrong_final_output"),  # 最终输出不匹配文本
            "signature": "wrong_final_output",  # 最终输出漂移签名
            "constraint": (  # 最终输出漂移签名对应的 prompt memory 约束
                "Reconfirm case outputs against the Python oracle and focus regeneration "
                "on the drift keys reported by semantic validation."
            ),  # 最终输出漂移写入 memory 的重生成范围提醒
        },
        {
            "source_terms": (),  # checkpoint 漂移来自语义报告文本
            "text_terms": ("checkpoint drift", "checkpoint_divergence"),  # checkpoint 不一致文本
            "signature": "checkpoint_divergence",  # checkpoint 漂移签名
            "constraint": (  # checkpoint 漂移签名对应的 prompt memory 约束
                "Preserve intermediate checkpoints and use them to localize where the Verilog "
                "behavior diverges from the Python oracle."
            ),  # checkpoint 漂移写入 memory 的定位提醒
        },
        {
            "source_terms": (),  # case 顺序漂移来自 trace 文本
            "text_terms": ("case order drift", "case_order_drift"),  # 用例顺序不一致文本
            "signature": "case_order_drift",  # 用例顺序签名
            "constraint": (  # case 顺序漂移签名对应的 prompt memory 约束
                "Keep case ordering and case ids stable between the semantic contract "
                "and the Verilog transcript."
            ),  # 用例顺序漂移写入 memory 的排序提醒
        },
        {
            "source_terms": (),  # oracle 强度来自 trace 文本
            "text_terms": ("weak_test_oracle", "augment_tests"),  # 测试增强文本
            "signature": "weak_test_oracle",  # 测试 oracle 签名
            "constraint": "Add stronger boundary, negative, and checkpoint cases before escalating to a human.",  # 测试增强记忆
        },
        {
            "source_terms": (),  # 规格歧义来自结构化文本
            "text_terms": ("ambiguous_spec_rule",),  # 歧义规则文本
            "signature": "ambiguous_spec_rule",  # 规格歧义签名
            "constraint": (  # 规格歧义签名对应的 prompt memory 约束
                "Preserve the spec conflict explicitly and route it into structured human intervention "
                "rather than inferring behavior."
            ),  # 规格歧义写入 memory 的人工介入提醒
        },
    )
    
    # optimize_prompt_from_trace 将 trace 诊断整理成下一轮 prompt patch。
    def optimize_prompt_from_trace(trace_path: Path, plan: dict[str, Any]) -> str:
        """根据历史 trace 为下一轮 staged generation 构造 prompt patch。
    
        参数:
            trace_path: workflow trace JSONL 或 JSON 文件路径。
            plan: 已有 codegen plan 或规格字典。
    
        返回:
            可追加到下一轮 prompt 的 Markdown 补丁文本。
        """
    
        # trace 事件提供失败模式和恢复线索。
        list_events = read_trace(trace_path)  # 历史 workflow 事件
    
        # 规范化计划用于稳定读取设计名和子功能列表。
        dict_normalized_plan = decompose_spec(plan)  # 规范化后的 RTL 生成计划
    
        # 约束列表按规则顺序去重,保持 prompt patch 可预测。
        list_constraints = _derive_constraints(list_events)  # 下一轮 prompt 约束
    
        # 子功能摘要在 Context 区域显示,帮助人工确认覆盖范围。
        str_subfunctions = _subfunction_summary(dict_normalized_plan)  # 子功能名称摘要
    
        # prompt patch 头部保持旧版 Markdown wire shape。
        list_lines = [  # 供optimize_prompt_from_trace拼接返回Markdown补丁正文的行序列
            f"# Prompt patch: {dict_normalized_plan['name']}",  # 标识目标设计名称的补丁标题行
            "",  # 标题和正文之间的 Markdown 空行
            "Apply these incremental constraints to the next staged generation prompt.",  # 固定说明文本
            "",  # 说明和约束标题之间的 Markdown 空行
            "## Targeted Constraints",  # 约束章节标题
            "",  # 约束标题后的 Markdown 空行
        ]
    
        # 有具体约束时逐条追加,空约束时保留旧版兜底文本。
        if list_constraints:
    
            # 约束条目必须保持规则匹配顺序。
            list_lines.extend(f"- {str_constraint}" for str_constraint in list_constraints)
    
        # trace 没有命中失败模式时不强行发明 prompt 约束。
        else:
    
            # 兜底约束明确要求保留既有 staged prompt 合同。
            list_lines.append(
                "- No concrete failure pattern was found; keep the existing staged prompt contract unchanged."
            )
    
        # Context 区域汇总 trace 数量、子功能和输出合同边界。
        list_lines.extend(
            [
                "",  # 约束列表和 Context 标题之间的 Markdown 空行
                "## Context",  # 上下文章节标题
                "",  # Context 标题后的 Markdown 空行
                f"- Trace events analyzed: {len(list_events)}",  # trace 事件数量
                f"- Subfunctions: {str_subfunctions}",  # 子功能摘要
                "- Preserve exact manifest/code-fence output contract.",  # 输出合同保护提醒
            ]
        )
    
        # 返回带末尾换行的 Markdown 文本,保持旧版 CLI 输出习惯。
        return "\n".join(list_lines) + "\n"
    
    # build_prompt_memory 将 trace 诊断转换为 workflow 可复用记忆。
    def build_prompt_memory(trace_path: Path, plan: dict[str, Any]) -> dict[str, Any]:
        """根据 trace 和计划生成 prompt memory 结构。
    
        参数:
            trace_path: workflow trace JSONL 或 JSON 文件路径。
            plan: 已有 codegen plan 或规格字典。
    
        返回:
            包含版本、目标和记忆条目的字典。
        """
    
        # prompt memory 只读取能复用到后续生成的失败线索。
        list_events = read_trace(trace_path)  # prompt memory 签名抽取的输入事件
    
        # 顶层 memory 字段从规范化计划读取,避免原始 spec 形态差异。
        dict_normalized_plan = decompose_spec(plan)  # memory 顶层名称和目标来源
    
        # 返回结构保持旧版 prompt memory wire shape。
        return {
            "version": 1,  # memory 结构版本
            "name": dict_normalized_plan["name"],  # 设计或计划名称
            "target": dict_normalized_plan["target"],  # 生成目标类型
            "entries": _memory_entries(list_events, dict_normalized_plan),  # 去重后的 trace 记忆条目
        }
    
    # _derive_constraints 负责从 trace 文本中抽取 prompt 约束。
    def _derive_constraints(list_events: list[dict[str, Any]]) -> list[str]:
        """从历史事件文本中提取下一轮 prompt 约束。
    
        参数:
            list_events: read_trace 返回的 workflow 事件列表。
    
        返回:
            按规则顺序去重后的英文 prompt 约束列表。
        """
    
        # 所有事件统一转成小写文本,兼容旧逻辑的字符串匹配方式。
        str_joined_events = "\n".join(str(dict_event).lower() for dict_event in list_events)  # trace 拼接文本
    
        # prompt patch 约束按 CONSTRAINT_RULES 命中顺序累积。
        list_constraints: list[str] = []  # 下一轮生成 prompt 中追加的约束条目
    
        # 逐条匹配历史规则,保持旧版约束文本和顺序。
        for tuple_keywords, str_constraint in CONSTRAINT_RULES:
    
            # 当前关键词组命中时追加对应约束。
            if _contains_any(str_joined_events, tuple_keywords):
    
                # 去重追加避免多个关键词命中同一约束时重复输出。
                _append_unique(list_constraints, str_constraint)
    
        # 返回 prompt patch 使用的约束列表。
        return list_constraints
    
    # _memory_entries 负责把 trace 事件展开成去重记忆条目。
    def _memory_entries(list_events: list[dict[str, Any]], dict_plan: dict[str, Any]) -> list[dict[str, Any]]:
        """把 trace 事件转换为按子功能和阶段索引的记忆条目。
    
        参数:
            list_events: read_trace 返回的 workflow 事件列表。
            dict_plan: decompose_spec 输出的规范化计划。
    
        返回:
            去重后的 prompt memory entries 列表。
        """
    
        # 子功能列表缺省为星号,保留旧版全局记忆语义。
        list_subfunctions = _plan_subfunctions(dict_plan)  # prompt memory 适用的子功能名称
    
        # entries 先完整收集,再按 subfunction/stage/signature 去重。
        list_entries: list[dict[str, Any]] = []  # 原始记忆条目列表
    
        # 每个 trace 事件可能贡献多个签名。
        for dict_event in list_events:
    
            # 事件文本沿用旧版 str(event).lower() 匹配语义。
            str_joined_event = str(dict_event).lower()  # 单个事件小写文本
    
            # 事件签名规则输出错误签名和约束文本。
            list_signatures = _event_signatures(dict_event, str_joined_event)  # 当前事件命中的签名
    
            # 每个签名生成一条 memory entry。
            for str_signature, str_constraint in list_signatures:
    
                # 记忆条目保持 workflow state 使用的字段形状。
                list_entries.append(
                    {
                        "subfunction": dict_event.get("subfunction") or list_subfunctions[0],  # 事件归属子功能
                        "stage": _event_stage(dict_event),  # 事件归属阶段或 readiness
                        "attempt_id": dict_event.get("attempt_id"),  # 原始尝试标识
                        "error_signature": str_signature,  # 可复用错误签名
                        "constraint": str_constraint,  # 下一轮 prompt 约束文本
                    }
                )
    
        # 去重后返回给 prompt memory 写出流程。
        return _dedupe_entries(list_entries)
    
    # _event_signatures 根据单个事件匹配可复用错误签名。
    def _event_signatures(dict_event: dict[str, Any], str_joined_event: str) -> list[tuple[str, str]]:
        """提取单个 trace 事件命中的记忆签名。
    
        参数:
            dict_event: 单条 workflow trace 事件。
            str_joined_event: 事件字典转成小写后的文本。
    
        返回:
            由 error_signature 和 constraint 组成的二元组列表。
        """
    
        # error_sources 只有列表形态时才参与源分类匹配。
        set_sources = set(dict_event.get("error_sources", []) or [])  # 当前事件错误来源集合
    
        # 签名输出按 SIGNATURE_RULES 顺序累积。
        list_signatures: list[tuple[str, str]] = []  # 当前事件命中的签名列表
    
        # 逐条匹配来源和文本关键词,保持旧版优先级。
        for dict_rule in SIGNATURE_RULES:
    
            # 规则命中后生成一条 prompt memory 签名。
            if _signature_rule_matches(dict_rule, set_sources, str_joined_event):
    
                # 签名和约束文本来自静态规则表,不做运行时改写。
                tuple_signature = (dict_rule["signature"], dict_rule["constraint"])  # 记忆签名和约束
    
                # 当前事件命中的签名进入返回列表。
                list_signatures.append(tuple_signature)
    
        # 返回当前事件贡献的所有签名。
        return list_signatures
    
    # _signature_rule_matches 判断签名规则是否命中当前事件。
    def _signature_rule_matches(dict_rule: dict[str, Any], set_sources: set[Any], str_joined_event: str) -> bool:
        """判断一条签名规则是否匹配当前 trace 事件。
    
        参数:
            dict_rule: SIGNATURE_RULES 中的一条规则。
            set_sources: 当前事件的 error_sources 集合。
            str_joined_event: 当前事件的小写文本。
    
        返回:
            来源或文本关键词任一命中时返回 True。
        """
    
        # source_terms 为空时只依赖文本关键词。
        tuple_source_terms = tuple(dict_rule.get("source_terms", ()))  # 规则错误来源关键词
    
        # text_terms 为空时只依赖 error_sources。
        tuple_text_terms = tuple(dict_rule.get("text_terms", ()))  # 规则事件文本关键词
    
        # 来源命中沿用旧逻辑中的 error_sources 判断。
        bool_source_matched = bool(tuple_source_terms) and any(  # error_sources 是否命中该签名规则
            str_source in set_sources  # 当前来源是否在事件来源集合中
            for str_source in tuple_source_terms  # 规则要求的来源关键词
        )
    
        # 文本命中沿用旧逻辑中的 str(event).lower() 判断。
        bool_text_matched = _contains_any(str_joined_event, tuple_text_terms)  # 文本是否命中
    
        # 来源或文本任一路径命中即可生成签名。
        return bool_source_matched or bool_text_matched
    
    # _plan_subfunctions 解析计划中的子功能名称列表。
    def _plan_subfunctions(dict_plan: dict[str, Any]) -> list[str]:
        """从规范化计划中提取 prompt memory 适用的子功能名称。
    
        参数:
            dict_plan: decompose_spec 输出的规范化计划。
    
        返回:
            子功能名称列表;没有可用名称时返回 ``["*"]``。
        """
    
        # 子功能名只从 dict 条目提取,兼容旧版过滤逻辑。
        list_names = [
            str(dict_item.get("name"))  # 子功能名称
            for dict_item in dict_plan.get("subfunctions", [])  # 规范化计划子功能列表
            if isinstance(dict_item, dict) and dict_item.get("name")  # 只保留具名子功能
        ]  # 已解析子功能名称
    
        # 没有子功能时返回全局星号,保持旧版默认行为。
        return list_names or ["*"]
    
    # _subfunction_summary 生成 prompt patch 中展示的子功能摘要。
    def _subfunction_summary(dict_plan: dict[str, Any]) -> str:
        """生成 prompt patch Context 区域使用的子功能摘要文本。
    
        参数:
            dict_plan: decompose_spec 输出的规范化计划。
    
        返回:
            以逗号分隔的子功能名称字符串。
        """
    
        # 子功能摘要复用 memory 的解析规则,避免两个路径默认值不一致。
        list_subfunctions = _plan_subfunctions(dict_plan)  # prompt patch 展示的子功能名称
    
        # 返回 Markdown 列表项中使用的逗号分隔摘要。
        return ", ".join(list_subfunctions)
    
    # _event_stage 解析 memory entry 的阶段字段。
    def _event_stage(dict_event: dict[str, Any]) -> Any:
        """解析 trace 事件所属阶段或 readiness。
    
        参数:
            dict_event: 单条 workflow trace 事件。
    
        返回:
            事件中的 stage、readiness、event 或 ``unknown``。
        """
    
        # stage/readiness/event 按旧版优先级依次兜底。
        return dict_event.get("stage") or dict_event.get("readiness") or dict_event.get("event") or "unknown"
    
    # _contains_any 统一处理小写文本的关键词匹配。
    def _contains_any(str_text: str, tuple_keywords: tuple[str, ...]) -> bool:
        """判断文本是否包含任一关键词。
    
        参数:
            str_text: 已按调用方需要归一化的待检索文本。
            tuple_keywords: 需要依次匹配的关键词集合。
    
        返回:
            任一关键词出现在文本中时返回 True。
        """
    
        # any 保持短路匹配,避免无意义地扫描后续关键词。
        return any(str_keyword in str_text for str_keyword in tuple_keywords)
    
    # _append_unique 保持约束列表的稳定去重追加语义。
    def _append_unique(list_values: list[str], str_value: str) -> None:
        """向字符串列表追加不存在的值。
    
        参数:
            list_values: 需要原地更新的字符串列表。
            str_value: 候选字符串值。
    
        返回:
            无。
        """
    
        # 只有首次命中才写入,保持旧版 add helper 的去重行为。
        if str_value not in list_values:
    
            # 原地追加让调用方持有的列表保持同步。
            list_values.append(str_value)
    
    # _dedupe_entries 按子功能、阶段和错误签名去重。
    def _dedupe_entries(list_entries: list[dict[str, Any]]) -> list[dict[str, Any]]:
        """去除重复的 prompt memory entry。
    
        参数:
            list_entries: 原始 prompt memory 条目列表。
    
        返回:
            保留首次出现顺序的去重条目列表。
        """
    
        # seen 记录已经输出过的 memory 业务键。
        set_seen: set[tuple[Any, Any, Any]] = set()  # 已出现的记忆去重键
    
        # 去重结果按输入顺序保存首次出现的条目。
        list_deduped: list[dict[str, Any]] = []  # 保留首次出现顺序的 memory 条目
    
        # 逐条检查 memory entry 的业务唯一键。
        for dict_entry in list_entries:
    
            # memory 去重仍使用旧版的三字段业务键。
            tuple_key = (  # 子功能、阶段和签名组成 memory 去重键
                dict_entry.get("subfunction"),  # 记忆适用子功能
                dict_entry.get("stage"),  # workflow 阶段或 readiness 名称
                dict_entry.get("error_signature"),  # 触发 prompt 记忆复用的错误签名
            )
    
            # 已见过的业务键直接跳过,保留首次条目。
            if tuple_key in set_seen:
    
                # 跳过重复条目,不改变输出顺序。
                continue
    
            # 记录当前业务键,避免后续重复输出。
            set_seen.add(tuple_key)
    
            # 首次出现的条目保留原字段内容。
            list_deduped.append(dict_entry)
    
        # 返回去重后的 memory 条目。
        return list_deduped
    
  • scripts/python/existing_rtl/reflection.py87 KB33170dda2ee3upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/existing_rtl/semantic_contract.py46 KB8c645326c368upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/existing_rtl/verifier.py15 KBa68cf21f02fdupstream ↗
    """校验 Verilog workflow 相邻阶段的契约一致性。"""
    
    # 延迟注解解析,避免导入期处理嵌套 JSON 类型。
    from __future__ import annotations
    
    # 运行时契约由 JSON 字典承载,类型提示保持宽容。
    from typing import Any
    
    # 公开入口汇总阶段契约、计划接口和语义执行问题。
    def verify_stage(
        plan: dict[str, Any],
        from_contract: dict[str, Any],
        to_contract: dict[str, Any],
    ) -> dict[str, Any]:
        """校验 workflow 相邻阶段之间的契约兼容性。
    
        参数:
            plan: codegen plan 或规范化计划,用于提供期望 top 和端口。
            from_contract: 上一阶段导出的契约。
            to_contract: 当前阶段导出的契约。
    
        返回:
            保持旧版字段形状的校验报告,包含 ready、issues 和语义执行摘要。
        """
    
        # issues 汇总原始契约问题、接口漂移和测试用例漂移。
        list_issues: list[dict[str, Any]] = []  # 阶段契约问题列表
    
        # 上一阶段问题保留原诊断内容,只附加来源侧。
        list_issues.extend(_contract_issues(from_contract, "from"))
    
        # 当前阶段问题同样附加来源侧,便于报告定位。
        list_issues.extend(_contract_issues(to_contract, "to"))
    
        # RTL 输出契约需要和 plan 中的 top/ports 对齐。
        list_issues.extend(plan_contract_interface_issues(plan, to_contract))
    
        # reference 和 RTL 阶段的 case_ids 不一致会降低验证闭环可信度。
        list_issues.extend(_check_cases(from_contract, to_contract))
    
        # 语义执行指标独立解析,供报告字段和 recommended_action 复用。
        dict_semantic = _semantic_execution_issues(to_contract)  # 当前阶段语义执行诊断
    
        # 语义问题加入统一 issues 列表。
        list_issues.extend(dict_semantic["issues"])
    
        # ready 只要存在 error 级问题就为 False。
        bool_ready = not any(item.get("severity") == "error" for item in list_issues)  # 阶段契约是否可继续
    
        # semantic_ready 显式布尔 False 时建议修复语义 testbench。
        semantic_ready_value = dict_semantic["semantic_ready"]  # 当前阶段语义 ready 原始值
    
        # 仅布尔 False 触发 repair_semantic_testbench,None 表示未检查。
        bool_requires_semantic_repair = isinstance(semantic_ready_value, bool) and not semantic_ready_value  # 是否建议修复语义 testbench
    
        # 默认没有语义修复建议。
        str_recommended_action = None  # 下一步建议动作
    
        # 语义执行明确失败时给出旧版建议动作。
        if bool_requires_semantic_repair:
    
            # 推荐动作字符串由旧版报告消费,不能改名。
            str_recommended_action = "repair_semantic_testbench"  # 语义 testbench 修复动作
    
        # error_sources 去重排序后供 workflow trace 和 repair plan 使用。
        list_error_sources = sorted({str(item.get("source")) for item in list_issues if item.get("source")})  # 问题来源集合
    
        # 返回字段保持旧版契约,避免上游报告解析变化。
        return {
            "version": 1,
            "target": plan.get("target", "rtl"),
            "ready": bool_ready,
            "issues": list_issues,
            "semantic_ready": dict_semantic["semantic_ready"],
            "mismatched_cases": dict_semantic["mismatched_cases"],
            "checkpoint_drift": dict_semantic["checkpoint_drift"],
            "failed_cases": dict_semantic["failed_cases"],
            "localization_confidence": dict_semantic["localization_confidence"],
            "error_sources": list_error_sources,
            "recommended_action": str_recommended_action,
            "summary": {
                "from_target": from_contract.get("target"),
                "to_target": to_contract.get("target"),
                "top": to_contract.get("top"),
            },
        }
    
    # 公开接口校验器检查 plan 期望端口和 RTL 契约端口是否一致。
    def plan_contract_interface_issues(plan: dict[str, Any], contract: dict[str, Any]) -> list[dict[str, Any]]:
        """检查 RTL 阶段契约是否保留计划中的 top 和端口定义。
    
        参数:
            plan: 提供期望模块名和 interfaces.ports 的计划字典。
            contract: 当前阶段导出的契约字典。
    
        返回:
            error 级接口漂移问题列表;非 RTL 契约返回空列表。
        """
    
        # 当前函数只验证 RTL 契约,其它阶段没有端口约束。
        list_issues: list[dict[str, Any]] = []  # RTL 接口契约问题
    
        # 非 RTL 目标不执行 top/ports 对齐检查。
        if contract.get("target") != "rtl":
    
            # 返回空问题,保持非 RTL 阶段宽容。
            return list_issues
    
        # plan.name 是期望的 RTL 顶层模块名。
        value_expected_top = plan.get("name")  # 计划中的期望 top 名称
    
        # contract.top 是当前阶段实际解析到的 RTL 顶层名。
        value_observed_top = contract.get("top")  # 当前契约中的 top 名称
    
        # 两侧都提供 top 且不一致时报告顶层漂移。
        if value_expected_top and value_observed_top and value_expected_top != value_observed_top:
    
            # 顶层不一致通常表示生成文件不是目标模块。
            list_issues.append(
                _issue("error", f"RTL top mismatch: expected {value_expected_top!r}, observed {value_observed_top!r}.")
            )
    
        # 期望端口按 name 建索引,便于后续逐个比较。
        dict_expected_ports = {
            str(item.get("name")): item  # 计划端口对象
            for item in plan.get("interfaces", {}).get("ports", [])  # 计划端口列表
            if isinstance(item, dict) and item.get("name")  # 只索引 RTL 契约中可命名匹配的端口
        }  # 计划端口索引
    
        # 观测端口同样按 name 建索引。
        dict_observed_ports = {
            str(item.get("name")): item  # 契约端口对象
            for item in contract.get("ports", [])  # RTL 契约端口列表
            if isinstance(item, dict) and item.get("name")  # 只保留具名端口
        }  # RTL 契约端口索引
    
        # 逐个计划端口检查是否缺失、方向漂移或位宽漂移。
        for str_port_name, dict_expected_port in dict_expected_ports.items():
    
            # observed 缺失说明 RTL 没有导出计划要求的端口。
            dict_observed_port = dict_observed_ports.get(str_port_name)  # 当前端口的 RTL 观测定义
    
            # 缺失端口直接记录 error,并跳过后续方向/位宽比较。
            if not dict_observed_port:
    
                # 端口缺失会破坏 testbench 和集成契约。
                list_issues.append(_issue("error", f"RTL port {str_port_name!r} is missing."))
    
                # 当前端口没有可比较的观测定义。
                continue
    
            # 两侧都声明 direction 时必须完全一致。
            if (
                dict_expected_port.get("direction")
                and dict_observed_port.get("direction")
                and dict_expected_port["direction"] != dict_observed_port["direction"]
            ):
    
                # 方向漂移会改变模块使用方式。
                list_issues.append(_issue("error", f"RTL port {str_port_name!r} direction changed."))
    
            # 期望宽度缺省按 1 处理,匹配旧版逻辑。
            int_expected_width = int(dict_expected_port.get("width", 1) or 1)  # 计划端口位宽
    
            # 观测位宽允许缺失;缺失时不报宽度漂移。
            value_observed_width = dict_observed_port.get("width")  # RTL 契约端口位宽
    
            # 观测位宽存在且和期望不同则报告 error。
            if value_observed_width is not None and int(value_observed_width) != int_expected_width:
    
                # 长错误消息拆分成变量,避免报告构造行过宽。
                str_message = (  # 位宽漂移诊断文本
                    f"RTL port {str_port_name!r} width changed "  # 端口名和漂移类型
                    f"from {int_expected_width} to {value_observed_width}."  # 期望位宽到观测位宽
                )
    
                # 记录当前端口位宽漂移。
                list_issues.append(_issue("error", str_message))
    
        # 返回 RTL 接口漂移问题列表。
        return list_issues
    
    # 契约问题复制器给已有 issue 标注来源阶段。
    def _contract_issues(contract: dict[str, Any], side: str) -> list[dict[str, Any]]:
        """复制契约内已有问题并标注来源侧。
    
        参数:
            contract: workflow 阶段导出的契约字典。
            side: 当前问题所属的阶段侧标识,通常为 from 或 to。
    
        返回:
            已补充 side 字段的契约问题列表。
        """
    
        # 复制后的问题列表不会反写原始 contract。
        list_issues: list[dict[str, Any]] = []  # 附加 side 后的契约问题
    
        # contract.issues 可能缺失,按空列表处理。
        for item in contract.get("issues", []) or []:
    
            # 只有 dict 形态问题才能安全附加 side 字段。
            if isinstance(item, dict):
    
                # side 字段帮助诊断问题来自 from 还是 to 阶段。
                list_issues.append({**item, "side": side})
    
        # 返回复制后的契约问题。
        return list_issues
    
    # case_ids 检查器确认两阶段引用同一批参考用例。
    def _check_cases(from_contract: dict[str, Any], to_contract: dict[str, Any]) -> list[dict[str, Any]]:
        """检查两阶段契约是否引用同一批 reference case。
    
        参数:
            from_contract: 上一阶段导出的契约字典。
            to_contract: 当前阶段导出的契约字典。
    
        返回:
            用例集合漂移问题列表;未漂移时返回空列表。
        """
    
        # from 阶段 case_ids 是参考契约期望覆盖的用例集合。
        set_expected_cases = {str(item) for item in from_contract.get("case_ids", []) or []}  # 参考阶段用例集合
    
        # to 阶段 case_ids 是当前契约实际覆盖的用例集合。
        set_observed_cases = {str(item) for item in to_contract.get("case_ids", []) or []}  # 当前阶段用例集合
    
        # 两侧都有用例且集合不一致时报告 warning。
        if set_expected_cases and set_observed_cases and set_expected_cases != set_observed_cases:
    
            # 用例集合漂移影响覆盖率,但不一定阻断生成。
            return [_issue("warning", "Reference case ids differ between stages.", source="testbench_issue")]
    
        # 没有发现用例集合漂移。
        return []
    
    # 语义执行指标解析器把 transcript/checkpoint 失败转成契约问题。
    def _semantic_execution_issues(contract: dict[str, Any]) -> dict[str, Any]:
        """把契约中的 semantic_execution 指标转换为统一诊断。
    
        参数:
            contract: 当前阶段导出的契约字典。
    
        返回:
            包含语义执行问题、ready 状态、漂移用例和定位置信度的摘要字典。
        """
    
        # metrics 只有 dict 形态时才可读取 semantic_execution。
        dict_metrics = contract.get("metrics") if isinstance(contract.get("metrics"), dict) else {}  # 当前契约指标对象
    
        # 原始 semantic_execution 可能缺失或不是对象,先以动态值承接。
        value_semantic_execution = dict_metrics.get("semantic_execution")  # 原始语义执行指标
    
        # semantic_execution 缺失时使用空字典表达当前阶段未运行语义用例。
        dict_semantic_execution = value_semantic_execution if isinstance(value_semantic_execution, dict) else {}  # 语义执行指标
    
        # 没有语义指标时返回空诊断,但保留字段形状。
        if not dict_semantic_execution:
    
            # None 表示未检查,而不是语义检查失败。
            return {
                "issues": [],
                "semantic_ready": None,
                "mismatched_cases": [],
                "checkpoint_drift": [],
                "failed_cases": [],
                "localization_confidence": None,
            }
    
        # 语义执行问题会附加到 verify_stage 的统一 issues。
        list_issues: list[dict[str, Any]] = []  # 语义执行问题列表
    
        # semantic_ready 是上游语义执行器的总体就绪判断。
        value_semantic_ready = dict_semantic_execution.get("semantic_ready")  # 语义执行总体状态
    
        # mismatched_cases 记录 reference/RTL 用例覆盖差异。
        mismatched_cases = dict_semantic_execution.get("mismatched_cases", []) or []  # 覆盖不一致的用例
    
        # checkpoint_drift 记录 checkpoint 名称或值的漂移。
        list_checkpoint_drift = dict_semantic_execution.get("checkpoint_drift", []) or []  # 语义检查点漂移列表
    
        # failed_cases 记录 transcript 中失败的用例。
        failed_cases = dict_semantic_execution.get("failed_cases", []) or []  # 语义执行失败用例
    
        # 显式布尔 False 表示语义用例或 checkpoint 尚未准备好。
        bool_semantic_failed = isinstance(value_semantic_ready, bool) and not value_semantic_ready  # 语义执行是否明确失败
    
        # 语义执行未就绪时给出阻断级问题。
        if bool_semantic_failed:
    
            # 长错误消息独立成变量,避免问题登记行过宽。
            str_message = (  # 语义执行未就绪诊断
                "Semantic execution is not ready; "  # 语义执行失败诊断前半句
                "reference cases or checkpoints are missing or mismatched."  # 缺失或不匹配原因
            )
    
            # 未就绪说明 testbench 语义闭环需要修复。
            list_issues.append(_issue("error", str_message, source="testbench_issue"))
    
        # 用例覆盖不一致时记录阻断级问题。
        if mismatched_cases:
    
            # case coverage 不一致会让 RTL 与 reference 不可比。
            list_issues.append(
                _issue("error", "Semantic case coverage differs from the semantic contract.", source="testbench_issue")
            )
    
        # checkpoint drift 表示语义观测点不一致。
        if list_checkpoint_drift:
    
            # checkpoint 漂移需要在 reference 或 RTL transcript 中修复。
            list_issues.append(_issue("error", "Semantic checkpoint drift was detected.", source="testbench_issue"))
    
        # transcript 中存在失败 case 时记录阻断级问题。
        if failed_cases:
    
            # failed_cases 表示语义执行已经跑通但用例结果失败。
            str_message = "Semantic transcript contains failed reference cases."  # transcript 失败用例诊断
    
            # 失败用例来自 testbench 语义执行链路。
            list_issues.append(_issue("error", str_message, source="testbench_issue"))
    
        # 返回字段保持旧版语义执行摘要形状。
        return {
            "issues": list_issues,
            "semantic_ready": value_semantic_ready,
            "mismatched_cases": mismatched_cases,
            "checkpoint_drift": list_checkpoint_drift,
            "failed_cases": failed_cases,
            "localization_confidence": dict_semantic_execution.get("localization_confidence"),
        }
    
    # issue 构造器统一生成 severity/source/message 三字段诊断。
    def _issue(severity: str, message: str, *, source: str = "current_module_issue") -> dict[str, Any]:
        """生成 workflow 报告使用的最小 issue 对象。
    
        参数:
            severity: 问题严重程度。
            message: 人类可读诊断文本。
            source: 问题来源分类,默认归入当前模块。
    
        返回:
            包含 severity、source 和 message 的 issue 字典。
        """
    
        # 返回最小 issue 结构,保持 workflow 报告兼容。
        return {"severity": severity, "source": source, "message": message}
    
  • scripts/python/existing_rtl/verify_repair.py4.6 KB8f984bd8483bupstream ↗
    """existing RTL verify-repair 的兼容入口。"""
    
    # 延迟注解让 facade 只承担导出职责。
    from __future__ import annotations
    
    # 路径和宽松 JSON 类型用于复刻旧 facade 签名。
    from pathlib import Path
    from typing import Any
    
    # 主流程模块承载 verify_existing 的完整编排。
    from . import verify_repair_core as _core
    
    # support 模块承载入口校验、日志诊断和稳定常量。
    from . import verify_repair_support as _support
    
    # automation mode 常量保持旧导出路径。
    AUTOMATION_MODES: tuple[str, ...] = _support.AUTOMATION_MODES  # verify-repair 自动化模式集合
    
    # TB language 集合在旧调用方里常用于 CLI choices。
    TB_LANGUAGES: tuple[str, ...] = _support.TB_LANGUAGES  # testbench 语言集合
    
    # TB mode 集合保持 generate/augment 分支的旧读取位置。
    TB_MODES: tuple[str, ...] = _support.TB_MODES  # testbench 处理模式集合
    
    # 日志诊断入口保留旧模块路径,便于外部脚本继续导入。
    def diagnose_log_texts(*, compile_log: str, simulation_log: str, executed: bool) -> dict[str, Any]:
        """分类编译和仿真日志中的 verify-repair 诊断信息。
    
        Args:
            compile_log: 编译阶段输出文本。
            simulation_log: 仿真阶段输出文本。
            executed: 外部验证流程是否已经实际执行。
    
        Returns:
            可写入报告的日志诊断字典。
        """
    
        # 真实规则集中在 support 模块,facade 只保留旧入口。
        return _support.diagnose_log_texts(
            compile_log=compile_log,
            simulation_log=simulation_log,
            executed=executed,
        )
    
    # automation mode 校验是写回权限进入 core 前的兼容 guard。
    def require_automation_mode(str_value: str) -> str:
        """校验并规范化 verify-repair 自动化模式。
    
        Args:
            str_value: 调用方传入的自动化模式文本。
    
        Returns:
            support 模块认可的标准模式文本。
        """
    
        # 委托 support 保持错误消息和允许值完全一致。
        return _support.require_automation_mode(str_value)
    
    # TB language 校验继续服务直接从旧模块导入的脚本。
    def require_tb_language(str_value: str) -> str:
        """校验并规范化 testbench 语言。
    
        Args:
            str_value: 调用方传入的 testbench 语言文本。
    
        Returns:
            support 模块认可的标准语言文本。
        """
    
        # 委托 support 保持语言集合和大小写规整逻辑一致。
        return _support.require_tb_language(str_value)
    
    # TB mode 校验继续隔离 testbench 生成与增强策略。
    def require_tb_mode(str_value: str) -> str:
        """校验并规范化 testbench 处理模式。
    
        Args:
            str_value: 调用方传入的 testbench 模式文本。
    
        Returns:
            support 模块认可的标准模式文本。
        """
    
        # 委托 support 保持 generate/augment 分支边界一致。
        return _support.require_tb_mode(str_value)
    
    # verify_existing 是对外主入口,真实实现位于 core helper。
    def verify_existing(source_paths: list[Path], **dict_verify_options: Any) -> dict[str, Any]:
        """运行 existing RTL verify-repair,并保留旧 facade 入口。
    
        Args:
            source_paths: 待分析和验证的 RTL/TB 源文件路径。
            dict_verify_options: 旧调用方传入 core verify_existing 的关键字参数。
    
        Returns:
            verify-repair 运行报告和工件路径字典。
        """
    
        # core 模块承载真实编排,facade 不复制业务逻辑。
        return _core.verify_existing(source_paths, **dict_verify_options)
    
    # 私有元组集中保存旧模块允许导入的稳定符号名。
    tuple_public_verify_repair_exports: tuple[str, ...] = (  # verify_repair 旧导入语句允许解析的符号顺序
        "AUTOMATION_MODES",  # 旧调用方读取的自动化模式枚举
        "TB_LANGUAGES",  # 旧调用方读取的 testbench 语言枚举
        "TB_MODES",  # 旧调用方读取的 testbench 处理策略枚举
        "diagnose_log_texts",  # 旧调用方分析编译与仿真 transcript 的入口
        "require_automation_mode",  # 旧调用方校验 automation-mode 取值的入口
        "require_tb_language",  # 旧调用方校验 testbench 语言取值的入口
        "require_tb_mode",  # 旧调用方校验 testbench 模式取值的入口
        "verify_existing",  # 旧调用方启动 existing RTL verify-repair 的入口
    )
    
    # __all__ 保持 list 形态,避免旧测试或调用方依赖可变序列时失配。
    __all__: list[str] = list(tuple_public_verify_repair_exports)  # 旧导入清单的 list 兼容副本
    
  • scripts/python/existing_rtl/verify_repair_core.py46 KB50bc4caa8d12upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/existing_rtl/verify_repair_patch_apply.py23 KB92a8eb43d8beupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/existing_rtl/verify_repair_patch_categories.py35 KBbdf59f455107upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/existing_rtl/verify_repair_patch_plan.py25 KBd97db9958713upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/existing_rtl/verify_repair_patching.py2.4 KB27601a1d9c0cupstream ↗
    """verify-repair 的 RTL patch facade,保持旧导入面稳定。"""
    
    # 延迟类型求值,避免 facade 在类型解析阶段扩大耦合。
    from __future__ import annotations
    
    # patch 写回阶段的稳定公开入口从 apply 子模块转发。
    from .verify_repair_patch_apply import (
        RtlMutationContext,
        apply_rtl_patch as _apply_rtl_patch,
        decision_allows_apply,
        handle_rtl_mutation,
    )
    
    # post-apply 证据与人工确认入口继续复用 apply 子模块。
    from .verify_repair_patch_apply import (
        post_apply_equivalence_payload,
        post_apply_validation_payload,
        read_decision,
        write_rtl_intervention,
    )
    
    # patch 类别与候选生成 helper 从 categories 子模块转发。
    from .verify_repair_patch_categories import (
        build_root_cause_evidence,
        declared_reg_outputs,
        extract_reset_block,
        extract_reset_block_match,
        extract_reset_block_span,
    )
    
    # patch 类别补丁生成 helper 继续从 categories 子模块转发。
    from .verify_repair_patch_categories import (
        inferred_output_assignment,
        insert_output_register_assignments as _insert_output_register_assignments,
        insert_reset_assignments as _insert_reset_assignments,
        insert_state_hold_branch as _insert_state_hold_branch,
    )
    
    # patch 风险与输出推断 helper 继续从 categories 子模块转发。
    from .verify_repair_patch_categories import (
        missing_output_register_assignments as _missing_output_register_assignments,
        patch_case_default_completion,
        patch_missing_reset_initialization,
        patch_output_register_completion,
    )
    
    # patch 风险等级和信号推断 helper 继续从 categories 子模块转发。
    from .verify_repair_patch_categories import (
        patch_risk_level as _patch_risk_level,
        patch_state_hold_completion,
        reset_assignment,
        select_patch_candidate as _select_patch_candidate,
        signal_widths,
    )
    
    # patch 计划与策略 helper 从 plan 子模块转发。
    from .verify_repair_patch_plan import (
        build_patch_candidate,
        build_rtl_patch_plan,
        multi_file_patch_plan as _multi_file_patch_plan,
        recommended_action,
        rtl_mutation_policy,
    )
    
    # patch 策略补充 helper 继续从 plan 子模块转发。
    from .verify_repair_patch_plan import (
        rtl_no_candidate_policy as _rtl_no_candidate_policy,
        rtl_wait_confirmation as _rtl_wait_confirmation,
        source_mutation_policy,
        tb_mutation_policy,
        write_candidate_and_compare as _write_candidate_and_compare,
    )
    
    
  • scripts/python/existing_rtl/verify_repair_support.py26 KB3fb550d318e3upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/existing_rtl/verify_repair_testbench.py46 KBcba2c323f1dcupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/existing_rtl/verify_reporting.py16 KBfc7a1e755a55upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/facade/__init__.py45 B9c0cf5921c9fupstream ↗
    """对外公开的 Verilog facade 包。"""
    
  • scripts/python/facade/existing_rtl_api.py14 KB53bd121a8380upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/facade/quality_api.py20 KB2793394794fdupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/facade/representative_cases.py38 KB16e91ee2c6a2upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/facade/verilog_api.py6.5 KB0d8650660bb6upstream ↗
    """Verilog-only 生成、分析和验证公开 facade API。"""
    
    # future annotations 避免注解在导入期求值。
    from __future__ import annotations
    
    # Any 用于兼容旧 facade 的自由配置字典;其余类型描述 spec bundle 输入。
    from pathlib import Path
    from typing import Any, Callable, Mapping, Sequence
    
    # runtime 路由器负责只分类请求、不触发生成执行。
    from scripts.python.workflow.workflow_router import route_verilog_entry
    
    # 统一 VG 门禁入口由质量模块直接提供,避免 facade 复制规则逻辑。
    from scripts.python.quality.quality_gate import run_verilog_quality_gate
    
    # spec_document 是规范文档、接口交叉核验和 WaveDrom 伴随包的唯一实现入口。
    from scripts.python.workflow.spec_document import write_spec_bundle
    
    # existing-RTL 相关公开能力从子模块重导出。
    from .existing_rtl_api import (
        analyze_existing_verilog,
        compare_verilog_semantics,
        improve_existing_verilog,
        verify_existing_verilog,
    )
    
    # 质量门与工件验证能力从子模块重导出。
    from .quality_api import (
        check_verilog_deliverable,
        check_verilog_quality,
        validate_verilog_artifacts,
    )
    
    # 代表性案例运行入口和常量从子模块重导出。
    from .representative_cases import (
        DEFAULT_CASE_RUN_DIR,
        REPRESENTATIVE_BAD_CASE_IDS,
        REPRESENTATIVE_CASE_CATALOG,
        REPRESENTATIVE_CASE_ORDER,
        REPRESENTATIVE_IDEAL_CASE_IDS,
        run_verilog_cases,
    )
    
    # 工作流 facade 的类型与兼容辅助函数从子模块重导出。
    from .workflow_api import (
        JsonSource,
        PathCollectionSource,
        _merged_option_dict,
    )
    
    # 工作流 facade 的公开执行入口从子模块重导出。
    from .workflow_api import (
        load_default_workflow_config,
        load_workflow_result,
        render_verilog_prompt,
        run_verilog_batch,
        run_verilog_workflow,
    )
    
    # __all__ 固定 facade 对外导出的稳定符号集合。
    __all__ = [
        "JsonSource",  # 公共 spec 输入类型
        "PathCollectionSource",  # 公共路径集合输入类型
        "DEFAULT_CASE_RUN_DIR",  # 代表性案例默认运行目录名
        "REPRESENTATIVE_BAD_CASE_IDS",  # 负例代表性案例 ID 集合
        "REPRESENTATIVE_CASE_CATALOG",  # 代表性案例目录映射
        "REPRESENTATIVE_CASE_ORDER",  # 代表性案例稳定排序
        "REPRESENTATIVE_IDEAL_CASE_IDS",  # 正例代表性案例 ID 集合
        "run_verilog_workflow",  # 主工作流执行入口
        "run_verilog_batch",  # 批量工作流执行入口
        "render_verilog_prompt",  # 提示词渲染入口
        "validate_verilog_artifacts",  # 工件验证入口
        "check_verilog_deliverable",  # 交付门入口
        "check_verilog_quality",  # 质量门入口
        "run_verilog_quality_gate",  # 统一 VG 门禁入口
        "analyze_existing_verilog",  # 既有 RTL 分析入口
        "improve_existing_verilog",  # 既有 RTL 精修入口
        "compare_verilog_semantics",  # RTL 语义比较入口
        "verify_existing_verilog",  # 既有 RTL 验证修复入口
        "run_verilog_cases",  # 代表性案例运行入口
        "route_verilog_request",  # 请求分类入口
        "load_default_workflow_config",  # 默认工作流配置加载入口
        "load_workflow_result",  # 工作流结果读取入口
    ]  # facade 导出符号表
    
    # route_verilog_request 保留旧 facade 的请求分类入口。
    def route_verilog_request(
        *,
        config: dict[str, Any] | None = None,
        **legacy_options: Any,
    ) -> dict[str, Any]:
        """分类 Verilog 请求,但不执行生成或验证。
    
        参数:
            config: 新式 facade 配置字典;缺省时仅使用 legacy_options。
            legacy_options: 旧调用方传入的兼容关键字参数。
    
        返回:
            返回 workflow_router 的请求分类结果字典。
        """
    
        # 路由白名单文本集中声明兼容字段,避免列表元素注释之间互相相似。
        str_allowed_keys_text = (
            "request_summary spec codegen_plan rtl testbench "
            "logs waveform validation artifact_dir remote_validation_requested"
        )  # 路由入口允许的兼容键文本
    
        # 再把键文本切成集合,只允许这些字段参与请求分类。
        set_allowed_keys = set(str_allowed_keys_text.split())  # 路由入口允许透传给分类器的字段集合
    
        # 兼容配置字典把新旧调用参数合并为统一入口视图。
        dict_options = _merged_option_dict(  # 归一化后的路由参数
            "route_verilog_request",  # 当前 facade 入口名称
            config,  # 新式配置字典
            legacy_options,  # 旧式关键字参数
            allowed_keys=set_allowed_keys,  # 允许的兼容字段集合
        )
    
        # 仅把归一化字段传给 runtime 路由器做分类判定。
        return route_verilog_entry(
            request_summary=str(dict_options.get("request_summary", "")),
            spec=dict_options.get("spec"),
            codegen_plan=dict_options.get("codegen_plan"),
            rtl=dict_options.get("rtl"),
            testbench=dict_options.get("testbench"),
            logs=dict_options.get("logs"),
            waveform=dict_options.get("waveform"),
            validation=dict_options.get("validation"),
            artifact_dir=dict_options.get("artifact_dir"),
            remote_validation_requested=bool(
                dict_options.get("remote_validation_requested", False),
            ),
        )
    
    # write_verilog_specs 为生成、既有 RTL 和独立 CLI 共用同一 spec-first 核心。
    def write_verilog_specs(
        spec: Mapping[str, Any] | Path,
        out_dir: Path,
        *,
        source_paths: Sequence[Path] | None = None,
        language: str = "zh",
        renderer: Callable[[Path, Path], dict[str, Any]] | None = None,
    ) -> dict[str, Any]:
        """
        写出每个 Verilog 模块的 ``*_spec.md``、WaveJSON 和 SVG 伴随包。
    
        :param spec: 单模块或多模块规范对象,也可以是 JSON 文件路径。
        :param out_dir: 交付工件根目录。
        :param source_paths: 可选 RTL 源文件,用于模块和端口严格交叉核验。
        :param language: Markdown 语言,支持 ``zh`` 或 ``en``。
        :param renderer: 可选 WaveDrom 渲染器替身,默认使用固定 runtime。
        :return: 模块级写出报告,包含 ``ok``、``spec_root`` 和 ``modules``。
        :raises ValueError: 规范字段、源接口或 WaveDrom 渲染失败时抛出。
        """
    
        # facade 不复制 spec 规则,只把统一入口暴露给上层调用方。
        return write_spec_bundle(
            spec,
            out_dir,
            source_paths=source_paths,
            language=language,
            renderer=renderer,
        )
    
  • scripts/python/facade/workflow_api.py63 KBd08e329f083dupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/generation/tb_generator.py55 KBf88799cc4d64upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/header_contract.py21 KB06e1dec4d0beupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/installation/__init__.py52 B7f934481eea6upstream ↗
    """参数化技能安装器的标准库实现。"""
    
  • scripts/python/installation/bundle.py16 KBf1e6608231d4upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/installation/catalog.py17 KBbd019b0a995fupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/installation/cli.py26 KBc080fdd3f1bdupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/installation/projection.py14 KBb06d9145cf92upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/installation/receipt.py13 KBfe72eab40646upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/installation/transaction.py29 KBc62b0a9c3d17upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/clock_name_roles.py1.0 KBe8a3806d4a5cupstream ↗
    """集中定义 Verilog 时钟名称的下划线语义段识别规则。"""
    
    # 推迟类型标注求值,保持质量模块导入边界稳定。
    from __future__ import annotations
    
    # 正则表达式只处理已经抽取出的 Verilog 标识符名称。
    import re
    
    # 时钟词干覆盖通用、AXI、AHB 和 APB 常见命名。
    CLOCK_NAME_PATTERN = re.compile(  # 完整时钟语义段名称模式
        r"(?:^|_)(?:clk|clock|aclk|hclk|pclk)(?=_|$)",  # 时钟段前后必须是下划线边界或名称边界
        flags=re.IGNORECASE,  # Verilog 标识符角色不依赖大小写风格
    )
    
    # 单个标识符只要包含完整时钟段就具有 clock 角色。
    def is_clock_name(str_name: str) -> bool:
        """判断标识符是否包含完整的时钟语义段。
    
        参数:
            str_name: 待判断的 Verilog 标识符。
        返回:
            名称包含受控 clock 语义段时返回 True。
        """
    
        # search 允许时钟段出现在任意下划线分隔位置。
        return CLOCK_NAME_PATTERN.search(str_name) is not None
    
  • scripts/python/quality/comment_placement.py49 KB71b975d1439fupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/declaration_region_policy.py8.0 KB56d8012ee6feupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/deliverable_gate.py52 KBf5c26d8372e0upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/external_interface_stubs.py41 KB5ddf7314fb40upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_ast.py85 KB248afe5f3b3dupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_ast_instances.py5.4 KBb5ffb3212fd7upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/__init__.py777 B6c2309c06defupstream ↗
    """汇总 Verilog formatter 后端的公开入口。"""
    
    # 后端协议和默认实现保持旧导入路径兼容。
    from .base import FormatterBackend
    from .builtin_backend import BuiltinFormatterBackend
    from .engine import VerilogFormatterEngine, VerilogFormatterError
    from .factory import create_backend
    from .format_routing import FormatRouteResult
    
    # __all__ 明确暴露 formatter backend 的稳定 API 名称。
    __all__ = [
        "FormatterBackend",  # 抽象后端协议
        "BuiltinFormatterBackend",  # 随包 formatter 默认实现
        "VerilogFormatterEngine",  # 具体解析和渲染引擎
        "VerilogFormatterError",  # formatter 层统一异常
        "FormatRouteResult",  # 路由阶段结果模型
        "create_backend",  # 后端工厂入口
    ]
    
  • scripts/python/quality/formatter_backend/analysis_mixin.py203 KB36cb5ba808acupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/banners.py8.6 KB68d775219c6aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/base.py3.3 KB4cf6c585da8bupstream ↗
    """定义 Verilog formatter 后端需要实现的抽象接口。"""
    
    # 延迟类型注解求值,降低接口模块导入成本
    from __future__ import annotations
    
    # 抽象基类用于约束具体后端必须实现的能力
    from abc import ABC, abstractmethod
    from pathlib import Path
    
    # FormatterBackend 是 formatter CLI 和 runtime AST 检查之间的稳定协议
    class FormatterBackend(ABC):
        """约束 formatter 后端的格式化和检查接口。"""
    
        # 路径级格式化接口同时覆盖写文件、检查和 diff 三类 CLI 模式
        @abstractmethod
    
        # 路径级入口承载 CLI 写回策略,具体后端必须明确实现
        def format_path(
            self,
            input_path: Path,
            output_path: Path | None = None,
    
            # 以下布尔参数直接映射 CLI 行为开关,保持接口层显式可读
            inplace: bool = False,
            check: bool = False,
            diff: bool = False,
        ) -> tuple[int, str]:
            """
            格式化或检查指定路径的 RTL 文件。
    
            :param input_path: 输入 RTL 文件路径。
            :param output_path: 可选输出文件路径。
            :param inplace: 是否原地改写输入文件。
            :param check: 是否只检查格式而不写出。
            :param diff: 是否输出格式差异。
            :return: 进程式状态码和用户可读消息。
            :raises NotImplementedError: 具体后端未提供路径级格式化实现时抛出。
            """
    
            # 路径格式化涉及写盘策略,必须由具体后端按自身能力实现
            raise NotImplementedError("> ERR: [Python] formatter 后端未实现路径级格式化接口。")
    
        # 文本级格式化接口供 runtime AST 检查和单测直接复用
        @abstractmethod
    
        # 文本级入口服务内存中的 generated RTL,不应触碰文件系统
        def format_text(self, source: str, source_path: Path | None = None) -> str:
            """
            格式化内存中的 RTL 文本。
    
            :param source: 待格式化的 Verilog 文本。
            :param source_path: 可选来源路径,用于错误消息和规则上下文。
            :return: 格式化后的 RTL 文本。
            :raises NotImplementedError: 具体后端未提供文本格式化实现时抛出。
            """
    
            # 文本格式化不能在协议层猜测语法策略,交给后端实现
            raise NotImplementedError("> ERR: [Python] formatter 后端未实现文本格式化接口。")
    
        # 文本级检查接口只返回诊断,不改写输入文本
        @abstractmethod
    
        # 检查入口只报告格式问题,调用方据此决定是否阻断写回
        def check_text(self, source: str, source_path: Path | None = None) -> list[str]:
            """
            检查内存中的 RTL 文本并返回诊断列表。
    
            :param source: 待检查的 Verilog 文本。
            :param source_path: 可选来源路径,用于诊断定位。
            :return: formatter 检查发现的诊断消息列表。
            :raises NotImplementedError: 具体后端未提供文本检查实现时抛出。
            """
    
            # 诊断生成依赖后端规则集,协议层只固定返回类型
            raise NotImplementedError("> ERR: [Python] formatter 后端未实现文本检查接口。")
    
    
  • scripts/python/quality/formatter_backend/builtin_backend.py525 B4cefc54381ccupstream ↗
    """提供随包内置 Verilog formatter 后端类型。"""
    
    # 延迟类型注解求值,保持后端导入轻量
    from __future__ import annotations
    
    # 后端接口与本地模板驱动引擎共同组成内置实现
    from .base import FormatterBackend
    from .engine import VerilogFormatterEngine
    
    # 内置后端复用本地引擎,并显式声明符合 FormatterBackend 协议
    class BuiltinFormatterBackend(VerilogFormatterEngine, FormatterBackend):
        """基于本地模板驱动引擎的 formatter 后端。"""
    
  • scripts/python/quality/formatter_backend/constants.py26 KB5503ff18375bupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/control_node_classifier.py2.7 KB29a59c2c54c7upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/control_node_collectors.py12 KBb4bba12b65f1upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/control_node_normalize.py13 KB81e2b80945a6upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/control_node_parse_mixin.py75 KB538de326462dupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/control_parse_mixin.py169 KB0a9d89827a86upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/engine.py71 KB8fd7e59f287bupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/expression_facts.py99 KB1ae810b20e18upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/factory.py1.6 KB9a633ca4abadupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/file_discovery.py5.8 KB29d82b1b405dupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/format_routing.py12 KB475e8e70d9a8upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/guards.py6.9 KBe423eb4307c6upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/header_mixin.py112 KB334de1fd341cupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/instance_lexing.py13 KB16aed53617a5upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/layout_mixin.py131 KB48926d5e0217upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/lvalue_mixin.py38 KB55ea0a53c2eaupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/models.py35 KB6aee4ef86a98upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/parse_mixin.py85 KB74d1e7098b7aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/rename_mixin.py117 KBfe051a93205dupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/render_mixin.py151 KB06e15990fe4eupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/statement_render_mixin.py170 KB4303c9d26b21upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/syntax_utils.py82 KB91a71d5fa479upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_backend/textio.py1.5 KB0010f67efbfcupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_comments.py15 KB75bfe93dbf69upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/formatter_config.py9.3 KB93b71d195c25upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/quality_gate.py45 KB49f6a7a1d165upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/quality_gate_ast.py6.2 KBcaeb8ba20b25upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/quality_gate_comment_rules.py92 KBd8e83ec569b7upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/quality_gate_common.py63 KB10f839779104upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/quality_gate_fsm_rules.py46 KBde5624277c78upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/quality_gate_header_rules.py54 KB522797ebe752upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/quality_gate_protocol_rules.py34 KB5de04d8c0e51upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/quality_gate_region_rules.py62 KBb3f2574b89bfupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/quality_gate_reports.py2.2 KB6a58388493baupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/quality_gate_structure_rules.py198 KB491316e59268upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/quality_gate_text_rules.py75 KB6ba408ca7a1aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/quality_gate_types.py24 KBc84cbf2ef2b1upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/reset_name_roles.py2.1 KB44f0527e40e3upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/static_lint.py5.9 KB328920816565upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/verify_verilog_comment_only.py32 KB49f18b98eb27upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/verilog_lint.py16 KB2aeeae7bbba5upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/verilog_quality_gate.py11 KB1231f4e8b359upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_branch_rules.py43 KBb2687b196a36upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_clock_rules.py40 KB2bef73179052upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_comb_cone.py72 KB7f8fcf504807upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_comb_model.py25 KB9c6d5b4a17dbupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_comb_selectors.py33 KB3185431c8007upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_comb_targets.py213 KB0c0ceb1df656upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_comb_tracing.py4.9 KB34695db8d47dupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_comment_integrity.py32 KB184f0a60cdbfupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_comment_version.py5.1 KB1e79a4631fb8upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_contract_handshake.py13 KBb1d287d464dcupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_contract_liveness.py19 KB79de9f74ebbeupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_contract_parameter.py20 KBe62a7bec536fupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_contract_parser.py28 KBd174d25745efupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_contract_resource.py12 KBe5e884a3e5a0upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_contract_rules.py1.7 KB2d739ed0ebcfupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_control_rules.py55 KB96ef494e940cupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_diagnostic_render.py15 KB1dd7a6f671a4upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_diagnostics.py31 KB6d70e9ad603aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_driver_rules.py12 KBe02d1ef8acb4upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_expression_rules.py43 KBded39e65a28bupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_file_rules.py56 KBcca9ac3a65daupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_fsm_rules.py40 KBadeded5b9e2bupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_identifier_rules.py23 KB18d75dd424c4upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_instance_rules.py24 KBf6e79d8e2dc3upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_primitive_facts.py26 KBaa280d0694efupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_report_publisher.py5.6 KB53eb4f4b1a58upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_reset_rules.py55 KB01f0ebebb791upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_rule_models.py9.9 KBf0864e53f7a1upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_semantic_engine.py39 KB1286c5eaf4e3upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_semantic_facts.py21 KBdc9dcb244790upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_structure_rules.py49 KB266dc10d6781upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_subprogram_rules.py31 KB215dd6e3ecd2upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_trace_session.py26 KB1dbe4fcb16dbupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_trace_walk.py58 KBb90c6249e7daupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/quality/vg_value_facts.py41 KB3663321107c8upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/registry/__init__.py0 Be69de29bb2d1upstream ↗
  • scripts/python/registry/build_registry.py20 KBabf6c31b6bb6upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/registry/document_registry_common.py62 KBd77b90fdeb32upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/registry/manage_document_registry.py13 KB1f4f1ccde742upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/registry/query_registry.py37 KBecc0a7af4749upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/registry/registry_common.py58 KBcdc0cc79719bupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/remote/remote_archive_integrity.py969 Be9045da80c57upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/remote/remote_evidence_runtime.py31 KB2b6a82b28247upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/remote/remote_output_cleanup.py1.8 KB499fb246e9a9upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/remote/remote_pytest_summary.py13 KB89e18eeec3b2upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/remote/remote_selection.py12 KB10bf82b4d2d6upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/remote/remote_stage_manifest.py14 KBca7792bf0e13upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/remote/remote_validate_execution.py87 KBb606cc32893bupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/remote/remote_validate_gates.py15 KB3337633e6698upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/remote/remote_validate_selection.py25 KBc5f05ed4605bupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/remote/remote_validate_snippets.py60 KBb480969ce595upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/remote/remote_validate_verilog_skill.py77 KB079b0f330448upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/remote/remote_validation_context.py23 KBa19855ebda55upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/remote/test_evidence_receipt.py29 KB91ee3b1779eaupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/toolchain/dependency_fpga_route.py20 KB647065ac2dd0upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/toolchain/dependency_install.py19 KB604793fa494cupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/toolchain/dependency_state.py52 KB52e1aebf9454upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/toolchain/manage_skill_dependencies.py40 KBaf08fa2d6a3eupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/toolchain/preflight_verilog_toolchain.py23 KB85465faa36a0upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/toolchain/wavedrom_runtime.py58 KB7c84861f94c2upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/validation/audit.py18 KBbe3f0844c172upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/validation/eval_suite.py10 KB8291a39bd6eaupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/validation/evaluation.py43 KB65ee2afbd516upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/validation/evidence.py25 KBb2b9766f72abupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/validation/generated_deliverable_gate.py13 KB5e9b84634b61upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/validation/installer_audit.py41 KB50a12cf28f93upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/validation/rulebook.py6.8 KB75a97d8cebefupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/validation/skill_effectiveness.py127 KB7a6c897c6f13upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/validation/skill_effectiveness_support.py54 KB36235ad484a7upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/validation/validate_verilog_skill.py54 KB4ee8dfaacb52upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/validation/validation.py12 KB77559c9358d3upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/validation/validation_checks.py60 KBc3ca18e78784upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/validation/validation_gate_facade.py30 KB8dee47cfddf9upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/validation/validation_governance_gate.py34 KBe4a1544e1017upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/validation/validation_impl.py12 KBb3c3031ebc48upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/validation/validation_models.py11 KB195e8edbdd62upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/validation/validation_readiness.py50 KBe0e74c89d22bupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/validation/validation_reports.py17 KBf416e15ca7e6upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/validation/validation_runtime.py7.7 KB3f03262c5e59upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/validation/validation_smoke_gate.py40 KBb9f376ab665cupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/validation/validation_source_audit.py62 KBcc2ffe086880upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/validation/validation_workspace_gate.py22 KB885c15be571fupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/version.py328 B795b1263a48dupstream ↗
    """readable-verilog-generator 的源码版本常量。"""
    
    # 公开版本号供 validate、发布门禁和报告逻辑稳定读取。
    __all__ = ["__version__"]  # 对外暴露的源码版本常量名清单
    
    # 版本值与 skill 根目录 VERSION 文件保持一致。
    __version__ = "2.0.0"  # 当前 skill 源码版本号
    
  • scripts/python/workflow/artifact_graph.py19 KBaf83b177fb78upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/cli.py4.9 KB6d88fa426cd8upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/cli_audit_commands.py8.7 KBe057c5af6269upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/cli_existing_commands.py23 KB214e4116a82aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/cli_feedback_commands.py19 KBd70f329bd4f0upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/cli_generation_commands.py21 KB1db92467506aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/cli_parser.py30 KBbd38739388bcupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/cli_support.py13 KB949c08a49539upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/cli_workflow_commands.py18 KB3f0d4523520dupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/config.py64 KBa3be0cb53c24upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/extractor.py32 KB8ea0b8248f20upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/interface_contract.py25 KB14542ee98f31upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/interface_templates.py11 KBae8c2cfab788upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/model_provider.py8.1 KBd64d8717abc8upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/model_provider_command.py10 KB2ef0f7c08d09upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/model_provider_mock.py6.5 KB55a357b078bdupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/model_provider_mock_comments.py23 KB5387f9e5dacbupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/model_provider_mock_content.py18 KBe415b24e09bcupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/model_provider_mock_rtl.py76 KBe8351838bca5upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/model_provider_mock_testbench.py36 KBcb35841b818fupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/pattern_templates.py17 KBd440e87b5313upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/planning.py22 KBdc006521cb71upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/primitive_catalog.py18 KBd479246b8a55upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/prompt.py84 KB7ce6b7f8af0aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/requirements.py1.3 KB5e7ce7891503upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/requirements_extract.py17 KB4e076a3923dfupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/requirements_normalize.py54 KB89b3cd014994upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/requirements_render.py48 KBbcee53f94a4aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/spec.py48 KBc94a145b4958upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/spec_document.py66 KB96e26c48fc50upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/spec_document_io.py5.6 KB8fe68f79fb0bupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/trace.py8.3 KBc2ddedd10ee6upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/use_case_templates.py20 KB69bbcb0a18fcupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/vectors.py14 KB38634c134e92upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/verilog_gate_catalog.py15 KBe7f6d04661edupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/waveform_alignment.py13 KB4b1f98867ea1upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/waveform_alignment_support.py9.2 KB66f78d54a906upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/workflow.py20 KBd666cb386907upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/workflow_execution.py72 KB1af0c4d12656upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/workflow_gates.py31 KBd6c7b8ed9e2aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/workflow_router.py48 KB6d192da4951dupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/workflow_stage.py42 KB88008f3f4abcupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/workflow_support.py43 KB5681a20181b6upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • scripts/python/workflow/workspace.py28 KB663f1a8b7650upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • references/checklists/capability-distillation-checklist.md3.0 KBc5889c3f7f14upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • references/checklists/lint-checklist.md3.6 KBae8a86ddf706upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • references/checklists/verilog-readability-gate.md3.5 KBabebea85955aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • references/corpus/verilog-style-observations.md4.6 KBe0b90bf917c8upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • references/integration/configuration.md20 KB3f5f991918deupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • references/integration/host-integration.md11 KB57ea0d2b0167upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • references/rules/asic-verilog-quality.md3.9 KB2c1f0417bba3upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • references/rules/erie-style.md6.3 KB2001599c4b0eupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • references/rules/testbench-patterns.md3.2 KB5f487cc0ddc0upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • references/rules/verilog-code-comment-naming-standard.md56 KB8ae941aec764upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • references/rules/verilog-comment-placement.md8.4 KB3fa05687d1b8upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • references/rules/verilog-pattern-templates.md1.1 KB250b2b1fde5fupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • references/rules/verilog-quality-gates.md21 KB40ffcfe6a176upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • references/rules/xilinx-primitive-exemptions.md11 KBa63f8bd77b59upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • references/skill/installation.md6.1 KB0da2df53c1edupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • references/skill/script-guide.md7.5 KB18760c74d6fdupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • references/skill/skill-standards.md2.1 KB44858ee44d88upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • references/workflows/verilog_dispatcher.md6.4 KBce2927b672c0upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • references/workflows/workflow-contracts.md15 KB69fbcaa0d0faupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/existing_rtl/fsm_without_default.v761 B1ea9fbfd6e82upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/existing_rtl/fsm_without_default_spec.md311 B2d164820bab2upstream ↗
    # Existing RTL Verification Notes
    
    - Module `fsm_without_default` should return to `IDLE` after a single `WORK` cycle.
    - The state transition logic should keep deterministic behavior for any unlisted `state` encoding.
    - Preserve the public interface and clock/reset behavior while repairing control logic.
    
  • assets/examples/existing_rtl/leaf_counter.v314 Bbf232f280d61upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/existing_rtl/missing_output_register.v423 Bd7aebd1fbde8upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/existing_rtl/missing_output_register_spec.md331 Bfa444aac5a33upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/existing_rtl/ready_valid_slice.v967 B527382c38e05upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/existing_rtl/ready_valid_slice_spec.md420 Ba7a6e319c293upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/existing_rtl/reset_gap_counter.v319 B29cc74836559upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/existing_rtl/reset_gap_counter_spec.md212 Bbad3c4c4ee24upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/existing_rtl/tb_ready_valid_slice.v846 B0097c89445beupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/existing_rtl/top_counter.v271 B7ada954ac28fupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/existing_rtl/traffic_light.v2.5 KBa2569ac005bbupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/existing_rtl/traffic_light_spec.md585 B26c64301837eupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/readme/axis_packet_meter.v10 KBf4443ce6ad92upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/remote_fixtures/comb_hierarchy_budget/generated/rtl/comb_hierarchy_budget.v1.9 KBac8431098bd9upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/remote_fixtures/comb_hierarchy_budget/generated/tb/tb_comb_hierarchy_budget.v2.5 KBe23959b1071cupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/remote_fixtures/comb_hierarchy_budget/hierarchy_child_loop.v447 B84284a58bfc6upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/remote_fixtures/comb_hierarchy_budget/hierarchy_over_budget.v527 B5800337569d9upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/remote_fixtures/comb_hierarchy_budget/hierarchy_q_cut.v467 B5611e7444241upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/remote_fixtures/comb_hierarchy_budget/hierarchy_within_budget.v450 Bea5649ff72fcupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/remote_fixtures/comb_hierarchy_budget/spec.json1.7 KB15181af27d5bupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/remote_fixtures/comb_operation_budget/comb_operation_budget_bad.v187 Bb334590d4fedupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/remote_fixtures/comb_operation_budget/generated/rtl/comb_operation_budget.v6.1 KB316125743725upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/remote_fixtures/comb_operation_budget/generated/tb/tb_comb_operation_budget.v5.7 KBa99990f8538bupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/remote_fixtures/comb_operation_budget/spec.json2.9 KB09daf148fef2upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/remote_fixtures/comb_parity_mux/generated/rtl/comb_parity_mux.v2.1 KB0f066aabe0abupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/remote_fixtures/comb_parity_mux/generated/tb/tb_comb_parity_mux.v2.8 KB396c37bdc7edupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/remote_fixtures/comb_parity_mux/spec.json1.9 KB3d3c13f8ceb5upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/remote_fixtures/pipeline_delay/generated/rtl/pipeline_delay.v4.5 KBef9617534d2fupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/remote_fixtures/pipeline_delay/generated/tb/tb_pipeline_delay.v2.6 KBc57b696e0fe7upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/remote_fixtures/pipeline_delay/spec.json2.2 KBe2b4f74f79ceupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/remote_fixtures/ready_valid_slice/generated/rtl/ready_valid_slice.v5.2 KB1234a7e360bbupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/remote_fixtures/ready_valid_slice/generated/tb/tb_ready_valid_slice.v2.9 KBdce9cb5094e0upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/remote_fixtures/ready_valid_slice/spec.json2.6 KBb3a5eabcdcb3upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/rtl_erie_verilog_spec.json2.1 KB6a3f7bbe9bceupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/use_case_templates/jesd_adc.json2.4 KB7037eae1b7a2upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/use_case_templates/jesd_dac.json2.5 KB8e04eea17bd9upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/use_case_templates/mxfe_mixed.json2.7 KBf08ae3d58272upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/use_case_templates/spi_adc.json2.8 KBbe058e293d0cupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/use_case_templates/spi_dac.json2.7 KB97aedcf98c99upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/verilog_pattern_templates/axi4_lite_csr.json2.1 KB9da06da46af7upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/verilog_pattern_templates/axi_interconnect_dma.json2.3 KBf42267f8a9a1upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/verilog_pattern_templates/axis_ready_valid.json2.3 KBabed6ad69a03upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/examples/verilog_pattern_templates/conv_load_store.json1.8 KB374d62fc91adupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/external_interface_catalog.json2.9 KBfe0d3447bf58upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/ideal_bad_style_metrics.json18 KB91957263129aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/installer/manifest.projection.json2.8 KB02482800fa87upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/installer/platforms.json1.3 KB59a01083aa09upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/interface_templates/ahb_lite_config.vinc2.3 KB0425022e27acupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/interface_templates/apb_config.vinc861 B6bf7f7120797upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/interface_templates/axi4_full_master.vinc1.8 KB3113ad64a128upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/interface_templates/axi4_full_slave.vinc1.8 KB3dd40ad9da1fupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/interface_templates/axi4_lite_config.vinc1.6 KBef7f825c9a8cupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/interface_templates/axi_stream_duplex.vinc1.1 KB895ad5c44209upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/interface_templates/catalog.json2.6 KB49ba14eedb26upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/project_ip_interface_manifest.template.json9.4 KB7dd38014518dupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/readme-workflow.png1.4 MBf6db6071d9dcupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/readme/design-profile-cn.png1.4 MB2f320466f6dbupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/readme/design-profile.png1.4 MB9429cba13e45upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/readme/evidence-guard-cn.png1.4 MBf6db6071d9dcupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/readme/evidence-guard.png1.4 MBf6db6071d9dcupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/readme/hero-overview-cn.png1.5 MBc1e5e8784796upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/readme/hero-overview.png1.5 MB0851ae383b11upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/readme/project-facts-cn.png1.2 MB3b4f9317ef02upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/readme/project-facts.png1.3 MBb4091fd39a15upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/readme/rule-rendering-cn.png1.4 MB184956ade8efupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/readme/rule-rendering.png1.2 MB65fbd29a2757upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/style_templates/header_prompt_none_mode.txt2.1 KB5dc02c392b0eupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/style_templates/header_prompt_table_mode.txt2.5 KB7e0289caa99dupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/style_templates/rtl_bus_grouping.tpl1.0 KB8065c2ff64f2upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/style_templates/rtl_fsm.tpl832 Bb174f16cf36eupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/style_templates/rtl_header_bilingual.tpl1.6 KBdb9ce30ddae0upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/style_templates/rtl_instantiation.tpl496 B31370cfe62a2upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/style_templates/rtl_region_order.tpl987 B4919cef67e32upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/catalog.json2.8 KB09ccacfbbf2aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/jesd_adc/constraints/system_constr.xdc454 B93d266a76e3fupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/jesd_adc/manifest.json1.7 KB1480c24c3774upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/jesd_adc/tcl/common_bd.tcl4.0 KBad93b9e3e198upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/jesd_adc/tcl/system_bd.tcl920 B79209230b20eupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/jesd_adc/tcl/system_project.tcl1.0 KB55340c95adfdupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/jesd_adc/verilog/system_top.v2.9 KB8ed704400cdaupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/jesd_dac/constraints/system_constr.xdc299 B15651927b102upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/jesd_dac/manifest.json1.7 KBaaed61fe36e0upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/jesd_dac/tcl/common_bd.tcl4.8 KB0f7d057769baupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/jesd_dac/tcl/system_bd.tcl923 Bd155f903464bupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/jesd_dac/tcl/system_project.tcl1.1 KB9459d040d22aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/jesd_dac/verilog/system_top.v2.9 KB7d1a2ae21facupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/mxfe_mixed/constraints/system_constr.xdc380 B5d7b38994cb5upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/mxfe_mixed/manifest.json1.8 KB64cbb93b596fupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/mxfe_mixed/tcl/common_bd.tcl5.4 KB83c1c4fa6aa9upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/mxfe_mixed/tcl/system_bd.tcl1.2 KBd5bf394426a9upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/mxfe_mixed/tcl/system_project.tcl1.2 KB98df6d8989abupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/mxfe_mixed/verilog/system_top.v3.4 KBc5a17d3461faupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/spi_adc/constraints/system_constr.xdc635 B193beba035cdupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/spi_adc/manifest.json1.7 KB1b48f521d9abupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/spi_adc/tcl/common_bd.tcl6.3 KBcd8f9cc8e674upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/spi_adc/tcl/system_bd.tcl1.6 KB9f435c961dfbupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/spi_adc/tcl/system_project.tcl982 Bff80f45d52b1upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/spi_adc/verilog/system_top.v4.2 KBdf106db89827upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/spi_dac/constraints/system_constr.xdc546 B741391c69f93upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/spi_dac/manifest.json1.6 KBaebf4c53f1e7upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/spi_dac/tcl/common_bd.tcl5.7 KB577e091b45e2upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/spi_dac/tcl/system_bd.tcl1.0 KB26dcc268711aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/spi_dac/tcl/system_project.tcl981 B0a0159082cb7upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/use_case_templates/spi_dac/verilog/system_top.v3.5 KB5dc29afcdfaeupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_formatter_config/defaults.json6.2 KB4d356de36401upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_formatter_config/profiles/conservative.json283 B7209265493c5upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_formatter_config/profiles/example_compat.json484 Ba3601a223f2aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_formatter_config/profiles/formatter-lint.json121 Bc28c8fb6938eupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_formatter_config/profiles/formatter-normalize.json182 B9f6ba5809a98upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_formatter_config/profiles/formatter-preserve.json385 B750a4fad4db2upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_formatter_config/profiles/formatting.json270 Bb99b0a32c379upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_formatter_config/profiles/lint.json269 B3c881e2eae79upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_formatter_config/profiles/migration.json239 Bd2f126cd34c9upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_formatter_config/profiles/stress_cases_compat.json484 Ba3601a223f2aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_formatter_config/profiles/vitis-wrapper.json486 B0e2d56656942upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_formatter_config/schema.json14 KB2bfe913f319eupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_formatter_config/templates/task-batch.json212 Bd1661c0be9f0upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_formatter_config/templates/task-inplace.json221 B0b33a78bda25upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_formatter_config/templates/task-single-file.json220 B446bbd1f1fa7upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_pattern_templates/axi4_lite_csr_shell.vinc562 Baf80bea879efupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_pattern_templates/axi_interconnect_port_groups.vinc592 Bc38fdcafad24upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_pattern_templates/axis_ready_valid_slice.vinc494 Bac6f4d664a5aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_pattern_templates/catalog.json2.2 KB0eb2c9f2f0c3upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_pattern_templates/conv_load_store_pipeline.vinc457 B605bfd837d18upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_pattern_templates/counter_state_bridge.vinc443 Baf4b5f705ed0upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_pattern_templates/equivalence_wrapper_probe.vinc306 B2e7ec6bc170dupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_pattern_templates/fsm_state_transition.vinc1.0 KB374d050a46f5upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_pattern_templates/phase_output_registering.vinc404 Ba0e47cbf26c7upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_pattern_templates/wrapper_top_stitching.vinc608 Be02cb9f7349bupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_quality_gates.json38 KB6da875504edfupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/verilog_style_rules.json12 KBaa075e4dca9eupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • assets/xilinx_primitive_semantics.json21 KB902dfa8968adupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • agents/openai.yaml363 B10779120d5b9upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • CITATION.cff999 B0858b2ddbf56upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/defaults.json19 KB83a37a922c80upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/installer/installer-manifest.json3.1 KBf2e5ae68b670upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/installer/installer-manifest.schema.json835 B464cb19b61f1upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/installer/installer-projection.schema.json253 Bfea6b3c6fec9upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/installer/platform-catalog.json1.8 KB190ad11a2faaupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/installer/platform-catalog.schema.json292 B0f4aa69350fbupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/installer/platform-overrides.json45 B8be1c2069cc4upstream ↗
    {
      "schema_version": 1,
      "platforms": []
    }
    
  • config/installer/release-installer-manifest.json3.3 KBe7074794f7dcupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/installer/verification-cases.json2.2 KB7d9928933e12upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/installer/verification-cases.schema.json339 B912fd8ef9259upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/registry/commands/external.json9.8 KBd28e598db8b2upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/registry/commands/generation.json3.0 KBca1176cbbdf8upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/registry/commands/quality.json9.4 KB1c73110823f1upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/registry/commands/registry.json6.5 KB9f71250b5ab1upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/registry/commands/remote.json7.8 KB37c2e7dca35cupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/registry/commands/toolchain.json15 KBb241fba6517cupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/registry/commands/validation.json5.3 KB23d3e92b3e1cupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/registry/commands/workflow.json33 KB2f53b5e2ac6aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/registry/documents/catalog.json15 KB0b9764f29ec7upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/registry/governance/config.json353 B08c9516d1925upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/registry/governance/reviews.json25 KBeb232630c55aupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/registry/manifest.json913 B2d59c3073f2dupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/registry/registry.sqlite3608 KBc13fd0a30addupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/registry/schemas/command.schema.json3.3 KBeca319c78472upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/registry/schemas/document-catalog.schema.json1.4 KBa560d249e9c3upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/registry/schemas/governance-config.schema.json1.0 KB23a520c076e3upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/registry/schemas/governance-reviews.schema.json682 Bac47b84296dcupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/registry/schemas/workflow.schema.json1.0 KB68cfefa925d7upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/registry/workflows/catalog.json3.3 KB381b15bac6b9upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • config/runtime-manifest.json451 B3f1c8e64f5daupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • CONTRIBUTING.md1.8 KB128efa0b31cfupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • evals/evals.json14 KB0a670d537aa9upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • evals/vg_semantic_gate_cases.json52 KB094c47a20c87upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • install.bat2.4 KB8ebee79dcf4bupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • install.ps17.7 KB5b34e7fa2fcaupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • install.sh6.0 KB2b5499ab1d8cupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • installer.manifest.env612 Bc49b085b4e46upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • LICENSE9.0 KB5d7ca4cce57bupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • pyproject.toml496 B480df066bf3eupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • README-CN.md7.8 KB619197b33447upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • RELEASE_RECEIPT.json4.2 MB26a30506982eupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • SECURITY.md1.1 KB73677f69dac0upstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

  • VERSION7 B46b105a30dccupstream ↗
    v2.0.0
    

Plain-text copy, no login: /skill-bundles/eriemon-verilog-generator.md

// REPO STATS

332 stars
0 open issues
Last commit: 2mo ago