aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-06-08 15:53:24 +0200
committerDavid Shah <davey1576@gmail.com>2018-06-08 15:53:24 +0200
commit57cd67dbc12eb0b46528282958dea7b2d7e5c927 (patch)
tree15a7fcd450b8dd3a5b1a61bf3107bf8670a04f55 /python
parent5fa79cd2b586d9bb0c872360ff30434f8fcfa5ba (diff)
downloadnextpnr-57cd67dbc12eb0b46528282958dea7b2d7e5c927.tar.gz
nextpnr-57cd67dbc12eb0b46528282958dea7b2d7e5c927.tar.bz2
nextpnr-57cd67dbc12eb0b46528282958dea7b2d7e5c927.zip
Improving the Python bindings, particularly the map/pair wrappers
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'python')
-rw-r--r--python/dump_design.py29
1 files changed, 14 insertions, 15 deletions
diff --git a/python/dump_design.py b/python/dump_design.py
index 1850d509..d95f041b 100644
--- a/python/dump_design.py
+++ b/python/dump_design.py
@@ -1,26 +1,25 @@
# Run ./nextpnr-ice40 --json ice40/blinky.json --run python/dump_design.py
-for cell in sorted(design.cells, key=lambda x: x.first):
- print("Cell {} : {}".format(cell.first, cell.second.type))
+for cell, cinfo in sorted(design.cells, key=lambda x: x.first):
+ print("Cell {} : {}".format(cell, cinfo.type))
print("\tPorts:")
- for port in sorted(cell.second.ports, key=lambda x: x.first):
- dir = (" <-- ", " --> ", " <-> ")[int(port.second.type)]
- if port.second.net is not None:
- print("\t\t{} {} {}".format(port.first, dir, port.second.net.name))
+ for port, pinfo in sorted(cinfo.ports, key=lambda x: x.first):
+ dir = (" <-- ", " --> ", " <-> ")[int(pinfo.type)]
+ if pinfo.net is not None:
+ print("\t\t{} {} {}".format(port, dir, pinfo.net.name))
- if len(cell.second.attrs) > 0:
+ if len(cinfo.attrs) > 0:
print("\tAttrs:")
- for attr in cell.second.attrs:
- print("\t\t{}: {}".format(attr.first, attr.second))
+ for attr, val in cinfo.attrs:
+ print("\t\t{}: {}".format(attr, val))
- if len(cell.second.params) > 0:
+ if len(cinfo.params) > 0:
print("\tParams:")
- for param in cell.second.params:
- val = param.second
+ for param, val in cinfo.params:
if val.isdigit():
val = bin(int(val))[2:]
val = "{}'b{}".format(len(val), val)
- print("\t\t{}: {}".format(param.first, val))
+ print("\t\t{}: {}".format(param, val))
- if not cell.second.bel.nil():
- print("\tBel: {}".format(chip.getBelName(cell.second.bel)))
+ if not cinfo.bel.nil():
+ print("\tBel: {}".format(chip.getBelName(cinfo.bel)))
print()