Fixed DEF reader, updated golden test data.

This commit is contained in:
Matthias Koefferlein 2020-06-01 15:04:25 +02:00
parent d7af7fc5c0
commit 4aa1364e4b
6 changed files with 46 additions and 7 deletions

View File

@ -730,19 +730,30 @@ DEFImporter::read_nets (db::Layout &layout, db::Cell &design, double scale, bool
} else {
bool prefixed = false;
bool can_have_rect_or_polygon = true;
bool can_have_rect_polygon_or_via = true;
if ((was_shield = test ("SHIELD")) == true || test ("NOSHIELD") || test ("ROUTED") || test ("FIXED") || test ("COVER")) {
if (was_shield) {
take ();
}
prefixed = true;
can_have_rect_or_polygon = test ("+");
can_have_rect_polygon_or_via = test ("+");
}
bool any = false;
if (can_have_rect_or_polygon && test ("POLYGON")) {
if (can_have_rect_polygon_or_via) {
if (test ("SHAPE")) {
take ();
test ("+");
}
if (test ("MASK")) {
get_long ();
test ("+");
}
}
if (can_have_rect_polygon_or_via && test ("POLYGON")) {
std::string ln = get ();
@ -760,7 +771,7 @@ DEFImporter::read_nets (db::Layout &layout, db::Cell &design, double scale, bool
any = true;
} else if (can_have_rect_or_polygon && test ("RECT")) {
} else if (can_have_rect_polygon_or_via && test ("RECT")) {
std::string ln = get ();
@ -778,6 +789,24 @@ DEFImporter::read_nets (db::Layout &layout, db::Cell &design, double scale, bool
any = true;
} else if (can_have_rect_polygon_or_via && test ("VIA")) {
std::string vn = get ();
db::FTrans ft = get_orient (true /*optional*/);
test ("(");
db::Vector pt = get_vector (scale);
test (")");
std::map<std::string, ViaDesc>::const_iterator vd = m_via_desc.find (vn);
if (vd != m_via_desc.end ()) {
design.insert (db::CellInstArray (db::CellInst (vd->second.cell->cell_index ()), db::Trans (ft.rot (), pt)));
} else {
error (tl::to_string (tr ("Invalid via name: ")) + vn);
}
any = true;
} else if (prefixed) {
read_single_net (nondefaultrule, layout, design, scale, prop_id, specialnets);

View File

@ -131,7 +131,15 @@ static void run_test (tl::TestBase *_this, const char *lef_dir, const char *file
// normalize the layout by writing to OASIS and reading from ..
std::string tmp_file = _this->tmp_file ("tmp.oas");
// generate a "unique" name ...
unsigned int hash = 0;
if (au) {
for (const char *cp = au; *cp; ++cp) {
hash = (hash << 4) ^ (hash >> 4) ^ ((unsigned int) *cp);
}
}
std::string tmp_file = _this->tmp_file (tl::sprintf ("tmp_%x.oas", hash));
{
tl::OutputStream stream (tmp_file);

Binary file not shown.

View File

@ -16,12 +16,14 @@ VIAS 1 ;
END VIAS
SPECIALNETS 1 ;
- dummy
+ ROUTED + RECT M2 ( 350 0 ) ( 200 100 )
+ ROUTED + RECT M2 ( 350 0 ) ( 250 100 )
+ POLYGON M1 ( 300 0 ) ( 300 50 ) ( 350 50 ) ( 400 100 ) ( 400 0 )
+ ROUTED + POLYGON M2 ( 300 150 ) ( 300 200 ) ( 350 200 ) ( 400 250 ) ( 400 150 )
+ RECT M1 ( 0 0 ) ( 100 200 )
+ ROUTED M1 30 ( 0 0 15 ) ( 100 0 0 ) VIA1_dummy ( 100 100 10 )
+ ROUTED M1 30 + MASK 2 ( 0 0 15 ) ( 100 0 0 ) VIA1_dummy ( 100 100 10 )
+ ROUTED M2 50 + SHAPE RING + STYLE 1 ( 0 100 ) ( 100 200 ) ( 200 200 )
+ ROUTED + MASK 2 + RECT M2 ( 250 0 ) ( 150 100 )
+ ROUTED + SHAPE RING + MASK 1 + VIA VIA1_dummy E ( 200 200 )
;
END SPECIALNETS
END DESIGN