Odyssey PLL unlock analysis plugin
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: Ia53910eecdcdeb836bd836039a509f00121a67f7
diff --git a/util/pdbg.cpp b/util/pdbg.cpp
index 1ed25b0..2734885 100644
--- a/util/pdbg.cpp
+++ b/util/pdbg.cpp
@@ -129,6 +129,31 @@
//------------------------------------------------------------------------------
+pdbg_target* getParentProcessor(pdbg_target* i_target)
+{
+ assert(nullptr != i_target);
+
+ // Check if the given target is already a processor chip.
+ if (TYPE_PROC == getTrgtType(i_target))
+ {
+ return i_target; // simply return the given target
+ }
+
+ // Get the parent processor chip.
+ pdbg_target* parentChip = pdbg_target_parent("proc", i_target);
+
+ // There should always be a parent chip. Throw an error if not found.
+ if (nullptr == parentChip)
+ {
+ throw std::logic_error("No parent chip found: i_target=" +
+ std::string{getPath(i_target)});
+ }
+
+ return parentChip;
+}
+
+//------------------------------------------------------------------------------
+
pdbg_target* getChipUnit(pdbg_target* i_parentChip, TargetType_t i_unitType,
uint8_t i_unitPos)
{
diff --git a/util/pdbg.hpp b/util/pdbg.hpp
index 0b46c7d..b62f432 100644
--- a/util/pdbg.hpp
+++ b/util/pdbg.hpp
@@ -73,6 +73,9 @@
/** @return The parent chip target of the given unit target. */
pdbg_target* getParentChip(pdbg_target* i_unitTarget);
+/** @return The parent processor chip target of the given target. */
+pdbg_target* getParentProcessor(pdbg_target* i_target);
+
/** @return The unit target within chip of the given unit type and position
* relative to the chip. */
pdbg_target* getChipUnit(pdbg_target* i_parentChip, TargetType_t i_unitType,