2017-08-23 23:19:36 +02:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
KLayout Layout Viewer
|
2019-01-08 01:09:25 +01:00
|
|
|
Copyright (C) 2006-2019 Matthias Koefferlein
|
2017-08-23 23:19:36 +02:00
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-03 01:54:11 +02:00
|
|
|
#include "tlUnitTest.h"
|
2017-08-23 23:19:36 +02:00
|
|
|
#include "dbReader.h"
|
2017-09-03 01:54:11 +02:00
|
|
|
#include "dbTestSupport.h"
|
2017-08-23 23:19:36 +02:00
|
|
|
#include "lymMacro.h"
|
2019-03-10 19:35:13 +01:00
|
|
|
#include "tlFileUtils.h"
|
2017-08-23 23:19:36 +02:00
|
|
|
|
|
|
|
|
TEST(1)
|
|
|
|
|
{
|
2017-09-03 01:54:11 +02:00
|
|
|
std::string rs = tl::testsrc ();
|
2017-08-23 23:19:36 +02:00
|
|
|
rs += "/testdata/drc/drcSimpleTests_1.drc";
|
|
|
|
|
|
2017-09-03 01:54:11 +02:00
|
|
|
std::string au = tl::testsrc ();
|
2019-03-09 19:40:38 +01:00
|
|
|
au += "/testdata/drc/drcSimpleTests_au1.gds";
|
2017-08-23 23:19:36 +02:00
|
|
|
|
|
|
|
|
std::string output = this->tmp_file ("tmp.gds");
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
// Set some variables
|
|
|
|
|
lym::Macro config;
|
|
|
|
|
config.set_text (tl::sprintf (
|
|
|
|
|
"$drc_test_source = nil\n"
|
2018-07-15 11:11:05 +02:00
|
|
|
"$drc_test_target = '%s'\n"
|
2017-08-23 23:19:36 +02:00
|
|
|
, output)
|
|
|
|
|
);
|
|
|
|
|
config.set_interpreter (lym::Macro::Ruby);
|
|
|
|
|
EXPECT_EQ (config.run (), 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lym::Macro drc;
|
|
|
|
|
drc.load_from (rs);
|
|
|
|
|
EXPECT_EQ (drc.run (), 0);
|
|
|
|
|
|
|
|
|
|
db::Layout layout;
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
tl::InputStream stream (output);
|
|
|
|
|
db::Reader reader (stream);
|
|
|
|
|
reader.read (layout);
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-03 01:54:11 +02:00
|
|
|
db::compare_layouts (_this, layout, au, db::NoNormalization);
|
2017-08-23 23:19:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(2)
|
|
|
|
|
{
|
2017-09-03 01:54:11 +02:00
|
|
|
std::string rs = tl::testsrc ();
|
2017-08-23 23:19:36 +02:00
|
|
|
rs += "/testdata/drc/drcSimpleTests_2.drc";
|
|
|
|
|
|
2017-09-03 01:54:11 +02:00
|
|
|
std::string input = tl::testsrc ();
|
2017-08-23 23:19:36 +02:00
|
|
|
input += "/testdata/drc/drctest.gds";
|
|
|
|
|
|
2017-09-03 01:54:11 +02:00
|
|
|
std::string au = tl::testsrc ();
|
2019-03-09 19:40:38 +01:00
|
|
|
au += "/testdata/drc/drcSimpleTests_au2.gds";
|
2017-08-23 23:19:36 +02:00
|
|
|
|
|
|
|
|
std::string output = this->tmp_file ("tmp.gds");
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
// Set some variables
|
|
|
|
|
lym::Macro config;
|
|
|
|
|
config.set_text (tl::sprintf (
|
2018-07-15 11:11:05 +02:00
|
|
|
"$drc_test_source = '%s'\n"
|
|
|
|
|
"$drc_test_target = '%s'\n"
|
2017-08-23 23:19:36 +02:00
|
|
|
, input, output)
|
|
|
|
|
);
|
|
|
|
|
config.set_interpreter (lym::Macro::Ruby);
|
|
|
|
|
EXPECT_EQ (config.run (), 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lym::Macro drc;
|
|
|
|
|
drc.load_from (rs);
|
|
|
|
|
EXPECT_EQ (drc.run (), 0);
|
|
|
|
|
|
|
|
|
|
db::Layout layout;
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
tl::InputStream stream (output);
|
|
|
|
|
db::Reader reader (stream);
|
|
|
|
|
reader.read (layout);
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-03 01:54:11 +02:00
|
|
|
db::compare_layouts (_this, layout, au, db::NoNormalization);
|
2017-08-23 23:19:36 +02:00
|
|
|
}
|
|
|
|
|
|
2019-02-18 22:24:34 +01:00
|
|
|
TEST(3_Flat)
|
2017-08-23 23:19:36 +02:00
|
|
|
{
|
2017-09-03 01:54:11 +02:00
|
|
|
std::string rs = tl::testsrc ();
|
2017-08-23 23:19:36 +02:00
|
|
|
rs += "/testdata/drc/drcSimpleTests_3.drc";
|
|
|
|
|
|
2017-09-03 01:54:11 +02:00
|
|
|
std::string input = tl::testsrc ();
|
2017-08-23 23:19:36 +02:00
|
|
|
input += "/testdata/drc/drctest.gds";
|
|
|
|
|
|
2017-09-03 01:54:11 +02:00
|
|
|
std::string au = tl::testsrc ();
|
2019-03-09 19:40:38 +01:00
|
|
|
au += "/testdata/drc/drcSimpleTests_au3.gds";
|
2017-08-23 23:19:36 +02:00
|
|
|
|
|
|
|
|
std::string output = this->tmp_file ("tmp.gds");
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
// Set some variables
|
|
|
|
|
lym::Macro config;
|
|
|
|
|
config.set_text (tl::sprintf (
|
2018-07-15 11:11:05 +02:00
|
|
|
"$drc_test_source = '%s'\n"
|
|
|
|
|
"$drc_test_target = '%s'\n"
|
2017-08-23 23:19:36 +02:00
|
|
|
, input, output)
|
|
|
|
|
);
|
|
|
|
|
config.set_interpreter (lym::Macro::Ruby);
|
|
|
|
|
EXPECT_EQ (config.run (), 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lym::Macro drc;
|
|
|
|
|
drc.load_from (rs);
|
|
|
|
|
EXPECT_EQ (drc.run (), 0);
|
|
|
|
|
|
|
|
|
|
db::Layout layout;
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
tl::InputStream stream (output);
|
|
|
|
|
db::Reader reader (stream);
|
|
|
|
|
reader.read (layout);
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-03 01:54:11 +02:00
|
|
|
db::compare_layouts (_this, layout, au, db::NoNormalization);
|
2017-08-23 23:19:36 +02:00
|
|
|
}
|
2019-02-18 22:24:34 +01:00
|
|
|
|
|
|
|
|
TEST(4_Hierarchical)
|
|
|
|
|
{
|
|
|
|
|
std::string rs = tl::testsrc ();
|
|
|
|
|
rs += "/testdata/drc/drcSimpleTests_4.drc";
|
|
|
|
|
|
|
|
|
|
std::string input = tl::testsrc ();
|
|
|
|
|
input += "/testdata/drc/drctest.gds";
|
|
|
|
|
|
|
|
|
|
std::string au = tl::testsrc ();
|
2019-03-09 19:40:38 +01:00
|
|
|
au += "/testdata/drc/drcSimpleTests_au4.gds";
|
2019-02-18 22:24:34 +01:00
|
|
|
|
|
|
|
|
std::string output = this->tmp_file ("tmp.gds");
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
// Set some variables
|
|
|
|
|
lym::Macro config;
|
|
|
|
|
config.set_text (tl::sprintf (
|
|
|
|
|
"$drc_test_source = '%s'\n"
|
|
|
|
|
"$drc_test_target = '%s'\n"
|
|
|
|
|
, input, output)
|
|
|
|
|
);
|
|
|
|
|
config.set_interpreter (lym::Macro::Ruby);
|
|
|
|
|
EXPECT_EQ (config.run (), 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lym::Macro drc;
|
|
|
|
|
drc.load_from (rs);
|
|
|
|
|
EXPECT_EQ (drc.run (), 0);
|
|
|
|
|
|
|
|
|
|
db::Layout layout;
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
tl::InputStream stream (output);
|
|
|
|
|
db::Reader reader (stream);
|
|
|
|
|
reader.read (layout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
db::compare_layouts (_this, layout, au, db::NoNormalization);
|
|
|
|
|
}
|
2019-03-02 11:23:40 +01:00
|
|
|
|
|
|
|
|
TEST(5_FlatAntenna)
|
|
|
|
|
{
|
|
|
|
|
std::string rs = tl::testsrc ();
|
|
|
|
|
rs += "/testdata/drc/drcSimpleTests_5.drc";
|
|
|
|
|
|
|
|
|
|
std::string input = tl::testsrc ();
|
|
|
|
|
input += "/testdata/drc/antenna_l1.gds";
|
|
|
|
|
|
|
|
|
|
std::string au = tl::testsrc ();
|
2019-03-09 19:40:38 +01:00
|
|
|
au += "/testdata/drc/drcSimpleTests_au5.gds";
|
2019-03-02 11:23:40 +01:00
|
|
|
|
|
|
|
|
std::string output = this->tmp_file ("tmp.gds");
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
// Set some variables
|
|
|
|
|
lym::Macro config;
|
|
|
|
|
config.set_text (tl::sprintf (
|
|
|
|
|
"$drc_test_source = '%s'\n"
|
|
|
|
|
"$drc_test_target = '%s'\n"
|
|
|
|
|
, input, output)
|
|
|
|
|
);
|
|
|
|
|
config.set_interpreter (lym::Macro::Ruby);
|
|
|
|
|
EXPECT_EQ (config.run (), 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lym::Macro drc;
|
|
|
|
|
drc.load_from (rs);
|
|
|
|
|
EXPECT_EQ (drc.run (), 0);
|
|
|
|
|
|
|
|
|
|
db::Layout layout;
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
tl::InputStream stream (output);
|
|
|
|
|
db::Reader reader (stream);
|
|
|
|
|
reader.read (layout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
db::compare_layouts (_this, layout, au, db::NoNormalization);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(6_HierarchicalAntenna)
|
|
|
|
|
{
|
|
|
|
|
std::string rs = tl::testsrc ();
|
|
|
|
|
rs += "/testdata/drc/drcSimpleTests_6.drc";
|
|
|
|
|
|
|
|
|
|
std::string input = tl::testsrc ();
|
|
|
|
|
input += "/testdata/drc/antenna_l1.gds";
|
|
|
|
|
|
|
|
|
|
std::string au = tl::testsrc ();
|
2019-03-09 19:40:38 +01:00
|
|
|
au += "/testdata/drc/drcSimpleTests_au6.gds";
|
2019-03-02 11:23:40 +01:00
|
|
|
|
|
|
|
|
std::string output = this->tmp_file ("tmp.gds");
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
// Set some variables
|
|
|
|
|
lym::Macro config;
|
|
|
|
|
config.set_text (tl::sprintf (
|
|
|
|
|
"$drc_test_source = '%s'\n"
|
|
|
|
|
"$drc_test_target = '%s'\n"
|
|
|
|
|
, input, output)
|
|
|
|
|
);
|
|
|
|
|
config.set_interpreter (lym::Macro::Ruby);
|
|
|
|
|
EXPECT_EQ (config.run (), 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lym::Macro drc;
|
|
|
|
|
drc.load_from (rs);
|
|
|
|
|
EXPECT_EQ (drc.run (), 0);
|
|
|
|
|
|
|
|
|
|
db::Layout layout;
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
tl::InputStream stream (output);
|
|
|
|
|
db::Reader reader (stream);
|
|
|
|
|
reader.read (layout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
db::compare_layouts (_this, layout, au, db::NoNormalization);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(7_AntennaWithDiodes)
|
|
|
|
|
{
|
|
|
|
|
std::string rs = tl::testsrc ();
|
|
|
|
|
rs += "/testdata/drc/drcSimpleTests_7.drc";
|
|
|
|
|
|
|
|
|
|
std::string input = tl::testsrc ();
|
|
|
|
|
input += "/testdata/drc/antenna_l1.gds";
|
|
|
|
|
|
|
|
|
|
std::string au = tl::testsrc ();
|
2019-03-09 19:40:38 +01:00
|
|
|
au += "/testdata/drc/drcSimpleTests_au7.gds";
|
2019-03-02 11:23:40 +01:00
|
|
|
|
|
|
|
|
std::string output = this->tmp_file ("tmp.gds");
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
// Set some variables
|
|
|
|
|
lym::Macro config;
|
|
|
|
|
config.set_text (tl::sprintf (
|
|
|
|
|
"$drc_test_source = '%s'\n"
|
|
|
|
|
"$drc_test_target = '%s'\n"
|
|
|
|
|
, input, output)
|
|
|
|
|
);
|
|
|
|
|
config.set_interpreter (lym::Macro::Ruby);
|
|
|
|
|
EXPECT_EQ (config.run (), 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lym::Macro drc;
|
|
|
|
|
drc.load_from (rs);
|
|
|
|
|
EXPECT_EQ (drc.run (), 0);
|
|
|
|
|
|
|
|
|
|
db::Layout layout;
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
tl::InputStream stream (output);
|
|
|
|
|
db::Reader reader (stream);
|
|
|
|
|
reader.read (layout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
db::compare_layouts (_this, layout, au, db::NoNormalization);
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-06 07:41:44 +01:00
|
|
|
TEST(8_TextsAndPolygons)
|
2019-03-06 00:32:29 +01:00
|
|
|
{
|
|
|
|
|
std::string rs = tl::testsrc ();
|
|
|
|
|
rs += "/testdata/drc/drcSimpleTests_8.drc";
|
|
|
|
|
|
|
|
|
|
std::string input = tl::testsrc ();
|
|
|
|
|
input += "/testdata/drc/texts.gds";
|
|
|
|
|
|
|
|
|
|
std::string au = tl::testsrc ();
|
2019-03-09 19:40:38 +01:00
|
|
|
au += "/testdata/drc/drcSimpleTests_au8.gds";
|
2019-03-06 00:32:29 +01:00
|
|
|
|
|
|
|
|
std::string output = this->tmp_file ("tmp.gds");
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
// Set some variables
|
|
|
|
|
lym::Macro config;
|
|
|
|
|
config.set_text (tl::sprintf (
|
|
|
|
|
"$drc_test_source = '%s'\n"
|
|
|
|
|
"$drc_test_target = '%s'\n"
|
|
|
|
|
, input, output)
|
|
|
|
|
);
|
|
|
|
|
config.set_interpreter (lym::Macro::Ruby);
|
|
|
|
|
EXPECT_EQ (config.run (), 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lym::Macro drc;
|
|
|
|
|
drc.load_from (rs);
|
|
|
|
|
EXPECT_EQ (drc.run (), 0);
|
|
|
|
|
|
|
|
|
|
db::Layout layout;
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
tl::InputStream stream (output);
|
|
|
|
|
db::Reader reader (stream);
|
|
|
|
|
reader.read (layout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
db::compare_layouts (_this, layout, au, db::NoNormalization);
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-10 19:35:13 +01:00
|
|
|
TEST(9_NetlistExtraction)
|
|
|
|
|
{
|
|
|
|
|
std::string rs = tl::testsrc ();
|
|
|
|
|
rs += "/testdata/drc/drcSimpleTests_9.drc";
|
|
|
|
|
|
|
|
|
|
std::string input = tl::testsrc ();
|
|
|
|
|
input += "/testdata/drc/ringo.gds";
|
|
|
|
|
|
|
|
|
|
std::string au = tl::testsrc ();
|
|
|
|
|
au += "/testdata/drc/drcSimpleTests_au9a.cir";
|
|
|
|
|
|
|
|
|
|
std::string au_simplified = tl::testsrc ();
|
|
|
|
|
au_simplified += "/testdata/drc/drcSimpleTests_au9b.cir";
|
|
|
|
|
|
|
|
|
|
std::string output = this->tmp_file ("tmp.cir");
|
|
|
|
|
std::string output_simplified = this->tmp_file ("tmp_simplified.cir");
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
// Set some variables
|
|
|
|
|
lym::Macro config;
|
|
|
|
|
config.set_text (tl::sprintf (
|
|
|
|
|
"$drc_test_source = '%s'\n"
|
|
|
|
|
"$drc_test_target = '%s'\n"
|
|
|
|
|
"$drc_test_target_simplified = '%s'\n"
|
|
|
|
|
, input, output, output_simplified)
|
|
|
|
|
);
|
|
|
|
|
config.set_interpreter (lym::Macro::Ruby);
|
|
|
|
|
EXPECT_EQ (config.run (), 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lym::Macro drc;
|
|
|
|
|
drc.load_from (rs);
|
|
|
|
|
EXPECT_EQ (drc.run (), 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// verify
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
tl::InputStream is (output);
|
|
|
|
|
tl::InputStream is_au (au);
|
|
|
|
|
|
|
|
|
|
if (is.read_all () != is_au.read_all ()) {
|
|
|
|
|
_this->raise (tl::sprintf ("Compare failed - see\n actual: %s\n golden: %s",
|
|
|
|
|
tl::absolute_file_path (output),
|
|
|
|
|
tl::absolute_file_path (au)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
tl::InputStream is (output_simplified);
|
|
|
|
|
tl::InputStream is_au (au_simplified);
|
|
|
|
|
|
|
|
|
|
if (is.read_all () != is_au.read_all ()) {
|
|
|
|
|
_this->raise (tl::sprintf ("Compare failed (simplified netlist) - see\n actual: %s\n golden: %s",
|
|
|
|
|
tl::absolute_file_path (output_simplified),
|
|
|
|
|
tl::absolute_file_path (au_simplified)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(10_NetlistExtractionFlat)
|
|
|
|
|
{
|
|
|
|
|
std::string rs = tl::testsrc ();
|
|
|
|
|
rs += "/testdata/drc/drcSimpleTests_10.drc";
|
|
|
|
|
|
|
|
|
|
std::string input = tl::testsrc ();
|
|
|
|
|
input += "/testdata/drc/ringo.gds";
|
|
|
|
|
|
|
|
|
|
std::string au = tl::testsrc ();
|
|
|
|
|
au += "/testdata/drc/drcSimpleTests_au10a.cir";
|
|
|
|
|
|
|
|
|
|
std::string au_simplified = tl::testsrc ();
|
|
|
|
|
au_simplified += "/testdata/drc/drcSimpleTests_au10b.cir";
|
|
|
|
|
|
|
|
|
|
std::string output = this->tmp_file ("tmp.cir");
|
|
|
|
|
std::string output_simplified = this->tmp_file ("tmp_simplified.cir");
|
|
|
|
|
|
2019-03-10 22:37:32 +01:00
|
|
|
{
|
|
|
|
|
// Set some variables
|
|
|
|
|
lym::Macro config;
|
|
|
|
|
config.set_text (tl::sprintf (
|
|
|
|
|
"$drc_test_source = '%s'\n"
|
|
|
|
|
"$drc_test_target = '%s'\n"
|
|
|
|
|
"$drc_test_target_simplified = '%s'\n"
|
|
|
|
|
, input, output, output_simplified)
|
|
|
|
|
);
|
|
|
|
|
config.set_interpreter (lym::Macro::Ruby);
|
|
|
|
|
EXPECT_EQ (config.run (), 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lym::Macro drc;
|
|
|
|
|
drc.load_from (rs);
|
|
|
|
|
EXPECT_EQ (drc.run (), 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// verify
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
tl::InputStream is (output);
|
|
|
|
|
tl::InputStream is_au (au);
|
|
|
|
|
|
|
|
|
|
if (is.read_all () != is_au.read_all ()) {
|
|
|
|
|
_this->raise (tl::sprintf ("Compare failed - see\n actual: %s\n golden: %s",
|
|
|
|
|
tl::absolute_file_path (output),
|
|
|
|
|
tl::absolute_file_path (au)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
tl::InputStream is (output_simplified);
|
|
|
|
|
tl::InputStream is_au (au_simplified);
|
|
|
|
|
|
|
|
|
|
if (is.read_all () != is_au.read_all ()) {
|
|
|
|
|
_this->raise (tl::sprintf ("Compare failed (simplified netlist) - see\n actual: %s\n golden: %s",
|
|
|
|
|
tl::absolute_file_path (output_simplified),
|
|
|
|
|
tl::absolute_file_path (au_simplified)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST(11_CustomDevices)
|
|
|
|
|
{
|
|
|
|
|
std::string rs = tl::testsrc ();
|
|
|
|
|
rs += "/testdata/drc/drcSimpleTests_11.drc";
|
|
|
|
|
|
|
|
|
|
std::string input = tl::testsrc ();
|
|
|
|
|
input += "/testdata/drc/vdiv.gds";
|
|
|
|
|
|
|
|
|
|
std::string au = tl::testsrc ();
|
|
|
|
|
au += "/testdata/drc/drcSimpleTests_au11a.cir";
|
|
|
|
|
|
|
|
|
|
std::string au_simplified = tl::testsrc ();
|
|
|
|
|
au_simplified += "/testdata/drc/drcSimpleTests_au11b.cir";
|
|
|
|
|
|
|
|
|
|
std::string output = this->tmp_file ("tmp.cir");
|
|
|
|
|
std::string output_simplified = this->tmp_file ("tmp_simplified.cir");
|
|
|
|
|
|
2019-03-10 19:35:13 +01:00
|
|
|
{
|
|
|
|
|
// Set some variables
|
|
|
|
|
lym::Macro config;
|
|
|
|
|
config.set_text (tl::sprintf (
|
|
|
|
|
"$drc_test_source = '%s'\n"
|
|
|
|
|
"$drc_test_target = '%s'\n"
|
|
|
|
|
"$drc_test_target_simplified = '%s'\n"
|
|
|
|
|
, input, output, output_simplified)
|
|
|
|
|
);
|
|
|
|
|
config.set_interpreter (lym::Macro::Ruby);
|
|
|
|
|
EXPECT_EQ (config.run (), 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lym::Macro drc;
|
|
|
|
|
drc.load_from (rs);
|
|
|
|
|
EXPECT_EQ (drc.run (), 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// verify
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
tl::InputStream is (output);
|
|
|
|
|
tl::InputStream is_au (au);
|
|
|
|
|
|
|
|
|
|
if (is.read_all () != is_au.read_all ()) {
|
|
|
|
|
_this->raise (tl::sprintf ("Compare failed - see\n actual: %s\n golden: %s",
|
|
|
|
|
tl::absolute_file_path (output),
|
|
|
|
|
tl::absolute_file_path (au)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
tl::InputStream is (output_simplified);
|
|
|
|
|
tl::InputStream is_au (au_simplified);
|
|
|
|
|
|
|
|
|
|
if (is.read_all () != is_au.read_all ()) {
|
|
|
|
|
_this->raise (tl::sprintf ("Compare failed (simplified netlist) - see\n actual: %s\n golden: %s",
|
|
|
|
|
tl::absolute_file_path (output_simplified),
|
|
|
|
|
tl::absolute_file_path (au_simplified)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|