SPICE reader: recognize `.option scale` and suffixed scale factors
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start with the NetlistSpiceReader control-statement handling for .options and .option, and with where the scale value is parsed through tl::Extractor::try_read(double). Run the Python repro from the issue against the three directives and confirm that L and W come out as 0.45 and 1.5 in each case. Done means that .option scale=1e-6 is accepted without a warning, that suffixed values such as 1u scale correctly, and that the reader tests still pass.
由索引模型根据 Issue 内容生成。
描述
NetlistSpiceReader can read micrometre geometry one million times too large when a deck uses the ngspice scale syntax found in sky130 model libraries.
For the same native M device:
| Directive | Read L (µm) |
Read W (µm) |
|---|---|---|
.options scale=1e-6 |
0.45 | 1.5 |
.options scale=1u |
450000 | 1500000 |
.option scale=1e-6 |
450000 | 1500000 |
Expected: all three declarations yield L=0.45, W=1.5. The singular spelling emits a control-statement warning. The suffixed value is accepted without the intended scaling.
The sky130 model library uses .option scale=1.0u. This affects comparison of those schematic dimensions with layout geometry.
from pathlib import Path
from tempfile import TemporaryDirectory
import pya
with TemporaryDirectory() as directory:
path = Path(directory) / 'scale.cir'
for option in ('.options scale=1e-6', '.options scale=1u', '.option scale=1e-6'):
path.write_text('* scale\n' + option + '\n.subckt cell d g s b\n'
'M1 d g s b n L=0.45 W=1.5\n.ends\n', encoding='utf-8')
netlist = pya.Netlist()
netlist.read(str(path), pya.NetlistSpiceReader())
device = next(netlist.top_circuit().each_device())
print(option, device.parameter('L'), device.parameter('W'))
Run with klayout -b -r repro.py, or replace import pya with import klayout.db as pya when using the Python module.
Current master still recognizes only .options and reads its value with tl::Extractor::try_read(double), which leaves the SPICE suffix unconsumed.
Versions: KLayout Python module 0.30.13 from PyPI, Python 3.14, macOS; ngspice 47 used to verify the intended geometry-scale behavior
- 主要语言
- C++
- 星标
- 1.2k
- 派生
- 305
- 平均合并
- 3 天 2 小时
- 30 天内合并 PR
- 11
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
KLayout/klayout 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
KLayout/klayout#2554 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
KLayout/klayout#2412 · 3 条评论 ·
维护者通常 1 天内回复
-
DRC functions not working properly with clip in place可能已有人在做 @klayoutmatthias 今天认领。 未关闭bug
KLayout/klayout#2553 · 已指派 1 人 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 50/100
维护者通常 1 天内回复
-
Deep DRC can miss violations when a cell has many shapes可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 4/5 3-5 天 新手友好度 52/100
KLayout/klayout#2546 · 5 条评论 ·
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
LaneDibello/Kotor-Patch-Manager#375 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复