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

Aperta
#440 0 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@dsengupta0628 ci sta già lavorando.

Dal 22/10/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

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"); }
      }
    }
  }
}
Lingua principale
Verilog
Stelle
655
Fork
296
Merge medio
1g 12h
PR unite (30g)
28

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di The-OpenROAD-Project/OpenSTA

Tutte le issue di The-OpenROAD-Project/OpenSTA

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.