aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2019-11-29 16:25:11 +0000
committerDavid Shah <dave@ds0.me>2019-12-27 10:44:30 +0000
commitb1000870244dbb1a73198e23a859825865938b4c (patch)
tree1958990ff08d0dca2034e91f5651e4533fe9f60e /python
parent9f6031cda13a290903785a1c469af02838309b39 (diff)
downloadnextpnr-b1000870244dbb1a73198e23a859825865938b4c.tar.gz
nextpnr-b1000870244dbb1a73198e23a859825865938b4c.tar.bz2
nextpnr-b1000870244dbb1a73198e23a859825865938b4c.zip
python: Add bindings for hierarchy structures
Signed-off-by: David Shah <dave@ds0.me>
Diffstat (limited to 'python')
-rw-r--r--python/report_hierarchy.py10
1 files changed, 10 insertions, 0 deletions
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])
+