Add PropertyRegistry for Clock. (#298)

* Add PropertyRegistry for Clock.

Signed-off-by: Mike Inouye <mikeinouye@google.com>

* Remove extra blank line.

---------

Signed-off-by: Mike Inouye <mikeinouye@google.com>
This commit is contained in:
Mike Inouye 2025-09-17 14:19:22 -07:00 committed by GitHub
parent 8e50916693
commit cf060169aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 6 deletions

View File

@ -94,7 +94,7 @@ public:
const std::string property); const std::string property);
// Define handler for external property. // Define handler for external property.
// proerties->defineProperty("foo", // properties->defineProperty("foo",
// [] (const Instance *, Sta *) -> PropertyValue { // [] (const Instance *, Sta *) -> PropertyValue {
// return PropertyValue("bar"); // return PropertyValue("bar");
// }); // });
@ -116,6 +116,8 @@ public:
PropertyRegistry<const Pin *>::PropertyHandler handler); PropertyRegistry<const Pin *>::PropertyHandler handler);
void defineProperty(std::string &property, void defineProperty(std::string &property,
PropertyRegistry<const Net *>::PropertyHandler handler); PropertyRegistry<const Net *>::PropertyHandler handler);
void defineProperty(std::string &property,
PropertyRegistry<const Clock *>::PropertyHandler handler);
protected: protected:
PropertyValue portSlew(const Port *port, PropertyValue portSlew(const Port *port,
@ -159,6 +161,7 @@ protected:
PropertyRegistry<const Instance*> registry_instance_; PropertyRegistry<const Instance*> registry_instance_;
PropertyRegistry<const Pin*> registry_pin_; PropertyRegistry<const Pin*> registry_pin_;
PropertyRegistry<const Net*> registry_net_; PropertyRegistry<const Net*> registry_net_;
PropertyRegistry<const Clock*> registry_clock_;
Sta *sta_; Sta *sta_;
}; };

View File

@ -1240,9 +1240,15 @@ Properties::getProperty(const Clock *clk,
return PropertyValue(clk->isVirtual()); return PropertyValue(clk->isVirtual());
else if (property == "is_propagated") else if (property == "is_propagated")
return PropertyValue(clk->isPropagated()); return PropertyValue(clk->isPropagated());
else {
PropertyValue value = registry_clock_.getProperty(clk, property,
"clock", sta_);
if (value.type() != PropertyValue::Type::type_none)
return value;
else else
throw PropertyUnknown("clock", property); throw PropertyUnknown("clock", property);
} }
}
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
@ -1376,6 +1382,13 @@ Properties::defineProperty(std::string &property,
registry_net_.defineProperty(property, handler); registry_net_.defineProperty(property, handler);
} }
void
Properties::defineProperty(std::string &property,
PropertyRegistry<const Clock *>::PropertyHandler handler)
{
registry_clock_.defineProperty(property, handler);
}
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
template<class TYPE> template<class TYPE>