From 4dad6ab3b1059675290d096b07984f8701d54979 Mon Sep 17 00:00:00 2001 From: James Cherry Date: Thu, 13 Nov 2025 10:06:57 -0700 Subject: [PATCH 1/6] disconnect/disconnect pin set_multicycle_path resolves #327 Signed-off-by: James Cherry --- include/sta/Sdc.hh | 1 + sdc/Sdc.cc | 19 +++++++++++++++++++ test/disconnect_mcp_pin.tcl | 29 +++++++++++++++++++++++++++++ test/disconnect_mcp_pin.v | 11 +++++++++++ test/regression_vars.tcl | 1 + 5 files changed, 61 insertions(+) create mode 100644 test/disconnect_mcp_pin.tcl create mode 100644 test/disconnect_mcp_pin.v diff --git a/include/sta/Sdc.hh b/include/sta/Sdc.hh index 622ca6b7..580303dc 100644 --- a/include/sta/Sdc.hh +++ b/include/sta/Sdc.hh @@ -1115,6 +1115,7 @@ protected: void recordMergeHash(ExceptionPath *exception, ExceptionPt *missing_pt); void recordMergeHashes(ExceptionPath *exception); void unrecordExceptionFirstPts(ExceptionPath *exception); + void unrecordExceptionPins(ExceptionPath *exception); void unrecordExceptionClks(ExceptionPath *exception, ClockSet *clks, ClockExceptionsMap &exception_map); diff --git a/sdc/Sdc.cc b/sdc/Sdc.cc index d44979a9..1522bbcf 100644 --- a/sdc/Sdc.cc +++ b/sdc/Sdc.cc @@ -4880,6 +4880,8 @@ Sdc::findMergeMatch(ExceptionPath *exception) void Sdc::deleteExceptions() { + for (ExceptionPath *exception : exceptions_) + delete exception; exceptions_.clear(); exception_id_ = 0; @@ -4964,6 +4966,7 @@ Sdc::unrecordException(ExceptionPath *exception) { unrecordMergeHashes(exception); unrecordExceptionFirstPts(exception); + unrecordExceptionPins(exception); exceptions_.erase(exception); } @@ -5022,6 +5025,22 @@ Sdc::unrecordExceptionFirstPts(ExceptionPath *exception) } } +void +Sdc::unrecordExceptionPins(ExceptionPath *exception) +{ + ExceptionFrom *from = exception->from(); + if (from) + unrecordExceptionPins(exception, from->pins(), pin_exceptions_); + ExceptionThruSeq *thrus = exception->thrus(); + if (thrus) { + for (ExceptionThru *thru : *thrus) + unrecordExceptionPins(exception, thru->pins(), pin_exceptions_); + } + ExceptionTo *to = exception->to(); + if (to) + unrecordExceptionPins(exception, to->pins(), pin_exceptions_); +} + void Sdc::unrecordExceptionClks(ExceptionPath *exception, ClockSet *clks, diff --git a/test/disconnect_mcp_pin.tcl b/test/disconnect_mcp_pin.tcl new file mode 100644 index 00000000..e1641f66 --- /dev/null +++ b/test/disconnect_mcp_pin.tcl @@ -0,0 +1,29 @@ +# disconnect/disconnect pin set_multicycle_path +read_liberty asap7_small.lib.gz +read_verilog disconnect_mcp_pin.v +link_design top + +create_clock -name clk -period 500 clk +set_input_delay -clock clk 10 data_in[*] + +# This SDC defines setup and hold time requirements for data pins +# relative to a clock, typical for a source-synchronous interface. +set_data_check -from clk -to [get_pins u0/A] -setup 10 +set_data_check -from clk -to [get_pins u0/A] -hold 10 +set_data_check -from clk -to [get_pins u1/A] -setup 10 +set_data_check -from clk -to [get_pins u1/A] -hold 10 +set_multicycle_path -end -setup 1 -to [get_pins u0/A] +set_multicycle_path -end -setup 1 -to [get_pins u1/A] +set_multicycle_path -start -hold 0 -to [get_pins u0/A] +set_multicycle_path -start -hold 0 -to [get_pins u1/A] + +report_checks -to u1/A + +disconnect_pin data_in[1] u1/A + +report_checks -to u1/A + +connect_pin data_in[1] u1/A + +report_checks -to u1/A + diff --git a/test/disconnect_mcp_pin.v b/test/disconnect_mcp_pin.v new file mode 100644 index 00000000..6608e8fb --- /dev/null +++ b/test/disconnect_mcp_pin.v @@ -0,0 +1,11 @@ +module top (clk, clkout, data_in, data_out); + input clk; + output clkout; + input [1:0] data_in; + output [1:0] data_out; + + // Anchor buffers on the source-synchronous interface IOs + BUFx2_ASAP7_75t_R clkbuf0 (.A(clk), .Y(clkout)); + BUFx2_ASAP7_75t_R u0 (.A(data_in[0]), .Y(data_out[0])); + BUFx2_ASAP7_75t_R u1 (.A(data_in[1]), .Y(data_out[1])); +endmodule // top diff --git a/test/regression_vars.tcl b/test/regression_vars.tcl index d7a46617..c8e662e7 100644 --- a/test/regression_vars.tcl +++ b/test/regression_vars.tcl @@ -138,6 +138,7 @@ record_example_tests { } record_sta_tests { + disconnect_mcp_pin get_filter get_is_memory get_lib_pins_of_objects From 7fab248f56ed136a1479ef9f1874a92f621383be Mon Sep 17 00:00:00 2001 From: James Cherry Date: Thu, 13 Nov 2025 10:17:08 -0700 Subject: [PATCH 2/6] disconnect_mcp_pin.ok Signed-off-by: James Cherry --- test/disconnect_mcp_pin.ok | 59 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 test/disconnect_mcp_pin.ok diff --git a/test/disconnect_mcp_pin.ok b/test/disconnect_mcp_pin.ok new file mode 100644 index 00000000..19c4fede --- /dev/null +++ b/test/disconnect_mcp_pin.ok @@ -0,0 +1,59 @@ +Warning: disconnect_mcp_pin.tcl line 15, 'u0/A' is not a valid endpoint. +Warning: disconnect_mcp_pin.tcl line 16, 'u1/A' is not a valid endpoint. +Warning: disconnect_mcp_pin.tcl line 17, 'u0/A' is not a valid endpoint. +Warning: disconnect_mcp_pin.tcl line 18, 'u1/A' is not a valid endpoint. +Startpoint: data_in[1] (input port clocked by clk) +Endpoint: u1 (falling edge-triggered data to data check clocked by clk) +Path Group: clk +Path Type: max + + Delay Time Description +--------------------------------------------------------- + 500.00 500.00 clock clk (rise edge) + 0.00 500.00 clock network delay (ideal) + 10.00 510.00 ^ input external delay + 0.00 510.00 ^ data_in[1] (in) + 0.00 510.00 ^ u1/A (BUFx2_ASAP7_75t_R) + 510.00 data arrival time + + 750.00 750.00 clock clk (fall edge) + 0.00 750.00 clock network delay (propagated) + 0.00 750.00 clock reconvergence pessimism + 750.00 v clk (in) + -10.00 740.00 data check setup time + 740.00 data required time +--------------------------------------------------------- + 740.00 data required time + -510.00 data arrival time +--------------------------------------------------------- + 230.00 slack (MET) + + +No paths found. +Startpoint: data_in[1] (input port clocked by clk) +Endpoint: u1 (falling edge-triggered data to data check clocked by clk) +Path Group: clk +Path Type: max + + Delay Time Description +--------------------------------------------------------- + 500.00 500.00 clock clk (rise edge) + 0.00 500.00 clock network delay (ideal) + 10.00 510.00 ^ input external delay + 0.00 510.00 ^ data_in[1] (in) + 0.00 510.00 ^ u1/A (BUFx2_ASAP7_75t_R) + 510.00 data arrival time + + 250.00 250.00 clock clk (fall edge) + 0.00 250.00 clock network delay (propagated) + 0.00 250.00 clock reconvergence pessimism + 250.00 v clk (in) + -10.00 240.00 data check setup time + 240.00 data required time +--------------------------------------------------------- + 240.00 data required time + -510.00 data arrival time +--------------------------------------------------------- + -270.00 slack (VIOLATED) + + From db3a1dd6e6c345cb9d8f39027dc482921df3af70 Mon Sep 17 00:00:00 2001 From: James Cherry Date: Thu, 13 Nov 2025 10:31:43 -0700 Subject: [PATCH 3/6] disconnect_pin do not delete pin from exceptions Signed-off-by: James Cherry --- include/sta/ExceptionPath.hh | 12 ++++++------ include/sta/Sdc.hh | 2 +- sdc/ExceptionPath.cc | 8 ++++---- sdc/Sdc.cc | 8 ++++---- search/Sta.cc | 1 - test/disconnect_mcp_pin.ok | 16 ++++++++-------- 6 files changed, 23 insertions(+), 24 deletions(-) diff --git a/include/sta/ExceptionPath.hh b/include/sta/ExceptionPath.hh index 267b5653..c1c09978 100644 --- a/include/sta/ExceptionPath.hh +++ b/include/sta/ExceptionPath.hh @@ -355,8 +355,8 @@ public: const Network *network) = 0; virtual void connectPinAfter(PinSet *, Network *network) = 0; - virtual void disconnectPinBefore(const Pin *pin, - Network *network) = 0; + virtual void deletePinBefore(const Pin *pin, + Network *network) = 0; protected: const RiseFallBoth *rf_; @@ -415,8 +415,8 @@ public: const Network *) {} virtual void connectPinAfter(PinSet *, Network *) {} - virtual void disconnectPinBefore(const Pin *, - Network *); + virtual void deletePinBefore(const Pin *, + Network *); void deleteInstance(const Instance *inst, const Network *network); @@ -537,8 +537,8 @@ public: virtual size_t objectCount() const; virtual void connectPinAfter(PinSet *drvrs, Network *network); - virtual void disconnectPinBefore(const Pin *pin, - Network *network); + virtual void deletePinBefore(const Pin *pin, + Network *network); void deleteInstance(const Instance *inst, const Network *network); diff --git a/include/sta/Sdc.hh b/include/sta/Sdc.hh index 580303dc..b14e10cc 100644 --- a/include/sta/Sdc.hh +++ b/include/sta/Sdc.hh @@ -1027,7 +1027,7 @@ public: void removeGraphAnnotations(); // Network edit before/after methods. - void disconnectPinBefore(const Pin *pin); + void deletePinBefore(const Pin *pin); void connectPinAfter(const Pin *pin); void clkHpinDisablesChanged(const Pin *pin); void makeClkHpinDisable(const Clock *clk, diff --git a/sdc/ExceptionPath.cc b/sdc/ExceptionPath.cc index 2d4ccbf3..163dcf65 100644 --- a/sdc/ExceptionPath.cc +++ b/sdc/ExceptionPath.cc @@ -1166,8 +1166,8 @@ ExceptionFromTo::deleteInstance(const Instance *inst, } void -ExceptionFromTo::disconnectPinBefore(const Pin *pin, - Network *network) +ExceptionFromTo::deletePinBefore(const Pin *pin, + Network *network) { deletePin(pin, network); } @@ -2080,8 +2080,8 @@ ExceptionThru::makePinEdges(const Pin *pin, } void -ExceptionThru::disconnectPinBefore(const Pin *pin, - Network *network) +ExceptionThru::deletePinBefore(const Pin *pin, + Network *network) { deletePin(pin, network); // Remove edges from/to leaf pin and through hier pin. diff --git a/sdc/Sdc.cc b/sdc/Sdc.cc index 1522bbcf..daca9186 100644 --- a/sdc/Sdc.cc +++ b/sdc/Sdc.cc @@ -5685,22 +5685,22 @@ Sdc::connectPinAfter(const Pin *pin) } void -Sdc::disconnectPinBefore(const Pin *pin) +Sdc::deletePinBefore(const Pin *pin) { auto itr = pin_exceptions_.find(pin); if (itr != pin_exceptions_.end()) { for (ExceptionPath *exception : itr->second) { ExceptionFrom *from = exception->from(); if (from) - from->disconnectPinBefore(pin, network_); + from->deletePinBefore(pin, network_); ExceptionTo *to = exception->to(); if (to) - to->disconnectPinBefore(pin, network_); + to->deletePinBefore(pin, network_); ExceptionPt *first_pt = exception->firstPt(); ExceptionThruSeq *thrus = exception->thrus(); if (thrus) { for (ExceptionThru *thru : *exception->thrus()) { - thru->disconnectPinBefore(pin, network_); + thru->deletePinBefore(pin, network_); if (thru == first_pt) recordExceptionEdges(exception, thru->edges(), first_thru_edge_exceptions_); diff --git a/search/Sta.cc b/search/Sta.cc index d51ecae9..ae9c220b 100644 --- a/search/Sta.cc +++ b/search/Sta.cc @@ -4477,7 +4477,6 @@ Sta::disconnectPinBefore(const Pin *pin) sdc_network_->pathName(pin), sdc_network_->pathName(network_->net(pin))); parasitics_->disconnectPinBefore(pin, network_); - sdc_->disconnectPinBefore(pin); sim_->disconnectPinBefore(pin); if (graph_) { if (network_->isDriver(pin)) { diff --git a/test/disconnect_mcp_pin.ok b/test/disconnect_mcp_pin.ok index 19c4fede..a0645c2b 100644 --- a/test/disconnect_mcp_pin.ok +++ b/test/disconnect_mcp_pin.ok @@ -44,16 +44,16 @@ Path Type: max 0.00 510.00 ^ u1/A (BUFx2_ASAP7_75t_R) 510.00 data arrival time - 250.00 250.00 clock clk (fall edge) - 0.00 250.00 clock network delay (propagated) - 0.00 250.00 clock reconvergence pessimism - 250.00 v clk (in) - -10.00 240.00 data check setup time - 240.00 data required time + 750.00 750.00 clock clk (fall edge) + 0.00 750.00 clock network delay (propagated) + 0.00 750.00 clock reconvergence pessimism + 750.00 v clk (in) + -10.00 740.00 data check setup time + 740.00 data required time --------------------------------------------------------- - 240.00 data required time + 740.00 data required time -510.00 data arrival time --------------------------------------------------------- - -270.00 slack (VIOLATED) + 230.00 slack (MET) From f5cae661f444bd0f1204ea113adc13548f939ed2 Mon Sep 17 00:00:00 2001 From: James Cherry Date: Thu, 13 Nov 2025 10:42:23 -0700 Subject: [PATCH 4/6] delete_instance update exceptions Signed-off-by: James Cherry --- search/Sta.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/search/Sta.cc b/search/Sta.cc index ae9c220b..b34d2d8a 100644 --- a/search/Sta.cc +++ b/search/Sta.cc @@ -4662,6 +4662,7 @@ Sta::deletePinBefore(const Pin *pin) } } } + sdc_->deletePinBefore(pin); sim_->deletePinBefore(pin); clk_network_->deletePinBefore(pin); power_->deletePinBefore(pin); From 16a92707fb1ff725fba82c993bf93728227e0f34 Mon Sep 17 00:00:00 2001 From: Akash Levy Date: Sun, 16 Nov 2025 18:34:37 -0500 Subject: [PATCH 5/6] Fix `isBuffer` (#329) * Add support for "well" direction type (nwell, pwell, etc.), and fix isBuffer (+ other functions) to accommodate wells * Just fix isBuffer issue --- liberty/Liberty.cc | 3 ++- test/get_is_buffer.ok | 1 + test/get_is_buffer.tcl | 5 +++++ test/get_is_buffer.v | 11 +++++++++++ test/regression_vars.tcl | 1 + 5 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 test/get_is_buffer.ok create mode 100644 test/get_is_buffer.tcl create mode 100644 test/get_is_buffer.v diff --git a/liberty/Liberty.cc b/liberty/Liberty.cc index c4d9fdd3..3cf867f2 100644 --- a/liberty/Liberty.cc +++ b/liberty/Liberty.cc @@ -1226,7 +1226,8 @@ LibertyCell::bufferPorts(// Return values. } output = port; } - else if (!dir->isPowerGround()) { + else if (!port->isPwrGnd()) { + // Invalid direction. input = nullptr; output = nullptr; break; diff --git a/test/get_is_buffer.ok b/test/get_is_buffer.ok new file mode 100644 index 00000000..655d42ed --- /dev/null +++ b/test/get_is_buffer.ok @@ -0,0 +1 @@ +buf_inst diff --git a/test/get_is_buffer.tcl b/test/get_is_buffer.tcl new file mode 100644 index 00000000..c02f682e --- /dev/null +++ b/test/get_is_buffer.tcl @@ -0,0 +1,5 @@ +# is_buffer property +read_liberty ../examples/sky130hd_tt.lib.gz +read_verilog get_is_buffer.v +link_design dut +report_object_full_names [get_cells -filter is_buffer] diff --git a/test/get_is_buffer.v b/test/get_is_buffer.v new file mode 100644 index 00000000..91f8afea --- /dev/null +++ b/test/get_is_buffer.v @@ -0,0 +1,11 @@ +module dut ( + input A, + output Y +); + + sky130_fd_sc_hd__buf_2 buf_inst ( + .A(A), + .X(Y) + ); + +endmodule diff --git a/test/regression_vars.tcl b/test/regression_vars.tcl index c8e662e7..f3eb42e9 100644 --- a/test/regression_vars.tcl +++ b/test/regression_vars.tcl @@ -140,6 +140,7 @@ record_example_tests { record_sta_tests { disconnect_mcp_pin get_filter + get_is_buffer get_is_memory get_lib_pins_of_objects get_noargs From c4b94c3ee58fde01962a1d5c6aa7d26050f22210 Mon Sep 17 00:00:00 2001 From: Logikable Date: Mon, 17 Nov 2025 09:23:32 -0800 Subject: [PATCH 6/6] Add missing system header includes. (#330) Signed-off-by: Sean Luchen --- dcalc/ArcDelayCalc.cc | 2 ++ liberty/TableModel.cc | 1 + 2 files changed, 3 insertions(+) diff --git a/dcalc/ArcDelayCalc.cc b/dcalc/ArcDelayCalc.cc index 37dadf19..d20ca928 100644 --- a/dcalc/ArcDelayCalc.cc +++ b/dcalc/ArcDelayCalc.cc @@ -24,6 +24,8 @@ #include "ArcDelayCalc.hh" +#include + #include "Units.hh" #include "Liberty.hh" #include "TimingArc.hh" diff --git a/liberty/TableModel.cc b/liberty/TableModel.cc index 7d847a79..b4a0b325 100644 --- a/liberty/TableModel.cc +++ b/liberty/TableModel.cc @@ -24,6 +24,7 @@ #include "TableModel.hh" +#include #include #include "Error.hh"