Added two useful functions for RBA/pya CellView (context_trans, context_dtrans)

This commit is contained in:
Matthias Koefferlein 2021-07-20 19:31:54 +02:00
parent 7f26c580e0
commit 99d980cd16
4 changed files with 35 additions and 0 deletions

View File

@ -2188,6 +2188,22 @@ Class<lay::CellViewRef> 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"

View File

@ -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 ();
}
}
}

View File

@ -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<lay::CellView> mp_cv;
tl::weak_ptr<lay::LayoutView> mp_view;

View File

@ -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")