Fixing issue #1724 (avoid duplicate LEF files)

This commit is contained in:
Matthias Koefferlein 2024-05-30 16:21:52 +02:00
parent 48b32733c2
commit c70e622590
8 changed files with 99 additions and 4 deletions

View File

@ -160,9 +160,12 @@ LEFDEFReader::read_lefdef (db::Layout &layout, const db::LoadLayoutOptions &opti
DEFImporter importer (warn_level ());
std::set<std::string> lef_files_read;
for (std::vector<std::string>::const_iterator l = effective_options.begin_lef_files (); l != effective_options.end_lef_files (); ++l) {
std::string lp = correct_path (*l, layout, base_path);
lef_files_read.insert (tl::normalize_path (lp));
tl::SelfTimer timer (tl::verbosity () >= 21, tl::to_string (tr ("Reading LEF file: ")) + lp);
@ -187,11 +190,16 @@ LEFDEFReader::read_lefdef (db::Layout &layout, const db::LoadLayoutOptions &opti
std::string lp = tl::combine_path (input_dir, *e);
tl::SelfTimer timer (tl::verbosity () >= 21, tl::to_string (tr ("Reading LEF file: ")) + lp);
// skip if already read (issue-1724)
if (lef_files_read.find (tl::normalize_path (lp)) == lef_files_read.end ()) {
tl::InputStream lef_stream (lp);
tl::log << tl::to_string (tr ("Reading")) << " " << lp;
importer.read_lef (lef_stream, layout, state);
tl::SelfTimer timer (tl::verbosity () >= 21, tl::to_string (tr ("Reading LEF file: ")) + lp);
tl::InputStream lef_stream (lp);
tl::log << tl::to_string (tr ("Reading")) << " " << lp;
importer.read_lef (lef_stream, layout, state);
}
}

View File

@ -1050,3 +1050,30 @@ TEST(212_widthtable)
run_test (_this, "issue-1528", "map:gds.map+lef:tech.lef+def:routed.def", "au.oas", default_options (), false);
}
// issue-1724 (skip duplicate LEF)
TEST(213_no_duplicate_LEF)
{
db::Layout ly;
std::string fn_path (tl::testdata ());
fn_path += "/lefdef/issue-1724/";
db::LEFDEFReaderOptions lefdef_opt = default_options ();
lefdef_opt.set_map_file ("tech.map");
std::vector<std::string> lf;
lf.push_back ("d/tech.lef");
lf.push_back ("blocks.lef");
lefdef_opt.set_lef_files (lf);
lefdef_opt.set_read_lef_with_def (true);
db::LoadLayoutOptions opt;
opt.set_options (lefdef_opt);
{
tl::InputStream is (fn_path + "top.def");
db::Reader reader (is);
reader.read (ly, opt);
}
db::compare_layouts (_this, ly, fn_path + "au.oas", db::WriteOAS);
}

BIN
testdata/lefdef/issue-1724/au.oas vendored Normal file

Binary file not shown.

31
testdata/lefdef/issue-1724/blocks.lef vendored Normal file
View File

@ -0,0 +1,31 @@
VERSION 5.8 ;
MACRO a
ORIGIN 0 0 ;
SIZE 600 BY 600 ;
OBS
LAYER M1 ;
RECT 10 10 590 590 ;
END
END a
MACRO b
ORIGIN -600 0 ;
SIZE 400 BY 500 ;
OBS
LAYER M1 ;
RECT 610 10 990 490 ;
END
END b
MACRO c
ORIGIN -500 -500 ;
SIZE 500 BY 500 ;
OBS
LAYER M1 ;
POLYGON 510 610 610 610 610 510 990 510 990 990 510 990 ;
LAYER overlap ;
RECT 500 700 1000 1000 ;
POLYGON 500 600 600 600 600 500 1000 500 1000 700 500 700 ;
END
END c

12
testdata/lefdef/issue-1724/d/tech.lef vendored Normal file
View File

@ -0,0 +1,12 @@
VERSION 5.8 ;
LAYER M1
TYPE ROUTING ;
DIRECTION HORIZONTAL ;
WIDTH 0.1 ;
PITCH 0.1 ;
END M1
LAYER overlap
TYPE OVERLAP ;
END overlap

6
testdata/lefdef/issue-1724/tech.map vendored Normal file
View File

@ -0,0 +1,6 @@
DIEAREA ALL 1 0
#BOUNDARY DIEAREA 1 0
BOUNDARY MACRO 1 0
#M1 LEFOBS 2 0
M1 LEFOBS 3 0
M1 BLOCKAGE 3 0

10
testdata/lefdef/issue-1724/top vendored Normal file
View File

@ -0,0 +1,10 @@
VERSION 5.8 ;
DESIGN top ;
UNITS DISTANCE MICRONS 1000 ;
DIEAREA ( 0 0 ) ( 1000000 1000000 ) ;
COMPONENTS 3 ;
- a a + PLACED ( 0 0 ) N ;
- b b + PLACED ( 600000 0 ) N ;
- c c + PLACED ( 500000 500000 ) N ;
END COMPONENTS
END DESIGN

1
testdata/lefdef/issue-1724/top.def vendored Symbolic link
View File

@ -0,0 +1 @@
top