diff --git a/src/db/db/dbPCellDeclaration.h b/src/db/db/dbPCellDeclaration.h index b749fbd64..96130a3c7 100644 --- a/src/db/db/dbPCellDeclaration.h +++ b/src/db/db/dbPCellDeclaration.h @@ -28,6 +28,7 @@ #include "gsiObject.h" #include "dbLayout.h" +#include "dbVia.h" #include "tlVariant.h" #include "tlObject.h" #include "tlOptional.h" @@ -672,6 +673,16 @@ public: return std::string (); } + /** + * @brief Returns the description text of the PCell + * + * The description text is a for human interpretation only. By default, the name will be returned. + */ + virtual std::string get_description () const + { + return m_name; + } + /** * @brief Returns true, if the PCell can be created from the given shape on the given layer * @@ -717,6 +728,23 @@ public: return false; } + /** + * @brief Returns the via types the PCell can provide + * + * This method returns a list of via types the PCell can support. + * If this list is non-empty, the PCell will be used to implement + * vias of one of the given type. + * + * Such a PCell needs to support the following parameters + * * "via" (string): the name of the via type + * * "w" (float): the via width (top or bottom layer) in um + * * "h" (float): the via height (top or bottom layer) in um + */ + virtual std::vector via_types () const + { + return std::vector (); + } + /** * @brief Gets the Layout object the PCell is registered inside or NULL if it is not registered */ diff --git a/src/db/db/dbVia.cc b/src/db/db/dbVia.cc index e69de29bb..0122e32eb 100644 --- a/src/db/db/dbVia.cc +++ b/src/db/db/dbVia.cc @@ -0,0 +1,43 @@ + +/* + + 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 "dbVia.h" + +namespace db +{ + +void +ViaType::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; +} + +} diff --git a/src/db/db/dbVia.h b/src/db/db/dbVia.h index 717450792..93ce955d9 100644 --- a/src/db/db/dbVia.h +++ b/src/db/db/dbVia.h @@ -155,19 +155,7 @@ public: 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; - } + void init (); }; } diff --git a/src/db/db/gsiDeclDbLibrary.cc b/src/db/db/gsiDeclDbLibrary.cc index 1d8a8babe..3e353fe6a 100644 --- a/src/db/db/gsiDeclDbLibrary.cc +++ b/src/db/db/gsiDeclDbLibrary.cc @@ -287,6 +287,8 @@ Class decl_PCellDeclaration_Native ("db", "PCellDeclaratio gsi::method ("parameters_from_shape", &db::PCellDeclaration::parameters_from_shape, gsi::arg ("layout"), gsi::arg ("shape"), gsi::arg ("layer")) + gsi::method ("transformation_from_shape", &db::PCellDeclaration::transformation_from_shape, gsi::arg ("layout"), gsi::arg ("shape"), gsi::arg ("layer")) + gsi::method ("wants_lazy_evaluation", &db::PCellDeclaration::wants_lazy_evaluation) + + gsi::method ("via_types", &db::PCellDeclaration::via_types) + + gsi::method ("description", &db::PCellDeclaration::get_description) + gsi::method ("display_text", &db::PCellDeclaration::get_display_name, gsi::arg ("parameters")) + gsi::method ("layout", &db::PCellDeclaration::layout, "@brief Gets the Layout object the PCell is registered in or nil if it is not registered yet.\n" @@ -537,6 +539,34 @@ public: } } + std::string get_description_fb () const + { + return db::PCellDeclaration::get_description (); + } + + virtual std::string get_description () const + { + if (cb_get_description.can_issue ()) { + return cb_get_description.issue (&db::PCellDeclaration::get_description); + } else { + return db::PCellDeclaration::get_description (); + } + } + + std::vector via_types_fb () const + { + return db::PCellDeclaration::via_types (); + } + + virtual std::vector via_types () const + { + if (cb_via_types.can_issue ()) { + return cb_via_types.issue> (&db::PCellDeclaration::via_types); + } else { + return db::PCellDeclaration::via_types (); + } + } + std::string get_display_name_fb (const db::pcell_parameters_type ¶meters) const { return db::PCellDeclaration::get_display_name (parameters); @@ -561,6 +591,8 @@ public: gsi::Callback cb_coerce_parameters; gsi::Callback cb_callback; gsi::Callback cb_get_display_name; + gsi::Callback cb_get_description; + gsi::Callback cb_via_types; }; Class decl_PCellDeclaration (decl_PCellDeclaration_Native, "db", "PCellDeclaration", @@ -573,6 +605,8 @@ Class decl_PCellDeclaration (decl_PCellDeclaration_Native, gsi::method ("transformation_from_shape", &PCellDeclarationImpl::transformation_from_shape_fb, "@hide") + gsi::method ("display_text", &PCellDeclarationImpl::get_display_name_fb, "@hide") + gsi::method ("wants_lazy_evaluation", &PCellDeclarationImpl::wants_lazy_evaluation_fb, "@hide") + + gsi::method ("description", &PCellDeclarationImpl::get_description_fb, "@hide") + + gsi::method ("via_types", &PCellDeclarationImpl::via_types_fb, "@hide") + gsi::callback ("get_layers", &PCellDeclarationImpl::get_layer_declarations_impl, &PCellDeclarationImpl::cb_get_layer_declarations, gsi::arg ("parameters"), "@brief Returns a list of layer declarations\n" "Reimplement this method to return a list of layers this PCell wants to create.\n" @@ -670,6 +704,27 @@ Class decl_PCellDeclaration (decl_PCellDeclaration_Native, "\n" "This method has been added in version 0.27.6.\n" ) + + gsi::callback ("description", &PCellDeclarationImpl::get_description, &PCellDeclarationImpl::cb_get_description, + "@brief Gets the PCell description\n" + "The description string is a text that gives a human-readable description of the PCell. By default, the " + "PCell name is used for the description.\n" + "\n" + "This method has been added in version 0.30.4.\n" + ) + + gsi::callback ("via_types", &PCellDeclarationImpl::via_types, &PCellDeclarationImpl::cb_via_types, + "@brief Gets the via types the PCell supports - if it is a via PCell\n" + "If the returned list is non-empty, the PCell may be used as a via PCell. This method is supposed " + "to deliver a list of via types the PCell supports. If the PCell supports vias, it is expected to " + "accept the following parameters:\n" + "\n" + "@ul\n" + "@li 'via' (string): the name of the via type requested @/li\n" + "@li 'w' (float): the via width (top or bottom layer) in micron @/li\n" + "@li 'h' (float): the via height (top or bottom layer) in micron @/li\n" + "@/ul\n" + "\n" + "This method has been added in version 0.30.4.\n" + ) + gsi::callback ("display_text", &PCellDeclarationImpl::get_display_name, &PCellDeclarationImpl::cb_get_display_name, gsi::arg ("parameters"), "@brief Returns the display text for this PCell given a certain parameter set\n" "Reimplement this method to create a distinct display text for a PCell variant with \n"