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

Abierto
#440 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@dsengupta0628 ya está trabajando en esto.

Desde el 22/10/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

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"); }
      }
    }
  }
}
Lenguaje dominante
Verilog
Estrellas
658
Forks
299
Merge medio
1 d 12 h
PR fusionados (30 d)
28

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de The-OpenROAD-Project/OpenSTA

Todos los issues de The-OpenROAD-Project/OpenSTA

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.