From 11f6eb21e031a63bd3c48f6c16a1092d036eeae7 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 18 Oct 2022 21:52:40 +0200 Subject: [PATCH] Added ParentCellInst#dinst --- src/db/db/gsiDeclDbCell.cc | 16 ++++++++++++++++ testdata/ruby/dbLayoutTests2.rb | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/src/db/db/gsiDeclDbCell.cc b/src/db/db/gsiDeclDbCell.cc index 7c00d4c9d..c3d339043 100644 --- a/src/db/db/gsiDeclDbCell.cc +++ b/src/db/db/gsiDeclDbCell.cc @@ -4370,6 +4370,17 @@ Class decl_Instance ("db", "Instance", // --------------------------------------------------------------- // db::ParentInstRep binding (to "ParentInstArray") +static db::DCellInstArray +dinst (const db::ParentInstRep *parent_inst) +{ + const db::Instances *instances = parent_inst->child_inst ().instances (); + if (! instances || ! instances->layout ()) { + return db::DCellInstArray (); + } + + return cell_inst_array_defs::transform_array (parent_inst->inst (), db::CplxTrans (instances->layout ()->dbu ())); +} + Class decl_ParentInstArray ("db", "ParentInstArray", method ("parent_cell_index", &db::ParentInstRep::parent_cell_index, "@brief Gets the index of the parent cell\n" @@ -4381,6 +4392,11 @@ Class decl_ParentInstArray ("db", "ParentInstArray", ) + method ("inst", &db::ParentInstRep::inst, "@brief Compute the inverse instance by which the parent is seen from the child\n" + ) + + method_ext ("dinst", &dinst, + "@brief Compute the inverse instance by which the parent is seen from the child in micrometer units\n" + "\n" + "This convenience method has been introduced in version 0.28." ), "@brief A parent instance\n" "\n" diff --git a/testdata/ruby/dbLayoutTests2.rb b/testdata/ruby/dbLayoutTests2.rb index cc079830f..6b679975f 100644 --- a/testdata/ruby/dbLayoutTests2.rb +++ b/testdata/ruby/dbLayoutTests2.rb @@ -599,6 +599,14 @@ class DBLayoutTests2_TestClass < TestBase c1.each_parent_inst { |i| arr.push( i ) } assert_equal( arr.size, 1 ) + strarr = [] + c1.each_parent_inst { |i| strarr.push( i.inst.to_s ) } + assert_equal( strarr.join(";"), "#1 m45 *0.666666667 33,-67 [0,-67*10;-67,0*20]" ) + + strarr = [] + c1.each_parent_inst { |i| strarr.push( i.dinst.to_s ) } + assert_equal( strarr.join(";"), "#1 m45 *0.666666667 0.033,-0.067 [0,-0.067*10;-0.067,0*20]" ) + assert_equal( arr[0].parent_cell_index, c2.cell_index ) assert_equal( arr[0].child_inst.cell_index, c1.cell_index ) assert_equal( arr[0].inst.cell_index, c2.cell_index )