mirror of https://github.com/KLayout/klayout.git
WIP: test for multimapping in LEF/DEF
This commit is contained in:
parent
d4b5dab0db
commit
9688da9ffd
|
|
@ -32,34 +32,6 @@ namespace db
|
|||
// ---------------------------------------------------------------
|
||||
// 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 ();
|
||||
|
||||
CommonReader::CommonReader ()
|
||||
|
|
|
|||
|
|
@ -31,9 +31,6 @@
|
|||
namespace db
|
||||
{
|
||||
|
||||
DB_PUBLIC void
|
||||
join_layer_names (std::string &s, const std::string &n);
|
||||
|
||||
/**
|
||||
* @brief The CellConflictResolution enum
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -30,6 +30,33 @@
|
|||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
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)) {
|
||||
found = true;
|
||||
res.insert ((*i).first);
|
||||
lfound = int ((*i).first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! found) {
|
||||
if (lfound < 0) {
|
||||
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 ()) {
|
||||
|
|
|
|||
|
|
@ -724,6 +724,24 @@ TEST(118_density)
|
|||
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)
|
||||
{
|
||||
db::Layout ly;
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -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
|
||||
Loading…
Reference in New Issue