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

Đang mở
#440 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@dsengupta0628 đang làm issue này rồi.

Từ ngày 22/10/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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"); }
      }
    }
  }
}
Ngôn ngữ chính
Verilog
Star
658
Fork
299
Merge trung bình
1 ngày 12 giờ
Pull request đã merge (30 ngày)
28

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của The-OpenROAD-Project/OpenSTA

Tất cả issue của The-OpenROAD-Project/OpenSTA

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.