| name | chip-spyglass-rdc-resolver |
| description | Use when processing SpyGlass RDC reports to resolve violations. Triggers on 'rdc违例', 'rdc violation', 'rdc report', 'rdc分析', 'rdc waive', 'rdc修复', 'rdc resolver'. Maps RDC rules to priority levels, proposes RTL fixes or generates waiver files. |
Chip SpyGlass RDC Resolver
分析 SpyGlass RDC 报告,通过 LLM 与知识库中的 RDC 规则信息,对 RTL 进行分析,给出修改建议或生成 waiver 文件。
When to Use
- 处理
chip-spyglass-rdc-chk 生成的 RDC 报告(rdc_summary.log、rdc_verify.log)
- 需要分析 RDC 违例的根因并给出 RTL 修改建议
- 需要为可接受的违例生成 waiver 文件
- RDC 签核前的违例清理
核心工作流
0. 加载 Blackbox 模块列表
1. 解析 RDC 报告 → 提取 (rule, severity, file, line, message) 元组
2. 过滤 Blackbox → 模块在 blackbox 列表中的违例自动 waive
3. 按优先级分类违例 → P0~P4
4. 对 P0/P2 违例:必须修复,LLM 分析 RTL 给出修改方案
5. 对 P1/P3/P4 违例:LLM 分析判断是否真问题,修复或 waive
6. 输出:RTL 修改建议 + waiver 文件
Step 0: 加载 Blackbox 模块列表
读取 blackbox-modules.md(本 SKILL.md 同目录),加载 blackbox 模块列表。
判定规则:
- 模块名匹配 blackbox 列表条目,或
- 违例文件路径包含 blackbox 模块名
如果 blackbox-modules.md 为空或不存在,跳过此步骤。
Step 1: 解析 RDC 报告
RDC 报告来自 chip-spyglass-rdc-chk 的输出,典型路径:
{module}_work/ds/report/rdc/rdc_summary.log — 汇总报告
{module}_work/ds/report/rdc/3_rdc_verify.log — 亚稳态检查
{module}_work/ds/report/rdc/4_rdc_verify_corrupt.log — 数据损坏检查
SpyGlass 日志格式:
Warning [<rule_name>] <file>:<line> <message>
Error [<rule_name>] <file>:<line> <message>
提取:rule_name、severity、file path、line number、violation message。
Step 2: 过滤 Blackbox 违例
对每个解析出的违例,检查其模块是否在 blackbox 列表中。Blackbox waive 的违例在 waiver 文件中单独一节输出。
Step 3: 按优先级分类违例
查 rdc-rules-reference.md(本 SKILL.md 同目录)中的规则映射表。
如果规则不在映射表中,标记为 "unknown rule" 并提示用户手动分类。
Step 4: 执行优先级动作
| 优先级 | 动作 | 输出 |
|---|
| P0 (Async Reset Metastability) | 必须修复。 添加复位同步器或设置 reset ordering | RTL 修改建议 |
| P1 (Reset-less Path Corruption) | 分析判断。 添加 qualifier 或 safe-stating 逻辑 | 修复或 waive |
| P2 (RDC on Clock Path) | 必须修复。 复位信号禁止组合逻辑驱动时钟 | RTL 修改建议 |
| P3 (Reset Convergence) | 分析判断。 检查复位是否正确分组 | 修复或 waive |
| P4 (Power Domain RDC) | 分析判断。 需 UPF 确认隔离/开关 | 修复或 waive |
关键规则:P0 和 P2 绝对禁止 waive,必须从设计层面修复。
Step 5: 生成输出
5a. RTL 修改建议 (rdc_fix_proposal.md)
# RDC Fix Proposal
## Summary
- Total violations: N
- Blackbox waived: N
- P0 must-fix: N (Async Reset Metastability)
- P2 must-fix: N (RDC on Clock Path)
- P1/P3/P4 reviewed: N
- Fix required: N
- Waived: N
- Unknown rules: N
## P0 — Must Fix (NEVER Waive)
### [P0] Ar_asyncreset01 — <file>:<line>
**Violation:** <message>
**Root Cause:** <分析>
**Fix:**
```verilog
// Before
<原始代码>
// After — 异步复位同步释放
<修复代码>
P2 — Must Fix (NEVER Waive)
[P2] Rdc_clockpath01 — :
Violation:
Root Cause: <分析>
Fix:
// Before — 复位信号通过组合逻辑驱动时钟
<原始代码>
// After — 寄存器输出直接驱动 ICG
<修复代码>
P1/P3/P4 — Reviewed
[P1] Rdc_corrupt01 — :
Violation:
Assessment: <真数据损坏风险 / 误报>
Action: Fix / Waive
#### 5b. Waiver 文件 (`{module}.rdc.waiver`)
SpyGlass waiver 文件格式:
```waiver
// Auto-generated RDC waiver file
// Module: {module}
// Date: YYYY-MM-DD
// Generated by chip-spyglass-rdc-resolver
// === Blackbox Module Waives ===
waive -rule <rule> -file <file> -line <line> -message "BLACKBOX: <module> is in blackbox list (<reason>)"
// === Constraint-based Waives (推荐替代方案) ===
// set_rdc_define_assertion_sequence — 复位释放顺序
// set_reset_groups — 复位分组
// rdc_qualifier — 阻断信号
// === P1/P3/P4 Conditional Waives ===
waive -rule <rule> -file <file> -line <line> -message "<reason>"
Waive 理由:
- BLACKBOX 模块:
"BLACKBOX: <module> is in blackbox list (<reason>)"
- Reset ordering 可解决:
"Can be resolved by set_rdc_define_assertion_sequence"
- Reset grouping 可解决:
"Can be resolved by set_reset_groups"
- Qualifier 可解决:
"Can be resolved by rdc_qualifier"
- 误报:
"False positive: <explanation>"
注意:对于 reset ordering/grouping/qualifier 可解决的违例,优先建议修改 RDC 约束而非 waive。
Step 6: Wiki 知识查询
对复杂违例,查询 wiki 获取规则详情:
wiki query: "<rule_name> RDC violation fix"
利用 wiki 知识([[SpyGlass-RDC-Methodology]])提高根因分析和修复建议的质量。
输出文件
| 文件 | 用途 | 位置 |
|---|
rdc_fix_proposal.md | RTL 修改建议 | 与 RDC 报告同目录 |
{module}.rdc.waiver | RDC waiver 文件 | ds/run/ 目录 |
参考文件
| 文件 | 说明 |
|---|
rdc-rules-reference.md | RDC 规则 → 优先级映射(P0~P4)+ 分析指引 |
blackbox-modules.md | 可配置的 blackbox 模块列表(自动 waive) |
常见错误
| 问题 | 处理 |
|---|
| 规则不在映射表 | 标记 unknown,提示用户分类 |
| 日志格式未知 | 要求用户粘贴样本 |
| 用户要求 waive P0/P2 | 拒绝,提示必须修复 |
| wiki 知识不可用 | 使用通用知识继续,标注 "wiki unavailable" |
| blackbox-modules.md 为空 | 跳过 blackbox 检查,处理所有违例 |
与 chip-spyglass-rdc-chk 的关系
chip-spyglass-rdc-chk → 执行 RDC 检查 → 生成 rdc_summary.log
↓
chip-spyglass-rdc-resolver → 分析违例 → 生成修复建议 + waiver 文件