UCSLib Parser
Rust 默认发布 · Updated 2026-07-25
Smart Fix support

Parse Liberty once. Use every corner.

直接解析 .lib / .lib.gz,提取 cell timing arc、delay table 与可选 cell 属性,生成 Smart Fix 使用的 per-corner 或 merged JSON。

Rust — defaultPython — reference/fallbackRHEL7 / RHEL8

发布版本

Python 与 Rust 的源程序和编译版本都会保留;默认交付和网页示例以 Rust 为准。

Implementation用途状态
rust客户默认发布版;原生单文件程序。Default
python行为基准、参考和 fallback;同样提供单文件编译版。Retained

两种实现使用相同 CLI 和 JSON schema。Rust 版已按 Python 行为进行单 corner、merged、parallel、gzip 和 enrichment 差分验证。

Quick start

选择与系统匹配的 Rust 文件,把有效许可证放在程序旁边或上级目录,然后解析一个 corner。

chmod +x ucs_lib_parser
./ucs_lib_parser \
  --corner ss_0p72v_125c \
  --libs "/proj/lib/ss/*.lib.gz" \
  --output ss_0p72v_125c.json

多个 --libs pattern 可以在同一次运行中给出;匹配到的文件按名称排序后解析。

Multi-corner config

Config mode 支持 sequential、local parallel 和 LSF backend。

{
  "output_dir": "./cell_data",
  "technology": "tsmc_n3c",
  "cell_attr_file": "./cell_attributes.json",
  "corners": [
    {
      "name": "ss_0p72v_125c",
      "libs": ["/proj/lib/ss/*.lib", "/proj/lib/ss/*.lib.gz"]
    },
    {
      "name": "ff_0p88v_m40c",
      "libs": "/proj/lib/ff/*.lib.gz"
    }
  ]
}
# 每个 corner 一个 JSON
./ucs_lib_parser --config gen_config.json --parallel 8

# 所有 corner 合并为一个 JSON
./ucs_lib_parser --config gen_config.json --merged \
  --output all_corners.json

# LSF;--parallel 限制同时运行的 job 数
./ucs_lib_parser --config gen_config.json \
  --lsf "bsub -q normal" --parallel 20

Cell attributes

Delay 由 Liberty 直接解析;cell metadata 可以来自 PrimeTime dump,也可以从 cell name 推导。

ModeOption行为
A--cell_attr_file读取 ucs_dump_lib_cell_attribute.tcl 在 PrimeTime 中生成的 JSON;优先级最高。接口字段为 name、base_name、size_base_name、swap_base_name、vt_type、drive_strength 和可选 function_id。
B--technology对属性文件中没有的 cell,根据 tsmc_n3c、tsmc_n3p 或 samsung_n8 命名规则补充属性。

ucs_lib_parser 不替代 PrimeTime attribute dump:前者解析 Liberty timing,后者取得 PrimeTime 已加载库中的 cell 属性;两者共同准备 Smart Fix 输入。Samsung P57 命名族应在 PrimeTime 中使用 ucs_dump_lib_cells -tech samsung_p57 生成 Mode A JSON。

Command line

OptionPurpose
--corner NAMESingle-corner mode;与 --config 互斥。
--libs GLOB...Single-corner Liberty paths/globs,支持 .lib 和 .lib.gz。
--output FILESingle-corner 或 merged 输出文件。
--config JSONMulti-corner configuration。
--mergedConfig mode 输出一个 corners 根节点的 merged JSON。
--output_dir DIRPer-corner 输出目录;覆盖 config。
--parallel NLocal worker 数,或 LSF 最大并发数。
--lsf BSUB_CMD使用 LSF backend。
--technology TECH启用 technology name parser。
--cell_attr_file JSONPrimeTime cell attribute JSON。
--debug显示 backend debug 信息。
-debug 0..4UCS debug level,受许可证上限约束。

Output

Per-corner

{
  "meta": {
    "corner": "ss_0p72v_125c",
    "generated": "2026-07-25 17:00:00",
    "total_cells": 120000,
    "total_arcs": 840000
  },
  "cells": {
    "BUFFD4": {
      "area": 1.2,
      "arcs": []
    }
  }
}

Merged

{
  "corners": {
    "ss_0p72v_125c": { "cells": {} },
    "ff_0p88v_m40c": { "cells": {} }
  }
}

Parsing behavior

  • 解析前移除 Liberty block comment 和 line comment。
  • 跳过 dont_use : true 或 is_macro_cell : true 的 cell。
  • 保留 combinational timing arc;缺失 timing_type 时按 combinational 处理。
  • Pin direction 不区分大小写,并接受 input/in 与 output/out。
  • 忽略空 related_pin、sequential arc,以及没有可用 rise/fall table 的 cell。
  • 相同 output/input pin pair 出现多个 conditional arc 时,以第一项 rise-table value 选择 worst arc。
  • 多个 Liberty 文件定义同名 cell 时,后解析的文件覆盖前一项。
  • Drive resistance 使用最小 input slew 对应 transition row,在完整 output capacitance 范围上计算 slope。

License & runtime

ucs_lib_parser/ ├── rust/ │ ├── RHEL7/ucs_lib_parser │ └── RHEL8/ucs_lib_parser └── python/ ├── RHEL7/ucs_lib_parser └── RHEL8/ucs_lib_parser
DefaultUse rust/RHEL7 or rust/RHEL8.
License searchExecutable directory, .COMMON/, then parent directories.
External dependencyTarget RHEL base ABI and system openssl.
Logucs_lib_parser_YYYYMMDD_HHMMSS.log in the current directory.

UniversalChip Studio Support

Technical: tech@universalchipstudio.com
Business: support@universalchipstudio.com