mirror of https://github.com/KLayout/klayout.git
Added tests for LEF/DEF mapfile, fixed a few bugs.
This commit is contained in:
parent
97022a3a87
commit
fd63d1017f
|
|
@ -128,7 +128,7 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
return tl::combine_path (m_stream.absolute_path (), fn);
|
||||
return tl::combine_path (tl::dirname (m_stream.absolute_path ()), fn);
|
||||
|
||||
} else {
|
||||
return fn;
|
||||
|
|
|
|||
|
|
@ -604,12 +604,12 @@ LEFImporter::read_layer (Layout & /*layout*/)
|
|||
|
||||
} else if (test ("TYPE")) {
|
||||
|
||||
if (test ("ROUTING")) {
|
||||
std::string type = get ();
|
||||
|
||||
if (type == "ROUTING" || type == "MASTERSLICE") {
|
||||
m_routing_layers.insert (ln);
|
||||
} else if (test ("CUT")) {
|
||||
} else if (type == "CUT") {
|
||||
m_cut_layers.insert (ln);
|
||||
} else {
|
||||
get ();
|
||||
}
|
||||
expect (";");
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ static db::LEFDEFReaderOptions default_options ()
|
|||
return tc;
|
||||
}
|
||||
|
||||
static void run_test (tl::TestBase *_this, const char *lef_dir, const char *filename, const char *au, const db::LEFDEFReaderOptions &tc, bool priv = true)
|
||||
static void run_test (tl::TestBase *_this, const char *lef_dir, const char *filename, const char *au, const db::LEFDEFReaderOptions &options, bool priv = true)
|
||||
{
|
||||
std::string fn_path (priv ? tl::testsrc_private () : tl::testsrc ());
|
||||
fn_path += "/testdata/lefdef/";
|
||||
|
|
@ -61,7 +61,7 @@ static void run_test (tl::TestBase *_this, const char *lef_dir, const char *file
|
|||
|
||||
tl::Extractor ex (filename);
|
||||
|
||||
db::LEFDEFReaderState ld (&tc, layout);
|
||||
db::LEFDEFReaderState ld (&options, layout);
|
||||
|
||||
db::DEFImporter imp;
|
||||
|
||||
|
|
@ -103,6 +103,18 @@ static void run_test (tl::TestBase *_this, const char *lef_dir, const char *file
|
|||
db::Reader reader (stream);
|
||||
reader.read (layout, db::LoadLayoutOptions ());
|
||||
|
||||
} else if (ex.test("read:")) {
|
||||
|
||||
std::string fn = fn_path, f;
|
||||
ex.read_word_or_quoted (f);
|
||||
fn += f;
|
||||
|
||||
tl::InputStream stream (fn);
|
||||
db::Reader reader (stream);
|
||||
db::LoadLayoutOptions lo;
|
||||
lo.set_options (options);
|
||||
reader.read (layout, lo);
|
||||
|
||||
} else {
|
||||
|
||||
break;
|
||||
|
|
@ -361,3 +373,11 @@ TEST(110_lefpins)
|
|||
|
||||
run_test (_this, "lefpins", "lef:in_tech.lef+lef:in.lef+def:in.def", "au_lefpins_mapped.oas.gz", options, false);
|
||||
}
|
||||
|
||||
TEST(111_mapfile)
|
||||
{
|
||||
db::LEFDEFReaderOptions options = default_options ();
|
||||
options.set_map_file ("test.map");
|
||||
|
||||
run_test (_this, "mapfile", "read:in.def", "au.oas.gz", options, false);
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
VERSION 5.8 ;
|
||||
DIVIDERCHAR "/" ;
|
||||
BUSBITCHARS "[]" ;
|
||||
DESIGN mapfile ;
|
||||
UNITS DISTANCE MICRONS 1000 ;
|
||||
|
||||
DIEAREA ( 0 0 ) ( 1000 2000 ) ;
|
||||
|
||||
COMPONENTS 3 ;
|
||||
- macro1 macro1 + PLACED ( 0 0 ) N ;
|
||||
END COMPONENTS
|
||||
|
||||
SPECIALNETS 1 ;
|
||||
- VDD ( * VDD )
|
||||
+ ROUTED M1 50 + SHAPE STRIPE ( 500 0 ) ( 500 500 25 ) square ( 0 500 )
|
||||
+ USE POWER ;
|
||||
END SPECIALNETS
|
||||
|
||||
PINS 1 ;
|
||||
- VDD + NET VDD + SPECIAL + DIRECTION INOUT + USE POWER
|
||||
+ LAYER M1 ( 0 0 ) ( 50 70 )
|
||||
;
|
||||
END PINS
|
||||
|
||||
NETS 1 ;
|
||||
- TOP
|
||||
+ ROUTED M1 ( 100 700 ) ( 500 * ) ;
|
||||
END NETS
|
||||
|
||||
END DESIGN
|
||||
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
MACRO macro1
|
||||
CLASS CORE ;
|
||||
ORIGIN 0.035 0.235 ;
|
||||
SIZE 0.07 BY 0.47 ;
|
||||
PIN Z
|
||||
PORT
|
||||
LAYER M1 ;
|
||||
RECT -0.02 0 0.02 0.2 ;
|
||||
RECT -0.03 -0.2 0.01 -0.1 ;
|
||||
VIA 0.0 0.2 square ;
|
||||
VIA 0.01 -0.2 square ;
|
||||
END
|
||||
END Z
|
||||
OBS
|
||||
LAYER M1 ;
|
||||
RECT -0.035 -0.235 0.035 0.235 ;
|
||||
END
|
||||
END macro1
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
LAYER M0PO
|
||||
TYPE MASTERSLICE ;
|
||||
WIDTH 0.02 ;
|
||||
END M0PO
|
||||
LAYER VIA0
|
||||
TYPE CUT ;
|
||||
END VIA0
|
||||
LAYER M1
|
||||
TYPE MASTERSLICE ;
|
||||
WIDTH 0.025 ;
|
||||
END M1
|
||||
LAYER VIA1
|
||||
TYPE CUT ;
|
||||
END VIA1
|
||||
LAYER M2
|
||||
TYPE MASTERSLICE ;
|
||||
WIDTH 0.03 ;
|
||||
END M2
|
||||
|
||||
VIA square
|
||||
LAYER M0PO ;
|
||||
RECT -0.006 -0.006 0.006 0.006 ;
|
||||
LAYER VIA0 ;
|
||||
RECT -0.006 -0.006 0.006 0.006 ;
|
||||
LAYER M1 ;
|
||||
RECT -0.006 -0.006 0.006 0.006 ;
|
||||
END square
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
DIEAREA ALL 100 0
|
||||
M0PO LEFPIN,LEFOBS,PIN,NET,SPNET,VIA 10 0
|
||||
VIA0 LEFPIN,LEFOBS,VIA,PIN,NET,SPNET 11 0
|
||||
M1 LEFPIN 12 0
|
||||
M1 LEFOBS 12 1
|
||||
M1 PIN 12 2
|
||||
M1 NET 12 3
|
||||
M1 SPNET 12 4
|
||||
M1 VIA 12 5
|
||||
M1 FILLOPC 12 100
|
||||
M1 FILLOPC:MASK:1 12 101
|
||||
M1 FILLOPC:MASK:2 12 102
|
||||
M1 BLOCKAGEFILL 12 150
|
||||
M1 BLOCKAGE 12 151
|
||||
M1 FILL 12 152
|
||||
NAME M1/PIN 12 10
|
||||
VIA1 LEFPIN,LEFOBS,VIA,PIN,NET,SPNET 13 0
|
||||
M2 LEFPIN,LEFOBS,PIN,NET,SPNET,VIA 14 0
|
||||
Loading…
Reference in New Issue