mirror of https://github.com/KLayout/klayout.git
A small enhancement (dbu argument in LayoutToNetlist#evaluate_nets), maybe fixing issues on old Ruby versions
This commit is contained in:
parent
b6fba7bb69
commit
f289fa9483
|
|
@ -2055,7 +2055,7 @@ db::Region LayoutToNetlist::antenna_check (const db::Region &gate, double gate_a
|
|||
}
|
||||
|
||||
db::Region
|
||||
LayoutToNetlist::measure_net (const db::Region &primary, const std::map<std::string, const db::Region *> &secondary, const std::string &expression, const std::map<std::string, tl::Variant> &variables)
|
||||
LayoutToNetlist::measure_net (const db::Region &primary, const std::map<std::string, const db::Region *> &secondary, const std::string &expression, const std::map<std::string, tl::Variant> &variables, double dbu)
|
||||
{
|
||||
// TODO: that's basically too much .. we only need the clusters
|
||||
if (! m_netlist_extracted) {
|
||||
|
|
@ -2063,7 +2063,10 @@ LayoutToNetlist::measure_net (const db::Region &primary, const std::map<std::str
|
|||
}
|
||||
|
||||
db::Layout &ly = dss ().layout (m_layout_index);
|
||||
double dbu = ly.dbu ();
|
||||
|
||||
if (dbu < 0.0) {
|
||||
dbu = ly.dbu ();
|
||||
}
|
||||
|
||||
db::MeasureNetEval eval (this, dbu);
|
||||
|
||||
|
|
|
|||
|
|
@ -1148,7 +1148,7 @@ public:
|
|||
* * "skip(flag)": will skip the primary shapes of that net when called with a true value
|
||||
* * "net": the Net object of the current net
|
||||
*/
|
||||
db::Region measure_net (const db::Region &primary, const std::map<std::string, const db::Region *> &secondary, const std::string &expression, const std::map<std::string, tl::Variant> &variables);
|
||||
db::Region measure_net (const db::Region &primary, const std::map<std::string, const db::Region *> &secondary, const std::string &expression, const std::map<std::string, tl::Variant> &variables, double dbu = -1.0);
|
||||
|
||||
/**
|
||||
* @brief Saves the database to the given path
|
||||
|
|
|
|||
|
|
@ -521,8 +521,13 @@ MeasureNetEval::compute_area_and_perimeter (int layer_index) const
|
|||
mp_l2n->compute_area_and_perimeter_of_net_shapes (m_cell_index, m_cluster_id, layer, area, perimeter);
|
||||
|
||||
AreaAndPerimeter ap;
|
||||
ap.area = m_dbu * m_dbu * area;
|
||||
ap.perimeter = m_dbu * perimeter;
|
||||
if (m_dbu > 0.0) {
|
||||
ap.area = m_dbu * m_dbu * area;
|
||||
ap.perimeter = m_dbu * perimeter;
|
||||
} else {
|
||||
ap.area = area;
|
||||
ap.perimeter = perimeter;
|
||||
}
|
||||
|
||||
return ap;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ static db::Region antenna_check (db::LayoutToNetlist *l2n, const db::Region &pol
|
|||
return antenna_check3 (l2n, poly, 1, 0, metal, 1, 0, ratio, diodes, texts);
|
||||
}
|
||||
|
||||
static db::Region evaluate_nets (db::LayoutToNetlist *l2n, const db::Region &primary, const std::map<std::string, const db::Region *> &secondary, const std::string &expression, const tl::Variant &variables)
|
||||
static db::Region evaluate_nets (db::LayoutToNetlist *l2n, const db::Region &primary, const std::map<std::string, const db::Region *> &secondary, const std::string &expression, const tl::Variant &variables, const tl::Variant &dbu)
|
||||
{
|
||||
if (! variables.is_array ()) {
|
||||
throw tl::Exception (tl::to_string (tr ("'variables' argument needs to a hash")));
|
||||
|
|
@ -227,7 +227,7 @@ static db::Region evaluate_nets (db::LayoutToNetlist *l2n, const db::Region &pri
|
|||
variables_map [v->first.to_string ()] = v->second;
|
||||
}
|
||||
|
||||
return l2n->measure_net (primary, secondary, expression, variables_map);
|
||||
return l2n->measure_net (primary, secondary, expression, variables_map, dbu.is_nil () ? -1.0 : dbu.to_float ());
|
||||
}
|
||||
|
||||
static void join_net_names (db::LayoutToNetlist *l2n, const std::string &s)
|
||||
|
|
@ -1224,7 +1224,7 @@ Class<db::LayoutToNetlist> decl_dbLayoutToNetlist ("db", "LayoutToNetlist",
|
|||
"\n"
|
||||
"This variant has been introduced in version 0.26.6.\n"
|
||||
) +
|
||||
gsi::method_ext ("evaluate_nets", &evaluate_nets, gsi::arg ("primary"), gsi::arg ("secondary"), gsi::arg ("expression"), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"),
|
||||
gsi::method_ext ("evaluate_nets", &evaluate_nets, gsi::arg ("primary"), gsi::arg ("secondary"), gsi::arg ("expression"), gsi::arg ("variables", std::map<std::string, tl::Variant> (), "{}"), gsi::arg ("dbu", tl::Variant (), "auto"),
|
||||
"@brief Runs a generic net measurement function\n"
|
||||
"\n"
|
||||
"This method accepts some primary layer, a number of secondary layers with names and an expression.\n"
|
||||
|
|
@ -1249,6 +1249,9 @@ Class<db::LayoutToNetlist> decl_dbLayoutToNetlist ("db", "LayoutToNetlist",
|
|||
"@li 'skip(flag)': will skip the primary shapes of that net when called with a true value @/li\n"
|
||||
"@li 'net': the \\Net object of the current net @/li\n"
|
||||
"@/ul\n"
|
||||
"\n"
|
||||
"If given, the 'dbu' argument gives the database unit to use for converting shape dimensions into micrometer units. "
|
||||
"If this value is 0, the area and perimeters are calculated in database units. If no DBU is specified, the value is determined automatically."
|
||||
) +
|
||||
// test API
|
||||
gsi::method ("make_soft_connection_diodes=", &db::LayoutToNetlist::set_make_soft_connection_diodes, gsi::arg ("flag"), "@hide") +
|
||||
|
|
|
|||
|
|
@ -5152,7 +5152,7 @@ CODE
|
|||
# new layer.
|
||||
|
||||
def merged_props(overlap_count = 1)
|
||||
@engine._context("merged") do
|
||||
@engine._context("merged_props") do
|
||||
requires_region
|
||||
aa = [ self.data.min_coherence, @engine._prep_value(overlap_count), true ]
|
||||
DRCLayer::new(@engine, @engine._tcmd(self.data, 0, self.data.class, :merged, *aa))
|
||||
|
|
@ -5160,7 +5160,7 @@ CODE
|
|||
end
|
||||
|
||||
def merge_props(overlap_count = 1)
|
||||
@engine._context("merge") do
|
||||
@engine._context("merge_props") do
|
||||
requires_region
|
||||
aa = [ self.data.min_coherence, @engine._prep_value(overlap_count), true ]
|
||||
if @engine.is_tiled?
|
||||
|
|
|
|||
|
|
@ -858,7 +858,7 @@ module DRC
|
|||
|
||||
expression.is_a?(String) || raise("'expression' argument must be a string")
|
||||
|
||||
DRC::DRCLayer::new(@engine, @engine._cmd(l2n_data, :evaluate_nets, primary.data, secondary_data, expression, variables))
|
||||
DRC::DRCLayer::new(@engine, @engine._cmd(l2n_data, :evaluate_nets, primary.data, secondary_data, expression, variables, nil))
|
||||
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue