From cf060169aac49ee9faa73a97e39bc1fcf400a2ac Mon Sep 17 00:00:00 2001 From: Mike Inouye Date: Wed, 17 Sep 2025 14:19:22 -0700 Subject: [PATCH] Add PropertyRegistry for Clock. (#298) * Add PropertyRegistry for Clock. Signed-off-by: Mike Inouye * Remove extra blank line. --------- Signed-off-by: Mike Inouye --- include/sta/Property.hh | 11 +++++++---- search/Property.cc | 17 +++++++++++++++-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/include/sta/Property.hh b/include/sta/Property.hh index aa9270ae..9ddafeac 100644 --- a/include/sta/Property.hh +++ b/include/sta/Property.hh @@ -94,10 +94,10 @@ public: const std::string property); // Define handler for external property. - // proerties->defineProperty("foo", - // [] (const Instance *, Sta *) -> PropertyValue { - // return PropertyValue("bar"); - // }); + // properties->defineProperty("foo", + // [] (const Instance *, Sta *) -> PropertyValue { + // return PropertyValue("bar"); + // }); void defineProperty(std::string &property, PropertyRegistry::PropertyHandler handler); void defineProperty(std::string &property, @@ -116,6 +116,8 @@ public: PropertyRegistry::PropertyHandler handler); void defineProperty(std::string &property, PropertyRegistry::PropertyHandler handler); + void defineProperty(std::string &property, + PropertyRegistry::PropertyHandler handler); protected: PropertyValue portSlew(const Port *port, @@ -159,6 +161,7 @@ protected: PropertyRegistry registry_instance_; PropertyRegistry registry_pin_; PropertyRegistry registry_net_; + PropertyRegistry registry_clock_; Sta *sta_; }; diff --git a/search/Property.cc b/search/Property.cc index 67aa3aac..ad63155c 100644 --- a/search/Property.cc +++ b/search/Property.cc @@ -1240,8 +1240,14 @@ Properties::getProperty(const Clock *clk, return PropertyValue(clk->isVirtual()); else if (property == "is_propagated") return PropertyValue(clk->isPropagated()); - else - throw PropertyUnknown("clock", property); + else { + PropertyValue value = registry_clock_.getProperty(clk, property, + "clock", sta_); + if (value.type() != PropertyValue::Type::type_none) + return value; + else + throw PropertyUnknown("clock", property); + } } //////////////////////////////////////////////////////////////// @@ -1376,6 +1382,13 @@ Properties::defineProperty(std::string &property, registry_net_.defineProperty(property, handler); } +void +Properties::defineProperty(std::string &property, + PropertyRegistry::PropertyHandler handler) +{ + registry_clock_.defineProperty(property, handler); +} + //////////////////////////////////////////////////////////////// template