diff --git a/include/sta/ClkNetwork.hh b/include/sta/ClkNetwork.hh index 9175abd3..c08e9f1b 100644 --- a/include/sta/ClkNetwork.hh +++ b/include/sta/ClkNetwork.hh @@ -39,9 +39,11 @@ public: void ensureClkNetwork(); void clear(); bool isClock(const Pin *pin) const; + bool isClock(const Net *net) const; bool isIdealClock(const Pin *pin) const; const ClockSet *clocks(const Pin *pin); const ClockSet *idealClocks(const Pin *pin); + const PinSet *pins(const Clock *clk); void clkPinsInvalid(); protected: diff --git a/include/sta/Sta.hh b/include/sta/Sta.hh index d971af89..8ade548f 100644 --- a/include/sta/Sta.hh +++ b/include/sta/Sta.hh @@ -1146,11 +1146,12 @@ public: //////////////////////////////////////////////////////////////// void ensureClkNetwork(); - // Assumes ensureClkNetwork() has been called. - bool isClock(Pin *pin) const; - // Assumes ensureClkNetwork() has been called. - bool isIdealClock(Pin *pin) const; void clkPinsInvalid(); + // The following functions assume ensureClkNetwork() has been called. + bool isClock(const Pin *pin) const; + bool isClock(const Net *net) const; + bool isIdealClock(const Pin *pin) const; + const PinSet *pins(const Clock *clk); //////////////////////////////////////////////////////////////// diff --git a/search/ClkNetwork.cc b/search/ClkNetwork.cc index 4c9a08a2..ca8073ba 100644 --- a/search/ClkNetwork.cc +++ b/search/ClkNetwork.cc @@ -146,6 +146,22 @@ ClkNetwork::isClock(const Pin *pin) const return pin_clks_map_.hasKey(pin); } +bool +ClkNetwork::isClock(const Net *net) const +{ + bool is_clk = false; + NetConnectedPinIterator *pin_iter = network_->pinIterator(net); + while (pin_iter->hasNext()) { + Pin *pin = pin_iter->next(); + if (isClock(pin)) { + is_clk = true; + break; + } + } + delete pin_iter; + return is_clk; +} + bool ClkNetwork::isIdealClock(const Pin *pin) const { @@ -170,4 +186,13 @@ ClkNetwork::idealClocks(const Pin *pin) return nullptr; } +const PinSet * +ClkNetwork::pins(const Clock *clk) +{ + if (clk_pins_map_.hasKey(clk)) + return &clk_pins_map_[clk]; + else + return nullptr; +} + } // namespace diff --git a/search/Sta.cc b/search/Sta.cc index 99ed8039..6701b277 100644 --- a/search/Sta.cc +++ b/search/Sta.cc @@ -5272,17 +5272,29 @@ Sta::ensureClkNetwork() } bool -Sta::isClock(Pin *pin) const +Sta::isClock(const Pin *pin) const { return clk_network_->isClock(pin); } bool -Sta::isIdealClock(Pin *pin) const +Sta::isClock(const Net *net) const +{ + return clk_network_->isClock(net); +} + +bool +Sta::isIdealClock(const Pin *pin) const { return clk_network_->isIdealClock(pin); } +const PinSet * +Sta::pins(const Clock *clk) +{ + return clk_network_->pins(clk); +} + void Sta::clkPinsInvalid() {