Skip to content
Back to skills

Readable Verilog Model

ASecurity

Build an independent cycle-level Python RTL model from confirmed behavior. Simulate targeted scenarios, diagnose specification conflicts, and freeze golden outputs for RTL comparison.

  • 346 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 2, 2026
ai-agentspythongo

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned December 2, 2026

npx -y skills add Eriemon/verilog-generator --skill readable-verilog-model --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Readable Verilog Model?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Readable Verilog Model
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/eriemon-readable-verilog-model/badge)](https://www.skillsdirectory.com/skills/eriemon-readable-verilog-model)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: readable-verilog-model
description: Build an independent cycle-level Python RTL model from confirmed behavior. Simulate targeted scenarios, diagnose specification conflicts, and freeze golden outputs for RTL comparison.
---

# 建立逐拍参考模型与 golden

## 实现模型

- 从确认版 spec 编写 `model/model.py`。每个采样点读取旧状态与输入,按优先级更新;按约定的沿前或沿后时刻输出。符号、截断、饱和和复位遵从规定位宽。
- 模型独立计算期望。每个场景单独启动一次;stdin 的 JSON 含 `spec` 和 `case`(id、inputs、可选参数),验收检查点由运行器保留。stdout 返回逐拍 JSON 数组,每拍列出全部可观察输出;调试信息写 stderr。

使能寄存器的沿后采样示例:

```python
import json
import sys

q = None
trace = []
for cycle in json.load(sys.stdin)["case"]["inputs"]:
    if cycle["reset"]:
        q = 0
    elif cycle["en"]:
        q = cycle["d"]
    trace.append({"q": q})
json.dump(trace, sys.stdout)
```

## 验证与退回

1. 运行 `python -m verilog_generator run-model --spec docs/spec/spec.json --model model/model.py --out-dir <新目录>`。所有场景的独立检查点通过后才写 golden。
2. 失配报告场景、拍号、端口、期望与实际。模型有误则修复;规格允许两种结果时返回 `{"spec_question":"触发输入、冲突与需决定的行为"}`,交[规格](../readable-verilog-spec/SKILL.md)确认后重跑。
3. 需要缓存时,在 spec 顶层用 `model_dependencies` 列出模型目录内全部数据和辅助模块(如 `["coeffs.json"]`);确定为单文件、仅依赖 stdin 的模型填 `[]`。动态输入、随机性或依赖不明时省略该字段,每轮重算。保留历史轨迹。新设计将同版 golden 交[生成](../readable-verilog-generate/SKILL.md)作为行为基线;已有 DUT 需要对拍时交[验证](../readable-verilog-verify/SKILL.md)作逐拍比较。

Files in this skill

  • SKILL.md1.9 KB
  • scripts/models/golden.py5.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.