replace_cell between cells with non-equivalent timing arcs drops constant-based arc disabling until Sim is reset

オープン
#440 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@dsengupta0628 がすでに取り組んでいます。

2026年10月22日 から。

評価

この issue はまだ評価されていません。

説明

Swapping an instance to another cell and back changes its timing, though the design ends up identical. In the repro, u1 goes XOR2_COND → XOR2_PLAIN → XOR2_COND; the cell, netlist, constant (u1/B = 0) and constraints are the same as at the start, but u1/Y fall arrival goes from 0.110 to 0.550. A set_case_analysis edit restores 0.110. The two cells have the same function but non-equivalent timing arcs (equiv_cell_timing_arcs = 0). Seen on master 84c4d7e1.

Run sta -no_init -exit repro.tcl (files below):

XOR2_COND (expect 0.110)             u1/Y fall arrival 0.110
XOR2_PLAIN (expect 0.110)            u1/Y fall arrival 0.510
XOR2_COND again (expect 0.110)       u1/Y fall arrival 0.550
after case analysis reset (0.110)    u1/Y fall arrival 0.110

The XOR2_PLAIN step is also wrong (0.510): with B = 0 the arc from A is positive unate, so Y fall follows A fall (0.1 + 0.01).

Suspected cause: Sta::replaceCellAfter() makes new timing edges, but incremental Sim annotates only instances whose pin values changed (Sim.cc ~609), so the new edges get no sim timing sense or disabled-cond.

In OpenROAD this shows up as pessimistic timing after resizer VT swaps between ORFS asap7 RVT (250407) and LVT/SLVT (211120) cells, whose arcs differ.

repro.tcl
# A cell swap between cells whose timing arc sets differ leaves the new
# timing edges without the constant-propagation (Sim) annotations, so the
# arcs a constant input disables come back until Sim is fully recomputed.
read_liberty repro.lib
read_verilog repro.v
link_design top

create_clock -name vclk -period 1
# A rises late and falls early, so the arc used for y fall is visible.
set_input_delay -clock vclk -rise 0.5 [get_ports a]
set_input_delay -clock vclk -fall 0.1 [get_ports a]
set_output_delay -clock vclk 0 [get_ports y]

set y [get_pins u1/Y]
proc y_fall { tag } {
  global y
  puts [format "%-36s u1/Y fall arrival %.3f" $tag \
          [get_property $y arrival_max_fall]]
}

puts "equiv_cells [sta::equiv_cells [get_lib_cells XOR2_COND] [get_lib_cells XOR2_PLAIN]]\
 equiv_cell_timing_arcs [sta::equiv_cell_timing_arcs [get_lib_cells XOR2_COND] [get_lib_cells XOR2_PLAIN]]"
# u1/B is tied to 0, so y = a: only the positive unate "when !B" arc applies
# and y falls at a fall (0.1) + 0.01.
y_fall "XOR2_COND (expect 0.110)"
replace_cell u1 [get_lib_cells XOR2_PLAIN]
y_fall "XOR2_PLAIN (expect 0.110)"
replace_cell u1 [get_lib_cells XOR2_COND]
y_fall "XOR2_COND again (expect 0.110)"
# Any SDC constant edit recomputes Sim from scratch and fixes the timing.
set_case_analysis 0 [get_pins u1/B]
unset_case_analysis [get_pins u1/B]
y_fall "after case analysis reset (0.110)"
repro.v
module top (a, y);
  input a;
  output y;
  XOR2_COND u1 (.A(a), .B(1'b0), .Y(y));
endmodule
repro.lib
library (repro) {
  delay_model : table_lookup;
  time_unit : "1ns";
  voltage_unit : "1V";
  current_unit : "1mA";
  capacitive_load_unit (1, pf);
  leakage_power_unit : "1nW";
  pulling_resistance_unit : "1kohm";
  nom_process : 1;
  nom_voltage : 1;
  nom_temperature : 25;
  input_threshold_pct_rise : 50;
  input_threshold_pct_fall : 50;
  output_threshold_pct_rise : 50;
  output_threshold_pct_fall : 50;
  slew_lower_threshold_pct_rise : 20;
  slew_upper_threshold_pct_rise : 80;
  slew_lower_threshold_pct_fall : 20;
  slew_upper_threshold_pct_fall : 80;
  default_max_transition : 1;

  /* Y = A ^ B with arcs split by the state of the other input:
     positive unate when it is 0, negative unate (slower) when it is 1. */
  cell (XOR2_COND) {
    area : 1;
    pin (A) { direction : input; capacitance : 0.001; }
    pin (B) { direction : input; capacitance : 0.001; }
    pin (Y) {
      direction : output;
      function : "(A^B)";
      timing () {
        related_pin : "A"; timing_sense : positive_unate; when : "!B";
        cell_rise (scalar) { values ("0.01"); }
        cell_fall (scalar) { values ("0.01"); }
        rise_transition (scalar) { values ("0.01"); }
        fall_transition (scalar) { values ("0.01"); }
      }
      timing () {
        related_pin : "A"; timing_sense : negative_unate; when : "B";
        cell_rise (scalar) { values ("0.05"); }
        cell_fall (scalar) { values ("0.05"); }
        rise_transition (scalar) { values ("0.01"); }
        fall_transition (scalar) { values ("0.01"); }
      }
      timing () {
        related_pin : "B"; timing_sense : non_unate;
        cell_rise (scalar) { values ("0.01"); }
        cell_fall (scalar) { values ("0.01"); }
        rise_transition (scalar) { values ("0.01"); }
        fall_transition (scalar) { values ("0.01"); }
      }
    }
  }

  /* The same function and pins with unconditional arcs, so its timing arc
     sets are not equivalent to XOR2_COND's. */
  cell (XOR2_PLAIN) {
    area : 1;
    pin (A) { direction : input; capacitance : 0.001; }
    pin (B) { direction : input; capacitance : 0.001; }
    pin (Y) {
      direction : output;
      function : "(A^B)";
      timing () {
        related_pin : "A"; timing_sense : non_unate;
        cell_rise (scalar) { values ("0.01"); }
        cell_fall (scalar) { values ("0.01"); }
        rise_transition (scalar) { values ("0.01"); }
        fall_transition (scalar) { values ("0.01"); }
      }
      timing () {
        related_pin : "B"; timing_sense : non_unate;
        cell_rise (scalar) { values ("0.01"); }
        cell_fall (scalar) { values ("0.01"); }
        rise_transition (scalar) { values ("0.01"); }
        fall_transition (scalar) { values ("0.01"); }
      }
    }
  }
}
主要言語
Verilog
スター
655
フォーク
296
平均マージ
1日 12時間
マージ済み PR(30日)
28

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

The-OpenROAD-Project/OpenSTA のほかの issue

The-OpenROAD-Project/OpenSTA の issue をすべて見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。