RF-FIELDWORK Layout RCopt

开发中In developmentCLI · Tk GUI · 顶层调度

Layout RCopt

版图闭环的顶层调度。它把 VCO Design Studio(设计与原理图)、VCO Layout Generator(分模块版图)和 rc-annot(寄生汇总与反标)整合进一个界面:先让 gm、电容阵列、电流源各自调到达标,再拼回顶层;每个点都跑真实的版图生成、LVS 和寄生抽取,用 DE、NSGA-II 或 CMA-ES 优化。The top-level orchestrator of the layout loop. It brings VCO Design Studio (design and schematics), VCO Layout Generator (layout by module) and rc-annot (parasitic summary and back-annotation) into one interface: the gm core, capacitor array and current source are tuned to their own targets first, then assembled at the top level. Every point runs real layout generation, LVS and parasitic extraction, optimized with DE, NSGA-II or CMA-ES.

分层优化视图的真实运行回放
分层视图实录 · Class-B CMOS 单元复用 · 约 1 h 40 min 加速回放Hierarchical view, recorded · Class-B CMOS, replicated cells · ~1 h 40 min, sped up

可以动手体验Try it by hand

Layout 实验室:拖参数,看版图和寄生一起变Layout Lab: drag a parameter, watch layout and parasitics change

以 Class-B 和 Hegazi tail 为例,直接调电感、腿、阵列接法、线宽和叠层,版图实时重排,违例当场标红,每一位 P/N 两侧的寄生 R、C 同步更新。看完点左下角就能回到这里。Using Class-B and Hegazi tail, tune the coil, legs, array connection, wire widths and metal stack; the layout rearranges live, violations light up, and per-bit P/N parasitic R and C update with it. The button at the bottom left brings you back here.

打开 Layout 实验室Open the Layout Lab →

演示片Film

原理图进,
优化版图出。
Schematic in,
optimized layout out.

竖屏中文演示片,约 3 分 47 秒:四个工具各自独立、前后衔接,最上层由 Layout RCopt 统一调度。画面来自真实界面和真实运行数据。A vertical film in Chinese (about 3 min 47 s): four tools, each independent and handing over to the next, orchestrated from the top by Layout RCopt. Footage comes from the real interfaces and real runs. An English version will follow.


四个工具,一条链,由它统一调度Four tools, one chain, one orchestrator

三个工具各自独立、可以单独使用,前一个的输出就是后一个的输入;Layout RCopt 在最上层下发任务、收回结果,把它们串成闭环。The three tools are independent and usable on their own; each one's output is the next one's input. Layout RCopt sits on top, dispatching work and collecting results to close the loop.

① VCO Design Studio① VCO Design Studio
选结构、定指标、设阵列画法与开关拆分,一键生成分层原理图并导出原生 OA;“设计交接”页给出设计目录与 graph_hash,和版图同源可查。Pick the structure, set targets, array style and switch split, and generate a hierarchical schematic with native OA export. The hand-off page gives the design directory and graph_hash, traceable to the layout.
② VCO Layout Generator② VCO Layout Generator
按模块各自的规则生成 gm、电容阵列、电流源等,再拼成顶层;上百个参数集中在一份高级设置里,秒级预检,模块与顶层都能单独跑 LVS 和抽取。版图对原理图 LVS 13/13 一次通过。Builds the gm core, capacitor array, current source and the rest by their own rules, then assembles the top. Over a hundred parameters live in one advanced-settings file; plans take seconds, and both modules and the top run LVS and extraction on their own. Layout vs. schematic LVS: 13/13 correct.
③ rc-annot
把每个网络的电阻、电容汇总排序,定位寄生来自哪段走线,再逐层反标回原理图;反标仿真与全寄生后仿:频率差 0.003%,幅度差 0.2%。Summarizes and ranks every net's R and C, locates which wire segment they come from, and back-annotates level by level; annotated vs. full-parasitic simulation: 0.003% in frequency, 0.2% in amplitude.
④ Layout RCopt④ Layout RCopt
参数来自 Layout Generator,观察的网络来自 rc-annot,目标、约束、算法在同一页设好;按模块分层优化,再拼回顶层。Parameters come from the Layout Generator and watched nets from rc-annot; targets, constraints and algorithms are set on one page. It optimizes module by module, then assembles the top level.

先调模块,再拼顶层Tune the modules, then assemble the top

阶段一:gm、电容阵列、电流源各自单独生成、LVS、抽取,调到自己的小指标全部通过。阶段二:合并三块的最优参数拼回顶层,各小指标作为约束;模块调好了,顶层整合的压力很小。Stage 1: the gm core, capacitor array and current source are each built, checked and extracted on their own until their own small metrics all pass. Stage 2: the best parameters of the three are merged at the top level with those metrics as constraints; with the modules already right, assembling the top takes little effort.

电容阵列:两种画法逐候选回放Capacitor array: two styles, candidate by candidate
整体最优版图(Layout 3D Viewer 渲染)Optimized top layout (rendered with Layout 3D Viewer)
阶段一Stage 1
三个模块都从“未全部达标”调到 3/3 通过。电容阵列最大下极板 / 上极板接入电阻:等比放大 1.248 → 0.801 Ω(−36%)/ 0.417 → 0.244 Ω(−42%);单元复用 −27% / −29%。All three modules go from partly failing to 3/3 passing. Capacitor-array max bottom / top plate access R: scaled 1.248 → 0.801 Ω (−36%) / 0.417 → 0.244 Ω (−42%); replicated −27% / −29%.
阶段二Stage 2
拼回顶层后,9 项模块小指标、5 项总指标全部通过;两种画法各 33 个真实顶层点。After assembly, all 9 module metrics and 5 top-level metrics pass; 33 real top-level points per array style.
口径Basis
Class-B CMOS,65 nm 工艺,MOM 电容阵列;每个点都做 LVS 与寄生抽取,不跑后仿、不评价相噪;两种画法合计 1 h 45 min。Class-B CMOS, 65 nm process, MOM capacitor array; every point runs LVS and parasitic extraction, no post-layout simulation or phase-noise claim; both styles took 1 h 45 min in total.

每个点走一遍完整链路Every point runs the full chain

优化器不用代理模型,目标值来自真实版图的抽取结果。LVS 必须通过,否则这个点不可行。There is no surrogate model; objectives come from extraction of the real layout. LVS must pass, otherwise the point is infeasible.

  1. 1取参数Pick parameters

    在各变量的范围和步长网格内取值。相同取值直接命中缓存。Values come from each variable's range and step grid. Repeated values hit the cache.

  2. 2预检Plan check

    先做可行性检查。违反规则的点记为不可行,不进入后面的 EDA 步骤。A feasibility check comes first. A point that breaks a rule is marked infeasible and skips every EDA step.

    实测约 1.5–2 sobserved about 1.5–2 s
  3. 3生成版图Build layout

    调用版图生成器回放出版图。The layout generator replays the layout.

    实测 12–365 sobserved 12–365 s
  4. 4LVS

    层次化 LVS,结果必须是 CORRECT。Hierarchical LVS; the result must be CORRECT.

    与抽取合计实测 52–476 swith extraction, observed 52–476 s
  5. 5寄生抽取Extract

    xRC 抽取整个版图,同时做串联 R 的自检。xRC extracts the whole layout and the series-R check runs alongside.

  6. 6rc-annot

    汇总关注 net 的 C、R_access、R_dc 等,在进程内完成。Summarizes C, R_access, R_dc and more for the watched nets, in process.

    实测 0.3–15.5 sobserved 0.3–15.5 s
  7. 7算目标Objectives

    用指标名或表达式算目标,并按约束计算违例量。Objectives are metrics or expressions; constraint violations are summed alongside.

  8. ↻算法给出下一组Next candidates

    DE、NSGA-II 或 CMA-ES 根据结果给出下一代参数,回到第 1 步。DE, NSGA-II or CMA-ES propose the next generation and the loop returns to step 1.

一个点的墙钟时间是分钟级:最终回归里 19 个真实评估为 87–598 s,中位数 252 s,其中包含排 Calibre 锁的等待。所以预算通常只有几十个点,算法按代批量提交,并行 worker 各自独立进程。One point takes minutes of wall time. In the final regression the 19 real evaluations took 87–598 s, median 252 s, including waits for the Calibre lock. Budgets are therefore a few dozen points, algorithms submit whole generations, and each parallel worker is a separate process.


DE、NSGA-II 与 CMA-ESDE, NSGA-II and CMA-ES

单目标和多目标都能做。三种算法都是 ask/tell 接口,在归一化空间里运行;整数和离散变量在解码时取整或映射到网格。Single and multiple objectives are both covered. All three use an ask/tell interface in a normalized space; integer and discrete variables are rounded or mapped onto their grid when decoded.

单目标 · 多目标时加权和Single objective · weighted sum for several

DE

差分进化,默认 rand1bin,可选 current_to_best 和自适应 jDE。Differential evolution: rand1bin by default, with current_to_best and self-adaptive jDE as options.

  • 约束按“可行优先,同为不可行时违例小者优先”处理Constraints follow "feasible first, smaller violation wins among infeasible"
  • 越界分量在基向量与边界之间重取Out-of-bounds components are redrawn between base vector and bound
  • 多个目标按 Σ 权重·F/基线 合成Several objectives combine as Σ weight·F/baseline
多目标Multi-objective

NSGA-II

快速非支配排序加拥挤距离,输出 Pareto 前沿。Fast non-dominated sorting with crowding distance, returning a Pareto front.

  • SBX 交叉(η=15)、多项式变异(η=20)SBX crossover (η=15), polynomial mutation (η=20)
  • 约束支配;种群取偶数Constrained domination; even population size
  • 运行页画 Pareto 前沿和每代超体积The run page plots the front and the hypervolume per generation
单目标 · 连续变量Single objective · continuous variables

CMA-ES

(μ/μ_w, λ) 协方差自适应,λ 默认 4+⌊3 ln d⌋,σ0 按归一化坐标给。(μ/μ_w, λ) covariance adaptation with λ = 4+⌊3 ln d⌋ by default; σ0 is given in normalized coordinates.

  • 边界默认罚函数,也可重采样Bounds by penalty by default, resampling optional
  • 没有专门处理整数和离散变量,步长粗时容易过早收敛Integer and discrete variables are not handled specially; coarse steps can stall it early
基线Baseline
各变量的默认值先单独评估一次,再作为初始种群的第 0 个个体(CMA-ES 为初始均值)。初始种群默认拉丁超立方。The defaults are evaluated once first and become member 0 of the initial population (the initial mean for CMA-ES). The initial population is Latin hypercube by default.
续跑Resume
每代存一次检查点,续跑结果与不中断时一致,也与 worker 数无关(有测试覆盖)。A checkpoint is written every generation. A resumed run matches an uninterrupted one and does not depend on worker count (covered by tests).
算法测试Algorithm tests
合成函数上,DE 和 CMA-ES 的 sphere 误差小于 1e-8;NSGA-II 在 ZDT1 上超体积大于 0.64(最优 2/3)。共 79 个测试,不需要 EDA。On synthetic functions DE and CMA-ES reach sphere error below 1e-8, and NSGA-II exceeds hypervolume 0.64 on ZDT1 (optimum 2/3). 79 tests in total, none needs EDA.

回放真实运行Replay a real run

三组数据来自最终回归,真实调用版图生成、LVS 和抽取。拖动滑块,逐条看每个点的参数、目标值和前沿的变化。The three studies come from the final regression and ran real build, LVS and extraction. Drag the slider to see each point's parameters, objective values and the front as it grows.

每组种群 4、跑 2 代,共 9 条记录,其中重复出现的点复用已有结果。这些运行用来核对链路,不代表收敛后的效果。Class-B 的 NSGA-II 在 3 个变量(磁件腿宽、gm 引线宽、VDD 环宽)下,把 OUTP 总电容从基线 59.17 fF 降到 47.66 fF,OUTP 接入电阻 0.7988 Ω 变为 0.8012 Ω。Each study has population 4 and two generations, 9 records in all, and repeated points reuse stored results. The runs check the flow and say nothing about converged quality. With three variables (magnetic leg width, gm strap width, VDD ring width), Class-B NSGA-II lowers OUTP total capacitance from the 59.17 fF baseline to 47.66 fF, while OUTP access resistance moves from 0.7988 Ω to 0.8012 Ω.


深色界面,三个页面A dark GUI with three pages

设置、运行、结果。截图来自真实运行的回归;界面文字为英文。Setup, run and results. Screenshots come from the real regression runs.

1

设置Setup

载入参数表,勾选要变化的参数并改范围与步长,选观察的 net、目标、约束、算法和预算。「Probe effective」会逐个参数试探版图是否真的变化;勾了不生效的参数时,表格下方给出红色提示(截图中故意勾上一个)。Load the parameter table, tick the variables to vary and edit range and step, then choose watched nets, objectives, constraints, algorithm and budget. "Probe effective" tests whether each parameter really changes the layout; ticking an ineffective one shows a red warning below the table (one is ticked on purpose in the screenshot).

2

运行Run

进度条和六个读数,每个 worker 当前处于哪个阶段、用了多久,日志实时滚动。四张图:收敛、目标空间、变量平行坐标,以及所选点与基线的 net RC 对比。可以暂停、停止和续跑。A progress bar and six readouts, the stage and elapsed time of each worker, and a live log. Four plots: convergence, objective space, parallel coordinates of the variables, and the net RC of the selected point against the baseline. Runs can be paused, stopped and resumed.

3

结果Results

评估表可排序、筛选和搜索。选中一个点,右侧列出参数、目标、约束违例、各阶段耗时和各 net 的 RC,可以导出该点的 layout options 或全部结果的 CSV。The evaluation table sorts, filters and searches. Select a point to see its parameters, objectives, constraint violations, stage times and per-net RC, and export that point's layout options or a CSV of everything.


参数与约束Parameters and constraints

不可行的点在 build 之前就被拦下,不占 EDA 时间。Infeasible points are stopped before the build and cost no EDA time.

参数来源Parameters
版图生成器提供的参数表。Class-B CMOS 有 159 个可调参数,Hegazi 尾电感有 160 个。类型有实数、整数和枚举,按步长取网格。The layout generator's parameter table: 159 tunable parameters for Class-B CMOS and 160 for the Hegazi tail. Types are real, integer and choice, sampled on a step grid.
是否生效Effectiveness
探测把每个参数换成范围内另外两个值重建,比较版图是否变化:Class-B CMOS 66 个确认有效、17 个被读取但不生效;Hegazi 尾电感 69 个有效、24 个不生效。选了不生效的参数会得到警告。The probe rebuilds each parameter at two other values in range and compares the layout: 66 are effective and 17 are read but ineffective for Class-B CMOS; 69 and 24 for the Hegazi tail. Selecting an ineffective parameter raises a warning.
观察 netWatched nets
例如 OUTP、OUTN、VDD、VSS、SN。可用的指标有 C_total、C_gnd、C_cc、R_access_max、R_dc 等,目标和约束都可以用指标名或表达式。For example OUTP, OUTN, VDD, VSS and SN. Available metrics include C_total, C_gnd, C_cc, R_access_max and R_dc; objectives and constraints use metric names or expressions.
约束Constraints
「LVS 通过」总是自动加上。其他可选:rcheck 违例数、plan 可行、任意指标的上下限。违例量按界限归一后相加。"LVS passes" is always added. Optional ones: rcheck violation count, plan feasibility, and bounds on any metric. Violations are normalized by the bound and summed.
失败处理Failures
不可行、build 失败和 LVS 不通过是确定结果,会缓存;工具错误、超时和取消可以重试,不进缓存。Infeasible, build-failed and LVS-incorrect are definite outcomes and are cached; tool errors, timeouts and cancellations can be retried and are not cached.

命令行Command line

界面和命令行读写同一种 study 文件。无 EDA 的机器上可以用 plan 或合成后端试流程。The GUI and the CLI share one study file format. On a machine without EDA, the plan or synthetic backend exercises the flow.

# list tunable parameters; --probe adds the effective column
lrcopt params --family hegazi --variant tail --probe
lrcopt init -o my.json --family hegazi --variant tail --probe
lrcopt run my.json --algo nsga2 --budget 12 --workers 2
lrcopt resume RUN_DIR --budget 24
lrcopt summary RUN_DIR
lrcopt export RUN_DIR --best --options best.json --csv all.csv
lrcopt gui [STUDY.json | RUN_DIR]
backend
real 真实链路;plan 只做可行性与几何估算,约 0.5 s 一个点;synthetic 解析函数,毫秒级。real is the full chain; plan only checks feasibility and geometry, about 0.5 s per point; synthetic uses analytic functions, milliseconds.
Ctrl-C
按一次是优雅停止:正在跑的评估跑完,未完成的一代下次续跑时重新提出。再按一次直接结束 worker 进程。Once is a graceful stop: running evaluations finish and the unfinished generation is asked again on resume. A second press kills the worker processes.
输出Output
每次运行一个目录,含逐点评估记录、检查点、摘要和日志;导出的 options 可直接交给版图生成器重建该点。One directory per run with per-point records, checkpoint, summary and log; an exported options file lets the layout generator rebuild that point.

范围与限制Scope and limits

项目仍在开发,尚未发布。下面是目前验证过的范围。The project is still in development and not released. This is what has been validated so far.

结构Structures
只验证了 Class-B CMOS 和 Hegazi 尾电感两种结构。代码不限结构,但测试、示例和真实冒烟只覆盖这两种。Only Class-B CMOS and the Hegazi tail are validated. The code is not tied to a structure, but tests, examples and real smoke runs cover only these two.
电容阵列Capacitor bank
固定为等比放大的 MOM 阵列。Fixed to a scaled MOM bank.
目标Objectives
只优化版图寄生的 R 和 C 以及由它们算出的量,默认只跑 LVS 与 rcheck。不做仿真,所以相噪、频率、功耗这些性能不在目标里;后仿开关只是保留项,没有专门验证。Only layout-parasitic R and C, and quantities derived from them, are optimized; by default only LVS and rcheck run. No simulation is performed, so phase noise, frequency and power are not objectives. The post-layout simulation switch is a retained option and has no dedicated validation.
预算Budget
单点为分钟级,回归里每组只有 9 条记录,只能先看到前沿的大致形状。Points cost minutes, and each regression study has only 9 records, enough to see the rough shape of a front at best.
已知问题Known issues
Hegazi 的 VSS 直流路径电阻在回归的全部点上恒为 0.314 Ω,说明某些参数改变了几何却不改变这个目标;探测只能判断版图是否变化,判断不了目标是否变化。CMA-ES 对整数变量没有专门处理。VSS 的 C_total 恒为 0。In the regression the Hegazi VSS DC path resistance stays at 0.314 Ω for every point: some parameters change the geometry but not this objective, and the probe can tell that the layout changed but not that the objective did. CMA-ES has no special handling of integer variables. VSS C_total is always 0.
运行环境Environment
真实链路需要本机的版图生成器、Calibre 和对应设计目录,因此没有可下载的发布包。界面使用 Tk,在没有 Xft 的环境里文字为英文。The real chain needs a local layout generator, Calibre and a matching design directory, so there is no downloadable package. The GUI uses Tk, and its text is English in environments without Xft.