Implemented FILLS support for LEF/DEF

This commit is contained in:
Matthias Koefferlein 2021-02-21 18:27:25 +01:00
parent 96e3570c6d
commit 898dbf07e9
12 changed files with 209 additions and 10 deletions

View File

@ -1243,6 +1243,101 @@ DEFImporter::read_pins (db::Layout &layout, db::Cell &design, double scale)
}
}
void
DEFImporter::read_fills (db::Layout &layout, db::Cell &design, double scale)
{
std::map <std::pair<std::string, unsigned int>, std::vector <db::Polygon> > geometry;
while (test ("-")) {
if (test ("LAYER")) {
std::string ln = get ();
unsigned int mask = 0;
bool opc = false;
while (test ("+")) {
if (test ("MASK")) {
mask = get_mask (get_long ());
} else if (test ("OPC")) {
opc = true;
} else {
error (tl::to_string (tr ("'MASK' or 'OPC' keyword expected")));
}
}
std::vector <db::Polygon> polygons;
while (! test (";")) {
if (test ("RECT")) {
test ("(");
db::Point pt1 = get_point (scale);
test (")");
test ("(");
db::Point pt2 = get_point (scale);
test (")");
polygons.push_back (db::Polygon (db::Box (pt1, pt2)));
} else if (test ("POLYGON")) {
std::vector<db::Point> points;
double x = 0.0, y = 0.0;
while (test ("(")) {
if (! test ("*")) {
x = get_double ();
}
if (! test ("*")) {
y = get_double ();
}
points.push_back (db::Point (db::DPoint (x * scale, y * scale)));
expect (")");
}
polygons.push_back (db::Polygon ());
polygons.back ().assign_hull (points.begin (), points.end ());
} else {
error (tl::to_string (tr ("'RECT' or 'POLYGON' keyword expected")));
}
}
std::set<unsigned int> dl = open_layer (layout, ln, opc ? FillsOPC : Fills, mask);
if (! dl.empty ()) {
for (std::vector<db::Polygon>::const_iterator p = polygons.begin (); p != polygons.end (); ++p) {
for (std::set<unsigned int>::const_iterator l = dl.begin (); l != dl.end (); ++l) {
design.shapes (*l).insert (*p);
}
}
}
} else if (test ("VIA")) {
// TODO: implement
warn (tl::to_string (tr ("VIA not supported on fills currently")));
while (! at_end () && ! test (";")) {
take ();
}
} else {
error (tl::to_string (tr ("'LAYER' or 'VIA' keyword expected")));
}
}
}
void
DEFImporter::read_styles (double scale)
{
@ -1427,10 +1522,14 @@ DEFImporter::do_read (db::Layout &layout)
}
} else if (test ("FILLS")) {
// read over FILLS statements
while (! test ("END") || ! test ("FILLS")) {
take ();
}
// Read FILLS statements
get_long ();
expect (";");
read_fills (layout, design, scale);
expect ("END");
expect ("FILLS");
} else if (test ("SCANCHAINS")) {
// read over SCANCHAINS statements

View File

@ -82,10 +82,10 @@ private:
void read_regions (std::map<std::string, std::vector<db::Polygon> > &regions, double scale);
void read_groups (std::list<DEFImporterGroup> &groups, double scale);
void read_blockages (db::Layout &layout, db::Cell &design, double scale);
void read_fills (db::Layout &layout, db::Cell &design, double scale);
void read_nets (db::Layout &layout, db::Cell &design, double scale, bool specialnets);
void read_vias (db::Layout &layout, db::Cell &design, double scale);
void read_pins (db::Layout &layout, db::Cell &design, double scale);
void read_fills (db::Layout &layout, db::Cell &design, double scale);
void read_styles (double scale);
void read_components (Layout &layout, std::list<std::pair<std::string, db::CellInstArray> > &instances, double scale);
void read_single_net (std::string &nondefaultrule, db::Layout &layout, db::Cell &design, double scale, properties_id_type prop_id, bool specialnets);

View File

@ -714,7 +714,7 @@
<item>
<widget class="QTabWidget" name="layer_map_mode">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
@ -1352,6 +1352,17 @@ type ...</string>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>read_lef_with_def</tabstop>
<tabstop>lef_files</tabstop>
<tabstop>add_lef_file</tabstop>
<tabstop>del_lef_files</tabstop>
<tabstop>move_lef_files_up</tabstop>
<tabstop>move_lef_files_down</tabstop>
<tabstop>dbu</tabstop>
<tabstop>separate_groups</tabstop>
<tabstop>prefix_via_cellname</tabstop>
<tabstop>produce_lef_geo</tabstop>
<tabstop>produce_net_names</tabstop>
<tabstop>net_prop_name</tabstop>
<tabstop>produce_inst_names</tabstop>
@ -1364,6 +1375,10 @@ type ...</string>
<tabstop>placement_blockage_layer</tabstop>
<tabstop>produce_regions</tabstop>
<tabstop>region_layer</tabstop>
<tabstop>layer_map_mode</tabstop>
<tabstop>mapfile_path</tabstop>
<tabstop>browse_mapfile</tabstop>
<tabstop>scrollArea</tabstop>
<tabstop>produce_via_geometry</tabstop>
<tabstop>suffix_via_geometry</tabstop>
<tabstop>datatype_via_geometry</tabstop>
@ -1373,6 +1388,9 @@ type ...</string>
<tabstop>produce_lef_pins</tabstop>
<tabstop>suffix_lef_pins</tabstop>
<tabstop>datatype_lef_pins</tabstop>
<tabstop>produce_fills</tabstop>
<tabstop>suffix_fills</tabstop>
<tabstop>datatype_fills</tabstop>
<tabstop>produce_obstructions</tabstop>
<tabstop>suffix_obstructions</tabstop>
<tabstop>datatype_obstructions</tabstop>
@ -1385,8 +1403,10 @@ type ...</string>
<tabstop>produce_labels</tabstop>
<tabstop>suffix_labels</tabstop>
<tabstop>datatype_labels</tabstop>
<tabstop>mapfile_path</tabstop>
<tabstop>browse_mapfile</tabstop>
<tabstop>produce_blockages</tabstop>
<tabstop>suffix_blockages</tabstop>
<tabstop>datatype_blockages</tabstop>
<tabstop>read_all_cbx</tabstop>
</tabstops>
<resources>
<include location="../../../../lay/lay/layResources.qrc"/>

View File

@ -754,12 +754,12 @@ TEST(119_multimapping)
TEST(120_simplefill)
{
run_test (_this, "fill", "lef:simple.lef+def:simple.def+map:simple.map", "simple_au.oas.gz", default_options (), false);
run_test (_this, "fill", "map:simple.map+lef:simple.lef+def:simple.def", "simple_au.oas.gz", default_options (), false);
}
TEST(121_fillwithmask)
{
run_test (_this, "fill", "lef:with_mask.lef+def:with_mask.def+map:with_mask.map", "with_mask_au.oas.gz", default_options (), false);
run_test (_this, "fill", "map:with_mask.map+lef:with_mask.lef+def:with_mask.def", "with_mask_au.oas.gz", default_options (), false);
}
TEST(200_lefdef_plugin)

14
testdata/lefdef/fill/simple.def vendored Normal file
View File

@ -0,0 +1,14 @@
VERSION 5.8 ;
DESIGN test ;
DIEAREA ( 0 0 ) ( 4000 7000 ) ;
FILLS 2 ;
- LAYER M1
RECT ( 1000 2000 ) ( 1500 4000 )
RECT ( 1000 4500 ) ( 1500 6500 ) ;
- LAYER M2
RECT ( 1000 2000 ) ( 1500 4000 )
POLYGON ( 1000 500 ) ( 2000 1500 ) ( 3000 1500 ) ( 3000 500 ) ;
- LAYER M2 + OPC
RECT ( 3000 2000 ) ( 3500 4000 ) ;
END FILLS
END DESIGN

29
testdata/lefdef/fill/simple.lef vendored Normal file
View File

@ -0,0 +1,29 @@
VERSION 5.8 ;
BUSBITCHARS "[]" ;
DIVIDERCHAR "/" ;
UNITS
DATABASE MICRONS 2000 ;
END UNITS
MANUFACTURINGGRID 0.000500 ;
LAYER M1
TYPE ROUTING ;
DIRECTION HORIZONTAL ;
PITCH 100 ;
WIDTH 50 ;
SPACING 50 ;
END M1
LAYER VIA1
TYPE CUT ;
END VIA1
LAYER M2
TYPE ROUTING ;
DIRECTION VERTICAL ;
PITCH 100 ;
WIDTH 50 ;
SPACING 50 ;
END M2
END LIBRARY

4
testdata/lefdef/fill/simple.map vendored Normal file
View File

@ -0,0 +1,4 @@
DIEAREA ALL 100 0
M1 FILL 10 1
M2 FILL 20 2
M2 FILLOPC 20 3

BIN
testdata/lefdef/fill/simple_au.oas.gz vendored Normal file

Binary file not shown.

14
testdata/lefdef/fill/with_mask.def vendored Normal file
View File

@ -0,0 +1,14 @@
VERSION 5.8 ;
DESIGN test ;
DIEAREA ( 0 0 ) ( 4000 7000 ) ;
FILLS 2 ;
- LAYER M1 + MASK 1
RECT ( 1000 2000 ) ( 1500 4000 )
RECT ( 1000 4500 ) ( 1500 6500 ) ;
- LAYER M2 + MASK 2
RECT ( 1000 2000 ) ( 1500 4000 )
POLYGON ( 1000 500 ) ( 2000 1500 ) ( 3000 1500 ) ( 3000 500 ) ;
- LAYER M2 + MASK 2 + OPC
RECT ( 3000 2000 ) ( 3500 4000 ) ;
END FILLS
END DESIGN

15
testdata/lefdef/fill/with_mask.lef vendored Normal file
View File

@ -0,0 +1,15 @@
VERSION 5.8 ;
BUSBITCHARS "[]" ;
DIVIDERCHAR "/" ;
UNITS
DATABASE MICRONS 2000 ;
END UNITS
LAYER M1
TYPE ROUTING ;
END M1
LAYER M2
TYPE ROUTING ;
END M2
END LIBRARY

4
testdata/lefdef/fill/with_mask.map vendored Normal file
View File

@ -0,0 +1,4 @@
DIEAREA ALL 100 0
M1 FILL:MASK:1 10 1
M2 FILL:MASK:2 20 2
M2 FILLOPC:MASK:2 20 3

BIN
testdata/lefdef/fill/with_mask_au.oas.gz vendored Normal file

Binary file not shown.