Skip to content

Commit cf06016

Browse files
authored
Add PropertyRegistry for Clock. (The-OpenROAD-Project#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>
1 parent 8e50916 commit cf06016

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

include/sta/Property.hh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ public:
9494
const std::string property);
9595

9696
// Define handler for external property.
97-
// proerties->defineProperty("foo",
98-
// [] (const Instance *, Sta *) -> PropertyValue {
99-
// return PropertyValue("bar");
100-
// });
97+
// properties->defineProperty("foo",
98+
// [] (const Instance *, Sta *) -> PropertyValue {
99+
// return PropertyValue("bar");
100+
// });
101101
void defineProperty(std::string &property,
102102
PropertyRegistry<const Library *>::PropertyHandler handler);
103103
void defineProperty(std::string &property,
@@ -116,6 +116,8 @@ public:
116116
PropertyRegistry<const Pin *>::PropertyHandler handler);
117117
void defineProperty(std::string &property,
118118
PropertyRegistry<const Net *>::PropertyHandler handler);
119+
void defineProperty(std::string &property,
120+
PropertyRegistry<const Clock *>::PropertyHandler handler);
119121

120122
protected:
121123
PropertyValue portSlew(const Port *port,
@@ -159,6 +161,7 @@ protected:
159161
PropertyRegistry<const Instance*> registry_instance_;
160162
PropertyRegistry<const Pin*> registry_pin_;
161163
PropertyRegistry<const Net*> registry_net_;
164+
PropertyRegistry<const Clock*> registry_clock_;
162165

163166
Sta *sta_;
164167
};

search/Property.cc

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,8 +1240,14 @@ Properties::getProperty(const Clock *clk,
12401240
return PropertyValue(clk->isVirtual());
12411241
else if (property == "is_propagated")
12421242
return PropertyValue(clk->isPropagated());
1243-
else
1244-
throw PropertyUnknown("clock", property);
1243+
else {
1244+
PropertyValue value = registry_clock_.getProperty(clk, property,
1245+
"clock", sta_);
1246+
if (value.type() != PropertyValue::Type::type_none)
1247+
return value;
1248+
else
1249+
throw PropertyUnknown("clock", property);
1250+
}
12451251
}
12461252

12471253
////////////////////////////////////////////////////////////////
@@ -1376,6 +1382,13 @@ Properties::defineProperty(std::string &property,
13761382
registry_net_.defineProperty(property, handler);
13771383
}
13781384

1385+
void
1386+
Properties::defineProperty(std::string &property,
1387+
PropertyRegistry<const Clock *>::PropertyHandler handler)
1388+
{
1389+
registry_clock_.defineProperty(property, handler);
1390+
}
1391+
13791392
////////////////////////////////////////////////////////////////
13801393

13811394
template<class TYPE>

0 commit comments

Comments
 (0)