Fixed a pending TODO from issue #1470

This commit is contained in:
Matthias Koefferlein 2025-07-21 20:56:32 +02:00
parent 2d5778a860
commit cb4511b721
2 changed files with 12 additions and 4 deletions

View File

@ -26,6 +26,7 @@
#include "tlGlobPattern.h"
#include <cmath>
#include <cctype>
namespace db
{
@ -1233,16 +1234,23 @@ DEFImporter::read_vias (db::Layout &layout, db::Cell & /*design*/, double scale)
// issue #1470
static std::string fix_pin_name (const std::string &pin_name)
{
auto pos = pin_name.find (".extra");
const std::string extra (".extra");
auto pos = pin_name.find (extra);
if (pos == std::string::npos) {
return pin_name;
} else {
// TODO: do we need to be more specific?
// Formally, the allowed specs are:
// pinname.extraN
// pinname.extraN[n]
// pinname.extraN[n][m]...
return std::string (pin_name.begin (), pin_name.begin () + pos);
// where N = a sequence of digits -
// we only remove the ".extraN".
std::string result (pin_name.begin (), pin_name.begin () + pos);
auto i = pos + extra.size ();
for ( ; i != pin_name.size () && isdigit (pin_name [i]); ++i)
;
result += std::string (pin_name.begin () + i, pin_name.end ());
return result;
}
}

View File

@ -432,7 +432,7 @@ TEST(def16)
// (complete example)
db::LEFDEFReaderOptions opt = default_options ();
opt.set_macro_resolution_mode (1);
run_test (_this, "def16", "lef:a.lef+lef:tech.lef+def:a.def", "au_4c.oas.gz", opt);
run_test (_this, "def16", "lef:a.lef+lef:tech.lef+def:a.def", "au_4d.oas.gz", opt);
}
TEST(100)