mirror of https://github.com/KLayout/klayout.git
Rework: need to properly parse NAME records in map files, adjusted test data
This commit is contained in:
parent
b02a4a3bfa
commit
4c3729631a
|
|
@ -998,39 +998,60 @@ LEFDEFReaderState::read_map_file (const std::string &path, db::Layout &layout)
|
|||
// into a canonical name mapping like
|
||||
// "(M1/LABELS): M1.LABEL"
|
||||
// "(M2/LABELS): M2.LABEL"
|
||||
// supported purposes: PINS(->Label), LEFPINS(->LEFLabels)
|
||||
|
||||
LayerPurpose label_purpose = Pins;
|
||||
std::vector< std::pair<std::string, LayerPurpose> > layer_defs;
|
||||
|
||||
std::vector<std::string> layer_names;
|
||||
std::vector<std::string> purposes = tl::split (w2, ",");
|
||||
for (std::vector<std::string>::const_iterator p = purposes.begin (); p != purposes.end (); ++p) {
|
||||
|
||||
if (*p == "DIEAREA" || *p == "ALL" || *p == "COMP") {
|
||||
|
||||
tl::warn << tl::sprintf (tl::to_string (tr ("Reading layer map file %s, line %d: NAME record ignored for entity: %s")), path, ts.line_number (), *p);
|
||||
|
||||
} else {
|
||||
|
||||
std::vector<std::string> lp = tl::split (*p, "/");
|
||||
|
||||
if (lp.size () > 1) {
|
||||
|
||||
LayerPurpose label_purpose = Pins;
|
||||
std::map<std::string, LayerPurpose>::const_iterator i = purpose_translation.find (lp[1]);
|
||||
if (i != purpose_translation.end ()) {
|
||||
label_purpose = i->second;
|
||||
}
|
||||
|
||||
if (label_purpose == Pins || label_purpose == LEFPins) {
|
||||
layer_defs.push_back (std::make_pair (lp.front (), label_purpose == Pins ? Label : LEFLabel));
|
||||
} else {
|
||||
tl::warn << tl::sprintf (tl::to_string (tr ("Reading layer map file %s, line %d: NAME record ignored for purpose: %s")), path, ts.line_number (), purpose_to_name (label_purpose));
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
layer_defs.push_back (std::make_pair (lp.front (), Label));
|
||||
layer_defs.push_back (std::make_pair (lp.front (), LEFLabel));
|
||||
|
||||
}
|
||||
layer_names.push_back (lp.front ());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (label_purpose == Pins || label_purpose == LEFPins) {
|
||||
std::string final_name;
|
||||
for (std::vector< std::pair<std::string, LayerPurpose> >::const_iterator i = layer_defs.begin (); i != layer_defs.end (); ++i) {
|
||||
if (! final_name.empty ()) {
|
||||
final_name += "/";
|
||||
}
|
||||
final_name += i->first + "." + purpose_to_name (i->second);
|
||||
}
|
||||
|
||||
LayerPurpose layer_purpose = label_purpose == Pins ? Label : LEFLabel;
|
||||
|
||||
std::string final_name = tl::join (layer_names, "/") + "." + purpose_to_name (layer_purpose);
|
||||
for (std::vector<std::string>::const_iterator ln = layer_names.begin (); ln != layer_names.end (); ++ln) {
|
||||
for (std::vector<int>::const_iterator l = layers.begin (); l != layers.end (); ++l) {
|
||||
for (std::vector<int>::const_iterator d = datatypes.begin (); d != datatypes.end (); ++d) {
|
||||
layer_map [std::make_pair (*ln, LayerDetailsKey (layer_purpose))].push_back (db::LayerProperties (*l, *d, final_name));
|
||||
}
|
||||
for (std::vector< std::pair<std::string, LayerPurpose> >::const_iterator i = layer_defs.begin (); i != layer_defs.end (); ++i) {
|
||||
for (std::vector<int>::const_iterator l = layers.begin (); l != layers.end (); ++l) {
|
||||
for (std::vector<int>::const_iterator d = datatypes.begin (); d != datatypes.end (); ++d) {
|
||||
layer_map [std::make_pair (i->first, LayerDetailsKey (i->second))].push_back (db::LayerProperties (*l, *d, final_name));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (w1 == "COMP") {
|
||||
|
|
|
|||
|
|
@ -335,6 +335,13 @@ TEST(22)
|
|||
run_test (_this, "def13", "map:test.map+lef:test.lef_5.8+def:top.def.gz", "au2.oas.gz", opt);
|
||||
}
|
||||
|
||||
TEST(23)
|
||||
{
|
||||
db::LEFDEFReaderOptions opt = default_options ();
|
||||
opt.set_macro_resolution_mode (1);
|
||||
run_test (_this, "def14", "map:test.map+lef:tech.lef+lef:stdlib.lef+def:test.def", "au.oas.gz", opt);
|
||||
}
|
||||
|
||||
TEST(100)
|
||||
{
|
||||
run_test (_this, "issue-172", "lef:in.lef+def:in.def", "au.oas.gz", default_options (), false);
|
||||
|
|
@ -726,11 +733,11 @@ TEST(117_mapfile_all)
|
|||
"'\\'M1.FILLOPC:2\\' : \\'M1.FILLOPC:2\\' (11/0)';"
|
||||
"'\\'M1.VIA:SIZE0.05X0.05\\' : \\'M1.VIA:SIZE0.05X0.05\\' (20/0)';"
|
||||
"'\\'M1.VIA:SIZE3X3\\' : \\'M1.VIA:SIZE3X3\\' (21/0)';"
|
||||
"'+M1.LABEL : M1.LABEL (26/0)';"
|
||||
"'+M1.LABEL : M1.LABEL (27/0)';"
|
||||
"'+M1.LABEL : M1.LABEL (28/1)';"
|
||||
"'M1.LABEL : M1.LABEL (26/0)';"
|
||||
// NAME M1/NET not supported: "'+M1.LABEL : M1.LABEL (27/0)';"
|
||||
// NAME M1/SPNET not supported: "'+M1.LABEL : M1.LABEL (28/1)';"
|
||||
"'+M1.BLK : M1.BLK (13/0)';"
|
||||
"'M1_TEXT.LABEL : M1_TEXT.LABEL (29/0)'"
|
||||
"'M1_TEXT.LABEL;M1_TEXT.LEFLABEL : \\'M1_TEXT.LABEL/M1_TEXT.LEFLABEL\\' (29/0)'"
|
||||
")"
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,5 +14,6 @@ M1 BLOCKAGEFILL 12 150
|
|||
M1 BLOCKAGE 12 151
|
||||
M1 FILL 12 152
|
||||
NAME M1/PIN 12 10
|
||||
NAME M1/LEFPIN 12 10
|
||||
VIA1 LEFPIN,LEFOBS,VIA,PIN,NET,SPNET 13 0
|
||||
M2 LEFPIN,LEFOBS,PIN,NET,SPNET,VIA 14 0
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue