@@ -95,7 +95,7 @@ bool _dbTechLayerAntennaRule::operator==(
9595 return false ;
9696 }
9797
98- if (gate_plus_diff_factor_ != rhs.gate_plus_diff_factor_ ) {
98+ if (gate_plus_diff_val_ != rhs.gate_plus_diff_val_ ) {
9999 return false ;
100100 }
101101
@@ -239,7 +239,7 @@ dbOStream& operator<<(dbOStream& stream, const _dbTechLayerAntennaRule& inrule)
239239 stream << inrule.par_sidearea_val_ ;
240240 stream << inrule.cum_sidearea_val_ ;
241241 stream << inrule.area_diff_reduce_val_ ;
242- stream << inrule.gate_plus_diff_factor_ ;
242+ stream << inrule.gate_plus_diff_val_ ;
243243 stream << inrule.area_minus_diff_factor_ ;
244244 stream << inrule.has_antenna_cumroutingpluscut_ ;
245245 return stream;
@@ -255,7 +255,13 @@ dbIStream& operator>>(dbIStream& stream, _dbTechLayerAntennaRule& inrule)
255255 stream >> inrule.par_sidearea_val_ ;
256256 stream >> inrule.cum_sidearea_val_ ;
257257 stream >> inrule.area_diff_reduce_val_ ;
258- stream >> inrule.gate_plus_diff_factor_ ;
258+ if (inrule.getDatabase ()->isSchema (kSchemaLef58AntennaGatePlusDiff )) {
259+ stream >> inrule.gate_plus_diff_val_ ;
260+ } else {
261+ double factor;
262+ stream >> factor;
263+ inrule.gate_plus_diff_val_ .ratio_ = factor;
264+ }
259265 stream >> inrule.area_minus_diff_factor_ ;
260266 stream >> inrule.has_antenna_cumroutingpluscut_ ;
261267 return stream;
@@ -292,10 +298,22 @@ void dbTechLayerAntennaRule::writeLef(lefout& writer) const
292298 fmt::print (writer.out (), " ANTENNACUMROUTINGPLUSCUT ;\n " );
293299 }
294300
295- if (ant_rule->gate_plus_diff_factor_ > 0.0 ) {
301+ if (ant_rule->gate_plus_diff_val_ .diff_ratio_ .size () > 1 ) {
302+ fmt::print (writer.out (), " ANTENNAGATEPLUSDIFF PWL ( " );
303+ dbVector<double >::const_iterator diffdx_itr;
304+ dbVector<double >::const_iterator ratio_itr;
305+ for (diffdx_itr = ant_rule->gate_plus_diff_val_ .diff_idx_ .begin (),
306+ ratio_itr = ant_rule->gate_plus_diff_val_ .diff_ratio_ .begin ();
307+ diffdx_itr != ant_rule->gate_plus_diff_val_ .diff_idx_ .end ()
308+ && ratio_itr != ant_rule->gate_plus_diff_val_ .diff_ratio_ .end ();
309+ diffdx_itr++, ratio_itr++) {
310+ fmt::print (writer.out (), " ( {:g} {:g} ) " , *diffdx_itr, *ratio_itr);
311+ }
312+ fmt::print (writer.out (), " ) ;\n " );
313+ } else if (ant_rule->gate_plus_diff_val_ .ratio_ > 0.0 ) {
296314 fmt::print (writer.out (),
297315 " ANTENNAGATEPLUSDIFF {:g} ;\n " ,
298- ant_rule->gate_plus_diff_factor_ );
316+ ant_rule->gate_plus_diff_val_ . ratio_ );
299317 }
300318
301319 if (ant_rule->area_minus_diff_factor_ > 0.0 ) {
@@ -639,13 +657,29 @@ void dbTechLayerAntennaRule::setAntennaCumRoutingPlusCut(bool value)
639657double dbTechLayerAntennaRule::getGatePlusDiffFactor () const
640658{
641659 _dbTechLayerAntennaRule* ant_rule = (_dbTechLayerAntennaRule*) this ;
642- return ant_rule->gate_plus_diff_factor_ ;
660+ return ant_rule->gate_plus_diff_val_ . ratio_ ;
643661}
644662
645663void dbTechLayerAntennaRule::setGatePlusDiffFactor (double factor)
646664{
647665 _dbTechLayerAntennaRule* ant_rule = (_dbTechLayerAntennaRule*) this ;
648- ant_rule->gate_plus_diff_factor_ = factor;
666+ ant_rule->gate_plus_diff_val_ .ratio_ = factor;
667+ }
668+
669+ dbTechLayerAntennaRule::pwl_pair dbTechLayerAntennaRule::getGatePlusDiffPWL ()
670+ const
671+ {
672+ _dbTechLayerAntennaRule* ant_rule = (_dbTechLayerAntennaRule*) this ;
673+ auto & rule = ant_rule->gate_plus_diff_val_ ;
674+ return {.indices = rule.diff_idx_ , .ratios = rule.diff_ratio_ };
675+ }
676+
677+ void dbTechLayerAntennaRule::setGatePlusDiffPWL (
678+ const std::vector<double >& diff_idx,
679+ const std::vector<double >& ratios)
680+ {
681+ _dbTechLayerAntennaRule* ant_rule = (_dbTechLayerAntennaRule*) this ;
682+ ant_rule->gate_plus_diff_val_ .setDiff (diff_idx, ratios);
649683}
650684
651685double dbTechLayerAntennaRule::getAreaMinusDiffFactor () const
0 commit comments