WIP: Moved net tracer into plugin, GSI is now in db module.

This commit is contained in:
Matthias Koefferlein 2018-06-16 00:56:35 +02:00
parent 757c6af80f
commit 7e56ce23e5
29 changed files with 1551 additions and 1324 deletions

1
.gitignore vendored
View File

@ -37,6 +37,7 @@ mkqtdecl.tmp
private
src/plugins/*
!src/plugins/streamers
!src/plugins/tools
!src/plugins/*.pro
!src/plugins/*.pri

View File

@ -122,7 +122,7 @@ gsi::Class<db::TechnologyComponent> technology_component_decl ("db", "Technology
"This class has been introduced in version 0.25."
);
DB_PUBLIC gsi::Class<db::TechnologyComponent> &decl_layTechnologyComponent () { return technology_component_decl; }
DB_PUBLIC gsi::Class<db::TechnologyComponent> &decl_dbTechnologyComponent () { return technology_component_decl; }
gsi::Class<db::Technology> technology_decl ("db", "Technology",
gsi::method ("name", &db::Technology::name,

View File

@ -9,10 +9,6 @@ DEFINES += MAKE_EXT_LIBRARY
HEADERS += \
extBooleanOperationsDialogs.h \
extDiffToolDialog.h \
extNetTracer.h \
extNetTracerConfig.h \
extNetTracerDialog.h \
extNetTracerIO.h \
extStreamImportDialog.h \
extStreamImporter.h \
extXORToolDialog.h \
@ -23,9 +19,6 @@ HEADERS += \
FORMS += \
BooleanOptionsDialog.ui \
DiffToolDialog.ui \
NetTracerConfigPage.ui \
NetTracerDialog.ui \
NetTracerTechComponentEditor.ui \
SizingOptionsDialog.ui \
StreamImportDialog.ui \
MergeOptionsDialog.ui \
@ -37,11 +30,6 @@ SOURCES += \
extDiffPlugin.cc \
extDiffToolDialog.cc \
extForceLink.cc \
extNetTracer.cc \
extNetTracerConfig.cc \
extNetTracerDialog.cc \
extNetTracerIO.cc \
extNetTracerPlugin.cc \
extStreamImport.cc \
extStreamImportDialog.cc \
extStreamImporter.cc \

View File

@ -1,436 +0,0 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2018 Matthias Koefferlein
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
*/
#include "extNetTracerIO.h"
#include "extNetTracerDialog.h"
#include "extNetTracerConfig.h"
#include "layConverters.h"
#include "layCellView.h"
#include "gsiDecl.h"
namespace tl
{
/**
* @brief A specialization of the XMLConverter that is used to serialize the connection info
*/
template <>
struct XMLStdConverter<ext::NetTracerConnectionInfo>
{
std::string to_string (const ext::NetTracerConnectionInfo &v) const
{
return v.to_string ();
}
void from_string (const std::string &s, ext::NetTracerConnectionInfo &v) const
{
tl::Extractor ex (s.c_str ());
v.parse (ex);
}
};
/**
* @brief A specialization of the XMLConverter that is used to serialize the symbol info
*/
template <>
struct XMLStdConverter<ext::NetTracerSymbolInfo>
{
std::string to_string (const ext::NetTracerSymbolInfo &v) const
{
return v.to_string ();
}
void from_string (const std::string &s, ext::NetTracerSymbolInfo &v) const
{
tl::Extractor ex (s.c_str ());
v.parse (ex);
}
};
}
namespace ext
{
extern std::string net_tracer_component_name;
// -----------------------------------------------------------------------------------
// NetTracerPlugin definition and implementation
class NetTracerPluginDeclaration
: public lay::PluginDeclaration
{
public:
virtual void get_options (std::vector < std::pair<std::string, std::string> > &options) const
{
options.push_back (std::pair<std::string, std::string> (cfg_nt_window_mode, "fit-net"));
options.push_back (std::pair<std::string, std::string> (cfg_nt_window_dim, "1.0"));
options.push_back (std::pair<std::string, std::string> (cfg_nt_max_shapes_highlighted, "10000"));
options.push_back (std::pair<std::string, std::string> (cfg_nt_marker_color, lay::ColorConverter ().to_string (QColor ())));
options.push_back (std::pair<std::string, std::string> (cfg_nt_marker_cycle_colors_enabled, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_nt_marker_cycle_colors, "255,0,0 0,255,0 0,0,255 255,255,0 255,0,255 0,255,255 160,80,255 255,160,0"));
options.push_back (std::pair<std::string, std::string> (cfg_nt_marker_line_width, "-1"));
options.push_back (std::pair<std::string, std::string> (cfg_nt_marker_vertex_size, "-1"));
options.push_back (std::pair<std::string, std::string> (cfg_nt_marker_halo, "-1"));
options.push_back (std::pair<std::string, std::string> (cfg_nt_marker_dither_pattern, "-1"));
options.push_back (std::pair<std::string, std::string> (cfg_nt_marker_intensity, "50"));
}
virtual std::vector<std::pair <std::string, lay::ConfigPage *> > config_pages (QWidget *parent) const
{
std::vector<std::pair <std::string, lay::ConfigPage *> > pages;
pages.push_back (std::make_pair (tl::to_string (QObject::tr ("Other Tools|Net Tracer")), new NetTracerConfigPage (parent)));
return pages;
}
virtual void get_menu_entries (std::vector<lay::MenuEntry> &menu_entries) const
{
// TODO: where should that go?
lay::PluginDeclaration::get_menu_entries (menu_entries);
menu_entries.push_back (lay::MenuEntry ("net_trace_group", "tools_menu.end"));
menu_entries.push_back (lay::MenuEntry ("ext::net_trace", "net_trace", "tools_menu.end", tl::to_string (QObject::tr ("Trace Net"))));
}
virtual lay::Plugin *create_plugin (db::Manager * /*manager*/, lay::PluginRoot *root, lay::LayoutView *view) const
{
return new NetTracerDialog (root, view);
}
};
static tl::RegisteredClass<lay::PluginDeclaration> config_decl (new NetTracerPluginDeclaration (), 13000, "NetTracerPlugin");
class NetTracerTechnologyEditorProvider
: public lay::TechnologyEditorProvider
{
public:
virtual lay::TechnologyComponentEditor *create_editor (QWidget *parent) const
{
return new NetTracerTechComponentEditor (parent);
}
};
static tl::RegisteredClass<lay::TechnologyEditorProvider> editor_decl (new NetTracerTechnologyEditorProvider (), 13000, net_tracer_component_name.c_str ());
class NetTracerTechnologyComponentProvider
: public db::TechnologyComponentProvider
{
public:
NetTracerTechnologyComponentProvider ()
: db::TechnologyComponentProvider ()
{
// .. nothing yet ..
}
virtual db::TechnologyComponent *create_component () const
{
return new NetTracerTechnologyComponent ();
}
virtual tl::XMLElementBase *xml_element () const
{
return new db::TechnologyComponentXMLElement<NetTracerTechnologyComponent> (net_tracer_component_name,
tl::make_member ((NetTracerTechnologyComponent::const_iterator (NetTracerTechnologyComponent::*) () const) &NetTracerTechnologyComponent::begin, (NetTracerTechnologyComponent::const_iterator (NetTracerTechnologyComponent::*) () const) &NetTracerTechnologyComponent::end, &NetTracerTechnologyComponent::add, "connection") +
tl::make_member ((NetTracerTechnologyComponent::const_symbol_iterator (NetTracerTechnologyComponent::*) () const) &NetTracerTechnologyComponent::begin_symbols, (NetTracerTechnologyComponent::const_symbol_iterator (NetTracerTechnologyComponent::*) () const) &NetTracerTechnologyComponent::end_symbols, &NetTracerTechnologyComponent::add_symbol, "symbols")
);
}
};
static tl::RegisteredClass<db::TechnologyComponentProvider> tc_decl (new NetTracerTechnologyComponentProvider (), 13000, "NetTracerPlugin");
}
// -----------------------------------------------------------------------------------
// GSI binding
namespace gsi
{
static void def_connection2 (ext::NetTracerTechnologyComponent *tech, const std::string &la, const std::string &lb)
{
ext::NetTracerLayerExpressionInfo la_info = ext::NetTracerLayerExpressionInfo::compile (la);
ext::NetTracerLayerExpressionInfo lb_info = ext::NetTracerLayerExpressionInfo::compile (lb);
tech->add (ext::NetTracerConnectionInfo (la_info, lb_info));
}
static void def_connection3 (ext::NetTracerTechnologyComponent *tech, const std::string &la, const std::string &via, const std::string &lb)
{
ext::NetTracerLayerExpressionInfo la_info = ext::NetTracerLayerExpressionInfo::compile (la);
ext::NetTracerLayerExpressionInfo via_info = ext::NetTracerLayerExpressionInfo::compile (via);
ext::NetTracerLayerExpressionInfo lb_info = ext::NetTracerLayerExpressionInfo::compile (lb);
tech->add (ext::NetTracerConnectionInfo (la_info, via_info, lb_info));
}
static void def_symbol (ext::NetTracerTechnologyComponent *tech, const std::string &name, const std::string &expr)
{
tech->add_symbol (ext::NetTracerSymbolInfo (db::LayerProperties (name), expr));
}
gsi::Class<db::TechnologyComponent> &decl_layTechnologyComponent ();
gsi::Class<ext::NetTracerTechnologyComponent> decl_NetTracerTechnology (decl_layTechnologyComponent (), "lay", "NetTracerTechnology",
gsi::method_ext ("connection", &def_connection2, gsi::arg("a"), gsi::arg("b"),
"@brief Defines a connection between two materials\n"
"See the class description for details about this method."
) +
gsi::method_ext ("connection", &def_connection3, gsi::arg("a"), gsi::arg("via"), gsi::arg("b"),
"@brief Defines a connection between materials through a via\n"
"See the class description for details about this method."
) +
gsi::method_ext ("symbol", &def_symbol, gsi::arg("name"), gsi::arg("expr"),
"@brief Defines a symbol for use in the material expressions.\n"
"Defines a sub-expression to be used in further symbols or material expressions. "
"For the detailed notation of the expression see the description of the net tracer feature."
),
"@brief A technology description for the net tracer\n"
"\n"
"This object represents the technology description for the net tracer (represented by the \\NetTracer class).\n"
"A technology description basically consists of connection declarations.\n"
"A connection is given by either two or three expressions describing two conductive materials.\n"
"With two expressions, the connection describes a transition from one material to another one.\n"
"With three expressions, the connection describes a transition from one material to another through a "
"connection (a \"via\").\n"
"\n"
"The conductive material is derived from original layers either directly or through "
"boolean expressions. These expressions can include symbols which are defined through the "
"\\symbol method.\n"
"\n"
"For details about the expressions see the description of the net tracer feature.\n"
"\n"
"This class has been introduced in version 0.25.\n"
);
static void trace1 (ext::NetTracer *net_tracer, const ext::NetTracerTechnologyComponent &tech, const db::Layout &layout, const db::Cell &cell, const db::Point &start_point, unsigned int start_layer)
{
ext::NetTracerData tracer_data = tech.get_tracer_data (layout);
net_tracer->trace (layout, cell, start_point, start_layer, tracer_data);
}
static void trace2 (ext::NetTracer *net_tracer, const ext::NetTracerTechnologyComponent &tech, const db::Layout &layout, const db::Cell &cell, const db::Point &start_point, unsigned int start_layer, const db::Point &stop_point, unsigned int stop_layer)
{
ext::NetTracerData tracer_data = tech.get_tracer_data (layout);
net_tracer->trace (layout, cell, start_point, start_layer, stop_point, stop_layer, tracer_data);
}
static ext::NetTracerData get_tracer_data_from_cv (const lay::CellViewRef &cv)
{
const db::Technology *tech = cv->technology ();
tl_assert (tech != 0);
const ext::NetTracerTechnologyComponent *tech_component = dynamic_cast <const ext::NetTracerTechnologyComponent *> (tech->component_by_name (ext::net_tracer_component_name));
tl_assert (tech_component != 0);
return tech_component->get_tracer_data (cv->layout ());
}
static void trace1_cv (ext::NetTracer *net_tracer, const lay::CellViewRef &cv, const db::Point &start_point, unsigned int start_layer)
{
ext::NetTracerData tracer_data = get_tracer_data_from_cv (cv);
net_tracer->trace (cv->layout (), *cv.cell (), start_point, start_layer, tracer_data);
}
static void trace2_cv (ext::NetTracer *net_tracer, const lay::CellViewRef &cv, const db::Point &start_point, unsigned int start_layer, const db::Point &stop_point, unsigned int stop_layer)
{
ext::NetTracerData tracer_data = get_tracer_data_from_cv (cv);
net_tracer->trace (cv->layout (), *cv.cell (), start_point, start_layer, stop_point, stop_layer, tracer_data);
}
static ext::NetTracerData get_tracer_data_from_tech (const std::string &tech_name, const db::Layout &layout)
{
const db::Technology *tech = db::Technologies::instance ()->technology_by_name (tech_name);
tl_assert (tech != 0);
const ext::NetTracerTechnologyComponent *tech_component = dynamic_cast <const ext::NetTracerTechnologyComponent *> (tech->component_by_name (ext::net_tracer_component_name));
tl_assert (tech_component != 0);
return tech_component->get_tracer_data (layout);
}
static void trace1_tn (ext::NetTracer *net_tracer, const std::string &tech, const db::Layout &layout, const db::Cell &cell, const db::Point &start_point, unsigned int start_layer)
{
ext::NetTracerData tracer_data = get_tracer_data_from_tech (tech, layout);
net_tracer->trace (layout, cell, start_point, start_layer, tracer_data);
}
static void trace2_tn (ext::NetTracer *net_tracer, const std::string &tech, const db::Layout &layout, const db::Cell &cell, const db::Point &start_point, unsigned int start_layer, const db::Point &stop_point, unsigned int stop_layer)
{
ext::NetTracerData tracer_data = get_tracer_data_from_tech (tech, layout);
net_tracer->trace (layout, cell, start_point, start_layer, stop_point, stop_layer, tracer_data);
}
gsi::Class<ext::NetTracerShape> decl_NetElement ("lay", "NetElement",
gsi::method ("trans", &ext::NetTracerShape::trans,
"@brief Gets the transformation to apply for rendering the shape in the original top cell\n"
"See the class description for more details about this attribute."
) +
gsi::method ("shape", (const db::Shape &(ext::NetTracerShape::*) () const) &ext::NetTracerShape::shape,
"@brief Gets the shape that makes up this net element\n"
"See the class description for more details about this attribute."
) +
#if 0
gsi::method ("is_valid?", &ext::NetTracerShape::is_valid,
"@brief Gets a value indicating whether the shape is valid\n"
"Currently this flag is not used."
) +
gsi::method ("is_pseudo?", &ext::NetTracerShape::is_pseudo,
"@brief Gets a value indicating whether the shape is a pseudo shape\n"
"Currently this flag is not used."
) +
#endif
gsi::method ("cell_index", &ext::NetTracerShape::cell_index,
"@brief Gets the index of the cell the shape is inside"
) +
gsi::method ("layer", &ext::NetTracerShape::layer,
"@brief Gets the index of the layer the shape is on"
) +
gsi::method ("bbox", &ext::NetTracerShape::bbox,
"@brief Delivers the bounding box of the shape as seen from the original top cell"
),
"@brief A net element for the \\NetTracer net tracing facility\n"
"\n"
"This object represents a piece of a net extracted by the net tracer. "
"See the description of \\NetTracer for more details about the net tracer feature.\n"
"\n"
"The NetTracer object represents one shape of the net. The shape can be an original shape or a shape derived in a boolean operation. "
"In the first case, the shape refers to a shape within a cell or a subcell of the original top cell. In the latter case, the shape "
"is a synthesized one and outside the original layout hierarchy.\n"
"\n"
"In any case, the \\shape method will deliver the shape and \\trans the transformation of the shape into the original top cell. "
"To obtain a flat representation of the net, the shapes need to be transformed by this transformation.\n"
"\n"
"\\layer will give the layer the shape is located at, \\cell_index will denote the cell that containes the shape.\n"
"\n"
"This class has been introduced in version 0.25.\n"
);
gsi::Class<ext::NetTracer> decl_NetTracer ("lay", "NetTracer",
gsi::method_ext ("trace", &trace1, gsi::arg ("tech"), gsi::arg ("layout"), gsi::arg ("cell"), gsi::arg ("start_point"), gsi::arg ("start_layer"),
"@brief Runs a net extraction\n"
"\n"
"This method runs an extraction with the given parameters.\n"
"To make the extraction successful, a shape must be present at the given start point on the start layer. "
"The start layer must be a valid layer mentioned within the technology specification.\n"
"\n"
"This version runs a single extraction - i.e. it will extract all elements connected to the given seed point. "
"A path extraction version is provided as well which will extract one (the presumably shortest) path between two "
"points.\n"
"\n"
"@param tech The technology definition\n"
"@param layout The layout on which to run the extraction\n"
"@param cell The cell on which to run the extraction (child cells will be included)\n"
"@param start_point The start point from which to start extraction of the net\n"
"@param start_layer The layer from which to start extraction\n"
) +
gsi::method_ext ("trace", &trace2, gsi::arg ("tech"), gsi::arg ("layout"), gsi::arg ("cell"), gsi::arg ("start_point"), gsi::arg ("start_layer"), gsi::arg ("stop_point"), gsi::arg ("stop_layer"),
"@brief Runs a path extraction\n"
"\n"
"This method runs an path extraction with the given parameters.\n"
"To make the extraction successful, a shape must be present at the given start point on the start layer and "
"at the given stop point at the given stop layer. "
"The start and stop layers must be a valid layers mentioned within the technology specification.\n"
"\n"
"This version runs a path extraction and will deliver elements forming one path leading from the start to the end point.\n"
"\n"
"@param tech The technology definition\n"
"@param layout The layout on which to run the extraction\n"
"@param cell The cell on which to run the extraction (child cells will be included)\n"
"@param start_point The start point from which to start extraction of the net\n"
"@param start_layer The layer from which to start extraction\n"
"@param stop_point The stop point at which to stop extraction of the net\n"
"@param stop_layer The layer at which to stop extraction\n"
) +
gsi::method_ext ("trace", &trace1_tn, gsi::arg ("tech"), gsi::arg ("layout"), gsi::arg ("cell"), gsi::arg ("start_point"), gsi::arg ("start_layer"),
"@brief Runs a net extraction taking a predefined technology\n"
"This method behaves identical as the version with a technology object, except that it will look for a technology "
"with the given name to obtain the extraction setup."
) +
gsi::method_ext ("trace", &trace2_tn, gsi::arg ("tech"), gsi::arg ("layout"), gsi::arg ("cell"), gsi::arg ("start_point"), gsi::arg ("start_layer"), gsi::arg ("stop_point"), gsi::arg ("stop_layer"),
"@brief Runs a path extraction taking a predefined technology\n"
"This method behaves identical as the version with a technology object, except that it will look for a technology "
"with the given name to obtain the extraction setup."
) +
gsi::method_ext ("trace", &trace1_cv, gsi::arg ("cellview"), gsi::arg ("start_point"), gsi::arg ("start_layer"),
"@brief Runs a net extraction from a cell view\n"
"This method behaves identical as the version with a technology, layout and cell object, except that it will take these "
"from the cellview specified."
) +
gsi::method_ext ("trace", &trace2_cv, gsi::arg ("cellview"), gsi::arg ("start_point"), gsi::arg ("start_layer"), gsi::arg ("stop_point"), gsi::arg ("stop_layer"),
"@brief Runs a path extraction from a cell view\n"
"This method behaves identical as the version with a technology, layout and cell object, except that it will take these "
"from the cellview specified."
) +
gsi::iterator ("each_element", &ext::NetTracer::begin, &ext::NetTracer::end,
"@brief Iterates over the elements found during extraction\n"
"The elements are available only after the extraction has been performed."
) +
gsi::method ("num_elements", &ext::NetTracer::size,
"@brief Returns the number of elements found during extraction\n"
"This attribute is useful only after the extraction has been performed."
) +
gsi::method ("clear", &ext::NetTracer::clear,
"@brief Clears the data from the last extraction\n"
) +
gsi::method ("name", &ext::NetTracer::name,
"@brief Returns the name of the net found during extraction\n"
"The net name is extracted from labels found during the extraction. "
"This attribute is useful only after the extraction has been performed."
) +
gsi::method ("incomplete?", &ext::NetTracer::incomplete,
"@brief Returns a value indicating whether the net is incomplete\n"
"A net may be incomplete if the extraction has been stopped by the user for example. "
"This attribute is useful only after the extraction has been performed."
),
"@brief The net tracer feature\n"
"\n"
"The net tracer class provides an interface to the net tracer feature. It is accompanied by the \\NetElement and \\NetTracerTechnology classes. "
"The latter will provide the technology definition for the net tracer while the \\NetElement objects represent a piece of the net "
"after it has been extracted.\n"
"\n"
"The technology definition is optional. The net tracer can be used with a predefined technology as well. The basic "
"scheme of using the net tracer is to instantiate a net tracer object and run the extraction through the \\NetTracer#trace "
"method. After this method was executed successfully, the resulting net can be obtained from the net tracer object by "
"iterating over the \\NetElement objects of the net tracer.\n"
"\n"
"Here is some sample code:\n"
"\n"
"@code\n"
"ly = RBA::CellView::active.layout\n"
"\n"
"tracer = RBA::NetTracer::new\n"
"\n"
"tech = RBA::NetTracerTechnology::new\n"
"tech.connection(\"1/0\", \"2/0\", \"3/0\")\n"
"\n"
"tracer.trace(tech, ly, ly.top_cell, RBA::Point::new(7000, 1500), ly.find_layer(1, 0))\n"
"\n"
"tracer.each_element do |e|\n"
" puts e.shape.polygon.transformed(e.trans)\n"
"end\n"
"@/code\n"
"\n"
"This class has been introduced in version 0.25."
);
}

View File

@ -7,7 +7,6 @@ TARGET = ext_tests
include($$PWD/../../lib_ut.pri)
SOURCES = \
extNetTracer.cc \
INCLUDEPATH += $$EXT_INC $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC
DEPENDPATH += $$EXT_INC $$TL_INC $$LAYBASIC_INC $$DB_INC $$GSI_INC

View File

@ -38,6 +38,14 @@
#include "tlClassRegistry.h"
#include "dbStream.h"
#include "ui_TechSetupDialog.h"
#include "ui_TechMacrosPage.h"
#include "ui_TechComponentSetupDialog.h"
#include "ui_TechBaseEditorPage.h"
#include "ui_TechLayerMappingEditorPage.h"
#include "ui_TechLoadOptionsEditorPage.h"
#include "ui_TechSaveOptionsEditorPage.h"
#include <QInputDialog>
#include <QMessageBox>
#include <QHeaderView>
@ -78,45 +86,52 @@ title_for_technology (const db::Technology *t)
TechBaseEditorPage::TechBaseEditorPage (QWidget *parent)
: TechnologyComponentEditor (parent)
{
Ui::TechBaseEditorPage::setupUi (this);
connect (browse_pb, SIGNAL (clicked ()), this, SLOT (browse_clicked ()));
connect (browse_lyp_pb, SIGNAL (clicked ()), this, SLOT (browse_lyp_clicked ()));
mp_ui = new Ui::TechBaseEditorPage ();
mp_ui->setupUi (this);
connect (mp_ui->browse_pb, SIGNAL (clicked ()), this, SLOT (browse_clicked ()));
connect (mp_ui->browse_lyp_pb, SIGNAL (clicked ()), this, SLOT (browse_lyp_clicked ()));
}
TechBaseEditorPage::~TechBaseEditorPage ()
{
delete mp_ui;
mp_ui = 0;
}
void
TechBaseEditorPage::setup ()
{
name_le->setText (tl::to_qstring (tech ()->name ()));
desc_le->setText (tl::to_qstring (tech ()->description ()));
dbu_le->setText (tl::to_qstring (tl::to_string (tech ()->dbu ())));
desc_le->setEnabled (! tech ()->name ().empty ());
base_path_le->setText (tl::to_qstring (tech ()->explicit_base_path ()));
mp_ui->name_le->setText (tl::to_qstring (tech ()->name ()));
mp_ui->desc_le->setText (tl::to_qstring (tech ()->description ()));
mp_ui->dbu_le->setText (tl::to_qstring (tl::to_string (tech ()->dbu ())));
mp_ui->desc_le->setEnabled (! tech ()->name ().empty ());
mp_ui->base_path_le->setText (tl::to_qstring (tech ()->explicit_base_path ()));
#if QT_VERSION >= 0x040700
base_path_le->setPlaceholderText (tl::to_qstring (tech ()->default_base_path ()));
mp_ui->base_path_le->setPlaceholderText (tl::to_qstring (tech ()->default_base_path ()));
#endif
const std::string &lyp = tech ()->layer_properties_file ();
lyp_grp->setChecked (! lyp.empty ());
lyp_le->setText (tl::to_qstring (lyp));
add_other_layers_cbx->setChecked (tech ()->add_other_layers ());
mp_ui->lyp_grp->setChecked (! lyp.empty ());
mp_ui->lyp_le->setText (tl::to_qstring (lyp));
mp_ui->add_other_layers_cbx->setChecked (tech ()->add_other_layers ());
}
void
TechBaseEditorPage::commit ()
{
tech ()->set_description (tl::to_string (desc_le->text ()));
tech ()->set_explicit_base_path (tl::to_string (base_path_le->text ()));
tech ()->set_description (tl::to_string (mp_ui->desc_le->text ()));
tech ()->set_explicit_base_path (tl::to_string (mp_ui->base_path_le->text ()));
double d = 0.001;
tl::from_string (tl::to_string (dbu_le->text ()), d);
tl::from_string (tl::to_string (mp_ui->dbu_le->text ()), d);
tech ()->set_dbu (d);
if (! lyp_grp->isChecked ()) {
if (! mp_ui->lyp_grp->isChecked ()) {
tech ()->set_layer_properties_file (std::string ());
tech ()->set_add_other_layers (true);
} else {
tech ()->set_layer_properties_file (tl::to_string (lyp_le->text ()));
tech ()->set_add_other_layers (add_other_layers_cbx->isChecked ());
tech ()->set_layer_properties_file (tl::to_string (mp_ui->lyp_le->text ()));
tech ()->set_add_other_layers (mp_ui->add_other_layers_cbx->isChecked ());
}
}
@ -124,9 +139,9 @@ void
TechBaseEditorPage::browse_clicked ()
{
QString p = QFileDialog::getExistingDirectory (this, QObject::tr ("Choose Base Path"),
base_path_le->text ());
mp_ui->base_path_le->text ());
if (! p.isNull ()) {
base_path_le->setText (p);
mp_ui->base_path_le->setText (p);
}
}
@ -139,7 +154,7 @@ TechBaseEditorPage::browse_lyp_clicked ()
std::string lyp = tech ()->base_path ();
if (open_dialog.get_open (lyp)) {
lyp_le->setText (tl::to_qstring (tech ()->correct_path (lyp)));
mp_ui->lyp_le->setText (tl::to_qstring (tech ()->correct_path (lyp)));
}
}
@ -149,10 +164,11 @@ TechBaseEditorPage::browse_lyp_clicked ()
TechLoadOptionsEditorPage::TechLoadOptionsEditorPage (QWidget *parent)
: TechnologyComponentEditor (parent)
{
Ui::TechLoadOptionsEditorPage::setupUi (this);
mp_ui = new Ui::TechLoadOptionsEditorPage ();
mp_ui->setupUi (this);
while (options_tab->count () > 0) {
options_tab->removeTab (0);
while (mp_ui->options_tab->count () > 0) {
mp_ui->options_tab->removeTab (0);
}
bool any_option = false;
@ -164,13 +180,13 @@ TechLoadOptionsEditorPage::TechLoadOptionsEditorPage (QWidget *parent)
// obtain the config page from the plugin which we identify by format name
const StreamReaderPluginDeclaration *decl = StreamReaderPluginDeclaration::plugin_for_format (fmt->format_name ());
if (decl) {
QScrollArea *page_host = new QScrollArea (options_tab);
QScrollArea *page_host = new QScrollArea (mp_ui->options_tab);
page_host->setFrameStyle (QFrame::NoFrame);
page_host->setWidgetResizable (true);
page = decl->format_specific_options_page (options_tab);
page = decl->format_specific_options_page (mp_ui->options_tab);
if (page) {
page_host->setWidget (page);
options_tab->addTab (page_host, tl::to_qstring (fmt->format_desc ()));
mp_ui->options_tab->addTab (page_host, tl::to_qstring (fmt->format_desc ()));
any_option = true;
} else {
delete page_host;
@ -180,10 +196,10 @@ TechLoadOptionsEditorPage::TechLoadOptionsEditorPage (QWidget *parent)
#if 0
// Add dummy pages for empty options
if (!page) {
QLabel *empty = new QLabel (options_tab);
QLabel *empty = new QLabel (mp_ui->options_tab);
empty->setAlignment (Qt::AlignCenter);
empty->setText (QObject::tr ("No specific options available for this format"));
options_tab->addTab (empty, tl::to_qstring (fmt->format_desc ()));
mp_ui->options_tab->addTab (empty, tl::to_qstring (fmt->format_desc ()));
}
#endif
@ -194,10 +210,16 @@ TechLoadOptionsEditorPage::TechLoadOptionsEditorPage (QWidget *parent)
}
if (! any_option) {
options_tab->hide ();
mp_ui->options_tab->hide ();
}
}
TechLoadOptionsEditorPage::~TechLoadOptionsEditorPage ()
{
delete mp_ui;
mp_ui = 0;
}
void
TechLoadOptionsEditorPage::setup ()
{
@ -232,10 +254,11 @@ TechLoadOptionsEditorPage::commit ()
TechSaveOptionsEditorPage::TechSaveOptionsEditorPage (QWidget *parent)
: TechnologyComponentEditor (parent)
{
Ui::TechSaveOptionsEditorPage::setupUi (this);
mp_ui = new Ui::TechSaveOptionsEditorPage ();
mp_ui->setupUi (this);
while (options_tab->count () > 0) {
options_tab->removeTab (0);
while (mp_ui->options_tab->count () > 0) {
mp_ui->options_tab->removeTab (0);
}
bool any_option = false;
@ -247,13 +270,13 @@ TechSaveOptionsEditorPage::TechSaveOptionsEditorPage (QWidget *parent)
// obtain the config page from the plugin which we identify by format name
const StreamWriterPluginDeclaration *decl = StreamWriterPluginDeclaration::plugin_for_format (fmt->format_name ());
if (decl) {
QScrollArea *page_host = new QScrollArea (options_tab);
QScrollArea *page_host = new QScrollArea (mp_ui->options_tab);
page_host->setFrameStyle (QFrame::NoFrame);
page_host->setWidgetResizable (true);
page = decl->format_specific_options_page (options_tab);
page = decl->format_specific_options_page (mp_ui->options_tab);
if (page) {
page_host->setWidget (page);
options_tab->addTab (page_host, tl::to_qstring (fmt->format_desc ()));
mp_ui->options_tab->addTab (page_host, tl::to_qstring (fmt->format_desc ()));
any_option = true;
} else {
delete page_host;
@ -263,10 +286,10 @@ TechSaveOptionsEditorPage::TechSaveOptionsEditorPage (QWidget *parent)
#if 0
// Add dummy pages for empty options
if (!page) {
QLabel *empty = new QLabel (options_tab);
QLabel *empty = new QLabel (mp_ui->options_tab);
empty->setAlignment (Qt::AlignCenter);
empty->setText (QObject::tr ("No specific options available for this format"));
options_tab->addTab (empty, tl::to_qstring (fmt->format_desc ()));
mp_ui->options_tab->addTab (empty, tl::to_qstring (fmt->format_desc ()));
}
#endif
@ -277,10 +300,16 @@ TechSaveOptionsEditorPage::TechSaveOptionsEditorPage (QWidget *parent)
}
if (! any_option) {
options_tab->hide ();
mp_ui->options_tab->hide ();
}
}
TechSaveOptionsEditorPage::~TechSaveOptionsEditorPage ()
{
delete mp_ui;
mp_ui = 0;
}
void
TechSaveOptionsEditorPage::setup ()
{
@ -323,40 +352,44 @@ TechSaveOptionsEditorPage::commit ()
TechMacrosPage::TechMacrosPage (QWidget *parent, const std::string &cat, const std::string &cat_desc)
: TechnologyComponentEditor (parent), m_cat (cat), m_cat_desc (cat_desc)
{
Ui::TechMacrosPage::setupUi (this);
mp_ui = new Ui::TechMacrosPage ();
mp_ui->setupUi (this);
m_original_labels.push_back (std::make_pair (title_label, title_label->text ()));
m_original_labels.push_back (std::make_pair (note_label, note_label->text ()));
m_original_labels.push_back (std::make_pair (empty_label1, empty_label1->text ()));
m_original_labels.push_back (std::make_pair (empty_label2, empty_label2->text ()));
m_original_labels.push_back (std::make_pair (empty_label3, empty_label3->text ()));
m_original_labels.push_back (std::make_pair (mp_ui->title_label, mp_ui->title_label->text ()));
m_original_labels.push_back (std::make_pair (mp_ui->note_label, mp_ui->note_label->text ()));
m_original_labels.push_back (std::make_pair (mp_ui->empty_label1, mp_ui->empty_label1->text ()));
m_original_labels.push_back (std::make_pair (mp_ui->empty_label2, mp_ui->empty_label2->text ()));
m_original_labels.push_back (std::make_pair (mp_ui->empty_label3, mp_ui->empty_label3->text ()));
folder_tree->header ()->hide ();
connect (folder_tree, SIGNAL (clicked (const QModelIndex &)), this, SLOT (macro_selected (const QModelIndex &)));
mp_ui->folder_tree->header ()->hide ();
connect (mp_ui->folder_tree, SIGNAL (clicked (const QModelIndex &)), this, SLOT (macro_selected (const QModelIndex &)));
QFont f = macro_text->font ();
QFont f = mp_ui->macro_text->font ();
f.setFixedPitch (true);
f.setFamily (tl::to_qstring ("Monospace"));
macro_text->setFont (f);
mp_ui->macro_text->setFont (f);
connect (create_folder_button, SIGNAL (clicked ()), this, SLOT (create_folder_clicked ()));
connect (mp_ui->create_folder_button, SIGNAL (clicked ()), this, SLOT (create_folder_clicked ()));
}
TechMacrosPage::~TechMacrosPage ()
{
// do this before the collection gets deleted.
delete folder_tree->model ();
delete mp_ui->folder_tree->model ();
delete mp_ui;
mp_ui = 0;
}
void
TechMacrosPage::setup ()
{
title_label->show ();
macro_frame->show ();
note_label->show ();
empty_label1->hide ();
empty_label3->hide ();
empty_label2_frame->hide ();
mp_ui->title_label->show ();
mp_ui->macro_frame->show ();
mp_ui->note_label->show ();
mp_ui->empty_label1->hide ();
mp_ui->empty_label3->hide ();
mp_ui->empty_label2_frame->hide ();
QDir base_dir (tl::to_qstring (tech ()->base_path ()));
QDir macro_dir (base_dir.filePath (tl::to_qstring (m_cat)));
@ -395,20 +428,20 @@ TechMacrosPage::setup ()
if (tech ()->base_path ().empty ()) {
// no base path set
title_label->hide ();
empty_label1->show ();
macro_frame->hide ();
note_label->hide ();
mp_ui->title_label->hide ();
mp_ui->empty_label1->show ();
mp_ui->macro_frame->hide ();
mp_ui->note_label->hide ();
} else {
if (! macro_dir.exists ()) {
// macro folder not found
title_label->hide ();
empty_label2_frame->show ();
macro_frame->hide ();
note_label->hide ();
mp_ui->title_label->hide ();
mp_ui->empty_label2_frame->show ();
mp_ui->macro_frame->hide ();
mp_ui->note_label->hide ();
} else {
@ -422,10 +455,10 @@ TechMacrosPage::setup ()
// this can happen, if the macro collection is already there in a different context.
// Show a message indicating that
title_label->hide ();
empty_label3->show ();
macro_frame->hide ();
note_label->hide ();
mp_ui->title_label->hide ();
mp_ui->empty_label3->show ();
mp_ui->macro_frame->hide ();
mp_ui->note_label->hide ();
} else {
@ -441,10 +474,10 @@ TechMacrosPage::setup ()
mc->add_folder (desc, mp, m_cat, true);
m_current_path = mp;
delete folder_tree->model ();
folder_tree->setModel (new lay::MacroTreeModel (this, mc, m_cat));
folder_tree->expandAll ();
macro_text->hide ();
delete mp_ui->folder_tree->model ();
mp_ui->folder_tree->setModel (new lay::MacroTreeModel (this, mc, m_cat));
mp_ui->folder_tree->expandAll ();
mp_ui->macro_text->hide ();
}
@ -471,16 +504,16 @@ void
TechMacrosPage::macro_selected (const QModelIndex &index)
{
const lym::Macro *m = 0;
lay::MacroTreeModel *model = dynamic_cast<lay::MacroTreeModel *> (folder_tree->model ());
lay::MacroTreeModel *model = dynamic_cast<lay::MacroTreeModel *> (mp_ui->folder_tree->model ());
if (model && model->is_valid_pointer (index.internalPointer ())) {
m = dynamic_cast <lym::Macro *> ((QObject *) index.internalPointer ());
}
if (! m) {
macro_text->hide ();
mp_ui->macro_text->hide ();
} else {
macro_text->show ();
macro_text->setPlainText (tl::to_qstring (m->text ()));
mp_ui->macro_text->show ();
mp_ui->macro_text->setPlainText (tl::to_qstring (m->text ()));
}
}
@ -500,7 +533,8 @@ TechSetupDialog::TechSetupDialog (QWidget *parent)
{
setObjectName (QString::fromUtf8 ("tech_setup_dialog"));
Ui::TechSetupDialog::setupUi (this);
mp_ui = new Ui::TechSetupDialog ();
mp_ui->setupUi (this);
QAction *add_action = new QAction (QObject::tr ("Add Technology"), this);
connect (add_action, SIGNAL (triggered ()), this, SLOT (add_clicked ()));
@ -517,29 +551,32 @@ TechSetupDialog::TechSetupDialog (QWidget *parent)
QAction *separator;
tech_tree->addAction (add_action);
tech_tree->addAction (delete_action);
tech_tree->addAction (rename_action);
mp_ui->tech_tree->addAction (add_action);
mp_ui->tech_tree->addAction (delete_action);
mp_ui->tech_tree->addAction (rename_action);
separator = new QAction (this);
separator->setSeparator (true);
tech_tree->addAction (separator);
tech_tree->addAction (import_action);
tech_tree->addAction (export_action);
mp_ui->tech_tree->addAction (separator);
mp_ui->tech_tree->addAction (import_action);
mp_ui->tech_tree->addAction (export_action);
separator = new QAction (this);
separator->setSeparator (true);
tech_tree->addAction (separator);
tech_tree->addAction (refresh_action);
mp_ui->tech_tree->addAction (separator);
mp_ui->tech_tree->addAction (refresh_action);
tech_tree->header ()->hide ();
connect (tech_tree, SIGNAL (currentItemChanged (QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT (current_tech_changed (QTreeWidgetItem *, QTreeWidgetItem *)));
connect (add_pb, SIGNAL (clicked ()), this, SLOT (add_clicked ()));
connect (delete_pb, SIGNAL (clicked ()), this, SLOT (delete_clicked ()));
connect (rename_pb, SIGNAL (clicked ()), this, SLOT (rename_clicked ()));
mp_ui->tech_tree->header ()->hide ();
connect (mp_ui->tech_tree, SIGNAL (currentItemChanged (QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT (current_tech_changed (QTreeWidgetItem *, QTreeWidgetItem *)));
connect (mp_ui->add_pb, SIGNAL (clicked ()), this, SLOT (add_clicked ()));
connect (mp_ui->delete_pb, SIGNAL (clicked ()), this, SLOT (delete_clicked ()));
connect (mp_ui->rename_pb, SIGNAL (clicked ()), this, SLOT (rename_clicked ()));
}
TechSetupDialog::~TechSetupDialog ()
{
clear_components ();
delete mp_ui;
mp_ui = 0;
}
void
@ -551,7 +588,7 @@ TechSetupDialog::clear_components ()
m_technology_components.clear ();
for (std::map <std::string, lay::TechnologyComponentEditor *>::iterator tce = m_component_editors.begin (); tce != m_component_editors.end (); ++tce) {
tc_stack->removeWidget (tce->second);
mp_ui->tc_stack->removeWidget (tce->second);
delete tce->second;
}
m_component_editors.clear ();
@ -577,8 +614,8 @@ BEGIN_PROTECTED
// Save the expanded state of the items
std::set<std::string> expanded_techs;
for (int i = 0; i < tech_tree->topLevelItemCount (); ++i) {
QTreeWidgetItem *item = tech_tree->topLevelItem (i);
for (int i = 0; i < mp_ui->tech_tree->topLevelItemCount (); ++i) {
QTreeWidgetItem *item = mp_ui->tech_tree->topLevelItem (i);
if (item && item->isExpanded ()) {
QVariant d = item->data (0, Qt::UserRole);
if (d != QVariant ()) {
@ -593,19 +630,19 @@ BEGIN_PROTECTED
QTreeWidgetItem *new_item = 0;
for (int i = 0; i < tech_tree->topLevelItemCount () && !new_item; ++i) {
QTreeWidgetItem *item = tech_tree->topLevelItem (i);
for (int i = 0; i < mp_ui->tech_tree->topLevelItemCount () && !new_item; ++i) {
QTreeWidgetItem *item = mp_ui->tech_tree->topLevelItem (i);
QVariant d = item->data (0, Qt::UserRole);
if (d != QVariant () && tech_name == tl::to_string (d.toString ())) {
new_item = item;
}
}
tech_tree->setCurrentItem (new_item);
mp_ui->tech_tree->setCurrentItem (new_item);
// restore the expanded state
for (int i = 0; i < tech_tree->topLevelItemCount (); ++i) {
QTreeWidgetItem *item = tech_tree->topLevelItem (i);
for (int i = 0; i < mp_ui->tech_tree->topLevelItemCount (); ++i) {
QTreeWidgetItem *item = mp_ui->tech_tree->topLevelItem (i);
QVariant d = item->data (0, Qt::UserRole);
bool expand = (d != QVariant () && expanded_techs.find (tl::to_string (d.toString ())) != expanded_techs.end ());
item->setExpanded (expand);
@ -623,7 +660,7 @@ void
TechSetupDialog::update ()
{
update_tech_tree ();
tech_tree->setCurrentItem (tech_tree->topLevelItem (0));
mp_ui->tech_tree->setCurrentItem (mp_ui->tech_tree->topLevelItem (0));
update_tech (selected_tech ());
}
@ -641,7 +678,7 @@ TechSetupDialog::exec (db::Technologies &technologies)
m_technologies = technologies;
update ();
tc_stack->setMinimumSize (tc_stack->sizeHint ());
mp_ui->tc_stack->setMinimumSize (mp_ui->tc_stack->sizeHint ());
int ret = QDialog::exec ();
if (ret) {
@ -862,7 +899,7 @@ END_PROTECTED
void
TechSetupDialog::update_tech_tree ()
{
tech_tree->clear ();
mp_ui->tech_tree->clear ();
std::map <std::string, const db::Technology *> tech_by_name;
for (db::Technologies::const_iterator t = m_technologies.begin (); t != m_technologies.end (); ++t) {
@ -871,10 +908,10 @@ TechSetupDialog::update_tech_tree ()
for (std::map <std::string, const db::Technology *>::const_iterator t = tech_by_name.begin (); t != tech_by_name.end (); ++t) {
QFont f (tech_tree->font ());
QFont f (mp_ui->tech_tree->font ());
f.setItalic (t->second->is_readonly ());
QTreeWidgetItem *ti = new QTreeWidgetItem (tech_tree);
QTreeWidgetItem *ti = new QTreeWidgetItem (mp_ui->tech_tree);
ti->setData (0, Qt::DisplayRole, QVariant (tl::to_qstring (title_for_technology (t->second))));
ti->setData (0, Qt::UserRole, QVariant (tl::to_qstring (t->first)));
ti->setData (0, Qt::FontRole, QVariant (f));
@ -939,7 +976,7 @@ TechSetupDialog::update_tech (db::Technology *t)
lay::TechnologyComponentEditor *tce_widget = new TechBaseEditorPage (this);
tce_widget->setEnabled (!t->is_readonly ());
tce_widget->set_technology (t, 0);
tc_stack->addWidget (tce_widget);
mp_ui->tc_stack->addWidget (tce_widget);
m_component_editors.insert (std::make_pair (std::string ("_general"), tce_widget));
if (lay::MacroController::instance ()) {
@ -948,7 +985,7 @@ TechSetupDialog::update_tech (db::Technology *t)
tce_widget = new TechMacrosPage (this, c->name, c->description);
tce_widget->setEnabled (!t->is_readonly ());
tce_widget->set_technology (t, 0);
tc_stack->addWidget (tce_widget);
mp_ui->tc_stack->addWidget (tce_widget);
m_component_editors.insert (std::make_pair (std::string ("_macros_") + c->name, tce_widget));
}
}
@ -956,13 +993,13 @@ TechSetupDialog::update_tech (db::Technology *t)
tce_widget = new TechLoadOptionsEditorPage (this);
tce_widget->setEnabled (!t->is_readonly ());
tce_widget->set_technology (t, 0);
tc_stack->addWidget (tce_widget);
mp_ui->tc_stack->addWidget (tce_widget);
m_component_editors.insert (std::make_pair (std::string ("_load_options"), tce_widget));
tce_widget = new TechSaveOptionsEditorPage (this);
tce_widget->setEnabled (!t->is_readonly ());
tce_widget->set_technology (t, 0);
tc_stack->addWidget (tce_widget);
mp_ui->tc_stack->addWidget (tce_widget);
m_component_editors.insert (std::make_pair (std::string ("_save_options"), tce_widget));
std::vector <std::string> tc_names = t->component_names ();
@ -981,7 +1018,7 @@ TechSetupDialog::update_tech (db::Technology *t)
if (tce_widget) {
tce_widget->setEnabled (!t->is_readonly ());
tce_widget->set_technology (t, tc);
tc_stack->addWidget (tce_widget);
mp_ui->tc_stack->addWidget (tce_widget);
m_component_editors.insert (std::make_pair (tc->name (), tce_widget));
}
@ -1004,13 +1041,13 @@ TechSetupDialog::update_tech_component ()
mp_current_tech_component = 0;
}
tc_stack->setCurrentWidget (tce->second);
mp_ui->tc_stack->setCurrentWidget (tce->second);
mp_current_editor = tce->second;
tce->second->setup ();
} else {
tc_stack->setCurrentIndex (0);
mp_ui->tc_stack->setCurrentIndex (0);
mp_current_editor = 0;
}
@ -1024,14 +1061,14 @@ TechSetupDialog::select_tech (const db::Technology &tech)
// find the item for the new technology
QTreeWidgetItem *item = 0;
for (int i = tech_tree->topLevelItemCount (); i > 0; --i) {
item = tech_tree->topLevelItem (i - 1);
for (int i = mp_ui->tech_tree->topLevelItemCount (); i > 0; --i) {
item = mp_ui->tech_tree->topLevelItem (i - 1);
if (item->data (0, Qt::UserRole).toString () == tl::to_qstring (tech.name ())) {
break;
}
}
tech_tree->setCurrentItem (item);
mp_ui->tech_tree->setCurrentItem (item);
update_tech (selected_tech ());
update_tech_component ();
@ -1061,10 +1098,10 @@ BEGIN_PROTECTED
update_tech_component ();
}
} catch (...) {
disconnect (tech_tree, SIGNAL (currentItemChanged (QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT (current_tech_changed (QTreeWidgetItem *, QTreeWidgetItem *)));
disconnect (mp_ui->tech_tree, SIGNAL (currentItemChanged (QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT (current_tech_changed (QTreeWidgetItem *, QTreeWidgetItem *)));
// TODO: this leaves current selected - any way to unselect it?
tech_tree->setCurrentItem (previous);
connect (tech_tree, SIGNAL (currentItemChanged (QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT (current_tech_changed (QTreeWidgetItem *, QTreeWidgetItem *)));
mp_ui->tech_tree->setCurrentItem (previous);
connect (mp_ui->tech_tree, SIGNAL (currentItemChanged (QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT (current_tech_changed (QTreeWidgetItem *, QTreeWidgetItem *)));
throw;
}
END_PROTECTED
@ -1084,9 +1121,9 @@ TechSetupDialog::commit_tech_component ()
}
// because commit may have changed the description text, update the technology titles
for (int i = tech_tree->topLevelItemCount (); i > 0; --i) {
for (int i = mp_ui->tech_tree->topLevelItemCount (); i > 0; --i) {
QTreeWidgetItem *item = tech_tree->topLevelItem (i - 1);
QTreeWidgetItem *item = mp_ui->tech_tree->topLevelItem (i - 1);
db::Technology *t = m_technologies.technology_by_name (tl::to_string (item->data (0, Qt::UserRole).toString ()));
item->setData (0, Qt::DisplayRole, QVariant (tl::to_qstring (title_for_technology (t))));
@ -1099,7 +1136,7 @@ TechSetupDialog::commit_tech_component ()
std::string
TechSetupDialog::selected_tech_component_name ()
{
QTreeWidgetItem *item = tech_tree->currentItem ();
QTreeWidgetItem *item = mp_ui->tech_tree->currentItem ();
if (item) {
QVariant d = item->data (0, Qt::UserRole + 1);
if (d != QVariant ()) {
@ -1113,7 +1150,7 @@ TechSetupDialog::selected_tech_component_name ()
db::Technology *
TechSetupDialog::selected_tech ()
{
QTreeWidgetItem *item = tech_tree->currentItem ();
QTreeWidgetItem *item = mp_ui->tech_tree->currentItem ();
while (item) {
QVariant d = item->data (0, Qt::UserRole);
@ -1141,7 +1178,8 @@ TechComponentSetupDialog::TechComponentSetupDialog (QWidget *parent, db::Technol
{
setObjectName (QString::fromUtf8 ("tech_component_setup_dialog"));
Ui::TechComponentSetupDialog::setupUi (this);
mp_ui = new Ui::TechComponentSetupDialog ();
mp_ui->setupUi (this);
if (tech->name ().empty ()) {
setWindowTitle (tl::to_qstring (tl::to_string (QObject::tr ("Edit Technology")) + " - " + tl::to_string (QObject::tr ("(Default)"))));
@ -1157,16 +1195,16 @@ TechComponentSetupDialog::TechComponentSetupDialog (QWidget *parent, db::Technol
mp_editor = 0;
for (tl::Registrar<lay::TechnologyEditorProvider>::iterator cls = tl::Registrar<lay::TechnologyEditorProvider>::begin (); cls != tl::Registrar<lay::TechnologyEditorProvider>::end () && ! mp_editor; ++cls) {
if (cls.current_name () == mp_component->name ()) {
mp_editor = cls->create_editor (content_frame);
mp_editor = cls->create_editor (mp_ui->content_frame);
}
}
if (mp_editor) {
QVBoxLayout *layout = new QVBoxLayout (content_frame);
QVBoxLayout *layout = new QVBoxLayout (mp_ui->content_frame);
layout->addWidget (mp_editor);
layout->setMargin (0);
content_frame->setLayout (layout);
mp_ui->content_frame->setLayout (layout);
mp_editor->set_technology (tech, mp_component);
mp_editor->setup ();
@ -1179,6 +1217,9 @@ TechComponentSetupDialog::~TechComponentSetupDialog ()
{
delete mp_component;
mp_component = 0;
delete mp_ui;
mp_ui = 0;
}
void

View File

@ -24,20 +24,14 @@
#ifndef HDR_layTechSetupDialog
#define HDR_layTechSetupDialog
#include "ui_TechSetupDialog.h"
#include "ui_TechMacrosPage.h"
#include "ui_TechComponentSetupDialog.h"
#include "ui_TechBaseEditorPage.h"
#include "ui_TechLayerMappingEditorPage.h"
#include "ui_TechLoadOptionsEditorPage.h"
#include "ui_TechSaveOptionsEditorPage.h"
#include "layTechnology.h"
#include "layStream.h"
#include "layCommon.h"
#include <memory>
#include <QDialog>
namespace db
{
class Technology;
@ -49,19 +43,33 @@ namespace lym
class MacroCollection;
}
namespace Ui
{
class TechBaseEditorPage;
class TechComponentSetupDialog;
class TechSetupDialog;
class TechSaveOptionsEditorPage;
class TechLoadOptionsEditorPage;
class TechMacrosPage;
}
class QLabel;
class QModelIndex;
class QTreeWidgetItem;
namespace lay
{
class TechnologyComponentEditor;
class TechBaseEditorPage
: public TechnologyComponentEditor,
public Ui::TechBaseEditorPage
: public TechnologyComponentEditor
{
Q_OBJECT
public:
TechBaseEditorPage (QWidget *parent);
~TechBaseEditorPage ();
virtual void setup ();
virtual void commit ();
@ -69,11 +77,13 @@ public:
private slots:
void browse_clicked ();
void browse_lyp_clicked ();
private:
Ui::TechBaseEditorPage *mp_ui;
};
class TechMacrosPage
: public TechnologyComponentEditor,
public Ui::TechMacrosPage
: public TechnologyComponentEditor
{
Q_OBJECT
@ -85,6 +95,7 @@ public:
virtual void commit ();
private:
Ui::TechMacrosPage *mp_ui;
std::string m_cat, m_cat_desc;
std::vector<std::pair<QLabel *, QString> > m_original_labels;
std::auto_ptr<lym::MacroCollection> mp_collection;
@ -96,40 +107,41 @@ private slots:
};
class TechLoadOptionsEditorPage
: public TechnologyComponentEditor,
public Ui::TechLoadOptionsEditorPage
: public TechnologyComponentEditor
{
Q_OBJECT
public:
TechLoadOptionsEditorPage (QWidget *parent);
~TechLoadOptionsEditorPage ();
virtual void setup ();
virtual void commit ();
private:
Ui::TechLoadOptionsEditorPage *mp_ui;
std::vector< std::pair<lay::StreamReaderOptionsPage *, std::string> > m_pages;
};
class TechSaveOptionsEditorPage
: public TechnologyComponentEditor,
public Ui::TechSaveOptionsEditorPage
: public TechnologyComponentEditor
{
Q_OBJECT
public:
TechSaveOptionsEditorPage (QWidget *parent);
~TechSaveOptionsEditorPage ();
virtual void setup ();
virtual void commit ();
private:
Ui::TechSaveOptionsEditorPage *mp_ui;
std::vector< std::pair<lay::StreamWriterOptionsPage *, std::string> > m_pages;
};
class LAY_PUBLIC TechSetupDialog
: public QDialog,
public Ui::TechSetupDialog
: public QDialog
{
Q_OBJECT
@ -160,6 +172,7 @@ private:
void clear_components ();
void update ();
Ui::TechSetupDialog *mp_ui;
db::Technologies m_technologies;
db::Technology *mp_current_tech;
std::map <std::string, lay::TechnologyComponentEditor *> m_component_editors;
@ -170,8 +183,7 @@ private:
};
class LAY_PUBLIC TechComponentSetupDialog
: public QDialog,
public Ui::TechComponentSetupDialog
: public QDialog
{
public:
TechComponentSetupDialog (QWidget *parent, db::Technology *tech, const std::string &component_name);
@ -181,6 +193,7 @@ protected:
void accept ();
private:
Ui::TechComponentSetupDialog *mp_ui;
db::Technology *mp_tech;
db::TechnologyComponent *mp_component;
lay::TechnologyComponentEditor *mp_editor;

View File

@ -21,7 +21,7 @@
*/
#include "extNetTracer.h"
#include "dbNetTracer.h"
#include "dbRecursiveShapeIterator.h"
#include "dbPolygonTools.h"
@ -34,7 +34,7 @@
# pragma GCC optimize("O2")
#endif
namespace ext
namespace db
{
// -----------------------------------------------------------------------------------

View File

@ -22,10 +22,10 @@
#ifndef HDR_extNetTracer
#define HDR_extNetTracer
#ifndef HDR_dbNetTracer
#define HDR_dbNetTracer
#include "extCommon.h"
#include "dbCommon.h"
#include "dbShapes.h"
#include "dbShape.h"
@ -39,13 +39,9 @@
#include <list>
namespace db
{
class RecursiveShapeIterator;
}
namespace ext
{
class RecursiveShapeIterator;
class NetTracerLayerElement;
class NetTracerData;
@ -56,7 +52,7 @@ class NetTracerData;
* the data and second, this guarantees that the Shape references delivered point to the same object
* for identical shapes.
*/
class EXT_PUBLIC NetTracerShapeHeap
class DB_PUBLIC NetTracerShapeHeap
{
public:
/**
@ -85,7 +81,7 @@ private:
* This class describes a shape in the hierarchy by the transformation into the top cell, the shape reference, the cell
* index and the layer the shape resides on.
*/
class EXT_PUBLIC NetTracerShape
class DB_PUBLIC NetTracerShape
{
public:
/**
@ -256,7 +252,7 @@ typedef db::box_tree<db::Box, const NetTracerShape *, HitTestDataBoxConverter, 1
/**
* @brief Describes a boolean expression for computed layers
*/
class EXT_PUBLIC NetTracerLayerExpression
class DB_PUBLIC NetTracerLayerExpression
{
public:
/**
@ -401,7 +397,7 @@ private:
* This class has three members: the index of the first conductive layer, the
* index of the via layer and the index of the second conductive layer.
*/
class EXT_PUBLIC NetTracerConnection
class DB_PUBLIC NetTracerConnection
{
public:
/**
@ -478,7 +474,7 @@ private:
/**
* @brief Wraps the data for a net tracing
*/
class EXT_PUBLIC NetTracerData
class DB_PUBLIC NetTracerData
{
public:
/**
@ -586,7 +582,7 @@ private:
* Net tracing can be performed with a given seed point and given tracing data.
* The tracing is initiated with the "trace" method.
*/
class EXT_PUBLIC NetTracer
class DB_PUBLIC NetTracer
{
public:
typedef std::set <NetTracerShape>::const_iterator iterator;

View File

@ -0,0 +1,545 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2018 Matthias Koefferlein
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
*/
#include "dbNetTracerIO.h"
#include "dbTechnology.h"
#include "tlClassRegistry.h"
namespace db
{
DB_PUBLIC std::string net_tracer_component_name ("connectivity");
// -----------------------------------------------------------------------------------------
// NetTracerLayerExpressionInfo implementation
NetTracerLayerExpressionInfo::NetTracerLayerExpressionInfo ()
: mp_a (0), mp_b (0), m_op (NetTracerLayerExpression::OPNone)
{
// .. nothing yet ..
}
NetTracerLayerExpressionInfo::~NetTracerLayerExpressionInfo ()
{
delete mp_a;
mp_a = 0;
delete mp_b;
mp_b = 0;
}
NetTracerLayerExpressionInfo::NetTracerLayerExpressionInfo (const NetTracerLayerExpressionInfo &other)
: m_expression (other.m_expression), m_a (other.m_a), m_b (other.m_b), mp_a (0), mp_b (0), m_op (other.m_op)
{
if (other.mp_a) {
mp_a = new NetTracerLayerExpressionInfo (*other.mp_a);
}
if (other.mp_b) {
mp_b = new NetTracerLayerExpressionInfo (*other.mp_b);
}
}
NetTracerLayerExpressionInfo &
NetTracerLayerExpressionInfo::operator= (const NetTracerLayerExpressionInfo &other)
{
if (this != &other) {
m_expression = other.m_expression;
delete mp_a;
mp_a = 0;
delete mp_b;
mp_b = 0;
m_a = other.m_a;
m_b = other.m_b;
m_op = other.m_op;
if (other.mp_a) {
mp_a = new NetTracerLayerExpressionInfo (*other.mp_a);
}
if (other.mp_b) {
mp_b = new NetTracerLayerExpressionInfo (*other.mp_b);
}
}
return *this;
}
void
NetTracerLayerExpressionInfo::merge (NetTracerLayerExpression::Operator op, const NetTracerLayerExpressionInfo &other)
{
if (m_op != NetTracerLayerExpression::OPNone) {
NetTracerLayerExpressionInfo *e = new NetTracerLayerExpressionInfo (*this);
*this = NetTracerLayerExpressionInfo ();
mp_a = e;
}
m_op = op;
if (other.m_op == NetTracerLayerExpression::OPNone) {
if (other.mp_a) {
mp_b = new NetTracerLayerExpressionInfo (*other.mp_a);
} else {
m_b = other.m_a;
}
} else {
mp_b = new NetTracerLayerExpressionInfo (other);
}
}
NetTracerLayerExpressionInfo
NetTracerLayerExpressionInfo::parse_add (tl::Extractor &ex)
{
NetTracerLayerExpressionInfo e = parse_mult (ex);
while (true) {
if (ex.test ("+")) {
NetTracerLayerExpressionInfo ee = parse_mult (ex);
e.merge (NetTracerLayerExpression::OPOr, ee);
} else if (ex.test ("-")) {
NetTracerLayerExpressionInfo ee = parse_mult (ex);
e.merge (NetTracerLayerExpression::OPNot, ee);
} else {
break;
}
}
return e;
}
NetTracerLayerExpressionInfo
NetTracerLayerExpressionInfo::parse_mult (tl::Extractor &ex)
{
NetTracerLayerExpressionInfo e = parse_atomic (ex);
while (true) {
if (ex.test ("*")) {
NetTracerLayerExpressionInfo ee = parse_atomic (ex);
e.merge (NetTracerLayerExpression::OPAnd, ee);
} else if (ex.test ("^")) {
NetTracerLayerExpressionInfo ee = parse_atomic (ex);
e.merge (NetTracerLayerExpression::OPXor, ee);
} else {
break;
}
}
return e;
}
NetTracerLayerExpressionInfo
NetTracerLayerExpressionInfo::parse_atomic (tl::Extractor &ex)
{
NetTracerLayerExpressionInfo e;
if (ex.test ("(")) {
e = parse_add (ex);
ex.expect (")");
} else {
e.m_a.read (ex);
}
return e;
}
NetTracerLayerExpressionInfo
NetTracerLayerExpressionInfo::parse (tl::Extractor &ex)
{
const char *start = ex.skip ();
NetTracerLayerExpressionInfo e = parse_add (ex);
e.m_expression = std::string (start, ex.get () - start);
return e;
}
NetTracerLayerExpressionInfo
NetTracerLayerExpressionInfo::compile (const std::string &s)
{
tl::Extractor ex (s.c_str ());
const char *start = ex.skip ();
NetTracerLayerExpressionInfo e = parse_add (ex);
e.m_expression = std::string (start, ex.get () - start);
ex.expect_end ();
return e;
}
NetTracerLayerExpression *
NetTracerLayerExpressionInfo::get_expr (const db::LayerProperties &lp, const db::Layout &layout, const NetTracerTechnologyComponent &tech, const std::set<std::string> &used_symbols) const
{
for (NetTracerTechnologyComponent::const_symbol_iterator s = tech.begin_symbols (); s != tech.end_symbols (); ++s) {
if (s->symbol ().log_equal (lp)) {
std::set<std::string> us = used_symbols;
if (! us.insert (s->symbol ().to_string ()).second) {
throw tl::Exception (tl::to_string (QObject::tr ("Recursive expression through symbol %s")), s->symbol ());
}
return NetTracerLayerExpressionInfo::compile (s->expression ()).get (layout, tech, us);
}
}
for (db::Layout::layer_iterator l = layout.begin_layers (); l != layout.end_layers (); ++l) {
if ((*l).second->log_equal (lp)) {
return new NetTracerLayerExpression ((*l).first);
}
}
return new NetTracerLayerExpression (-1);
}
NetTracerLayerExpression *
NetTracerLayerExpressionInfo::get (const db::Layout &layout, const NetTracerTechnologyComponent &tech) const
{
std::set<std::string> us;
return get (layout, tech, us);
}
NetTracerLayerExpression *
NetTracerLayerExpressionInfo::get (const db::Layout &layout, const NetTracerTechnologyComponent &tech, const std::set<std::string> &used_symbols) const
{
NetTracerLayerExpression *e = 0;
if (mp_a) {
e = mp_a->get (layout, tech, used_symbols);
} else {
e = get_expr (m_a, layout, tech, used_symbols);
}
if (m_op != NetTracerLayerExpression::OPNone) {
if (mp_b) {
e->merge (m_op, mp_b->get (layout, tech, used_symbols));
} else {
e->merge (m_op, get_expr (m_b, layout, tech, used_symbols));
}
}
return e;
}
// -----------------------------------------------------------------------------------
// NetTracerConnectionInfo implementation
NetTracerConnectionInfo::NetTracerConnectionInfo ()
{
// .. nothing yet ..
}
NetTracerConnectionInfo::NetTracerConnectionInfo (const NetTracerLayerExpressionInfo &la, const NetTracerLayerExpressionInfo &lb)
: m_la (la), m_via (), m_lb (lb)
{
// .. nothing yet ..
}
NetTracerConnectionInfo::NetTracerConnectionInfo (const NetTracerLayerExpressionInfo &la, const NetTracerLayerExpressionInfo &via, const NetTracerLayerExpressionInfo &lb)
: m_la (la), m_via (via), m_lb (lb)
{
// .. nothing yet ..
}
static int get_layer_id (const NetTracerLayerExpressionInfo &e, const db::Layout &layout, const NetTracerTechnologyComponent &tech, NetTracerData *data)
{
std::auto_ptr<NetTracerLayerExpression> expr_in (NetTracerLayerExpressionInfo::compile (e.to_string ()).get (layout, tech));
int l = expr_in->alias_for ();
if (l < 0 && data) {
l = data->find_symbol (e.to_string ());
if (l < 0) {
return int (data->register_logical_layer (expr_in.release (), 0));
}
}
return l;
}
NetTracerConnection
NetTracerConnectionInfo::get (const db::Layout &layout, const NetTracerTechnologyComponent &tech, NetTracerData &data) const
{
int la = get_layer_id (m_la, layout, tech, &data);
int lb = get_layer_id (m_lb, layout, tech, &data);
if (! m_via.to_string ().empty ()) {
int via = get_layer_id (m_via, layout, tech, &data);
return NetTracerConnection (la, via, lb);
} else {
return NetTracerConnection (la, lb);
}
}
std::string
NetTracerConnectionInfo::to_string () const
{
std::string res;
res += m_la.to_string ();
res += ",";
res += m_via.to_string ();
res += ",";
res += m_lb.to_string ();
return res;
}
void
NetTracerConnectionInfo::parse (tl::Extractor &ex)
{
m_la = NetTracerLayerExpressionInfo::parse (ex);
ex.expect (",");
m_via = NetTracerLayerExpressionInfo::parse (ex);
ex.expect (",");
m_lb = NetTracerLayerExpressionInfo::parse (ex);
}
// -----------------------------------------------------------------------------------
// NetTracerSymbolInfo implementation
NetTracerSymbolInfo::NetTracerSymbolInfo ()
{
// .. nothing yet ..
}
NetTracerSymbolInfo::NetTracerSymbolInfo (const db::LayerProperties &symbol, const std::string &expression)
: m_symbol (symbol), m_expression (expression)
{
// .. nothing yet ..
}
std::string
NetTracerSymbolInfo::to_string () const
{
std::string res;
res += m_symbol.to_string ();
res += "=";
res += tl::to_quoted_string(m_expression);
return res;
}
void
NetTracerSymbolInfo::parse (tl::Extractor &ex)
{
m_symbol.read (ex);
ex.expect ("=");
ex.read_word_or_quoted (m_expression);
}
// -----------------------------------------------------------------------------------
// Net implementation
Net::Net ()
: m_dbu (0.001), m_incomplete (true), m_trace_path (false)
{
// .. nothing yet ..
}
Net::Net (const NetTracer &tracer, const db::ICplxTrans &trans, const db::Layout &layout, db::cell_index_type cell_index, const std::string &layout_filename, const std::string &layout_name, const NetTracerData &data)
: m_name (tracer.name ()), m_incomplete (tracer.incomplete ()), m_trace_path (false)
{
m_dbu = layout.dbu ();
m_top_cell_name = layout.cell_name (cell_index);
m_layout_filename = layout_filename;
m_layout_name = layout_name;
size_t n = 0;
for (NetTracer::iterator s = tracer.begin (); s != tracer.end (); ++s) {
++n;
}
m_net_shapes.reserve (n);
for (NetTracer::iterator s = tracer.begin (); s != tracer.end (); ++s) {
// TODO: should reset propery ID:
tl::ident_map<db::properties_id_type> pm;
db::Shape new_shape = m_shapes.insert (s->shape (), trans, pm);
m_net_shapes.push_back (*s);
m_net_shapes.back ().shape (new_shape);
if (m_cell_names.find (s->cell_index ()) == m_cell_names.end ()) {
m_cell_names.insert (std::make_pair (s->cell_index (), layout.cell_name (s->cell_index ())));
}
if (m_layers.find (s->layer ()) == m_layers.end ()) {
unsigned int l = s->layer ();
db::LayerProperties lp;
db::LayerProperties lprep;
if (layout.is_valid_layer (l)) {
lp = layout.get_properties (l);
lprep = lp;
} else {
int lrep = data.expression (l).representative_layer ();
if (layout.is_valid_layer (lrep)) {
lprep = layout.get_properties (lrep);
}
for (std::map<std::string, unsigned int>::const_iterator sy = data.symbols ().begin (); sy != data.symbols ().end (); ++sy) {
if (sy->second == l) {
tl::Extractor ex (sy->first.c_str ());
lp.read (ex);
break;
}
}
}
define_layer (l, lp, lprep);
}
}
}
std::vector<unsigned int>
Net::export_net (db::Layout &layout, db::Cell &export_cell)
{
std::vector<unsigned int> new_layers;
std::map<unsigned int, unsigned int> layer_map;
for (iterator net_shape = begin (); net_shape != end (); ++net_shape) {
if (net_shape->is_pseudo ()) {
continue;
}
std::map<unsigned int, unsigned int>::const_iterator lm = layer_map.find (net_shape->layer ());
if (lm == layer_map.end ()) {
int layer_index = -1;
for (db::Layout::layer_iterator l = layout.begin_layers (); l != layout.end_layers (); ++l) {
if ((*l).second->log_equal (representative_layer_for (net_shape->layer ()))) {
layer_index = int ((*l).first);
break;
}
}
if (layer_index < 0) {
layer_index = int (layout.insert_layer (representative_layer_for (net_shape->layer ())));
new_layers.push_back (layer_index);
}
lm = layer_map.insert (std::make_pair (net_shape->layer (), (unsigned int)layer_index)).first;
}
tl::ident_map<db::properties_id_type> pm;
export_cell.shapes (lm->second).insert (net_shape->shape (), db::ICplxTrans (net_shape->trans ()), pm);
}
return new_layers;
}
const std::string &
Net::cell_name (db::cell_index_type cell_index) const
{
std::map <unsigned int, std::string>::const_iterator cn = m_cell_names.find (cell_index);
if (cn != m_cell_names.end ()) {
return cn->second;
} else {
static std::string n;
return n;
}
}
db::LayerProperties
Net::representative_layer_for (unsigned int log_layer) const
{
std::map <unsigned int, std::pair <db::LayerProperties, db::LayerProperties> >::const_iterator l = m_layers.find (log_layer);
if (l != m_layers.end ()) {
return l->second.second;
} else {
return db::LayerProperties ();
}
}
db::LayerProperties
Net::layer_for (unsigned int log_layer) const
{
std::map <unsigned int, std::pair <db::LayerProperties, db::LayerProperties> >::const_iterator l = m_layers.find (log_layer);
if (l != m_layers.end ()) {
return l->second.first;
} else {
return db::LayerProperties ();
}
}
void
Net::define_layer (unsigned int l, const db::LayerProperties &lp, const db::LayerProperties &lp_representative)
{
m_layers.insert (std::make_pair (l, std::make_pair (lp, lp_representative)));
}
// -----------------------------------------------------------------------------------
// NetTracerTechnologyComponent implementation
NetTracerTechnologyComponent::NetTracerTechnologyComponent ()
: db::TechnologyComponent (net_tracer_component_name, tl::to_string (QObject::tr ("Connectivity")))
{
// .. nothing yet ..
}
NetTracerTechnologyComponent::NetTracerTechnologyComponent (const NetTracerTechnologyComponent &d)
: db::TechnologyComponent (net_tracer_component_name, tl::to_string (QObject::tr ("Connectivity")))
{
m_connections = d.m_connections;
m_symbols = d.m_symbols;
}
NetTracerData
NetTracerTechnologyComponent::get_tracer_data (const db::Layout &layout) const
{
// test run on the expressions to verify their syntax
int n = 1;
for (NetTracerTechnologyComponent::const_iterator c = begin (); c != end (); ++c, ++n) {
if (c->layer_a ().to_string ().empty ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Missing first layer specification on connectivity specification #%d")), n);
}
if (c->layer_b ().to_string ().empty ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Missing second layer specification on connectivity specification #%d")), n);
}
}
n = 1;
for (NetTracerTechnologyComponent::const_symbol_iterator s = begin_symbols (); s != end_symbols (); ++s, ++n) {
if (s->symbol ().to_string ().empty ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Missing symbol name on symbol specification #%d")), n);
}
if (s->expression ().empty ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Missing expression on symbol specification #%d")), n);
}
try {
std::auto_ptr<NetTracerLayerExpression> expr_in (NetTracerLayerExpressionInfo::compile (s->expression ()).get (layout, *this));
} catch (tl::Exception &ex) {
throw tl::Exception (tl::to_string (QObject::tr ("Error compiling expression '%s' (symbol #%d): %s")), s->expression (), n, ex.msg ());
}
}
NetTracerData data;
// register a logical layer for each original one as alias and one for each expression with a new ID
for (db::NetTracerTechnologyComponent::const_symbol_iterator s = begin_symbols (); s != end_symbols (); ++s) {
db::NetTracerLayerExpression *expr = db::NetTracerLayerExpressionInfo::compile (s->expression ()).get (layout, *this);
data.register_logical_layer (expr, s->symbol ().to_string ().c_str ());
}
for (db::NetTracerTechnologyComponent::const_iterator c = begin (); c != end (); ++c) {
data.add_connection (c->get (layout, *this, data));
}
return data;
}
}

View File

@ -20,35 +20,21 @@
*/
#ifndef HDR_dbNetTracerIO
#define HDR_dbNetTracerIO
#include "dbNetTracer.h"
#include "dbLayerProperties.h"
#include "dbTechnology.h"
#ifndef HDR_extNetTracerIO
#define HDR_extNetTracerIO
#include <QColor>
#include "ui_NetTracerTechComponentEditor.h"
#include "extNetTracer.h"
#include "extNetTracerConfig.h"
#include "layBrowser.h"
#include "layPlugin.h"
#include "layViewObject.h"
#include "layMarker.h"
#include "layTechnology.h"
#include "tlObject.h"
namespace lay
{
class FileDialog;
}
namespace ext
namespace db
{
class NetTracerTechnologyComponent;
class EXT_PUBLIC NetTracerLayerExpressionInfo
class DB_PUBLIC NetTracerLayerExpressionInfo
{
public:
NetTracerLayerExpressionInfo ();
@ -68,7 +54,7 @@ public:
{
return m_expression;
}
NetTracerLayerExpression *get (const db::Layout &layout, const NetTracerTechnologyComponent &tech) const;
private:
@ -86,7 +72,7 @@ private:
NetTracerLayerExpression *get_expr (const db::LayerProperties &lp, const db::Layout &layout, const NetTracerTechnologyComponent &tech, const std::set<std::string> &used_symbols) const;
};
class EXT_PUBLIC NetTracerConnectionInfo
class DB_PUBLIC NetTracerConnectionInfo
{
public:
NetTracerConnectionInfo ();
@ -98,32 +84,32 @@ public:
std::string to_string () const;
void parse (tl::Extractor &ex);
const NetTracerLayerExpressionInfo &layer_a () const
const NetTracerLayerExpressionInfo &layer_a () const
{
return m_la;
}
void set_layer_a (const NetTracerLayerExpressionInfo &l)
void set_layer_a (const NetTracerLayerExpressionInfo &l)
{
m_la = l;
}
const NetTracerLayerExpressionInfo &via_layer () const
const NetTracerLayerExpressionInfo &via_layer () const
{
return m_via;
}
void set_via_layer (const NetTracerLayerExpressionInfo &l)
void set_via_layer (const NetTracerLayerExpressionInfo &l)
{
m_via = l;
}
const NetTracerLayerExpressionInfo &layer_b () const
const NetTracerLayerExpressionInfo &layer_b () const
{
return m_lb;
}
void set_layer_b (const NetTracerLayerExpressionInfo &l)
void set_layer_b (const NetTracerLayerExpressionInfo &l)
{
m_lb = l;
}
@ -132,7 +118,7 @@ private:
NetTracerLayerExpressionInfo m_la, m_via, m_lb;
};
class EXT_PUBLIC NetTracerSymbolInfo
class DB_PUBLIC NetTracerSymbolInfo
{
public:
NetTracerSymbolInfo ();
@ -141,22 +127,22 @@ public:
std::string to_string () const;
void parse (tl::Extractor &ex);
const db::LayerProperties &symbol () const
const db::LayerProperties &symbol () const
{
return m_symbol;
}
void set_symbol (const db::LayerProperties &s)
void set_symbol (const db::LayerProperties &s)
{
m_symbol = s;
}
const std::string &expression () const
const std::string &expression () const
{
return m_expression;
}
void set_expression (const std::string &e)
void set_expression (const std::string &e)
{
m_expression = e;
}
@ -166,10 +152,10 @@ private:
std::string m_expression;
};
class EXT_PUBLIC Net
class DB_PUBLIC Net
{
public:
typedef std::vector <NetTracerShape>::const_iterator iterator;
typedef std::vector <db::NetTracerShape>::const_iterator iterator;
/**
* @brief Default constructor
@ -179,7 +165,7 @@ public:
/**
* @brief Constructor
*/
Net (const NetTracer &tracer, const db::ICplxTrans &trans, const db::Layout &layout, db::cell_index_type cell_index, const std::string &layout_filename, const std::string &layout_name, const NetTracerData &data);
Net (const db::NetTracer &tracer, const db::ICplxTrans &trans, const db::Layout &layout, db::cell_index_type cell_index, const std::string &layout_filename, const std::string &layout_name, const db::NetTracerData &data);
/**
* @brief Iterate the shapes (begin)
@ -216,7 +202,7 @@ public:
/**
* @brief Sets the color in which the net is drawn
*/
void set_color (QColor c)
void set_color (QColor c)
{
m_color = c;
}
@ -240,7 +226,7 @@ public:
}
/**
* @brief Gets the database unit
* @brief Gets the database unit
*/
double dbu () const
{
@ -289,7 +275,7 @@ public:
const std::string &cell_name (db::cell_index_type cell_index) const;
/**
* @brief Provides the
* @brief Provides the
*/
db::LayerProperties representative_layer_for (unsigned int log_layer) const;
@ -338,7 +324,7 @@ public:
/**
* @brief Sets the "trace path" flag for redo
*/
void set_trace_path_flag (bool tp)
void set_trace_path_flag (bool tp)
{
m_trace_path = tp;
}
@ -358,7 +344,7 @@ private:
std::string m_layout_name;
std::string m_top_cell_name;
bool m_incomplete;
std::vector <NetTracerShape> m_net_shapes;
std::vector <db::NetTracerShape> m_net_shapes;
db::Shapes m_shapes;
std::map <unsigned int, std::pair <db::LayerProperties, db::LayerProperties> > m_layers;
std::map <unsigned int, std::string> m_cell_names;
@ -369,7 +355,7 @@ private:
void define_layer (unsigned int l, const db::LayerProperties &lp, const db::LayerProperties &lp_representative);
};
class EXT_PUBLIC NetTracerTechnologyComponent
class DB_PUBLIC NetTracerTechnologyComponent
: public db::TechnologyComponent
{
public:
@ -479,35 +465,6 @@ private:
std::vector<NetTracerSymbolInfo> m_symbols;
};
class NetTracerTechComponentEditor
: public lay::TechnologyComponentEditor,
public Ui::NetTracerTechComponentEditor
{
Q_OBJECT
public:
NetTracerTechComponentEditor (QWidget *parent);
void commit ();
void setup ();
public slots:
void add_clicked ();
void del_clicked ();
void move_up_clicked ();
void move_down_clicked ();
void symbol_add_clicked ();
void symbol_del_clicked ();
void symbol_move_up_clicked ();
void symbol_move_down_clicked ();
private:
NetTracerTechnologyComponent m_data;
void update ();
};
}
#endif

View File

@ -0,0 +1,99 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2018 Matthias Koefferlein
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
*/
#include "dbNetTracerIO.h"
#include "dbTechnology.h"
#include "tlClassRegistry.h"
namespace tl
{
/**
* @brief A specialization of the XMLConverter that is used to serialize the connection info
*/
template <>
struct XMLStdConverter<db::NetTracerConnectionInfo>
{
std::string to_string (const db::NetTracerConnectionInfo &v) const
{
return v.to_string ();
}
void from_string (const std::string &s, db::NetTracerConnectionInfo &v) const
{
tl::Extractor ex (s.c_str ());
v.parse (ex);
}
};
/**
* @brief A specialization of the XMLConverter that is used to serialize the symbol info
*/
template <>
struct XMLStdConverter<db::NetTracerSymbolInfo>
{
std::string to_string (const db::NetTracerSymbolInfo &v) const
{
return v.to_string ();
}
void from_string (const std::string &s, db::NetTracerSymbolInfo &v) const
{
tl::Extractor ex (s.c_str ());
v.parse (ex);
}
};
}
namespace db
{
extern std::string net_tracer_component_name;
class NetTracerTechnologyComponentProvider
: public db::TechnologyComponentProvider
{
public:
NetTracerTechnologyComponentProvider ()
: db::TechnologyComponentProvider ()
{
// .. nothing yet ..
}
virtual db::TechnologyComponent *create_component () const
{
return new NetTracerTechnologyComponent ();
}
virtual tl::XMLElementBase *xml_element () const
{
return new db::TechnologyComponentXMLElement<NetTracerTechnologyComponent> (net_tracer_component_name,
tl::make_member ((NetTracerTechnologyComponent::const_iterator (NetTracerTechnologyComponent::*) () const) &NetTracerTechnologyComponent::begin, (NetTracerTechnologyComponent::const_iterator (NetTracerTechnologyComponent::*) () const) &NetTracerTechnologyComponent::end, &NetTracerTechnologyComponent::add, "connection") +
tl::make_member ((NetTracerTechnologyComponent::const_symbol_iterator (NetTracerTechnologyComponent::*) () const) &NetTracerTechnologyComponent::begin_symbols, (NetTracerTechnologyComponent::const_symbol_iterator (NetTracerTechnologyComponent::*) () const) &NetTracerTechnologyComponent::end_symbols, &NetTracerTechnologyComponent::add_symbol, "symbols")
);
}
};
static tl::RegisteredClass<db::TechnologyComponentProvider> tc_decl (new NetTracerTechnologyComponentProvider (), 13000, "NetTracerPlugin");
}

View File

@ -0,0 +1,16 @@
TARGET = net_tracer
DESTDIR = $$OUT_PWD/../../../../db_plugins
include($$PWD/../../../db_plugin.pri)
HEADERS = \
dbNetTracer.h \
dbNetTracerIO.h \
SOURCES = \
dbNetTracer.cc \
dbNetTracerIO.cc \
dbNetTracerPlugin.cc \
gsiDeclDbNetTracer.cc \

View File

@ -0,0 +1,271 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2018 Matthias Koefferlein
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
*/
#include "dbNetTracer.h"
#include "dbNetTracerIO.h"
#include "gsiDecl.h"
namespace db
{
extern const std::string net_tracer_component_name;
}
namespace gsi
{
// -----------------------------------------------------------------------------------
// GSI binding
static void def_connection2 (db::NetTracerTechnologyComponent *tech, const std::string &la, const std::string &lb)
{
db::NetTracerLayerExpressionInfo la_info = db::NetTracerLayerExpressionInfo::compile (la);
db::NetTracerLayerExpressionInfo lb_info = db::NetTracerLayerExpressionInfo::compile (lb);
tech->add (db::NetTracerConnectionInfo (la_info, lb_info));
}
static void def_connection3 (db::NetTracerTechnologyComponent *tech, const std::string &la, const std::string &via, const std::string &lb)
{
db::NetTracerLayerExpressionInfo la_info = db::NetTracerLayerExpressionInfo::compile (la);
db::NetTracerLayerExpressionInfo via_info = db::NetTracerLayerExpressionInfo::compile (via);
db::NetTracerLayerExpressionInfo lb_info = db::NetTracerLayerExpressionInfo::compile (lb);
tech->add (db::NetTracerConnectionInfo (la_info, via_info, lb_info));
}
static void def_symbol (db::NetTracerTechnologyComponent *tech, const std::string &name, const std::string &expr)
{
tech->add_symbol (db::NetTracerSymbolInfo (db::LayerProperties (name), expr));
}
gsi::Class<db::TechnologyComponent> &decl_dbTechnologyComponent ();
gsi::Class<db::NetTracerTechnologyComponent> decl_NetTracerTechnology (decl_dbTechnologyComponent (), "db", "NetTracerTechnology",
gsi::method_ext ("connection", &def_connection2, gsi::arg("a"), gsi::arg("b"),
"@brief Defines a connection between two materials\n"
"See the class description for details about this method."
) +
gsi::method_ext ("connection", &def_connection3, gsi::arg("a"), gsi::arg("via"), gsi::arg("b"),
"@brief Defines a connection between materials through a via\n"
"See the class description for details about this method."
) +
gsi::method_ext ("symbol", &def_symbol, gsi::arg("name"), gsi::arg("expr"),
"@brief Defines a symbol for use in the material expressions.\n"
"Defines a sub-expression to be used in further symbols or material expressions. "
"For the detailed notation of the expression see the description of the net tracer feature."
),
"@brief A technology description for the net tracer\n"
"\n"
"This object represents the technology description for the net tracer (represented by the \\NetTracer class).\n"
"A technology description basically consists of connection declarations.\n"
"A connection is given by either two or three expressions describing two conductive materials.\n"
"With two expressions, the connection describes a transition from one material to another one.\n"
"With three expressions, the connection describes a transition from one material to another through a "
"connection (a \"via\").\n"
"\n"
"The conductive material is derived from original layers either directly or through "
"boolean expressions. These expressions can include symbols which are defined through the "
"\\symbol method.\n"
"\n"
"For details about the expressions see the description of the net tracer feature.\n"
"\n"
"This class has been introduced in version 0.25.\n"
);
static void trace1 (db::NetTracer *net_tracer, const db::NetTracerTechnologyComponent &tech, const db::Layout &layout, const db::Cell &cell, const db::Point &start_point, unsigned int start_layer)
{
db::NetTracerData tracer_data = tech.get_tracer_data (layout);
net_tracer->trace (layout, cell, start_point, start_layer, tracer_data);
}
static void trace2 (db::NetTracer *net_tracer, const db::NetTracerTechnologyComponent &tech, const db::Layout &layout, const db::Cell &cell, const db::Point &start_point, unsigned int start_layer, const db::Point &stop_point, unsigned int stop_layer)
{
db::NetTracerData tracer_data = tech.get_tracer_data (layout);
net_tracer->trace (layout, cell, start_point, start_layer, stop_point, stop_layer, tracer_data);
}
static db::NetTracerData get_tracer_data_from_tech (const std::string &tech_name, const db::Layout &layout)
{
const db::Technology *tech = db::Technologies::instance ()->technology_by_name (tech_name);
tl_assert (tech != 0);
const db::NetTracerTechnologyComponent *tech_component = dynamic_cast <const db::NetTracerTechnologyComponent *> (tech->component_by_name (db::net_tracer_component_name));
tl_assert (tech_component != 0);
return tech_component->get_tracer_data (layout);
}
static void trace1_tn (db::NetTracer *net_tracer, const std::string &tech, const db::Layout &layout, const db::Cell &cell, const db::Point &start_point, unsigned int start_layer)
{
db::NetTracerData tracer_data = get_tracer_data_from_tech (tech, layout);
net_tracer->trace (layout, cell, start_point, start_layer, tracer_data);
}
static void trace2_tn (db::NetTracer *net_tracer, const std::string &tech, const db::Layout &layout, const db::Cell &cell, const db::Point &start_point, unsigned int start_layer, const db::Point &stop_point, unsigned int stop_layer)
{
db::NetTracerData tracer_data = get_tracer_data_from_tech (tech, layout);
net_tracer->trace (layout, cell, start_point, start_layer, stop_point, stop_layer, tracer_data);
}
gsi::Class<db::NetTracerShape> decl_NetElement ("db", "NetElement",
gsi::method ("trans", &db::NetTracerShape::trans,
"@brief Gets the transformation to apply for rendering the shape in the original top cell\n"
"See the class description for more details about this attribute."
) +
gsi::method ("shape", (const db::Shape &(db::NetTracerShape::*) () const) &db::NetTracerShape::shape,
"@brief Gets the shape that makes up this net element\n"
"See the class description for more details about this attribute."
) +
#if 0
gsi::method ("is_valid?", &db::NetTracerShape::is_valid,
"@brief Gets a value indicating whether the shape is valid\n"
"Currently this flag is not used."
) +
gsi::method ("is_pseudo?", &db::NetTracerShape::is_pseudo,
"@brief Gets a value indicating whether the shape is a pseudo shape\n"
"Currently this flag is not used."
) +
#endif
gsi::method ("cell_index", &db::NetTracerShape::cell_index,
"@brief Gets the index of the cell the shape is inside"
) +
gsi::method ("layer", &db::NetTracerShape::layer,
"@brief Gets the index of the layer the shape is on"
) +
gsi::method ("bbox", &db::NetTracerShape::bbox,
"@brief Delivers the bounding box of the shape as seen from the original top cell"
),
"@brief A net element for the NetTracer net tracing facility\n"
"\n"
"This object represents a piece of a net extracted by the net tracer. "
"See the description of \\NetTracer for more details about the net tracer feature.\n"
"\n"
"The NetTracer object represents one shape of the net. The shape can be an original shape or a shape derived in a boolean operation. "
"In the first case, the shape refers to a shape within a cell or a subcell of the original top cell. In the latter case, the shape "
"is a synthesized one and outside the original layout hierarchy.\n"
"\n"
"In any case, the \\shape method will deliver the shape and \\trans the transformation of the shape into the original top cell. "
"To obtain a flat representation of the net, the shapes need to be transformed by this transformation.\n"
"\n"
"\\layer will give the layer the shape is located at, \\cell_index will denote the cell that containes the shape.\n"
"\n"
"This class has been introduced in version 0.25.\n"
);
gsi::Class<db::NetTracer> decl_NetTracer ("db", "NetTracer",
gsi::method_ext ("trace", &trace1, gsi::arg ("tech"), gsi::arg ("layout"), gsi::arg ("cell"), gsi::arg ("start_point"), gsi::arg ("start_layer"),
"@brief Runs a net extraction\n"
"\n"
"This method runs an extraction with the given parameters.\n"
"To make the extraction successful, a shape must be present at the given start point on the start layer. "
"The start layer must be a valid layer mentioned within the technology specification.\n"
"\n"
"This version runs a single extraction - i.e. it will extract all elements connected to the given seed point. "
"A path extraction version is provided as well which will extract one (the presumably shortest) path between two "
"points.\n"
"\n"
"@param tech The technology definition\n"
"@param layout The layout on which to run the extraction\n"
"@param cell The cell on which to run the extraction (child cells will be included)\n"
"@param start_point The start point from which to start extraction of the net\n"
"@param start_layer The layer from which to start extraction\n"
) +
gsi::method_ext ("trace", &trace2, gsi::arg ("tech"), gsi::arg ("layout"), gsi::arg ("cell"), gsi::arg ("start_point"), gsi::arg ("start_layer"), gsi::arg ("stop_point"), gsi::arg ("stop_layer"),
"@brief Runs a path extraction\n"
"\n"
"This method runs an path extraction with the given parameters.\n"
"To make the extraction successful, a shape must be present at the given start point on the start layer and "
"at the given stop point at the given stop layer. "
"The start and stop layers must be a valid layers mentioned within the technology specification.\n"
"\n"
"This version runs a path extraction and will deliver elements forming one path leading from the start to the end point.\n"
"\n"
"@param tech The technology definition\n"
"@param layout The layout on which to run the extraction\n"
"@param cell The cell on which to run the extraction (child cells will be included)\n"
"@param start_point The start point from which to start extraction of the net\n"
"@param start_layer The layer from which to start extraction\n"
"@param stop_point The stop point at which to stop extraction of the net\n"
"@param stop_layer The layer at which to stop extraction\n"
) +
gsi::method_ext ("trace", &trace1_tn, gsi::arg ("tech"), gsi::arg ("layout"), gsi::arg ("cell"), gsi::arg ("start_point"), gsi::arg ("start_layer"),
"@brief Runs a net extraction taking a predefined technology\n"
"This method behaves identical as the version with a technology object, except that it will look for a technology "
"with the given name to obtain the extraction setup."
) +
gsi::method_ext ("trace", &trace2_tn, gsi::arg ("tech"), gsi::arg ("layout"), gsi::arg ("cell"), gsi::arg ("start_point"), gsi::arg ("start_layer"), gsi::arg ("stop_point"), gsi::arg ("stop_layer"),
"@brief Runs a path extraction taking a predefined technology\n"
"This method behaves identical as the version with a technology object, except that it will look for a technology "
"with the given name to obtain the extraction setup."
) +
gsi::iterator ("each_element", &db::NetTracer::begin, &db::NetTracer::end,
"@brief Iterates over the elements found during extraction\n"
"The elements are available only after the extraction has been performed."
) +
gsi::method ("num_elements", &db::NetTracer::size,
"@brief Returns the number of elements found during extraction\n"
"This attribute is useful only after the extraction has been performed."
) +
gsi::method ("clear", &db::NetTracer::clear,
"@brief Clears the data from the last extraction\n"
) +
gsi::method ("name", &db::NetTracer::name,
"@brief Returns the name of the net found during extraction\n"
"The net name is extracted from labels found during the extraction. "
"This attribute is useful only after the extraction has been performed."
) +
gsi::method ("incomplete?", &db::NetTracer::incomplete,
"@brief Returns a value indicating whether the net is incomplete\n"
"A net may be incomplete if the extraction has been stopped by the user for example. "
"This attribute is useful only after the extraction has been performed."
),
"@brief The net tracer feature\n"
"\n"
"The net tracer class provides an interface to the net tracer feature. It is accompanied by the \\NetElement and \\NetTracerTechnology classes. "
"The latter will provide the technology definition for the net tracer while the \\NetElement objects represent a piece of the net "
"after it has been extracted.\n"
"\n"
"The technology definition is optional. The net tracer can be used with a predefined technology as well. The basic "
"scheme of using the net tracer is to instantiate a net tracer object and run the extraction through the \\NetTracer#trace "
"method. After this method was executed successfully, the resulting net can be obtained from the net tracer object by "
"iterating over the \\NetElement objects of the net tracer.\n"
"\n"
"Here is some sample code:\n"
"\n"
"@code\n"
"ly = RBA::CellView::active.layout\n"
"\n"
"tracer = RBA::NetTracer::new\n"
"\n"
"tech = RBA::NetTracerTechnology::new\n"
"tech.connection(\"1/0\", \"2/0\", \"3/0\")\n"
"\n"
"tracer.trace(tech, ly, ly.top_cell, RBA::Point::new(7000, 1500), ly.find_layer(1, 0))\n"
"\n"
"tracer.each_element do |e|\n"
" puts e.shape.polygon.transformed(e.trans)\n"
"end\n"
"@/code\n"
"\n"
"This class has been introduced in version 0.25."
);
}

View File

@ -21,13 +21,13 @@
*/
#include "extNetTracerConfig.h"
#include "layNetTracerConfig.h"
#include "layConverters.h"
#include <QColorDialog>
#include <QPainter>
namespace ext
namespace lay
{
extern const std::string cfg_nt_marker_color ("nt-marker-color");
@ -45,17 +45,17 @@ extern const std::string cfg_nt_max_shapes_highlighted ("nt-max-shapes-highlight
// ------------------------------------------------------------
static struct {
ext::nt_window_type mode;
lay::nt_window_type mode;
const char *string;
} window_modes [] = {
{ ext::NTDontChange, "dont-change" },
{ ext::NTFitNet, "fit-net" },
{ ext::NTCenter, "center" },
{ ext::NTCenterSize, "center-size" }
{ lay::NTDontChange, "dont-change" },
{ lay::NTFitNet, "fit-net" },
{ lay::NTCenter, "center" },
{ lay::NTCenterSize, "center-size" }
};
void
NetTracerWindowModeConverter::from_string (const std::string &value, ext::nt_window_type &mode)
NetTracerWindowModeConverter::from_string (const std::string &value, lay::nt_window_type &mode)
{
for (unsigned int i = 0; i < sizeof (window_modes) / sizeof (window_modes [0]); ++i) {
if (value == window_modes [i].string) {
@ -67,7 +67,7 @@ NetTracerWindowModeConverter::from_string (const std::string &value, ext::nt_win
}
std::string
NetTracerWindowModeConverter::to_string (ext::nt_window_type mode)
NetTracerWindowModeConverter::to_string (lay::nt_window_type mode)
{
for (unsigned int i = 0; i < sizeof (window_modes) / sizeof (window_modes [0]); ++i) {
if (mode == window_modes [i].mode) {
@ -131,7 +131,7 @@ void
NetTracerConfigPage::setup (lay::PluginRoot *root)
{
// window mode
ext::nt_window_type wmode = ext::NTFitNet;
lay::nt_window_type wmode = lay::NTFitNet;
root->config_get (cfg_nt_window_mode, wmode, NetTracerWindowModeConverter ());
cbx_window->setCurrentIndex (int (wmode));
@ -233,7 +233,7 @@ NetTracerConfigPage::update_colors ()
void
NetTracerConfigPage::window_changed (int m)
{
le_window->setEnabled (m == int (ext::NTFitNet) || m == int (ext::NTCenterSize));
le_window->setEnabled (m == int (lay::NTFitNet) || m == int (lay::NTCenterSize));
}
void
@ -245,7 +245,7 @@ NetTracerConfigPage::commit (lay::PluginRoot *root)
unsigned int max_shapes_highlighted = 10000;
tl::from_string (tl::to_string (le_max_markers->text ()), max_shapes_highlighted);
root->config_set (cfg_nt_window_mode, ext::nt_window_type (cbx_window->currentIndex ()), NetTracerWindowModeConverter ());
root->config_set (cfg_nt_window_mode, lay::nt_window_type (cbx_window->currentIndex ()), NetTracerWindowModeConverter ());
root->config_set (cfg_nt_window_dim, dim);
root->config_set (cfg_nt_max_shapes_highlighted, max_shapes_highlighted);

View File

@ -22,15 +22,15 @@
#ifndef HDR_extNetTracerConfig
#define HDR_extNetTracerConfig
#ifndef HDR_layNetTracerConfig
#define HDR_layNetTracerConfig
#include "ui_NetTracerConfigPage.h"
#include "layPlugin.h"
#include "layColorPalette.h"
namespace ext
namespace lay
{
extern const std::string cfg_nt_marker_color;
@ -50,8 +50,8 @@ enum nt_window_type { NTDontChange = 0, NTFitNet, NTCenter, NTCenterSize };
class NetTracerWindowModeConverter
{
public:
void from_string (const std::string &value, ext::nt_window_type &mode);
std::string to_string (ext::nt_window_type mode);
void from_string (const std::string &value, lay::nt_window_type &mode);
std::string to_string (lay::nt_window_type mode);
};
class NetTracerConfigPage

View File

@ -21,10 +21,10 @@
*/
#include "extNetTracerIO.h"
#include "extNetTracerDialog.h"
#include "extNetTracerConfig.h"
#include "dbNetTracerIO.h"
#include "layNetTracerDialog.h"
#include "layNetTracerConfig.h"
#include "layConfigurationDialog.h"
#include "laybasicConfig.h"
#include "layConverters.h"
@ -47,10 +47,13 @@
#include <fstream>
#include <sstream>
namespace ext
namespace db
{
extern std::string net_tracer_component_name;
}
extern std::string net_tracer_component_name;
namespace lay
{
// -----------------------------------------------------------------------------------
// NetTracerDialog implementation
@ -60,7 +63,7 @@ NetTracerDialog::NetTracerDialog (lay::PluginRoot *root, lay::LayoutView *view)
lay::ViewService (view->view_object_widget ()),
m_cv_index (0),
m_net_index (1),
m_window (ext::NTFitNet),
m_window (lay::NTFitNet),
m_window_dim (0.0),
m_max_marker_count (0),
m_marker_line_width (-1),
@ -105,7 +108,7 @@ NetTracerDialog::~NetTracerDialog ()
void
NetTracerDialog::clear_nets ()
{
for (std::vector <Net *>::iterator n = mp_nets.begin (); n != mp_nets.end (); ++n) {
for (std::vector <db::Net *>::iterator n = mp_nets.begin (); n != mp_nets.end (); ++n) {
delete *n;
}
mp_nets.clear ();
@ -180,7 +183,7 @@ NetTracerDialog::mouse_click_event (const db::DPoint &p, unsigned int buttons, b
stop_search_box = db::DBox (m_mouse_first_point, m_mouse_first_point).enlarged (db::DVector (l, l));
}
Net *net = do_trace (start_search_box, stop_search_box, trace_path);
db::Net *net = do_trace (start_search_box, stop_search_box, trace_path);
if (net) {
// create a new net taking the shapes from the tracer
@ -222,7 +225,7 @@ NetTracerDialog::redo_trace_clicked ()
{
BEGIN_PROTECTED
std::set <Net *> selected_nets;
std::set <db::Net *> selected_nets;
QList<QListWidgetItem *> selected_items = net_list->selectedItems ();
for (QList<QListWidgetItem *>::const_iterator item = selected_items.begin (); item != selected_items.end (); ++item) {
@ -232,18 +235,18 @@ BEGIN_PROTECTED
}
}
std::vector <Net *> nets;
std::vector <db::Net *> nets;
nets.swap (mp_nets);
m_net_index = 1;
std::vector <size_t> new_selection;
for (std::vector <Net *>::const_iterator n = nets.begin (); n != nets.end (); ++n) {
for (std::vector <db::Net *>::const_iterator n = nets.begin (); n != nets.end (); ++n) {
try {
Net *net = do_trace ((*n)->start_search_box (), (*n)->stop_search_box (), (*n)->trace_path_flag ());
db::Net *net = do_trace ((*n)->start_search_box (), (*n)->stop_search_box (), (*n)->trace_path_flag ());
if (net) {
// create a new net taking the shapes from the tracer
@ -283,7 +286,7 @@ BEGIN_PROTECTED
END_PROTECTED
}
Net *
db::Net *
NetTracerDialog::do_trace (const db::DBox &start_search_box, const db::DBox &stop_search_box, bool trace_path)
{
unsigned int start_layer = 0;
@ -338,13 +341,13 @@ NetTracerDialog::do_trace (const db::DBox &start_search_box, const db::DBox &sto
if (! tech) {
return 0;
}
const NetTracerTechnologyComponent *tech_component = dynamic_cast <const NetTracerTechnologyComponent *> (tech->component_by_name (net_tracer_component_name));
const db::NetTracerTechnologyComponent *tech_component = dynamic_cast <const db::NetTracerTechnologyComponent *> (tech->component_by_name (db::net_tracer_component_name));
if (! tech_component) {
return 0;
}
// Set up the net tracer environment
NetTracerData tracer_data = tech_component->get_tracer_data (cv->layout ());
db::NetTracerData tracer_data = tech_component->get_tracer_data (cv->layout ());
unsigned int stop_layer = 0;
db::Point stop_point;
@ -383,7 +386,7 @@ NetTracerDialog::do_trace (const db::DBox &start_search_box, const db::DBox &sto
}
NetTracer net_tracer;
db::NetTracer net_tracer;
// and trace
try {
@ -403,7 +406,7 @@ NetTracerDialog::do_trace (const db::DBox &start_search_box, const db::DBox &sto
} else {
// create a new net taking the shapes from the tracer
Net *net = new Net (net_tracer, db::ICplxTrans (cv.context_trans ()), cv->layout (), cv.cell_index (), cv->filename (), cv->name (), tracer_data);
db::Net *net = new db::Net (net_tracer, db::ICplxTrans (cv.context_trans ()), cv->layout (), cv.cell_index (), cv->filename (), cv->name (), tracer_data);
net->set_start_search_box (start_search_box);
net->set_stop_search_box (stop_search_box);
net->set_trace_path_flag (trace_path);
@ -535,7 +538,7 @@ NetTracerDialog::configure (const std::string &name, const std::string &value)
void
NetTracerDialog::menu_activated (const std::string &symbol)
{
if (symbol == "ext::net_trace") {
if (symbol == "lay::net_trace") {
lay::CellView cv = view ()->cellview (view ()->active_cellview_index ());
if (cv.is_valid ()) {
@ -714,7 +717,7 @@ NetTracerDialog::update_info ()
std::map<unsigned int, db::coord_traits<db::Coord>::perimeter_type> statinfo_perimeter;
size_t tot_shapes = 0;
for (Net::iterator net_shape = mp_nets [item_index]->begin (); net_shape != mp_nets [item_index]->end (); ++net_shape) {
for (db::Net::iterator net_shape = mp_nets [item_index]->begin (); net_shape != mp_nets [item_index]->end (); ++net_shape) {
if (tot_shapes++ >= max_shapes) {
incomplete = true;
@ -919,7 +922,7 @@ NetTracerDialog::update_info ()
bool incomplete = false;
std::set<std::string> labels;
for (Net::iterator net_shape = mp_nets [item_index]->begin (); net_shape != mp_nets [item_index]->end (); ++net_shape) {
for (db::Net::iterator net_shape = mp_nets [item_index]->begin (); net_shape != mp_nets [item_index]->end (); ++net_shape) {
if (net_shape->shape ().is_text ()) {
@ -964,7 +967,7 @@ NetTracerDialog::update_info ()
incomplete = false;
std::set<std::string> cells;
for (Net::iterator net_shape = mp_nets [item_index]->begin (); net_shape != mp_nets [item_index]->end (); ++net_shape) {
for (db::Net::iterator net_shape = mp_nets [item_index]->begin (); net_shape != mp_nets [item_index]->end (); ++net_shape) {
if (cells.size () >= max_cells) {
incomplete = true;
@ -1200,7 +1203,7 @@ BEGIN_PROTECTED
db::Technology tech = *db::Technologies::instance ()->technology_by_name (tech_name);
// call the dialog and if successful, install the new technology
lay::TechComponentSetupDialog dialog (this, &tech, net_tracer_component_name);
lay::TechComponentSetupDialog dialog (this, &tech, db::net_tracer_component_name);
if (dialog.exec ()) {
*db::Technologies::instance ()->technology_by_name (tech.name ()) = tech;
}
@ -1240,7 +1243,7 @@ BEGIN_PROTECTED
w.start_element ("net");
const Net *net = mp_nets[item_index];
const db::Net *net = mp_nets[item_index];
w.start_element ("name");
w.cdata (net->name ());
@ -1264,7 +1267,7 @@ BEGIN_PROTECTED
w.start_element ("shapes");
for (Net::iterator net_shape = net->begin (); net_shape != net->end (); ++net_shape) {
for (db::Net::iterator net_shape = net->begin (); net_shape != net->end (); ++net_shape) {
w.start_element ("element");
@ -1445,7 +1448,7 @@ NetTracerDialog::adjust_view ()
db::DBox cv_bbox;
// Create markers for the shapes
for (Net::iterator net_shape = mp_nets [item_index]->begin (); net_shape != mp_nets [item_index]->end (); ++net_shape) {
for (db::Net::iterator net_shape = mp_nets [item_index]->begin (); net_shape != mp_nets [item_index]->end (); ++net_shape) {
// Find the actual layer by looking up the layer properties ..
std::map <unsigned int, unsigned int>::const_iterator ll = llmap.find (net_shape->layer ());
@ -1536,7 +1539,7 @@ NetTracerDialog::update_highlights ()
QColor net_color = mp_nets [item_index]->color ();
// Create markers for the shapes
for (Net::iterator net_shape = mp_nets [item_index]->begin (); net_shape != mp_nets [item_index]->end () && n_marker < m_max_marker_count; ++net_shape) {
for (db::Net::iterator net_shape = mp_nets [item_index]->begin (); net_shape != mp_nets [item_index]->end () && n_marker < m_max_marker_count; ++net_shape) {
// Find the actual layer by looking up the layer properties ..
std::map <unsigned int, unsigned int>::const_iterator ll = llmap.find (net_shape->layer ());

View File

@ -22,29 +22,29 @@
#ifndef HDR_extNetTracerDialog
#define HDR_extNetTracerDialog
#ifndef HDR_layNetTracerDialog
#define HDR_layNetTracerDialog
#include "ui_NetTracerDialog.h"
#include "extNetTracer.h"
#include "extNetTracerConfig.h"
#include "dbNetTracer.h"
#include "dbTechnology.h"
#include "layNetTracerConfig.h"
#include "layBrowser.h"
#include "layPlugin.h"
#include "layViewObject.h"
#include "layMarker.h"
#include "layTechnology.h"
namespace db
{
class Net;
}
namespace lay
{
class FileDialog;
}
namespace ext
{
class Net;
class FileDialog;
class NetTracerDialog
: public lay::Browser,
@ -82,7 +82,7 @@ protected slots:
void redo_trace_clicked ();
private:
std::vector <Net *> mp_nets;
std::vector <db::Net *> mp_nets;
std::vector <lay::ShapeMarker *> mp_markers;
unsigned int m_cv_index;
int m_net_index;
@ -113,7 +113,7 @@ private:
void update_info ();
void layer_list_changed (int index);
void release_mouse ();
Net *do_trace (const db::DBox &start_search_box, const db::DBox &stop_search_box, bool trace_path);
db::Net *do_trace (const db::DBox &start_search_box, const db::DBox &stop_search_box, bool trace_path);
};
}

View File

@ -21,8 +21,8 @@
*/
#include "extNetTracerIO.h"
#include "extNetTracerConfig.h"
#include "layNetTracerIO.h"
#include "layNetTracerConfig.h"
#include "layConfigurationDialog.h"
#include "laybasicConfig.h"
@ -46,374 +46,9 @@
#include <fstream>
#include <sstream>
namespace ext
namespace lay
{
std::string net_tracer_component_name ("connectivity");
// -----------------------------------------------------------------------------------
// NetTracerConnectionInfo implementation
NetTracerConnectionInfo::NetTracerConnectionInfo ()
{
// .. nothing yet ..
}
NetTracerConnectionInfo::NetTracerConnectionInfo (const NetTracerLayerExpressionInfo &la, const NetTracerLayerExpressionInfo &lb)
: m_la (la), m_via (), m_lb (lb)
{
// .. nothing yet ..
}
NetTracerConnectionInfo::NetTracerConnectionInfo (const NetTracerLayerExpressionInfo &la, const NetTracerLayerExpressionInfo &via, const NetTracerLayerExpressionInfo &lb)
: m_la (la), m_via (via), m_lb (lb)
{
// .. nothing yet ..
}
static int get_layer_id (const NetTracerLayerExpressionInfo &e, const db::Layout &layout, const NetTracerTechnologyComponent &tech, NetTracerData *data)
{
std::auto_ptr<NetTracerLayerExpression> expr_in (NetTracerLayerExpressionInfo::compile (e.to_string ()).get (layout, tech));
int l = expr_in->alias_for ();
if (l < 0 && data) {
l = data->find_symbol (e.to_string ());
if (l < 0) {
return int (data->register_logical_layer (expr_in.release (), 0));
}
}
return l;
}
NetTracerConnection
NetTracerConnectionInfo::get (const db::Layout &layout, const NetTracerTechnologyComponent &tech, NetTracerData &data) const
{
int la = get_layer_id (m_la, layout, tech, &data);
int lb = get_layer_id (m_lb, layout, tech, &data);
if (! m_via.to_string ().empty ()) {
int via = get_layer_id (m_via, layout, tech, &data);
return NetTracerConnection (la, via, lb);
} else {
return NetTracerConnection (la, lb);
}
}
std::string
NetTracerConnectionInfo::to_string () const
{
std::string res;
res += m_la.to_string ();
res += ",";
res += m_via.to_string ();
res += ",";
res += m_lb.to_string ();
return res;
}
void
NetTracerConnectionInfo::parse (tl::Extractor &ex)
{
m_la = NetTracerLayerExpressionInfo::parse (ex);
ex.expect (",");
m_via = NetTracerLayerExpressionInfo::parse (ex);
ex.expect (",");
m_lb = NetTracerLayerExpressionInfo::parse (ex);
}
// -----------------------------------------------------------------------------------
// NetTracerSymbolInfo implementation
NetTracerSymbolInfo::NetTracerSymbolInfo ()
{
// .. nothing yet ..
}
NetTracerSymbolInfo::NetTracerSymbolInfo (const db::LayerProperties &symbol, const std::string &expression)
: m_symbol (symbol), m_expression (expression)
{
// .. nothing yet ..
}
std::string
NetTracerSymbolInfo::to_string () const
{
std::string res;
res += m_symbol.to_string ();
res += "=";
res += tl::to_quoted_string(m_expression);
return res;
}
void
NetTracerSymbolInfo::parse (tl::Extractor &ex)
{
m_symbol.read (ex);
ex.expect ("=");
ex.read_word_or_quoted (m_expression);
}
// -----------------------------------------------------------------------------------------
// NetTracerLayerExpressionInfo implementation
NetTracerLayerExpressionInfo::NetTracerLayerExpressionInfo ()
: mp_a (0), mp_b (0), m_op (NetTracerLayerExpression::OPNone)
{
// .. nothing yet ..
}
NetTracerLayerExpressionInfo::~NetTracerLayerExpressionInfo ()
{
delete mp_a;
mp_a = 0;
delete mp_b;
mp_b = 0;
}
NetTracerLayerExpressionInfo::NetTracerLayerExpressionInfo (const NetTracerLayerExpressionInfo &other)
: m_expression (other.m_expression), m_a (other.m_a), m_b (other.m_b), mp_a (0), mp_b (0), m_op (other.m_op)
{
if (other.mp_a) {
mp_a = new NetTracerLayerExpressionInfo (*other.mp_a);
}
if (other.mp_b) {
mp_b = new NetTracerLayerExpressionInfo (*other.mp_b);
}
}
NetTracerLayerExpressionInfo &
NetTracerLayerExpressionInfo::operator= (const NetTracerLayerExpressionInfo &other)
{
if (this != &other) {
m_expression = other.m_expression;
delete mp_a;
mp_a = 0;
delete mp_b;
mp_b = 0;
m_a = other.m_a;
m_b = other.m_b;
m_op = other.m_op;
if (other.mp_a) {
mp_a = new NetTracerLayerExpressionInfo (*other.mp_a);
}
if (other.mp_b) {
mp_b = new NetTracerLayerExpressionInfo (*other.mp_b);
}
}
return *this;
}
void
NetTracerLayerExpressionInfo::merge (NetTracerLayerExpression::Operator op, const NetTracerLayerExpressionInfo &other)
{
if (m_op != NetTracerLayerExpression::OPNone) {
NetTracerLayerExpressionInfo *e = new NetTracerLayerExpressionInfo (*this);
*this = NetTracerLayerExpressionInfo ();
mp_a = e;
}
m_op = op;
if (other.m_op == NetTracerLayerExpression::OPNone) {
if (other.mp_a) {
mp_b = new NetTracerLayerExpressionInfo (*other.mp_a);
} else {
m_b = other.m_a;
}
} else {
mp_b = new NetTracerLayerExpressionInfo (other);
}
}
NetTracerLayerExpressionInfo
NetTracerLayerExpressionInfo::parse_add (tl::Extractor &ex)
{
NetTracerLayerExpressionInfo e = parse_mult (ex);
while (true) {
if (ex.test ("+")) {
NetTracerLayerExpressionInfo ee = parse_mult (ex);
e.merge (NetTracerLayerExpression::OPOr, ee);
} else if (ex.test ("-")) {
NetTracerLayerExpressionInfo ee = parse_mult (ex);
e.merge (NetTracerLayerExpression::OPNot, ee);
} else {
break;
}
}
return e;
}
NetTracerLayerExpressionInfo
NetTracerLayerExpressionInfo::parse_mult (tl::Extractor &ex)
{
NetTracerLayerExpressionInfo e = parse_atomic (ex);
while (true) {
if (ex.test ("*")) {
NetTracerLayerExpressionInfo ee = parse_atomic (ex);
e.merge (NetTracerLayerExpression::OPAnd, ee);
} else if (ex.test ("^")) {
NetTracerLayerExpressionInfo ee = parse_atomic (ex);
e.merge (NetTracerLayerExpression::OPXor, ee);
} else {
break;
}
}
return e;
}
NetTracerLayerExpressionInfo
NetTracerLayerExpressionInfo::parse_atomic (tl::Extractor &ex)
{
NetTracerLayerExpressionInfo e;
if (ex.test ("(")) {
e = parse_add (ex);
ex.expect (")");
} else {
e.m_a.read (ex);
}
return e;
}
NetTracerLayerExpressionInfo
NetTracerLayerExpressionInfo::parse (tl::Extractor &ex)
{
const char *start = ex.skip ();
NetTracerLayerExpressionInfo e = parse_add (ex);
e.m_expression = std::string (start, ex.get () - start);
return e;
}
NetTracerLayerExpressionInfo
NetTracerLayerExpressionInfo::compile (const std::string &s)
{
tl::Extractor ex (s.c_str ());
const char *start = ex.skip ();
NetTracerLayerExpressionInfo e = parse_add (ex);
e.m_expression = std::string (start, ex.get () - start);
ex.expect_end ();
return e;
}
NetTracerLayerExpression *
NetTracerLayerExpressionInfo::get_expr (const db::LayerProperties &lp, const db::Layout &layout, const NetTracerTechnologyComponent &tech, const std::set<std::string> &used_symbols) const
{
for (NetTracerTechnologyComponent::const_symbol_iterator s = tech.begin_symbols (); s != tech.end_symbols (); ++s) {
if (s->symbol ().log_equal (lp)) {
std::set<std::string> us = used_symbols;
if (! us.insert (s->symbol ().to_string ()).second) {
throw tl::Exception (tl::to_string (QObject::tr ("Recursive expression through symbol %s")), s->symbol ());
}
return NetTracerLayerExpressionInfo::compile (s->expression ()).get (layout, tech, us);
}
}
for (db::Layout::layer_iterator l = layout.begin_layers (); l != layout.end_layers (); ++l) {
if ((*l).second->log_equal (lp)) {
return new NetTracerLayerExpression ((*l).first);
}
}
return new NetTracerLayerExpression (-1);
}
NetTracerLayerExpression *
NetTracerLayerExpressionInfo::get (const db::Layout &layout, const NetTracerTechnologyComponent &tech) const
{
std::set<std::string> us;
return get (layout, tech, us);
}
NetTracerLayerExpression *
NetTracerLayerExpressionInfo::get (const db::Layout &layout, const NetTracerTechnologyComponent &tech, const std::set<std::string> &used_symbols) const
{
NetTracerLayerExpression *e = 0;
if (mp_a) {
e = mp_a->get (layout, tech, used_symbols);
} else {
e = get_expr (m_a, layout, tech, used_symbols);
}
if (m_op != NetTracerLayerExpression::OPNone) {
if (mp_b) {
e->merge (m_op, mp_b->get (layout, tech, used_symbols));
} else {
e->merge (m_op, get_expr (m_b, layout, tech, used_symbols));
}
}
return e;
}
// -----------------------------------------------------------------------------------
// NetTracerTechnologyComponent implementation
NetTracerTechnologyComponent::NetTracerTechnologyComponent ()
: db::TechnologyComponent (net_tracer_component_name, tl::to_string (QObject::tr ("Connectivity")))
{
// .. nothing yet ..
}
NetTracerTechnologyComponent::NetTracerTechnologyComponent (const NetTracerTechnologyComponent &d)
: db::TechnologyComponent (net_tracer_component_name, tl::to_string (QObject::tr ("Connectivity")))
{
m_connections = d.m_connections;
m_symbols = d.m_symbols;
}
NetTracerData
NetTracerTechnologyComponent::get_tracer_data (const db::Layout &layout) const
{
// test run on the expressions to verify their syntax
int n = 1;
for (NetTracerTechnologyComponent::const_iterator c = begin (); c != end (); ++c, ++n) {
if (c->layer_a ().to_string ().empty ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Missing first layer specification on connectivity specification #%d")), n);
}
if (c->layer_b ().to_string ().empty ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Missing second layer specification on connectivity specification #%d")), n);
}
}
n = 1;
for (NetTracerTechnologyComponent::const_symbol_iterator s = begin_symbols (); s != end_symbols (); ++s, ++n) {
if (s->symbol ().to_string ().empty ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Missing symbol name on symbol specification #%d")), n);
}
if (s->expression ().empty ()) {
throw tl::Exception (tl::to_string (QObject::tr ("Missing expression on symbol specification #%d")), n);
}
try {
std::auto_ptr<NetTracerLayerExpression> expr_in (NetTracerLayerExpressionInfo::compile (s->expression ()).get (layout, *this));
} catch (tl::Exception &ex) {
throw tl::Exception (tl::to_string (QObject::tr ("Error compiling expression '%s' (symbol #%d): %s")), s->expression (), n, ex.msg ());
}
}
NetTracerData data;
// register a logical layer for each original one as alias and one for each expression with a new ID
for (ext::NetTracerTechnologyComponent::const_symbol_iterator s = begin_symbols (); s != end_symbols (); ++s) {
ext::NetTracerLayerExpression *expr = ext::NetTracerLayerExpressionInfo::compile (s->expression ()).get (layout, *this);
data.register_logical_layer (expr, s->symbol ().to_string ().c_str ());
}
for (ext::NetTracerTechnologyComponent::const_iterator c = begin (); c != end (); ++c) {
data.add_connection (c->get (layout, *this, data));
}
return data;
}
// -----------------------------------------------------------------------------------------
// NetTracerConnectivityColumnDelegate definition and implementation
@ -421,7 +56,7 @@ class NetTracerConnectivityColumnDelegate
: public QItemDelegate
{
public:
NetTracerConnectivityColumnDelegate (QWidget *parent, NetTracerTechnologyComponent *data)
NetTracerConnectivityColumnDelegate (QWidget *parent, db::NetTracerTechnologyComponent *data)
: QItemDelegate (parent), mp_data (data)
{
// .. nothing yet ..
@ -462,13 +97,13 @@ public:
int n = model->data (index, Qt::UserRole).toInt ();
if (mp_data->size () > size_t (n)) {
NetTracerLayerExpressionInfo expr;
db::NetTracerLayerExpressionInfo expr;
std::string text = tl::to_string (editor->text ());
tl::Extractor ex (text.c_str ());
bool error = false;
try {
expr = NetTracerLayerExpressionInfo::compile (text);
expr = db::NetTracerLayerExpressionInfo::compile (text);
} catch (...) {
error = true;
}
@ -513,7 +148,7 @@ public:
}
private:
NetTracerTechnologyComponent *mp_data;
db::NetTracerTechnologyComponent *mp_data;
};
// -----------------------------------------------------------------------------------------
@ -523,7 +158,7 @@ class NetTracerConnectivitySymbolColumnDelegate
: public QItemDelegate
{
public:
NetTracerConnectivitySymbolColumnDelegate (QWidget *parent, NetTracerTechnologyComponent *data)
NetTracerConnectivitySymbolColumnDelegate (QWidget *parent, db::NetTracerTechnologyComponent *data)
: QItemDelegate (parent), mp_data (data)
{
// .. nothing yet ..
@ -581,7 +216,7 @@ public:
bool ok = true;
// check the expression
try {
NetTracerLayerExpressionInfo::compile (text);
db::NetTracerLayerExpressionInfo::compile (text);
} catch (tl::Exception &) {
ok = false;
}
@ -627,7 +262,7 @@ public:
}
private:
NetTracerTechnologyComponent *mp_data;
db::NetTracerTechnologyComponent *mp_data;
};
// -----------------------------------------------------------------------------------
@ -661,7 +296,7 @@ NetTracerTechComponentEditor::NetTracerTechComponentEditor (QWidget *parent)
void
NetTracerTechComponentEditor::commit ()
{
NetTracerTechnologyComponent *data = dynamic_cast <NetTracerTechnologyComponent *> (tech_component ());
db::NetTracerTechnologyComponent *data = dynamic_cast <db::NetTracerTechnologyComponent *> (tech_component ());
if (! data) {
return;
}
@ -672,7 +307,7 @@ NetTracerTechComponentEditor::commit ()
void
NetTracerTechComponentEditor::setup ()
{
NetTracerTechnologyComponent *data = dynamic_cast <NetTracerTechnologyComponent *> (tech_component ());
db::NetTracerTechnologyComponent *data = dynamic_cast <db::NetTracerTechnologyComponent *> (tech_component ());
if (! data) {
return;
}
@ -704,11 +339,11 @@ NetTracerTechComponentEditor::add_clicked ()
int row = connectivity_table->currentItem () ? connectivity_table->row (connectivity_table->currentItem ()) : -1;
if (row < 0) {
m_data.add (NetTracerConnectionInfo ());
m_data.add (db::NetTracerConnectionInfo ());
row = int (m_data.size () - 1);
} else {
row += 1;
m_data.insert (m_data.begin () + row, NetTracerConnectionInfo ());
m_data.insert (m_data.begin () + row, db::NetTracerConnectionInfo ());
}
update ();
@ -756,7 +391,7 @@ NetTracerTechComponentEditor::move_up_clicked ()
connectivity_table->setCurrentIndex (QModelIndex ());
int n = 0;
for (NetTracerTechnologyComponent::iterator l = m_data.begin (); l != m_data.end (); ++l, ++n) {
for (db::NetTracerTechnologyComponent::iterator l = m_data.begin (); l != m_data.end (); ++l, ++n) {
if (selected_rows.find (n + 1) != selected_rows.end () && selected_rows.find (n) == selected_rows.end ()) {
std::swap (m_data.begin () [n + 1], m_data.begin () [n]);
selected_rows.erase (n + 1);
@ -797,7 +432,7 @@ NetTracerTechComponentEditor::move_down_clicked ()
connectivity_table->setCurrentIndex (QModelIndex ());
int n = m_data.size ();
for (NetTracerTechnologyComponent::iterator l = m_data.end (); l != m_data.begin (); ) {
for (db::NetTracerTechnologyComponent::iterator l = m_data.end (); l != m_data.begin (); ) {
--l;
--n;
if (selected_rows.find (n - 1) != selected_rows.end () && selected_rows.find (n) == selected_rows.end ()) {
@ -830,11 +465,11 @@ NetTracerTechComponentEditor::symbol_add_clicked ()
int row = symbol_table->currentItem () ? symbol_table->row (symbol_table->currentItem ()) : -1;
if (row < 0) {
m_data.add_symbol (NetTracerSymbolInfo ());
m_data.add_symbol (db::NetTracerSymbolInfo ());
row = int (m_data.symbols () - 1);
} else {
row += 1;
m_data.insert_symbol (m_data.begin_symbols () + row, NetTracerSymbolInfo ());
m_data.insert_symbol (m_data.begin_symbols () + row, db::NetTracerSymbolInfo ());
}
update ();
@ -882,7 +517,7 @@ NetTracerTechComponentEditor::symbol_move_up_clicked ()
symbol_table->setCurrentIndex (QModelIndex ());
int n = 0;
for (NetTracerTechnologyComponent::symbol_iterator l = m_data.begin_symbols (); l != m_data.end_symbols (); ++l, ++n) {
for (db::NetTracerTechnologyComponent::symbol_iterator l = m_data.begin_symbols (); l != m_data.end_symbols (); ++l, ++n) {
if (selected_rows.find (n + 1) != selected_rows.end () && selected_rows.find (n) == selected_rows.end ()) {
std::swap (m_data.begin_symbols () [n + 1], m_data.begin_symbols () [n]);
selected_rows.erase (n + 1);
@ -923,7 +558,7 @@ NetTracerTechComponentEditor::symbol_move_down_clicked ()
symbol_table->setCurrentIndex (QModelIndex ());
int n = m_data.symbols ();
for (NetTracerTechnologyComponent::symbol_iterator l = m_data.end_symbols (); l != m_data.begin_symbols (); ) {
for (db::NetTracerTechnologyComponent::symbol_iterator l = m_data.end_symbols (); l != m_data.begin_symbols (); ) {
--l;
--n;
if (selected_rows.find (n - 1) != selected_rows.end () && selected_rows.find (n) == selected_rows.end ()) {
@ -965,7 +600,7 @@ NetTracerTechComponentEditor::update ()
connectivity_table->setHorizontalHeaderLabels (labels);
n = 0;
for (NetTracerTechnologyComponent::iterator l = m_data.begin (); l != m_data.end (); ++l, ++n) {
for (db::NetTracerTechnologyComponent::iterator l = m_data.begin (); l != m_data.end (); ++l, ++n) {
for (int c = 0; c < 3; ++c) {
@ -1017,7 +652,7 @@ NetTracerTechComponentEditor::update ()
symbol_table->setHorizontalHeaderLabels (labels);
n = 0;
for (NetTracerTechnologyComponent::symbol_iterator l = m_data.begin_symbols (); l != m_data.end_symbols (); ++l, ++n) {
for (db::NetTracerTechnologyComponent::symbol_iterator l = m_data.begin_symbols (); l != m_data.end_symbols (); ++l, ++n) {
for (int c = 0; c < 2; ++c) {
@ -1051,7 +686,7 @@ NetTracerTechComponentEditor::update ()
bool ok = true;
// check the expression
try {
NetTracerLayerExpressionInfo::compile (l->expression ());
db::NetTracerLayerExpressionInfo::compile (l->expression ());
} catch (tl::Exception &) {
ok = false;
}
@ -1076,155 +711,5 @@ NetTracerTechComponentEditor::update ()
symbol_table->clearSelection ();
}
// -----------------------------------------------------------------------------------
// Net implementation
Net::Net ()
: m_dbu (0.001), m_incomplete (true), m_trace_path (false)
{
// .. nothing yet ..
}
Net::Net (const NetTracer &tracer, const db::ICplxTrans &trans, const db::Layout &layout, db::cell_index_type cell_index, const std::string &layout_filename, const std::string &layout_name, const NetTracerData &data)
: m_name (tracer.name ()), m_incomplete (tracer.incomplete ()), m_trace_path (false)
{
m_dbu = layout.dbu ();
m_top_cell_name = layout.cell_name (cell_index);
m_layout_filename = layout_filename;
m_layout_name = layout_name;
size_t n = 0;
for (NetTracer::iterator s = tracer.begin (); s != tracer.end (); ++s) {
++n;
}
m_net_shapes.reserve (n);
for (NetTracer::iterator s = tracer.begin (); s != tracer.end (); ++s) {
// TODO: should reset propery ID:
tl::ident_map<db::properties_id_type> pm;
db::Shape new_shape = m_shapes.insert (s->shape (), trans, pm);
m_net_shapes.push_back (*s);
m_net_shapes.back ().shape (new_shape);
if (m_cell_names.find (s->cell_index ()) == m_cell_names.end ()) {
m_cell_names.insert (std::make_pair (s->cell_index (), layout.cell_name (s->cell_index ())));
}
if (m_layers.find (s->layer ()) == m_layers.end ()) {
unsigned int l = s->layer ();
db::LayerProperties lp;
db::LayerProperties lprep;
if (layout.is_valid_layer (l)) {
lp = layout.get_properties (l);
lprep = lp;
} else {
int lrep = data.expression (l).representative_layer ();
if (layout.is_valid_layer (lrep)) {
lprep = layout.get_properties (lrep);
}
for (std::map<std::string, unsigned int>::const_iterator sy = data.symbols ().begin (); sy != data.symbols ().end (); ++sy) {
if (sy->second == l) {
tl::Extractor ex (sy->first.c_str ());
lp.read (ex);
break;
}
}
}
define_layer (l, lp, lprep);
}
}
}
std::vector<unsigned int>
Net::export_net (db::Layout &layout, db::Cell &export_cell)
{
std::vector<unsigned int> new_layers;
std::map<unsigned int, unsigned int> layer_map;
for (iterator net_shape = begin (); net_shape != end (); ++net_shape) {
if (net_shape->is_pseudo ()) {
continue;
}
std::map<unsigned int, unsigned int>::const_iterator lm = layer_map.find (net_shape->layer ());
if (lm == layer_map.end ()) {
int layer_index = -1;
for (db::Layout::layer_iterator l = layout.begin_layers (); l != layout.end_layers (); ++l) {
if ((*l).second->log_equal (representative_layer_for (net_shape->layer ()))) {
layer_index = int ((*l).first);
break;
}
}
if (layer_index < 0) {
layer_index = int (layout.insert_layer (representative_layer_for (net_shape->layer ())));
new_layers.push_back (layer_index);
}
lm = layer_map.insert (std::make_pair (net_shape->layer (), (unsigned int)layer_index)).first;
}
tl::ident_map<db::properties_id_type> pm;
export_cell.shapes (lm->second).insert (net_shape->shape (), db::ICplxTrans (net_shape->trans ()), pm);
}
return new_layers;
}
const std::string &
Net::cell_name (db::cell_index_type cell_index) const
{
std::map <unsigned int, std::string>::const_iterator cn = m_cell_names.find (cell_index);
if (cn != m_cell_names.end ()) {
return cn->second;
} else {
static std::string n;
return n;
}
}
db::LayerProperties
Net::representative_layer_for (unsigned int log_layer) const
{
std::map <unsigned int, std::pair <db::LayerProperties, db::LayerProperties> >::const_iterator l = m_layers.find (log_layer);
if (l != m_layers.end ()) {
return l->second.second;
} else {
return db::LayerProperties ();
}
}
db::LayerProperties
Net::layer_for (unsigned int log_layer) const
{
std::map <unsigned int, std::pair <db::LayerProperties, db::LayerProperties> >::const_iterator l = m_layers.find (log_layer);
if (l != m_layers.end ()) {
return l->second.first;
} else {
return db::LayerProperties ();
}
}
void
Net::define_layer (unsigned int l, const db::LayerProperties &lp, const db::LayerProperties &lp_representative)
{
m_layers.insert (std::make_pair (l, std::make_pair (lp, lp_representative)));
}
}

View File

@ -0,0 +1,84 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2018 Matthias Koefferlein
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
*/
#ifndef HDR_layNetTracerIO
#define HDR_layNetTracerIO
#include "ui_NetTracerTechComponentEditor.h"
#include "dbNetTracer.h"
#include "dbNetTracerIO.h"
#include "dbTechnology.h"
#include "layNetTracerConfig.h"
#include "layBrowser.h"
#include "layPlugin.h"
#include "layViewObject.h"
#include "layMarker.h"
#include "layTechnology.h"
#include "tlObject.h"
namespace db
{
class NetTracerTechnologyComponent;
}
namespace lay
{
class FileDialog;
class NetTracerTechComponentEditor
: public lay::TechnologyComponentEditor,
public Ui::NetTracerTechComponentEditor
{
Q_OBJECT
public:
NetTracerTechComponentEditor (QWidget *parent);
void commit ();
void setup ();
public slots:
void add_clicked ();
void del_clicked ();
void move_up_clicked ();
void move_down_clicked ();
void symbol_add_clicked ();
void symbol_del_clicked ();
void symbol_move_up_clicked ();
void symbol_move_down_clicked ();
private:
db::NetTracerTechnologyComponent m_data;
void update ();
};
}
#endif

View File

@ -0,0 +1,99 @@
/*
KLayout Layout Viewer
Copyright (C) 2006-2018 Matthias Koefferlein
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
*/
#include "layNetTracerIO.h"
#include "layNetTracerDialog.h"
#include "layNetTracerConfig.h"
#include "layConverters.h"
#include "layCellView.h"
#include "gsiDecl.h"
namespace db
{
extern std::string net_tracer_component_name;
}
namespace lay
{
// -----------------------------------------------------------------------------------
// NetTracerPlugin definition and implementation
class NetTracerPluginDeclaration
: public lay::PluginDeclaration
{
public:
virtual void get_options (std::vector < std::pair<std::string, std::string> > &options) const
{
options.push_back (std::pair<std::string, std::string> (cfg_nt_window_mode, "fit-net"));
options.push_back (std::pair<std::string, std::string> (cfg_nt_window_dim, "1.0"));
options.push_back (std::pair<std::string, std::string> (cfg_nt_max_shapes_highlighted, "10000"));
options.push_back (std::pair<std::string, std::string> (cfg_nt_marker_color, lay::ColorConverter ().to_string (QColor ())));
options.push_back (std::pair<std::string, std::string> (cfg_nt_marker_cycle_colors_enabled, "false"));
options.push_back (std::pair<std::string, std::string> (cfg_nt_marker_cycle_colors, "255,0,0 0,255,0 0,0,255 255,255,0 255,0,255 0,255,255 160,80,255 255,160,0"));
options.push_back (std::pair<std::string, std::string> (cfg_nt_marker_line_width, "-1"));
options.push_back (std::pair<std::string, std::string> (cfg_nt_marker_vertex_size, "-1"));
options.push_back (std::pair<std::string, std::string> (cfg_nt_marker_halo, "-1"));
options.push_back (std::pair<std::string, std::string> (cfg_nt_marker_dither_pattern, "-1"));
options.push_back (std::pair<std::string, std::string> (cfg_nt_marker_intensity, "50"));
}
virtual std::vector<std::pair <std::string, lay::ConfigPage *> > config_pages (QWidget *parent) const
{
std::vector<std::pair <std::string, lay::ConfigPage *> > pages;
pages.push_back (std::make_pair (tl::to_string (QObject::tr ("Other Tools|Net Tracer")), new NetTracerConfigPage (parent)));
return pages;
}
virtual void get_menu_entries (std::vector<lay::MenuEntry> &menu_entries) const
{
// TODO: where should that go?
lay::PluginDeclaration::get_menu_entries (menu_entries);
menu_entries.push_back (lay::MenuEntry ("net_trace_group", "tools_menu.end"));
menu_entries.push_back (lay::MenuEntry ("lay::net_trace", "net_trace", "tools_menu.end", tl::to_string (QObject::tr ("Trace Net"))));
}
virtual lay::Plugin *create_plugin (db::Manager * /*manager*/, lay::PluginRoot *root, lay::LayoutView *view) const
{
return new NetTracerDialog (root, view);
}
};
static tl::RegisteredClass<lay::PluginDeclaration> config_decl (new NetTracerPluginDeclaration (), 13000, "NetTracerPlugin");
class NetTracerTechnologyEditorProvider
: public lay::TechnologyEditorProvider
{
public:
virtual lay::TechnologyComponentEditor *create_editor (QWidget *parent) const
{
return new NetTracerTechComponentEditor (parent);
}
};
static tl::RegisteredClass<lay::TechnologyEditorProvider> editor_decl (new NetTracerTechnologyEditorProvider (), 13000, db::net_tracer_component_name.c_str ());
}

View File

@ -0,0 +1,30 @@
TARGET = net_tracer
DESTDIR = $$OUT_PWD/../../../../lay_plugins
include($$PWD/../../../lay_plugin.pri)
INCLUDEPATH += $$PWD/../db_plugin
DEPENDPATH += $$PWD/../db_plugin
LIBS += -L$$DESTDIR/../db_plugins -lnet_tracer
!isEmpty(RPATH) {
QMAKE_RPATHDIR += $$RPATH/db_plugins
}
HEADERS = \
layNetTracerConfig.h \
layNetTracerDialog.h \
layNetTracerIO.h \
SOURCES = \
layNetTracerConfig.cc \
layNetTracerDialog.cc \
layNetTracerPlugin.cc \
layNetTracerIO.cc \
FORMS = \
NetTracerConfigPage.ui \
NetTracerDialog.ui \
NetTracerTechComponentEditor.ui \

View File

@ -0,0 +1,8 @@
TEMPLATE = subdirs
SUBDIRS = db_plugin lay_plugin unit_tests
lay_plugin.depends += db_plugin
unit_tests.depends += db_plugin

View File

@ -23,31 +23,30 @@
#include "tlUnitTest.h"
#include "extNetTracerDialog.h"
#include "extNetTracerIO.h"
#include "extNetTracer.h"
#include "dbNetTracerIO.h"
#include "dbNetTracer.h"
#include "dbRecursiveShapeIterator.h"
#include "dbLayoutDiff.h"
#include "dbTestSupport.h"
#include "dbWriter.h"
#include "dbReader.h"
static ext::NetTracerConnectionInfo connection (const std::string &a, const std::string &v, const std::string &b)
static db::NetTracerConnectionInfo connection (const std::string &a, const std::string &v, const std::string &b)
{
return ext::NetTracerConnectionInfo (ext::NetTracerLayerExpressionInfo::compile (a),
ext::NetTracerLayerExpressionInfo::compile (v),
ext::NetTracerLayerExpressionInfo::compile (b));
return db::NetTracerConnectionInfo (db::NetTracerLayerExpressionInfo::compile (a),
db::NetTracerLayerExpressionInfo::compile (v),
db::NetTracerLayerExpressionInfo::compile (b));
}
static ext::NetTracerConnectionInfo connection (const std::string &a, const std::string &b)
static db::NetTracerConnectionInfo connection (const std::string &a, const std::string &b)
{
return ext::NetTracerConnectionInfo (ext::NetTracerLayerExpressionInfo::compile (a),
ext::NetTracerLayerExpressionInfo::compile (b));
return db::NetTracerConnectionInfo (db::NetTracerLayerExpressionInfo::compile (a),
db::NetTracerLayerExpressionInfo::compile (b));
}
static ext::NetTracerSymbolInfo symbol (const std::string &s, const std::string &e)
static db::NetTracerSymbolInfo symbol (const std::string &s, const std::string &e)
{
return ext::NetTracerSymbolInfo (s, e);
return db::NetTracerSymbolInfo (s, e);
}
static int layer_for (const db::Layout &layout, const db::LayerProperties &lp)
@ -62,36 +61,36 @@ static int layer_for (const db::Layout &layout, const db::LayerProperties &lp)
#if 0
// not used yet:
static ext::NetTracerShape find_shape (const db::Layout &layout, const db::Cell &cell, int l, const db::Point &pt)
static db::NetTracerShape find_shape (const db::Layout &layout, const db::Cell &cell, int l, const db::Point &pt)
{
if (l < 0 || ! layout.is_valid_layer ((unsigned int) l)) {
return ext::NetTracerShape ();
return db::NetTracerShape ();
}
db::RecursiveShapeIterator s (layout, cell, (unsigned int) l, db::Box (pt, pt));
if (! s.at_end ()) {
return ext::NetTracerShape (s.itrans (), s.shape (), (unsigned int) l, s.cell_index ());
return db::NetTracerShape (s.itrans (), s.shape (), (unsigned int) l, s.cell_index ());
} else {
return ext::NetTracerShape ();
return db::NetTracerShape ();
}
}
#endif
static ext::Net trace (ext::NetTracer &tracer, const db::Layout &layout, const db::Cell &cell, const ext::NetTracerTechnologyComponent &tc, unsigned int l_start, const db::Point &p_start)
static db::Net trace (db::NetTracer &tracer, const db::Layout &layout, const db::Cell &cell, const db::NetTracerTechnologyComponent &tc, unsigned int l_start, const db::Point &p_start)
{
ext::NetTracerData tracer_data = tc.get_tracer_data (layout);
db::NetTracerData tracer_data = tc.get_tracer_data (layout);
tracer.trace (layout, cell, p_start, l_start, tracer_data);
return ext::Net (tracer, db::ICplxTrans (), layout, cell.cell_index (), std::string (), std::string (), tracer_data);
return db::Net (tracer, db::ICplxTrans (), layout, cell.cell_index (), std::string (), std::string (), tracer_data);
}
static ext::Net trace (ext::NetTracer &tracer, const db::Layout &layout, const db::Cell &cell, const ext::NetTracerTechnologyComponent &tc, unsigned int l_start, const db::Point &p_start, unsigned int l_stop, const db::Point &p_stop)
static db::Net trace (db::NetTracer &tracer, const db::Layout &layout, const db::Cell &cell, const db::NetTracerTechnologyComponent &tc, unsigned int l_start, const db::Point &p_start, unsigned int l_stop, const db::Point &p_stop)
{
ext::NetTracerData tracer_data = tc.get_tracer_data (layout);
db::NetTracerData tracer_data = tc.get_tracer_data (layout);
tracer.trace (layout, cell, p_start, l_start, p_stop, l_stop, tracer_data);
return ext::Net (tracer, db::ICplxTrans (), layout, cell.cell_index (), std::string (), std::string (), tracer_data);
return db::Net (tracer, db::ICplxTrans (), layout, cell.cell_index (), std::string (), std::string (), tracer_data);
}
void run_test (tl::TestBase *_this, const std::string &file, const ext::NetTracerTechnologyComponent &tc, const db::LayerProperties &lp_start, const db::Point &p_start, const std::string &file_au, const char *net_name = 0)
void run_test (tl::TestBase *_this, const std::string &file, const db::NetTracerTechnologyComponent &tc, const db::LayerProperties &lp_start, const db::Point &p_start, const std::string &file_au, const char *net_name = 0)
{
db::Manager m;
@ -107,8 +106,8 @@ void run_test (tl::TestBase *_this, const std::string &file, const ext::NetTrace
const db::Cell &cell = layout_org.cell (*layout_org.begin_top_down ());
ext::NetTracer tracer;
ext::Net net = trace (tracer, layout_org, cell, tc, layer_for (layout_org, lp_start), p_start);
db::NetTracer tracer;
db::Net net = trace (tracer, layout_org, cell, tc, layer_for (layout_org, lp_start), p_start);
if (net_name) {
EXPECT_EQ (net.name (), std::string (net_name));
@ -125,7 +124,7 @@ void run_test (tl::TestBase *_this, const std::string &file, const ext::NetTrace
db::compare_layouts (_this, layout_net, fn, db::WriteOAS);
}
void run_test2 (tl::TestBase *_this, const std::string &file, const ext::NetTracerTechnologyComponent &tc, const db::LayerProperties &lp_start, const db::Point &p_start, const db::LayerProperties &lp_stop, const db::Point &p_stop, const std::string &file_au, const char *net_name = 0)
void run_test2 (tl::TestBase *_this, const std::string &file, const db::NetTracerTechnologyComponent &tc, const db::LayerProperties &lp_start, const db::Point &p_start, const db::LayerProperties &lp_stop, const db::Point &p_stop, const std::string &file_au, const char *net_name = 0)
{
db::Manager m;
@ -141,8 +140,8 @@ void run_test2 (tl::TestBase *_this, const std::string &file, const ext::NetTrac
const db::Cell &cell = layout_org.cell (*layout_org.begin_top_down ());
ext::NetTracer tracer;
ext::Net net = trace (tracer, layout_org, cell, tc, layer_for (layout_org, lp_start), p_start, layer_for (layout_org, lp_stop), p_stop);
db::NetTracer tracer;
db::Net net = trace (tracer, layout_org, cell, tc, layer_for (layout_org, lp_start), p_start, layer_for (layout_org, lp_stop), p_stop);
if (net_name) {
EXPECT_EQ (net.name (), std::string (net_name));
@ -164,7 +163,7 @@ TEST(1)
std::string file = "t1.oas.gz";
std::string file_au = "t1_net.oas.gz";
ext::NetTracerTechnologyComponent tc;
db::NetTracerTechnologyComponent tc;
tc.add (connection ("1/0", "2/0", "3/0"));
run_test (_this, file, tc, db::LayerProperties (1, 0), db::Point (7000, 1500), file_au, "THE_NAME");
@ -175,7 +174,7 @@ TEST(1b)
std::string file = "t1.oas.gz";
std::string file_au = "t1b_net.oas.gz";
ext::NetTracerTechnologyComponent tc;
db::NetTracerTechnologyComponent tc;
tc.add (connection ("1/0", "2/0", "3/0"));
// point is off net ...
@ -187,7 +186,7 @@ TEST(1c)
std::string file = "t1.oas.gz";
std::string file_au = "t1_net.oas.gz";
ext::NetTracerTechnologyComponent tc;
db::NetTracerTechnologyComponent tc;
tc.add_symbol (symbol ("a", "1/0"));
tc.add_symbol (symbol ("c", "cc"));
tc.add_symbol (symbol ("cc", "3/0"));
@ -201,7 +200,7 @@ TEST(1d)
std::string file = "t1.oas.gz";
std::string file_au = "t1d_net.oas.gz";
ext::NetTracerTechnologyComponent tc;
db::NetTracerTechnologyComponent tc;
tc.add (connection ("1/0", "10/0", "11/0"));
// some layers are non-existing
@ -213,7 +212,7 @@ TEST(2)
std::string file = "t2.oas.gz";
std::string file_au = "t2_net.oas.gz";
ext::NetTracerTechnologyComponent tc;
db::NetTracerTechnologyComponent tc;
tc.add (connection ("1/0", "2/0", "3/0"));
run_test2 (_this, file, tc, db::LayerProperties (1, 0), db::Point (7000, 1500), db::LayerProperties (3, 0), db::Point (4000, -20000), file_au, "THE_NAME");
@ -224,7 +223,7 @@ TEST(3)
std::string file = "t3.oas.gz";
std::string file_au = "t3_net.oas.gz";
ext::NetTracerTechnologyComponent tc;
db::NetTracerTechnologyComponent tc;
tc.add (connection ("1/0", "2/0", "3/0"));
std::string msg;
@ -241,7 +240,7 @@ TEST(4)
std::string file = "t4.oas.gz";
std::string file_au = "t4_net.oas.gz";
ext::NetTracerTechnologyComponent tc;
db::NetTracerTechnologyComponent tc;
tc.add (connection ("1/0", "2/0", "3/0"));
run_test (_this, file, tc, db::LayerProperties (1, 0), db::Point (7000, 1500), file_au, "");
@ -252,7 +251,7 @@ TEST(4b)
std::string file = "t4.oas.gz";
std::string file_au = "t4b_net.oas.gz";
ext::NetTracerTechnologyComponent tc;
db::NetTracerTechnologyComponent tc;
tc.add (connection ("1/0", "3/0"));
run_test (_this, file, tc, db::LayerProperties (1, 0), db::Point (7000, 1500), file_au, "THE_NAME");
@ -263,7 +262,7 @@ TEST(5)
std::string file = "t5.oas.gz";
std::string file_au = "t5_net.oas.gz";
ext::NetTracerTechnologyComponent tc;
db::NetTracerTechnologyComponent tc;
tc.add (connection ("1/0*10/0", "2/0", "3/0"));
run_test (_this, file, tc, db::LayerProperties (1, 0), db::Point (7000, 1500), file_au, "THE_NAME");
@ -274,7 +273,7 @@ TEST(5b)
std::string file = "t5.oas.gz";
std::string file_au = "t5b_net.oas.gz";
ext::NetTracerTechnologyComponent tc;
db::NetTracerTechnologyComponent tc;
tc.add (connection ("1/0", "2/0*10/0", "3/0"));
run_test (_this, file, tc, db::LayerProperties (1, 0), db::Point (7000, 1500), file_au, "THE_NAME");
@ -285,7 +284,7 @@ TEST(5c)
std::string file = "t5.oas.gz";
std::string file_au = "t5c_net.oas.gz";
ext::NetTracerTechnologyComponent tc;
db::NetTracerTechnologyComponent tc;
tc.add (connection ("1/0", "2/0-11/0", "3/0"));
run_test (_this, file, tc, db::LayerProperties (1, 0), db::Point (7000, 1500), file_au, "");
@ -296,7 +295,7 @@ TEST(5d)
std::string file = "t5.oas.gz";
std::string file_au = "t5d_net.oas.gz";
ext::NetTracerTechnologyComponent tc;
db::NetTracerTechnologyComponent tc;
tc.add (connection ("1/0-12/0", "2/0", "3/0-12/0"));
run_test (_this, file, tc, db::LayerProperties (1, 0), db::Point (7000, 1500), file_au, "THE_NAME");
@ -307,7 +306,7 @@ TEST(5e)
std::string file = "t5.oas.gz";
std::string file_au = "t5e_net.oas.gz";
ext::NetTracerTechnologyComponent tc;
db::NetTracerTechnologyComponent tc;
tc.add (connection ("1/0-12/0", "2/0", "3/0-12/0"));
run_test (_this, file, tc, db::LayerProperties (1, 0), db::Point (7000, 1500), file_au, "THE_NAME");
@ -318,7 +317,7 @@ TEST(5f)
std::string file = "t5.oas.gz";
std::string file_au = "t5f_net.oas.gz";
ext::NetTracerTechnologyComponent tc;
db::NetTracerTechnologyComponent tc;
tc.add_symbol (symbol ("x", "3-14"));
tc.add (connection ("10-13", "x"));
tc.add (connection ("x", "2", "1+13"));
@ -331,7 +330,7 @@ TEST(6)
std::string file = "t6.oas.gz";
std::string file_au = "t6_net.oas.gz";
ext::NetTracerTechnologyComponent tc;
db::NetTracerTechnologyComponent tc;
tc.add (connection ("1-10", "2", "3"));
tc.add (connection ("3", "4", "5"));
@ -343,7 +342,7 @@ TEST(7)
std::string file = "t7.oas.gz";
std::string file_au = "t7_net.oas.gz";
ext::NetTracerTechnologyComponent tc;
db::NetTracerTechnologyComponent tc;
tc.add (connection ("15", "14", "2-7"));
tc.add (connection ("15", "14", "7"));
@ -356,7 +355,7 @@ TEST(8)
std::string file = "t8.oas.gz";
std::string file_au = "t8_net.oas.gz";
ext::NetTracerTechnologyComponent tc;
db::NetTracerTechnologyComponent tc;
tc.add (connection ("15", "14", "7"));
run_test (_this, file, tc, db::LayerProperties (15, 0), db::Point (4000, 10000), file_au, "");
@ -367,7 +366,7 @@ TEST(9)
std::string file = "t9.oas.gz";
std::string file_au = "t9_net.oas.gz";
ext::NetTracerTechnologyComponent tc;
db::NetTracerTechnologyComponent tc;
tc.add_symbol (symbol ("a", "8-12"));
tc.add_symbol (symbol ("b", "a+7"));
tc.add_symbol (symbol ("c", "15*26"));

View File

@ -0,0 +1,20 @@
DESTDIR_UT = $$OUT_PWD/../../../..
TARGET = net_tracer_tests
include($$PWD/../../../../lib_ut.pri)
SOURCES = \
dbNetTracer.cc \
INCLUDEPATH += $$LAY_INC $$TL_INC $$DB_INC $$GSI_INC $$PWD/../db_plugin
DEPENDPATH += $$LAY_INC $$TL_INC $$DB_INC $$GSI_INC $$PWD/../db_plugin
LIBS += -L$$DESTDIR_UT -lklayout_db -lklayout_tl -lklayout_gsi
# This makes the test pull the mebes library for testing (not installed)
PLUGINPATH = $$OUT_PWD/../../../../db_plugins
QMAKE_RPATHDIR += $$PLUGINPATH
LIBS += -L$$PLUGINPATH -lnet_tracer

View File

@ -0,0 +1,9 @@
TEMPLATE = subdirs
# Automatically include all sub-folders, but not the .pro file
SUBDIR_LIST = $$files($$PWD/*)
SUBDIR_LIST -= $$PWD/tools.pro
SUBDIRS = $$SUBDIR_LIST