Skip to content

Commit

Permalink
Implemented a solution for issue #1528 (LEF WIDTHTABLE)
Browse files Browse the repository at this point in the history
The WIDTHTABLE is evaluated for normal and WRONGDIRECTION.
The first value is taken as min width and as default width.
  • Loading branch information
Matthias Koefferlein committed Dec 2, 2023
1 parent 5b4473e commit 1017026
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 31 deletions.
107 changes: 76 additions & 31 deletions src/plugins/streamers/lefdef/db_plugin/dbLEFImporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,80 @@ LEFImporter::read_viadef (Layout &layout, const std::string &nondefaultrule)
expect (n);
}

static void
read_width_property (const std::string &name, const std::string &value, double &w, double &w_wrongdir, double &wmin, double &wmin_wrongdir)
{
if (name == "LEF58_MINWIDTH") {

// Cadence extension
tl::Extractor ex (value.c_str ());
double v = 0.0;
if (ex.test ("MINWIDTH") && ex.try_read (v)) {
if (ex.test ("WRONGDIRECTION")) {
wmin_wrongdir = v;
} else {
wmin = v;
}
}

} else if (name == "LEF58_WIDTH") {

// Cadence extension
tl::Extractor ex (value.c_str ());
double v = 0.0;
if (ex.test ("WIDTH") && ex.try_read (v)) {
if (ex.test ("WRONGDIRECTION")) {
w_wrongdir = v;
} else {
w = v;
}
}

} else if (name == "LEF58_WIDTHTABLE") {

// Cadence extension
tl::Extractor ex (value.c_str ());
while (! ex.at_end ()) {

if (ex.test ("WIDTHTABLE")) {

bool wrongdirection = false;
double v = 0.0;
double vv;
while (! ex.at_end () && *ex != ';') {
if (ex.try_read (vv)) {
if (v == 0.0 || vv < v) {
v = vv;
}
} else if (ex.test ("WRONGDIRECTION")) {
wrongdirection = true;
} else if (ex.test ("ORTHOGONAL")) {
// .. nothing yet ..
} else {
break;
}
}

if (v > 0.0) {
if (wrongdirection) {
w_wrongdir = wmin_wrongdir = v;
} else {
w = wmin = v;
}
}

}

while (! ex.at_end () && *ex != ';') {
++ex;
}
ex.test (";");

}

}
}

void
LEFImporter::read_layer (Layout & /*layout*/)
{
Expand Down Expand Up @@ -771,38 +845,9 @@ LEFImporter::read_layer (Layout & /*layout*/)
} else if (test ("PROPERTY")) {

while (! test (";") && ! at_end ()) {

std::string name = get ();
tl::Variant value = get ();

if (name == "LEF58_MINWIDTH") {

// Cadence extension
tl::Extractor ex (value.to_string ());
double v = 0.0;
if (ex.test ("MINWIDTH") && ex.try_read (v)) {
if (ex.test ("WRONGDIRECTION")) {
wmin_wrongdir = v;
} else {
wmin = v;
}
}

} else if (name == "LEF58_WIDTH") {

// Cadence extension
tl::Extractor ex (value.to_string ());
double v = 0.0;
if (ex.test ("WIDTH") && ex.try_read (v)) {
if (ex.test ("WRONGDIRECTION")) {
w_wrongdir = v;
} else {
w = v;
}
}

}

std::string value = get ();
read_width_property (name, value, w, w_wrongdir, wmin, wmin_wrongdir);
}

} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1018,3 +1018,9 @@ TEST(210_overlaps)
}


// issue-1528
TEST(212_widthtable)
{
run_test (_this, "issue-1528", "map:gds.map+lef:tech.lef+def:routed.def", "au.oas", default_options (), false);
}

Binary file added testdata/lefdef/issue-1528/au.oas
Binary file not shown.
1 change: 1 addition & 0 deletions testdata/lefdef/issue-1528/gds.map
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mx NET 10 0
13 changes: 13 additions & 0 deletions testdata/lefdef/issue-1528/routed.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
VERSION 5.8 ;
DIVIDERCHAR "/" ;
BUSBITCHARS "[]" ;
DESIGN block ;
UNITS DISTANCE MICRONS 2000 ;
DIEAREA ( 0 0 ) ( 3000 1000 ) ;
NETS 1 ;
- n1 + USE SIGNAL
+ ROUTED mx ( 1000 520 ) ( 2500 * )
NEW mx ( 1000 520 ) ( * 880 )
;
END NETS
END DESIGN
19 changes: 19 additions & 0 deletions testdata/lefdef/issue-1528/tech.lef
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
VERSION 5.8 ;

BUSBITCHARS "[]" ;
DIVIDERCHAR "/" ;

UNITS
DATABASE MICRONS 2000 ;
END UNITS

LAYER mx
TYPE ROUTING ;
WIDTH 0.04 ;
DIRECTION HORIZONTAL ;
PROPERTY LEF58_WIDTHTABLE "
WIDTHTABLE 0.08 ;
WIDTHTABLE 0.12 WRONGDIRECTION ;
" ;
END mx
END LIBRARY

0 comments on commit 1017026

Please sign in to comment.