From 99d980cd16af807add24b6605850f8f3dd60e050 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 20 Jul 2021 19:31:54 +0200 Subject: [PATCH] Added two useful functions for RBA/pya CellView (context_trans, context_dtrans) --- src/laybasic/laybasic/gsiDeclLayLayoutView.cc | 16 ++++++++++++++++ src/laybasic/laybasic/layCellView.cc | 10 ++++++++++ src/laybasic/laybasic/layCellView.h | 5 +++++ testdata/ruby/layLayoutView.rb | 4 ++++ 4 files changed, 35 insertions(+) diff --git a/src/laybasic/laybasic/gsiDeclLayLayoutView.cc b/src/laybasic/laybasic/gsiDeclLayLayoutView.cc index fb82f6878..a01db5183 100644 --- a/src/laybasic/laybasic/gsiDeclLayLayoutView.cc +++ b/src/laybasic/laybasic/gsiDeclLayLayoutView.cc @@ -2188,6 +2188,22 @@ Class decl_CellView ("lay", "CellView", "fashion, i.e. describing each instance in detail, not just by cell indexes. If " "the context and target cell are identical, the context path is empty." ) + + method ("context_trans", &lay::CellViewRef::context_trans, + "@brief Gets the accumulated transformation of the context path\n" + "This is the transformation applied to the target cell before it is shown in the context cell\n" + "Technically this is the product of all transformations over the context path.\n" + "See \\context_dtrans for a version delivering a micron-unit space transformation.\n" + "\n" + "This method has been introduced in version 0.27.3.\n" + ) + + method ("context_dtrans", &lay::CellViewRef::context_dtrans, + "@brief Gets the accumulated transformation of the context path in micron unit space\n" + "This is the transformation applied to the target cell before it is shown in the context cell\n" + "Technically this is the product of all transformations over the context path.\n" + "See \\context_trans for a version delivering an integer-unit space transformation.\n" + "\n" + "This method has been introduced in version 0.27.3.\n" + ) + event_ext ("on_technology_changed", &get_technology_changed_event, "@brief An event indicating that the technology has changed\n" "This event is triggered when the CellView is attached to a different technology.\n" diff --git a/src/laybasic/laybasic/layCellView.cc b/src/laybasic/laybasic/layCellView.cc index fea41be54..dafded284 100644 --- a/src/laybasic/laybasic/layCellView.cc +++ b/src/laybasic/laybasic/layCellView.cc @@ -834,5 +834,15 @@ CellViewRef::context_trans () const } } +db::DCplxTrans +CellViewRef::context_dtrans () const +{ + if (is_valid ()) { + return mp_cv->context_dtrans (); + } else { + return db::DCplxTrans (); + } +} + } diff --git a/src/laybasic/laybasic/layCellView.h b/src/laybasic/laybasic/layCellView.h index a78ef742b..e2239e999 100644 --- a/src/laybasic/laybasic/layCellView.h +++ b/src/laybasic/laybasic/layCellView.h @@ -735,6 +735,11 @@ public: */ db::ICplxTrans context_trans () const; + /** + * @brief Retrive the accumulated transformation induced by the context part of the path in micron units + */ + db::DCplxTrans context_dtrans() const; + private: tl::weak_ptr mp_cv; tl::weak_ptr mp_view; diff --git a/testdata/ruby/layLayoutView.rb b/testdata/ruby/layLayoutView.rb index 8ed0b6817..4608365e1 100644 --- a/testdata/ruby/layLayoutView.rb +++ b/testdata/ruby/layLayoutView.rb @@ -242,6 +242,8 @@ class LAYLayoutView_TestClass < TestBase assert_equal(view.cellview(1).cell.name, "INV2") assert_equal(cv2.path.collect { |p| cv2.layout.cell(p).name }.join(","), "RINGO,INV2") assert_equal(cv2.context_path.collect { |p| p.to_s }.join(","), "") + assert_equal(cv2.context_trans.to_s, "r0 *1 0,0") + assert_equal(cv2.context_dtrans.to_s, "r0 *1 0,0") assert_equal(active_cellview_changed, 0) assert_equal(cellviews_changed, 0) @@ -294,6 +296,8 @@ class LAYLayoutView_TestClass < TestBase cv2.context_path = sp assert_equal(cv2.context_path.collect { |p| p.inst.cell.name + ":" + p.specific_cplx_trans.to_s }.join(","), "TRANS:r0 *1 -400,0") + assert_equal(cv2.context_trans.to_s, "r0 *1 -400,0") + assert_equal(cv2.context_dtrans.to_s, "r0 *1 -0.4,0") assert_equal(cv2.cell_name, "TRANS") assert_equal(cv2.ctx_cell.name, "INV2")