From 569a8d7c527d1de35b7b8223090b94ab53c395e4 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Wed, 29 Jan 2025 00:29:15 +0100 Subject: [PATCH] First files. --- src/db/db/db.pro | 5 +- src/db/db/dbVia.cc | 0 src/db/db/dbVia.h | 176 ++++++++++++++++++++++++++++++++++++++ src/db/db/gsiDeclDbVia.cc | 149 ++++++++++++++++++++++++++++++++ 4 files changed, 329 insertions(+), 1 deletion(-) create mode 100644 src/db/db/dbVia.cc create mode 100644 src/db/db/dbVia.h create mode 100644 src/db/db/gsiDeclDbVia.cc diff --git a/src/db/db/db.pro b/src/db/db/db.pro index 98e7ef5da..c6a3cae47 100644 --- a/src/db/db/db.pro +++ b/src/db/db/db.pro @@ -107,6 +107,7 @@ SOURCES = \ dbUserObject.cc \ dbUtils.cc \ dbVector.cc \ + dbVia.cc \ dbWriter.cc \ dbWriterTools.cc \ dbVariableWidthPath.cc \ @@ -232,7 +233,8 @@ SOURCES = \ dbNetShape.cc \ dbShapeCollection.cc \ gsiDeclDbShapeCollection.cc \ - dbShapeCollectionUtils.cc + dbShapeCollectionUtils.cc \ + gsiDeclDbVia.cc HEADERS = \ dbArray.h \ @@ -342,6 +344,7 @@ HEADERS = \ dbUserObject.h \ dbUtils.h \ dbVector.h \ + dbVia.h \ dbWriter.h \ dbWriterTools.h \ dbGlyphs.h \ diff --git a/src/db/db/dbVia.cc b/src/db/db/dbVia.cc new file mode 100644 index 000000000..e69de29bb diff --git a/src/db/db/dbVia.h b/src/db/db/dbVia.h new file mode 100644 index 000000000..717450792 --- /dev/null +++ b/src/db/db/dbVia.h @@ -0,0 +1,176 @@ + +/* + + KLayout Layout Viewer + Copyright (C) 2006-2025 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_dbVia +#define HDR_dbVia + +#include "dbCommon.h" +#include "dbLayerProperties.h" + +#include + +namespace db +{ + +/** + * @brief A descriptor for a via + * + * This object describes one flavor of a via provided by via PCells. + */ +class DB_PUBLIC ViaType +{ +public: + /** + * @brief The default constructor + */ + ViaType () + { + init (); + } + + /** + * @brief The constructor with a name + */ + ViaType (const std::string &_name) + : name (_name) + { + init (); + } + + /** + * @brief The constructor with a name and description + */ + ViaType (const std::string &_name, const std::string &_description) + : name (_name), description (_description) + { + init (); + } + + /** + * @brief The minimum width of the bottom layer of the via + */ + double wbmin; + + /** + * @brief The maximum width of the bottom layer of the via + * + * A negative value means "not specified" or "infinite". + */ + double wbmax; + + /** + * @brief The minimum height of the bottom layer of the via + */ + double hbmin; + + /** + * @brief The maximum height of the bottom layer of the via + * + * A negative value means "not specified" or "infinite". + */ + double hbmax; + + /** + * @brief The minimum width of the top layer of the via + */ + double wtmin; + + /** + * @brief The maximum width of the top layer of the via + * + * A negative value means "not specified" or "infinite". + */ + double wtmax; + + /** + * @brief The minimum height of the top layer of the via + */ + double htmin; + + /** + * @brief The maximum height of the top layer of the via + * + * A negative value means "not specified" or "infinite". + */ + double htmax; + + /** + * @brief The bottom layer + */ + db::LayerProperties bottom; + + /** + * @brief A flag indicating whether the bottom layer is wired + * + * For example, sheet layers such as diffusion are not wired. + * By default, layers are wired. + */ + bool bottom_wired; + + /** + * @brief The top layer + */ + db::LayerProperties top; + + /** + * @brief A flag indicating whether the top layer is wired + * + * For example, sheet layers such as diffusion are not wired. + * By default, layers are wired. + */ + bool top_wired; + + /** + * @brief The name of the via + * + * The name is a formal name to identify the via. + */ + std::string name; + + /** + * @brief The description of the via + * + * This is a human-readable description. This attribute is optional. + */ + std::string description; + +private: + void init () + { + wbmin = 0.0; + wbmax = -1.0; + hbmin = 0.0; + hbmax = -1.0; + wtmin = 0.0; + wtmax = -1.0; + htmin = 0.0; + htmax = -1.0; + bottom_wired = true; + top_wired = true; + } +}; + +} + +#endif + diff --git a/src/db/db/gsiDeclDbVia.cc b/src/db/db/gsiDeclDbVia.cc new file mode 100644 index 000000000..7aff5e0c0 --- /dev/null +++ b/src/db/db/gsiDeclDbVia.cc @@ -0,0 +1,149 @@ + +/* + + KLayout Layout Viewer + Copyright (C) 2006-2025 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 "gsiDecl.h" +#include "dbVia.h" + +namespace gsi +{ + +// TODO: this is generic. Move it to gsiDecl? + +template +struct getter_def +{ + static const R &impl (const T *t) + { + return t->*member; + } +}; + +template +struct setter_def +{ + static void impl (T *t, const R &r) + { + t->*member = r; + } +}; + +template +gsi::Methods make_getter_setter (const std::string &name, const std::string &doc) +{ + return gsi::method_ext (name, &getter_def::impl, doc) + + gsi::method_ext (name + "=", &setter_def::impl, gsi::arg ("value"), doc); +} + +static db::ViaType *new_via_type (const std::string &name, const std::string &description) +{ + return new db::ViaType (name, description); +} + +Class decl_dbViaType ("db", "ViaType", + gsi::constructor ("new", &new_via_type, gsi::arg ("name"), gsi::arg ("description", std::string ()), + "@brief Creates a new via type object with the given name and description." + ) + + make_getter_setter ("name", + "@brief The formal name of the via type.\n" + "The name should be unique and identify the via type in the context of the " + "via declaration." + ) + + make_getter_setter ("description", + "@brief The description of the via type.\n" + "The description is an optional free-style text that describes the via type for a human." + ) + + make_getter_setter ("wbmin", + "@brief The minimum bottom-layer width of the via.\n" + "This values specifies the minimum width of the bottom layer in micrometers. " + "The default is zero." + ) + + make_getter_setter ("wbmax", + "@brief The maximum bottom-layer width of the via.\n" + "This values specifies the maximum width of the bottom layer in micrometers. " + "A negative value indicates that no specific upper limit is given. " + "The default is 'unspecified'." + ) + + make_getter_setter ("wtmin", + "@brief The minimum top-layer width of the via.\n" + "This values specifies the minimum width of the top layer in micrometers. " + "The default is zero." + ) + + make_getter_setter ("wtmax", + "@brief The maximum top-layer width of the via.\n" + "This values specifies the maximum width of the top layer in micrometers. " + "A negative value indicates that no specific upper limit is given. " + "The default is 'unspecified'." + ) + + make_getter_setter ("hbmin", + "@brief The minimum bottom-layer height of the via.\n" + "This values specifies the minimum height of the bottom layer in micrometers. " + "The default is zero." + ) + + make_getter_setter ("hbmax", + "@brief The maximum bottom-layer height of the via.\n" + "This values specifies the maximum height of the bottom layer in micrometers. " + "A negative value indicates that no specific upper limit is given. " + "The default is 'unspecified'." + ) + + make_getter_setter ("htmin", + "@brief The minimum top-layer height of the via.\n" + "This values specifies the minimum height of the top layer in micrometers. " + "The default is zero." + ) + + make_getter_setter ("htmax", + "@brief The maximum top-layer height of the via.\n" + "This values specifies the maximum height of the top layer in micrometers. " + "A negative value indicates that no specific upper limit is given. " + "The default is 'unspecified'." + ) + + make_getter_setter ("bottom", + "@brief The bottom layer of the via.\n" + ) + + make_getter_setter ("top", + "@brief The top layer of the via.\n" + ) + + make_getter_setter ("bottom_wired", + "@brief A flag indicating that the bottom layer is a wiring layer.\n" + "If false, the bottom layer is assume to be a sheet layer, such as diffusion. " + "In this case, changing the routing layer will not continue drawing a path. " + "If true (the default), drawing will continue on the bottom layer as a path." + ) + + make_getter_setter ("top_wired", + "@brief A flag indicating that the top layer is a wiring layer.\n" + "If false, the bottom layer is assume to be a sheet layer, such as diffusion. " + "In this case, changing the routing layer will not continue drawing a path. " + "If true (the default), drawing will continue on the bottom layer as a path." + ), + "@brief Describes a via type\n" + "These objects are used by PCellDeclaration#via_types to specify the via types a " + "via PCell is able to provide.\n" + "\n" + "The basic parameters of a via type are bottom and top layers (the layers that are " + "connected by the via) and width and height. Width and height are the dimensions of the " + "core via area - that is the part where bottom and top layers overlap. The actual " + "layout may exceed these dimensions if different enclosure rules require so for example.\n" + "\n" + "This class has been introduced in version 0.30." +); + +}