Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/odb/src/lefin/ArraySpacingParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,31 +60,31 @@ bool ArraySpacingParser::parse(const std::string& s)
{
rule_ = dbTechLayerArraySpacingRule::create(layer_);

qi::rule<std::string::const_iterator, space_type> CUTCLASS
qi::rule<std::string::const_iterator, space_type> cut_class_rule
= (lit("CUTCLASS")
>> _string[boost::bind(&ArraySpacingParser::setCutClass, this, _1)]);
qi::rule<std::string::const_iterator, space_type> VIA_WIDTH
qi::rule<std::string::const_iterator, space_type> via_width_rule
= (lit("WIDTH")
>> double_[boost::bind(&ArraySpacingParser::setViaWidth, this, _1)]);
qi::rule<std::string::const_iterator, space_type> ARRAYCUTS
qi::rule<std::string::const_iterator, space_type> array_cuts_rule
= (lit("ARRAYCUTS") >> int_ >> lit("SPACING") >> double_)[boost::bind(
&ArraySpacingParser::setArraySpacing, this, _1)];
qi::rule<std::string::const_iterator, space_type> WITHIN
qi::rule<std::string::const_iterator, space_type> within_rule
= (lit("WITHIN") >> double_ >> lit("ARRAYWIDTH")
>> double_)[boost::bind(&ArraySpacingParser::setWithin, this, _1)];

qi::rule<std::string::const_iterator, space_type> LEF58_ARRAYSPACING
= (lit("ARRAYSPACING") >> -(CUTCLASS)
qi::rule<std::string::const_iterator, space_type> lef58_array_spacing_rule
= (lit("ARRAYSPACING") >> -(cut_class_rule)
>> -lit("PARALLELOVERLAP")[boost::bind(
&dbTechLayerArraySpacingRule::setParallelOverlap, rule_, true)]
>> -lit("LONGARRAY")[boost::bind(
&dbTechLayerArraySpacingRule::setLongArray, rule_, true)]
>> -VIA_WIDTH >> -WITHIN >> lit("CUTSPACING")
>> -via_width_rule >> -within_rule >> lit("CUTSPACING")
>> double_[boost::bind(&ArraySpacingParser::setCutSpacing, this, _1)]
>> +ARRAYCUTS >> lit(";"));
>> +array_cuts_rule >> lit(";"));
auto first = s.begin();
auto last = s.end();
bool valid = qi::phrase_parse(first, last, LEF58_ARRAYSPACING, space)
bool valid = qi::phrase_parse(first, last, lef58_array_spacing_rule, space)
&& first == last;

if (!valid && rule_ != nullptr) { // fail if we did not get a full match
Expand All @@ -93,4 +93,4 @@ bool ArraySpacingParser::parse(const std::string& s)
return valid;
}

} // namespace odb
} // namespace odb
19 changes: 10 additions & 9 deletions src/odb/src/lefin/KeepOutZoneParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ void KeepOutZoneParser::parse(const std::string& s)
// Parse a single keep-out zone rule
// Format: KEEPOUTZONE CUTCLASS name [TO name] [EXCEPTEXACTALIGNED [SIDE|END]
// spacing]
// EXTENSION side forward [ENDEXTENSION endside endforward SIDEEXTENSION
// sideside sideforward] SPIRALEXTENSION spacing ;
// EXTENSION side forward [ENDEXTENSION endside endforward
// SIDEEXTENSION sideside sideforward] SPIRALEXTENSION spacing ;
bool KeepOutZoneParser::parseSubRule(const std::string& s)
{
rule_ = dbTechLayerKeepOutZoneRule::create(layer_);
qi::rule<std::string::const_iterator, space_type> EXCEPTEXACTALIGNED
qi::rule<std::string::const_iterator, space_type> except_exact_aligned_rule
= (lit("EXCEPTEXACTALIGNED")
>> -(lit("SIDE")[boost::bind(
&dbTechLayerKeepOutZoneRule::setExceptAlignedSide,
Expand All @@ -58,7 +58,7 @@ bool KeepOutZoneParser::parseSubRule(const std::string& s)
this,
_1,
&odb::dbTechLayerKeepOutZoneRule::setAlignedSpacing)]);
qi::rule<std::string::const_iterator, space_type> EXTENSION
qi::rule<std::string::const_iterator, space_type> extension_rule
= ((lit("EXTENSION") >> double_[boost::bind(
&KeepOutZoneParser::setInt,
this,
Expand Down Expand Up @@ -89,22 +89,23 @@ bool KeepOutZoneParser::parseSubRule(const std::string& s)
this,
_1,
&odb::dbTechLayerKeepOutZoneRule::setSideForwardExtension)]));
qi::rule<std::string::const_iterator, space_type> SPIRALEXTENSION
qi::rule<std::string::const_iterator, space_type> spiral_extension_rule
= ((lit("SPIRALEXTENSION") >> double_[boost::bind(
&KeepOutZoneParser::setInt,
this,
_1,
&odb::dbTechLayerKeepOutZoneRule::setSpiralExtension)]));

qi::rule<std::string::const_iterator, space_type> LEF58_KEEPOUTZONE
qi::rule<std::string::const_iterator, space_type> lef58_keepout_zone_rule
= (lit("KEEPOUTZONE") >> lit("CUTCLASS") >> _string[boost::bind(
&dbTechLayerKeepOutZoneRule::setFirstCutClass, rule_, _1)]
>> -(lit("TO") >> _string[boost::bind(
&dbTechLayerKeepOutZoneRule::setSecondCutClass, rule_, _1)])
>> -EXCEPTEXACTALIGNED >> EXTENSION >> SPIRALEXTENSION >> lit(";"));
>> -except_exact_aligned_rule >> extension_rule
>> spiral_extension_rule >> lit(";"));
auto first = s.begin();
auto last = s.end();
bool valid = qi::phrase_parse(first, last, LEF58_KEEPOUTZONE, space)
bool valid = qi::phrase_parse(first, last, lef58_keepout_zone_rule, space)
&& first == last;

if (!valid && rule_ != nullptr) { // fail if we did not get a full match
Expand All @@ -113,4 +114,4 @@ bool KeepOutZoneParser::parseSubRule(const std::string& s)
return valid;
}

} // namespace odb
} // namespace odb
Loading