WIP: test for multimapping in LEF/DEF

This commit is contained in:
Matthias Koefferlein 2020-12-19 21:28:22 +01:00
parent d4b5dab0db
commit 9688da9ffd
9 changed files with 90 additions and 36 deletions

View File

@ -32,34 +32,6 @@ namespace db
// --------------------------------------------------------------- // ---------------------------------------------------------------
// Common reader implementation // Common reader implementation
DB_PUBLIC void
join_layer_names (std::string &s, const std::string &n)
{
if (s == n) {
return;
}
if (! s.empty ()) {
size_t i = s.find (n);
if (i != std::string::npos && (i == 0 || s.c_str ()[i - 1] == ';')) {
char after = s.c_str ()[i + n.size ()];
if (after == 0 || after == ';') {
// n is already contained in s
return;
}
}
s += ";";
}
s += n;
}
// ---------------------------------------------------------------
// Common reader implementation
static const size_t null_id = std::numeric_limits<size_t>::max (); static const size_t null_id = std::numeric_limits<size_t>::max ();
CommonReader::CommonReader () CommonReader::CommonReader ()

View File

@ -31,9 +31,6 @@
namespace db namespace db
{ {
DB_PUBLIC void
join_layer_names (std::string &s, const std::string &n);
/** /**
* @brief The CellConflictResolution enum * @brief The CellConflictResolution enum
*/ */

View File

@ -30,6 +30,33 @@
namespace db namespace db
{ {
// ---------------------------------------------------------------
DB_PUBLIC void
join_layer_names (std::string &s, const std::string &n)
{
if (s == n) {
return;
}
if (! s.empty ()) {
size_t i = s.find (n);
if (i != std::string::npos && (i == 0 || s.c_str ()[i - 1] == ';')) {
char after = s.c_str ()[i + n.size ()];
if (after == 0 || after == ';') {
// n is already contained in s
return;
}
}
s += ";";
}
s += n;
}
// --------------------------------------------------------------- // ---------------------------------------------------------------
// ReaderBase implementation // ReaderBase implementation

View File

@ -54,6 +54,14 @@ public:
{ } { }
}; };
/**
* @brief Joins layer names into a single, combined layer
* @param s The first layer name and output
* @param n The name to add
*/
DB_PUBLIC void
join_layer_names (std::string &s, const std::string &n);
/** /**
* @brief The generic reader base class * @brief The generic reader base class
*/ */

View File

@ -1359,18 +1359,22 @@ std::set<unsigned int> LEFDEFReaderState::open_layer_uncached(db::Layout &layout
} }
} }
bool found = false; int lfound = -1;
if (lp_new.layer >= 0 && lp_new.datatype >= 0) { if (lp_new.layer >= 0 && lp_new.datatype >= 0) {
for (db::Layout::layer_iterator i = layout.begin_layers (); i != layout.end_layers () && ! found; ++i) { for (db::Layout::layer_iterator i = layout.begin_layers (); i != layout.end_layers () && lfound < 0; ++i) {
if ((*i).second->log_equal (lp_new)) { if ((*i).second->log_equal (lp_new)) {
found = true; lfound = int ((*i).first);
res.insert ((*i).first);
} }
} }
} }
if (! found) { if (lfound < 0) {
res.insert (layout.insert_layer (lp_new)); res.insert (layout.insert_layer (lp_new));
} else {
res.insert ((unsigned int) lfound);
db::LayerProperties lp_org = layout.get_properties ((unsigned int) lfound);
join_layer_names (lp_org.name, name);
layout.set_properties ((unsigned int) lfound, lp_org);
} }
if (l == ll.end ()) { if (l == ll.end ()) {

View File

@ -724,6 +724,24 @@ TEST(118_density)
run_test (_this, "density", "read:in.lef", "au.oas.gz", default_options (), false); run_test (_this, "density", "read:in.lef", "au.oas.gz", default_options (), false);
} }
TEST(119_multimapping)
{
db::LEFDEFReaderOptions options = default_options ();
db::LayerMap lm = db::LayerMap::from_string_file_format ("(M1:1/0)\n(M2:3/0)\n+(M1:100/0)\n+(M2:100/0)\n(VIA1:2/0)");
options.set_layer_map (lm);
db::LayerMap lm_read = run_test (_this, "multimap", "def:test.def", "au.oas.gz", options, false);
EXPECT_EQ (lm_read.to_string (),
"layer_map("
"'OUTLINE : OUTLINE (4/0)';"
"'+M1.VIA : M1 (1/0)';"
"'+M1.VIA;M2.VIA : \\'M1;M2\\' (100/0)';"
"'+M2.VIA : M2 (3/0)';"
"'VIA1.VIA : VIA1 (2/0)'"
")"
)
}
TEST(200_lefdef_plugin) TEST(200_lefdef_plugin)
{ {
db::Layout ly; db::Layout ly;

BIN
testdata/lefdef/multimap/.test.def.swp vendored Normal file

Binary file not shown.

BIN
testdata/lefdef/multimap/au.oas.gz vendored Normal file

Binary file not shown.

28
testdata/lefdef/multimap/test.def vendored Normal file
View File

@ -0,0 +1,28 @@
VERSION 5.8 ;
DIVIDERCHAR "/" ;
BUSBITCHARS "[]" ;
DESIGN chip_top ;
UNITS DISTANCE MICRONS 1000 ;
DIEAREA ( 30000 3000 ) ( 10000000 4000 ) ;
VIAS 1 ;
- VIA1_dummy
+ RECT M1 ( -200 -140 ) ( 200 140 )
+ RECT VIA1 ( -100 -100 ) ( 100 100 )
+ RECT M2 ( -300 -120 ) ( 300 120 ) ;
END VIAS
SPECIALNETS 1 ;
- dummy
+ ROUTED M1 150 + SHAPE IOWIRE ( 40000 3600 ) VIA1_dummy DO 16000 BY 1 STEP 700 0
;
END SPECIALNETS
SCANCHAINS 77 ;
- chain1_clock1
+ PARTITION clock1
+ START block1/bsr_reg_0 Q
+ FLOATING
block1/pgm_cgm_en_reg_reg ( IN SD ) ( OUT QZ )
block1/start_reset_dd_reg ( IN SD ) ( OUT QZ )
+ STOP block1/start_reset_d_reg SD ;
END SCANCHAINS
END DESIGN