mirror of
https://github.com/YosysHQ/nextpnr.git
synced 2026-01-27 04:32:22 +00:00
Improving the Python bindings, particularly the map/pair wrappers
Signed-off-by: David Shah <davey1576@gmail.com>
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user