Skip to content
Back to skills

Ic Ip Gen

ASecurity

纯 Verilog-2001 开源 IP 生成 Skill,支持两大模式:(1)解析 Xilinx .xci 明文参数并依据官方公开手册生成端口兼容的开源替代 IP;(2)根据用户自然语言需求从零冻结规格并生成自定义 FPGA IP。 当用户要求替代 Xilinx IP(如 fifo_generator/blk_mem_gen/clk_wiz/mult_gen/axi_dma/axi_interconnect)、或要求按规格从零生成一个新硬件 IP 模块时使用本 skill。

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 2, 2026
ai-agentspythongoc++

Security analysis

A100/100

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

Scanned December 2, 2026

npx -y skills add lihhf666-rgb/open-verilog-ip-skills --skill ic-ip-gen --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ic Ip Gen?

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

Security grade badge for Ic Ip Gen
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/lihhf666-rgb-ic-ip-gen/badge)](https://www.skillsdirectory.com/skills/lihhf666-rgb-ic-ip-gen)

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: ic-ip-gen
description: >-
  纯 Verilog-2001 开源 IP 生成 Skill,支持两大模式:(1)解析 Xilinx .xci 明文参数并依据官方公开手册生成端口兼容的开源替代 IP;(2)根据用户自然语言需求从零冻结规格并生成自定义 FPGA IP。
  当用户要求替代 Xilinx IP(如 fifo_generator/blk_mem_gen/clk_wiz/mult_gen/axi_dma/axi_interconnect)、或要求按规格从零生成一个新硬件 IP 模块时使用本 skill。
---

# 净室开源 IP 生成与定制(`ic-ip-gen`)

## 一、定位与合规红线
* **只负责**:在编码前强制完成**规格冻结(Spec Freeze)**,按模块化结构生成纯 Verilog-2001 RTL,并组织完成 Lint + 仿真/等价验证 + 综合三道闭环。
* **绝对合规红线**:
  * **严禁逆向、反编译或解密任何 Xilinx 加密 IP(IEEE 1735)**。
  * 替代 IP 只能读取 `.xci` 的明文配置参数与 `_stub.v` 端口声明,并依据官方公开手册(如 PG057 / PG058 / PG021 / PG065)从零净室编写。
* **公共模块优先复用与快速落地铁律**:
  * 凡是工程 `rtl/common/` 中已验证的公共原子模块(`open_axis_join2`、`open_skid_buffer`、`open_cdc_sync`、`open_rst_sync`、`open_cdc_pulse`、`open_rr_arbiter`、`open_sdp_ram`、`open_async_fifo`),**必须直接例化复用,严禁重复手写!**
  * **双通道 Blocking AXI-Stream 标准模块化流水线结构(直接套用,避免空想)**:
    * 输入层:`open_axis_join2`(1 拍延迟,自动处理两路独立气泡与反压,无组合环)
    * 核心层:`N` 级纯 `.v` 流水线寄存器,全局由 `wire pipe_en = skid_in_tready;` 统一使能(仅 `vld` 位接 `!aresetn` 复位,数据通路无复位!)
    * 输出层:`open_skid_buffer`(1 拍延迟,打断 `m_axis_*_tready` 组合反压链)
    * **精确延迟公式**:`Total Latency = 1 (join2) + N (core pipe stages) + 1 (skid) = N + 2` 拍!
  * 仅在从零设计陌生类别 IP 时才按需翻阅 [ip-taxonomy-and-oss-refs.md](./references/ip-taxonomy-and-oss-refs.md),**不要为了读参考文档耽误编码**。

---

## 二、模式 A:Xilinx `.xci` 净室替代闭环

```text
[STEP 1] 调用 `ic-xilinx-vivado`(模式 1)解析目标 `.xci` 与 `_stub.v`,产出 `docs/<ip>_xci_params.md`
   │
[STEP 2] 对照下方「高频 IP 净室规格核对表」冻结 `docs/<ip>_spec.md`:
         核对:模块名与端口 100% 同名同位宽 | 复位极性与同步/异步 | 输出延迟拍数 | 边界行为
   │
[STEP 3] 分层编码(严格遵循 `ic-verilog-style` + `ic-fsm-design` + `ic-timing-cdc`):
         ├── 通用参数化核心核:`rtl/open_<ip_type>.v`(可跨工程复用、支持 ASIC/国产 FPGA 综合)
         └── 精确兼容壳模块:`rtl/<Component_Name>.v`(严格匹配 `.xci` 端口名与参数)
   │
[STEP 4] 门禁 1(Lint):调用 `ic-verilog-style` 通过 Verilator `-Wall -Werror`
   │
[STEP 5] 门禁 2(逐拍等价验证,Max Loops = 5):
         ├── 生成共享随机激励 `sim/stim.hex`(覆盖空/满/边界/反压/中途复位)
         ├── 调用 `ic-xilinx-vivado`(模式 4)跑官方 `.xci` 录 `sim/golden_xsim.log`
         ├── 调用 `ic-sim-debug` 跑开源替代核(Verilator C++)逐拍比对 `golden_xsim.log`
         └── 有差异 ──▶ 定位首个错拍 `T_err` 修正替代核 ──▶ 回到 [STEP 4];零差异 ──▶ 进入 [STEP 6]
   │
[STEP 6] 门禁 3(PPA 对比):调用 `ic-xilinx-vivado`(模式 2)分别记录官方 IP 与开源替代 IP 的 LUT/FF/BRAM/DSP/WNS 对比表
```

### 高频 Xilinx IP 净室实现必查核对表(防漏关键特性)

| Xilinx IP 类型 | 官方手册 | 必须精确对齐的关键参数与行为(已实测避坑) |
| :--- | :--- | :--- |
| **`fifo_generator`** | PG057 | 同步/异步时钟;**Common-Clock BRAM FWFT 的真实深度 = `Input_Depth + 2`**(如 512→514,由 512 BRAM + 2 级预取输出寄存器构成),写到非空延迟为 **2 拍**,`almost_empty = ~(stage2_valid & stage1_valid)`,`almost_full = (core_cnt >= DEPTH-1)`;非对称位宽拼接序;同步/异步复位安全延迟 |
| **`blk_mem_gen`** | PG058 | SP / SDP / TDP 模式;Write-First / Read-First / No-Change 冲突行为;字节写使能 `wea` 位宽;**关键实测坑:当 `Register_PortB_Output_of_Memory_Primitives = true` 且未引出 `regceb` 引脚时,`enb` 同时门控 BRAM 阵列读 AND 原语输出寄存器 `DOB_REG`**(`enb=0` 时输出必须保持冻结,不可自由移位!) |
| **`mult_gen`** | PG108 | 有符号/无符号输入;精确流水线级数(`PipeStages = 3` 对应 A/B 输入寄存 → M 乘积寄存 → P 输出寄存);**PPA 优化点**:官方默认可能走 LUT(~350 LUT),净室纯 `.v` 加 `(* use_dsp = "yes" *)` + 无复位 3 级寄存可 0 LUT / 0 FF 映射为单颗 `DSP48E1` |
| **`floating_point`** | PG060 | IEEE-754 单精度 FMA/FMS(`A*B ± C` 单次舍入 RNE);**官方行为实测要点**:Subnormal 输入与下溢输出均刷新为带符号零(FTZ/DAZ)、规范 qNaN=`32'h7FC00000`、`operation[0]=1` 翻转 C 符号实现 FMS、4 通道 Blocking AXI-Stream 汇合 + `open_skid_buffer` 输出;24×24 乘法拆分为 `24×17 + 24×7` 仅用 **2 颗 DSP48E1**(省官方一半 DSP!) |
| **`div_gen`** | PG151 | 无符号/有符号 AXI-Stream 流水线除法器(`Radix2` / `High_Radix`);**实测要点**:`m_axis_dout_tdata = {quotient[W-1:0], remainder[W-1:0]}`,`m_axis_dout_tuser[0] = (divisor == 0)`;当 `divisor == 0` 时无符号恢复余数自然产出 `quotient = {W{1'b1}}`、`remainder = dividend`(与官方 `xsim` 100% 一致);用 `open_axis_join2` (1 拍) + `N` 级流水 + `open_skid_buffer` (1 拍) 实现 `Latency = N + 2` |
| **`axi_dma`** | PG021 | MM2S / S2MM 独立使能;AXI-Lite 控制寄存器偏移(MM2S `0x00/0x04/0x18/0x28`,S2MM `0x30/0x34/0x48/0x58`);**实测架构要点**:① MM2S/S2MM 均须严格执行 AXI4 **4KB 边界拆分**(`beats_to_4k = 1024 - addr[11:2]`);② S2MM 用 **16 拍分布式 RAM 突发缓冲(Store-and-Forward)**可原生支持任意拍提前 `tlast` 短包并精准回写实收字节数至 `S2MM_LENGTH (0x58)`;③ 用 Look-Ahead `rem_ge4_r` 寄存器消除字节计数关键路径(实测 Post-Route `399.0 MHz`,省 63% LUT / 79% FF / 2 BRAM) |
| **`axi_interconnect`** | PG059 | 主从数量与位宽转换;仲裁策略(轮询/固定);ID 扩展与路由回收;Outstanding 深度 |
| **`clk_wiz` / `ila` / `vio`** | PG065 等 | 仅生成仿真桩模块(`ifdef VERILATOR` / `SIMULATION`):按倍频/分频比输出虚拟时钟与 `locked` 信号,ILA/VIO 桥接至 C++/Python 打印与寄存器注入 |

---

## 三、模式 B:按用户需求从零定制新 IP 闭环

**强制规则:需求未冻结成规格表前,严禁开始写一行 `.v` 代码!**

```text
[STEP 1] 产出规格冻结表 `docs/<ip>_spec.md`(必须写清以下 6 项,缺一项先向用户确认或给出明确默认值):
         1. 功能描述与数学公式 / 数据流框图
         2. 参数表(位宽、深度、并行度、默认值)
         3. 完整端口清单(端口名、方向、位宽、所属时钟域、协议)
         4. 延迟与吞吐指标(Latency 拍数、II 间隔、目标主频 Fmax)
         5. 复位策略与异常/边界处理(如溢出饱和 vs 截断、零长度包)
         6. Golden Model 定义(用于自动化比对的 C++ 或 Python 参考公式)
   │
[STEP 2] 若模块超过 300 行,拆分为顶层 + 2~4 个单一职责子模块(如 `ctrl_fsm` + `dma` + `datapath`)
   │
[STEP 3] 依次调用 `ic-fsm-design`(控制面)与 `ic-verilog-style`(编码 + Lint 0 告警)
   │
[STEP 4] 调用 `ic-sim-debug` 编写带 Golden Model 的 Verilator C++/Cocotb 测试台并跑通 `Errors: 0`
   │
[STEP 5] 调用 `ic-xilinx-vivado`(模式 2)跑 OOC 综合,确认 0 Error、0 Latch 并输出基线 PPA 表
```

---

## 四、强制退出自检清单
- [ ] 已产出完整的 `docs/<ip>_spec.md`(模式 A 额外包含 `docs/<ip>_xci_params.md`)
- [ ] 核心代码 100% 为纯 Verilog-2001,零加密/私有原语强依赖(可跨平台综合)
- [ ] 已通过 `ic-verilog-style`(Lint=0)、`ic-sim-debug`(Errors=0)、`ic-xilinx-vivado`(0 Latch)三道门禁
- [ ] 若为 `.xci` 替代模式,已产出与 Vivado `xsim` 的**逐拍等价报告 + 仿真加速比 + PPA 对比表**

Files in this skill

  • SKILL.md8.4 KB
  • references/ip-taxonomy-and-oss-refs.md18.5 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.