aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/interactive.py6
-rw-r--r--python/report_hierarchy.py10
2 files changed, 16 insertions, 0 deletions
diff --git a/python/interactive.py b/python/interactive.py
new file mode 100644
index 00000000..a2f09edb
--- /dev/null
+++ b/python/interactive.py
@@ -0,0 +1,6 @@
+# Pass this file to one of the Python script arguments (e.g. --pre-place interactive.py)
+# to drop to a command-line interactive Python session in the middle of place and route
+
+import code
+print("Press Ctrl+D to finish interactive session")
+code.interact(local=locals())
diff --git a/python/report_hierarchy.py b/python/report_hierarchy.py
new file mode 100644
index 00000000..6d409a9b
--- /dev/null
+++ b/python/report_hierarchy.py
@@ -0,0 +1,10 @@
+def visit(indent, data):
+ istr = " " * indent
+ print("{}{}: {}".format(istr, data.name, data.type))
+ for lname, gname in data.leaf_cells:
+ print("{} {} -> {}".format(istr, lname, gname))
+ for lname, gname in data.hier_cells:
+ visit(indent + 4, ctx.hierarchy[gname])
+
+visit(0, ctx.hierarchy[ctx.top_module])
+