aboutsummaryrefslogtreecommitdiffstats
path: root/ice40/chipdb.py
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2018-07-31 11:55:25 +0200
committerClifford Wolf <clifford@clifford.at>2018-07-31 11:55:25 +0200
commit32ff0059feeb2dd8187393c63dae7db59a2e5b43 (patch)
tree588631eb04bbf2d6069d6e6a658d0cb01285d924 /ice40/chipdb.py
parent7da64ee167d518641a479cad1b660c608fb3dede (diff)
downloadnextpnr-32ff0059feeb2dd8187393c63dae7db59a2e5b43.tar.gz
nextpnr-32ff0059feeb2dd8187393c63dae7db59a2e5b43.tar.bz2
nextpnr-32ff0059feeb2dd8187393c63dae7db59a2e5b43.zip
Add binary search to getBelPinWire() and getBelPinType()
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'ice40/chipdb.py')
-rw-r--r--ice40/chipdb.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/ice40/chipdb.py b/ice40/chipdb.py
index 3ef58185..32d3485f 100644
--- a/ice40/chipdb.py
+++ b/ice40/chipdb.py
@@ -492,13 +492,13 @@ def add_bel_input(bel, wire, port):
if wire not in wire_belports:
wire_belports[wire] = set()
wire_belports[wire].add((bel, port))
- bel_wires[bel].append((wire, port, 0))
+ bel_wires[bel].append((portpins[port], 0, wire))
def add_bel_output(bel, wire, port):
if wire not in wire_belports:
wire_belports[wire] = set()
wire_belports[wire].add((bel, port))
- bel_wires[bel].append((wire, port, 1))
+ bel_wires[bel].append((portpins[port], 1, wire))
def add_bel_lc(x, y, z):
bel = len(bel_name)
@@ -759,14 +759,12 @@ bba.post('NEXTPNR_NAMESPACE_END')
bba.push("chipdb_blob_%s" % dev_name)
bba.r("chip_info_%s" % dev_name, "chip_info")
-index = 0
for bel in range(len(bel_name)):
bba.l("bel_wires_%d" % bel, "BelWirePOD")
- for i in range(len(bel_wires[bel])):
- bba.u32(bel_wires[bel][i][0], "wire_index")
- bba.u32(portpins[bel_wires[bel][i][1]], "port")
- bba.u32(bel_wires[bel][i][2], "type")
- index += 1
+ for data in sorted(bel_wires[bel]):
+ bba.u32(data[0], "port")
+ bba.u32(data[1], "type")
+ bba.u32(data[2], "wire_index")
bba.l("bel_data_%s" % dev_name, "BelInfoPOD")
for bel in range(len(bel_name)):