mirror of https://github.com/openXC7/prjxray.git
commit
7eb7d844b1
|
|
@ -29,7 +29,7 @@ contrib.append(
|
||||||
----
|
----
|
||||||
|
|
||||||
This file is generated from [README.md](README.md), please edit that file then
|
This file is generated from [README.md](README.md), please edit that file then
|
||||||
run the `./.update-contributing.py`.
|
run the `./.github/update-contributing.py`.
|
||||||
|
|
||||||
""")
|
""")
|
||||||
|
|
||||||
51
.travis.yml
51
.travis.yml
|
|
@ -1,29 +1,8 @@
|
||||||
matrix:
|
os: linux
|
||||||
include:
|
dist: trusty
|
||||||
# Job 1) Test C++ w/ GCC
|
language: python
|
||||||
- os: linux
|
python: 3.6
|
||||||
dist: trusty
|
addons:
|
||||||
language: cpp
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-6
|
|
||||||
script:
|
|
||||||
- export CC=gcc-6
|
|
||||||
- export CXX=g++-6
|
|
||||||
- mkdir -p build
|
|
||||||
- pushd build
|
|
||||||
- cmake -DPRJXRAY_BUILD_TESTING=ON ..
|
|
||||||
- make -j 4
|
|
||||||
- ctest
|
|
||||||
# Job 2) Lint checks on Python and C++
|
|
||||||
- os: linux
|
|
||||||
dist: trusty
|
|
||||||
language: python
|
|
||||||
python: 3.6
|
|
||||||
addons:
|
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
- ubuntu-toolchain-r-test
|
- ubuntu-toolchain-r-test
|
||||||
|
|
@ -31,12 +10,24 @@ matrix:
|
||||||
packages:
|
packages:
|
||||||
- clang-format-5.0
|
- clang-format-5.0
|
||||||
- g++-6
|
- g++-6
|
||||||
install:
|
|
||||||
|
install:
|
||||||
- export CC=gcc-6
|
- export CC=gcc-6
|
||||||
- export CXX=g++-6
|
- export CXX=g++-6
|
||||||
- pip install -r requirements.txt
|
- make env
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
include:
|
||||||
|
# State 1 - Tests
|
||||||
|
- stage: "Tests"
|
||||||
|
name: "C++ Tests"
|
||||||
|
script: make test-cpp
|
||||||
|
|
||||||
|
- name: "Python Tests"
|
||||||
|
script: make test-py
|
||||||
|
|
||||||
|
- name: "Format"
|
||||||
script:
|
script:
|
||||||
- export CC=gcc-6
|
|
||||||
- export CXX=g++-6
|
|
||||||
- make format
|
- make format
|
||||||
- test $(git status --porcelain | wc -l) -eq 0 || { git diff; false; }
|
- test $(git status --porcelain | wc -l) -eq 0 || { git diff; false; }
|
||||||
|
|
|
||||||
|
|
@ -92,5 +92,5 @@ In addition to the above contribution guidelines, see the guide to
|
||||||
----
|
----
|
||||||
|
|
||||||
This file is generated from [README.md](README.md), please edit that file then
|
This file is generated from [README.md](README.md), please edit that file then
|
||||||
run the `./.update-contributing.py`.
|
run the `./.github/update-contributing.py`.
|
||||||
|
|
||||||
|
|
|
||||||
64
Makefile
64
Makefile
|
|
@ -1,14 +1,13 @@
|
||||||
CLANG_FORMAT ?= clang-format-5.0
|
ALL_EXCLUDE = third_party .git env build
|
||||||
PYTHON_FORMAT ?= yapf
|
|
||||||
TCL_FORMAT ?= utils//tcl-reformat.sh
|
|
||||||
|
|
||||||
.PHONY: database format clean env
|
|
||||||
|
|
||||||
|
# Tools + Environment
|
||||||
IN_ENV = if [ -e env/bin/activate ]; then . env/bin/activate; fi;
|
IN_ENV = if [ -e env/bin/activate ]; then . env/bin/activate; fi;
|
||||||
env:
|
env:
|
||||||
virtualenv --python=python3 --system-site-packages env
|
virtualenv --python=python3 --system-site-packages env
|
||||||
$(IN_ENV) pip install -r requirements.txt
|
$(IN_ENV) pip install -r requirements.txt
|
||||||
|
$(IN_ENV) pip install -r docs/requirements.txt
|
||||||
ln -sf $(PWD)/prjxray env/lib/python3.*/site-packages/
|
ln -sf $(PWD)/prjxray env/lib/python3.*/site-packages/
|
||||||
|
ln -sf $(PWD)/third_party/fasm/fasm.py env/lib/python3.*/site-packages/
|
||||||
$(IN_ENV) python -c "import yaml" || (echo "Unable to find python-yaml" && exit 1)
|
$(IN_ENV) python -c "import yaml" || (echo "Unable to find python-yaml" && exit 1)
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
|
@ -16,16 +15,53 @@ build:
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cd build; cmake ..; $(MAKE)
|
cd build; cmake ..; $(MAKE)
|
||||||
|
|
||||||
database: build
|
.PHONY: env build
|
||||||
$(MAKE) -C $@
|
|
||||||
|
|
||||||
FORMAT_EXCLUDE = third_party .git env build
|
# Run tests of code.
|
||||||
FIND_EXCLUDE = $(foreach x,$(FORMAT_EXCLUDE),-and -not -path './$(x)/*')
|
# ------------------------
|
||||||
format:
|
TEST_EXCLUDE = $(foreach x,$(ALL_EXCLUDE) fuzzers minitests experiments,--ignore $(x))
|
||||||
find . -name \*.cc $(FIND_EXCLUDE) -print0 | xargs -0 -P $$(nproc) ${CLANG_FORMAT} -style=file -i
|
|
||||||
find . -name \*.h $(FIND_EXCLUDE) -print0 | xargs -0 -P $$(nproc) ${CLANG_FORMAT} -style=file -i
|
test: test-py test-cpp
|
||||||
$(IN_ENV) find . -name \*.py $(FIND_EXCLUDE) -print0 | xargs -0 -P $$(nproc) yapf -p -i
|
@true
|
||||||
find . -name \*.tcl $(FIND_EXCLUDE) -print0 | xargs -0 -P $$(nproc) -n 1 $(TCL_FORMAT)
|
|
||||||
|
test-py:
|
||||||
|
$(IN_ENV) py.test $(TEST_EXCLUDE) --doctest-modules --junitxml=build/py_test_results.xml
|
||||||
|
|
||||||
|
test-cpp:
|
||||||
|
mkdir -p build
|
||||||
|
cd build && cmake -DPRJXRAY_BUILD_TESTING=ON ..
|
||||||
|
cd build && $(MAKE) -s
|
||||||
|
cd build && ctest --no-compress-output -T Test -C RelWithDebInfo --output-on-failure
|
||||||
|
|
||||||
|
.PHONY: test test-py test-cpp
|
||||||
|
|
||||||
|
# Auto formatting of code.
|
||||||
|
# ------------------------
|
||||||
|
FORMAT_EXCLUDE = $(foreach x,$(ALL_EXCLUDE),-and -not -path './$(x)/*')
|
||||||
|
|
||||||
|
CLANG_FORMAT ?= clang-format-5.0
|
||||||
|
format-cpp:
|
||||||
|
find . -name \*.cc $(FORMAT_EXCLUDE) -print0 | xargs -0 -P $$(nproc) ${CLANG_FORMAT} -style=file -i
|
||||||
|
find . -name \*.h $(FORMAT_EXCLUDE) -print0 | xargs -0 -P $$(nproc) ${CLANG_FORMAT} -style=file -i
|
||||||
|
|
||||||
|
format-docs:
|
||||||
|
./.github/update-contributing.py
|
||||||
|
|
||||||
|
PYTHON_FORMAT ?= yapf
|
||||||
|
format-py:
|
||||||
|
$(IN_ENV) find . -name \*.py $(FORMAT_EXCLUDE) -print0 | xargs -0 -P $$(nproc) yapf -p -i
|
||||||
|
|
||||||
|
TCL_FORMAT ?= utils//tcl-reformat.sh
|
||||||
|
format-tcl:
|
||||||
|
find . -name \*.tcl $(FORMAT_EXCLUDE) -print0 | xargs -0 -P $$(nproc) -n 1 $(TCL_FORMAT)
|
||||||
|
|
||||||
|
format: format-cpp format-docs format-py format-tcl
|
||||||
|
@true
|
||||||
|
|
||||||
|
.PHONY: format format-cpp format-py format-tcl
|
||||||
|
|
||||||
|
# Project X-Ray database
|
||||||
|
# ------------------------
|
||||||
|
|
||||||
checkdb:
|
checkdb:
|
||||||
@for DB in database/*; do if [ -d $$DB ]; then \
|
@for DB in database/*; do if [ -d $$DB ]; then \
|
||||||
|
|
|
||||||
|
|
@ -4,30 +4,29 @@ import sys
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
|
||||||
db_tiles = set()
|
|
||||||
db_tile_prop = dict()
|
|
||||||
db_tile_sites = dict()
|
|
||||||
|
|
||||||
db_sites = set()
|
def main():
|
||||||
db_site_prop = dict()
|
db_tiles = set()
|
||||||
db_site_tile = dict()
|
db_tile_prop = dict()
|
||||||
db_site_bit = dict()
|
db_tile_sites = dict()
|
||||||
|
|
||||||
|
db_sites = set()
|
||||||
|
db_site_prop = dict()
|
||||||
|
db_site_tile = dict()
|
||||||
|
db_site_bit = dict()
|
||||||
|
|
||||||
def add_tile(tile):
|
def add_tile(tile):
|
||||||
if tile not in db_tiles:
|
if tile not in db_tiles:
|
||||||
db_tiles.add(tile)
|
db_tiles.add(tile)
|
||||||
db_tile_prop[tile] = dict()
|
db_tile_prop[tile] = dict()
|
||||||
db_tile_sites[tile] = list()
|
db_tile_sites[tile] = list()
|
||||||
|
|
||||||
|
def add_site(site):
|
||||||
def add_site(site):
|
|
||||||
if site not in db_sites:
|
if site not in db_sites:
|
||||||
db_sites.add(site)
|
db_sites.add(site)
|
||||||
db_site_prop[site] = dict()
|
db_site_prop[site] = dict()
|
||||||
|
|
||||||
|
with open("%s.txt" % sys.argv[1]) as f:
|
||||||
with open("%s.txt" % sys.argv[1]) as f:
|
|
||||||
for line in f:
|
for line in f:
|
||||||
line = line.split()
|
line = line.split()
|
||||||
|
|
||||||
|
|
@ -54,17 +53,17 @@ with open("%s.txt" % sys.argv[1]) as f:
|
||||||
|
|
||||||
assert False
|
assert False
|
||||||
|
|
||||||
print("Number of tiles: %d" % len(db_tiles))
|
print("Number of tiles: %d" % len(db_tiles))
|
||||||
print("Number of sites: %d" % len(db_sites))
|
print("Number of sites: %d" % len(db_sites))
|
||||||
print("Number of sites with bit: %d" % len(db_site_bit))
|
print("Number of sites with bit: %d" % len(db_site_bit))
|
||||||
|
|
||||||
database = dict()
|
database = dict()
|
||||||
loc_to_tile = dict()
|
loc_to_tile = dict()
|
||||||
|
|
||||||
database["device"] = sys.argv[2]
|
database["device"] = sys.argv[2]
|
||||||
|
|
||||||
database["tiles"] = dict()
|
database["tiles"] = dict()
|
||||||
for tile in db_tiles:
|
for tile in db_tiles:
|
||||||
entry = dict()
|
entry = dict()
|
||||||
entry["props"] = db_tile_prop[tile]
|
entry["props"] = db_tile_prop[tile]
|
||||||
entry["sites"] = db_tile_sites[tile]
|
entry["sites"] = db_tile_sites[tile]
|
||||||
|
|
@ -74,14 +73,14 @@ for tile in db_tiles:
|
||||||
row = int(db_tile_prop[tile]["ROW"])
|
row = int(db_tile_prop[tile]["ROW"])
|
||||||
loc_to_tile[(col, row)] = tile
|
loc_to_tile[(col, row)] = tile
|
||||||
|
|
||||||
database["sites"] = dict()
|
database["sites"] = dict()
|
||||||
for site in db_sites:
|
for site in db_sites:
|
||||||
entry = dict()
|
entry = dict()
|
||||||
entry["props"] = db_site_prop[site]
|
entry["props"] = db_site_prop[site]
|
||||||
entry["tile"] = db_site_tile[site]
|
entry["tile"] = db_site_tile[site]
|
||||||
database["sites"][site] = entry
|
database["sites"][site] = entry
|
||||||
|
|
||||||
for site, bit in db_site_bit.items():
|
for site, bit in db_site_bit.items():
|
||||||
bit = bit.split("_")
|
bit = bit.split("_")
|
||||||
bit_type = int(bit[4][1:])
|
bit_type = int(bit[4][1:])
|
||||||
bit_half = int(bit[5][1:])
|
bit_half = int(bit[5][1:])
|
||||||
|
|
@ -127,16 +126,20 @@ for site, bit in db_site_bit.items():
|
||||||
|
|
||||||
database["tiles"][left_tile]["cfgcol"] = entry
|
database["tiles"][left_tile]["cfgcol"] = entry
|
||||||
|
|
||||||
tile_cfgcol_count = 0
|
tile_cfgcol_count = 0
|
||||||
cfgcols = set()
|
cfgcols = set()
|
||||||
|
|
||||||
for tile in db_tiles:
|
for tile in db_tiles:
|
||||||
if "cfgcol" in database["tiles"][tile]:
|
if "cfgcol" in database["tiles"][tile]:
|
||||||
cfgcols.add(database["tiles"][tile]["cfgcol"]["BASE_FRAMEID"])
|
cfgcols.add(database["tiles"][tile]["cfgcol"]["BASE_FRAMEID"])
|
||||||
tile_cfgcol_count += 1
|
tile_cfgcol_count += 1
|
||||||
|
|
||||||
print("Number of assigned columns: %d" % len(cfgcols))
|
print("Number of assigned columns: %d" % len(cfgcols))
|
||||||
print("Number of tiles with assigned column: %d" % tile_cfgcol_count)
|
print("Number of tiles with assigned column: %d" % tile_cfgcol_count)
|
||||||
|
|
||||||
with open("%s.json" % sys.argv[1], "w") as f:
|
with open("%s.json" % sys.argv[1], "w") as f:
|
||||||
print(json.dumps(database, sort_keys=True, indent="\t"), file=f)
|
print(json.dumps(database, sort_keys=True, indent="\t"), file=f)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
|
|
||||||
|
|
@ -541,7 +541,7 @@ def get_bit_info(dbstate, frameidx, bitidx, tiletype):
|
||||||
label = bit_name[6:9]
|
label = bit_name[6:9]
|
||||||
|
|
||||||
if re.match("^INT_[LR].IMUX", bit_name):
|
if re.match("^INT_[LR].IMUX", bit_name):
|
||||||
m = re.match("^INT_[LR].IMUX(_L)?(\d+)", bit_name)
|
m = re.match("^INT_[LR].IMUX(_L)?(\\d+)", bit_name)
|
||||||
bgcolor = "#88aaff"
|
bgcolor = "#88aaff"
|
||||||
label = "IM" + m.group(2)
|
label = "IM" + m.group(2)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,10 @@ def get_db_root():
|
||||||
|
|
||||||
|
|
||||||
def roi_xy():
|
def roi_xy():
|
||||||
x1 = int(os.getenv('XRAY_ROI_GRID_X1'))
|
x1 = int(os.getenv('XRAY_ROI_GRID_X1', 0))
|
||||||
x2 = int(os.getenv('XRAY_ROI_GRID_X2'))
|
x2 = int(os.getenv('XRAY_ROI_GRID_X2', 58))
|
||||||
y1 = int(os.getenv('XRAY_ROI_GRID_Y1'))
|
y1 = int(os.getenv('XRAY_ROI_GRID_Y1', 0))
|
||||||
y2 = int(os.getenv('XRAY_ROI_GRID_Y2'))
|
y2 = int(os.getenv('XRAY_ROI_GRID_Y2', 52))
|
||||||
|
|
||||||
return (x1, x2), (y1, y2)
|
return (x1, x2), (y1, y2)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,3 +8,4 @@ scipy
|
||||||
sympy
|
sympy
|
||||||
yapf==0.24.0
|
yapf==0.24.0
|
||||||
textx
|
textx
|
||||||
|
pytest
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,9 @@ class TestUtil(TestCase):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
with setup_database(makedb({})):
|
with setup_database(makedb({})):
|
||||||
self.assertEquals(list(get_roi().gen_sites()), [])
|
self.assertListEqual(list(get_roi().gen_sites()), [])
|
||||||
with setup_database(makedb({'FOO': 'BAR'})):
|
with setup_database(makedb({'FOO': 'BAR'})):
|
||||||
self.assertEquals(
|
self.assertListEqual(
|
||||||
list(get_roi().gen_sites()), [('ATILE', 'FOO', 'BAR')])
|
list(get_roi().gen_sites()), [('ATILE', 'FOO', 'BAR')])
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,18 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
from prjxray import fasm_assembler
|
|
||||||
from prjxray import db
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
|
from prjxray import fasm_assembler
|
||||||
|
from prjxray import db
|
||||||
|
|
||||||
|
|
||||||
|
class FASMSyntaxError(SyntaxError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def dump_frames_verbose(frames):
|
def dump_frames_verbose(frames):
|
||||||
print()
|
print()
|
||||||
|
|
|
||||||
|
|
@ -105,11 +105,10 @@ def db_load():
|
||||||
return db_res
|
return db_res
|
||||||
|
|
||||||
|
|
||||||
type_to_tiles, grid_to_tile, nodes, node_node_pip, reverse_node_node = db_load(
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def route(args):
|
def route(args):
|
||||||
|
type_to_tiles, grid_to_tile, nodes, node_node_pip, reverse_node_node = db_load(
|
||||||
|
)
|
||||||
|
|
||||||
active_pips = set()
|
active_pips = set()
|
||||||
blocked_nodes = set()
|
blocked_nodes = set()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,8 @@ def bitread2bits(txt):
|
||||||
return bits_ref
|
return bits_ref
|
||||||
|
|
||||||
|
|
||||||
|
# FIXME: These functions are currently broken.
|
||||||
|
@unittest.skip
|
||||||
class TestStringMethods(unittest.TestCase):
|
class TestStringMethods(unittest.TestCase):
|
||||||
def test_lut(self):
|
def test_lut(self):
|
||||||
'''Simple smoke test on just the LUTs'''
|
'''Simple smoke test on just the LUTs'''
|
||||||
|
|
|
||||||
|
|
@ -5,24 +5,25 @@
|
||||||
|
|
||||||
import os, sys, json
|
import os, sys, json
|
||||||
|
|
||||||
with open("%s/%s/tilegrid.json" % (os.getenv("XRAY_DATABASE_DIR"),
|
|
||||||
|
def main():
|
||||||
|
with open("%s/%s/tilegrid.json" % (os.getenv("XRAY_DATABASE_DIR"),
|
||||||
os.getenv("XRAY_DATABASE")), "r") as f:
|
os.getenv("XRAY_DATABASE")), "r") as f:
|
||||||
tilegrid = json.load(f)
|
tilegrid = json.load(f)
|
||||||
|
|
||||||
with open("%s/%s/tileconn.json" % (os.getenv("XRAY_DATABASE_DIR"),
|
with open("%s/%s/tileconn.json" % (os.getenv("XRAY_DATABASE_DIR"),
|
||||||
os.getenv("XRAY_DATABASE")), "r") as f:
|
os.getenv("XRAY_DATABASE")), "r") as f:
|
||||||
tileconn = json.load(f)
|
tileconn = json.load(f)
|
||||||
|
|
||||||
grid = dict()
|
grid = dict()
|
||||||
wirepairs = dict()
|
wirepairs = dict()
|
||||||
remwires = set()
|
remwires = set()
|
||||||
|
|
||||||
for tilename, tiledata in tilegrid.items():
|
for tilename, tiledata in tilegrid.items():
|
||||||
key = (tiledata["grid_x"], tiledata["grid_y"])
|
key = (tiledata["grid_x"], tiledata["grid_y"])
|
||||||
grid[key] = tilename
|
grid[key] = tilename
|
||||||
|
|
||||||
|
def check_tileconn_entry(tilename, tiledata, entry, idx):
|
||||||
def check_tileconn_entry(tilename, tiledata, entry, idx):
|
|
||||||
if idx == 0:
|
if idx == 0:
|
||||||
otheridx = 1
|
otheridx = 1
|
||||||
otherxy = (
|
otherxy = (
|
||||||
|
|
@ -46,7 +47,8 @@ def check_tileconn_entry(tilename, tiledata, entry, idx):
|
||||||
print(
|
print(
|
||||||
" Found relevant entry (%s %s %d %d): %s" % (
|
" Found relevant entry (%s %s %d %d): %s" % (
|
||||||
entry["tile_types"][0], entry["tile_types"][1],
|
entry["tile_types"][0], entry["tile_types"][1],
|
||||||
entry["grid_deltas"][0], entry["grid_deltas"][1], othertilename))
|
entry["grid_deltas"][0], entry["grid_deltas"][1],
|
||||||
|
othertilename))
|
||||||
|
|
||||||
for pair in entry["wire_pairs"]:
|
for pair in entry["wire_pairs"]:
|
||||||
wirename = "%s/%s" % (tilename, pair[idx])
|
wirename = "%s/%s" % (tilename, pair[idx])
|
||||||
|
|
@ -63,8 +65,7 @@ def check_tileconn_entry(tilename, tiledata, entry, idx):
|
||||||
wirepairs[otherwirename] = set()
|
wirepairs[otherwirename] = set()
|
||||||
wirepairs[otherwirename].add(wirename)
|
wirepairs[otherwirename].add(wirename)
|
||||||
|
|
||||||
|
for tilename, tiledata in tilegrid.items():
|
||||||
for tilename, tiledata in tilegrid.items():
|
|
||||||
print("Connecting wires in tile %s." % tilename)
|
print("Connecting wires in tile %s." % tilename)
|
||||||
for entry in tileconn:
|
for entry in tileconn:
|
||||||
if entry["tile_types"][0] == tiledata["type"]:
|
if entry["tile_types"][0] == tiledata["type"]:
|
||||||
|
|
@ -72,8 +73,7 @@ for tilename, tiledata in tilegrid.items():
|
||||||
if entry["tile_types"][1] == tiledata["type"]:
|
if entry["tile_types"][1] == tiledata["type"]:
|
||||||
check_tileconn_entry(tilename, tiledata, entry, 1)
|
check_tileconn_entry(tilename, tiledata, entry, 1)
|
||||||
|
|
||||||
|
def check_wire(wire, source):
|
||||||
def check_wire(wire, source):
|
|
||||||
for next_wire in wirepairs[wire]:
|
for next_wire in wirepairs[wire]:
|
||||||
if next_wire == source:
|
if next_wire == source:
|
||||||
continue
|
continue
|
||||||
|
|
@ -84,10 +84,13 @@ def check_wire(wire, source):
|
||||||
remwires.remove(next_wire)
|
remwires.remove(next_wire)
|
||||||
check_wire(next_wire, wire)
|
check_wire(next_wire, wire)
|
||||||
|
|
||||||
|
while len(remwires):
|
||||||
while len(remwires):
|
|
||||||
wire = remwires.pop()
|
wire = remwires.pop()
|
||||||
print("Checking %s:" % wire)
|
print("Checking %s:" % wire)
|
||||||
check_wire(wire, None)
|
check_wire(wire, None)
|
||||||
|
|
||||||
print("NO LOOP FOUND: OK")
|
print("NO LOOP FOUND: OK")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
|
|
||||||
|
|
@ -2,24 +2,27 @@
|
||||||
|
|
||||||
import os, sys, json
|
import os, sys, json
|
||||||
|
|
||||||
if len(sys.argv) != 3:
|
|
||||||
|
def main(argv):
|
||||||
|
if len(argv) != 3:
|
||||||
print("Usage example: python3 %s HCLK_R HCLK_SW6E3" % sys.argv[0])
|
print("Usage example: python3 %s HCLK_R HCLK_SW6E3" % sys.argv[0])
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
with open("%s/%s/tileconn.json" % (os.getenv("XRAY_DATABASE_DIR"),
|
with open("%s/%s/tileconn.json" % (os.getenv("XRAY_DATABASE_DIR"),
|
||||||
os.getenv("XRAY_DATABASE")), "r") as f:
|
os.getenv("XRAY_DATABASE")), "r") as f:
|
||||||
tileconn = json.load(f)
|
tileconn = json.load(f)
|
||||||
|
|
||||||
outdata = list()
|
outdata = list()
|
||||||
max_tiletype_len = 1
|
max_tiletype_len = 1
|
||||||
|
|
||||||
for entry in tileconn:
|
for entry in tileconn:
|
||||||
if entry["tile_types"][0] == sys.argv[1]:
|
if entry["tile_types"][0] == sys.argv[1]:
|
||||||
this_idx, other_idx = 0, 1
|
this_idx, other_idx = 0, 1
|
||||||
delta_x, delta_y = entry["grid_deltas"]
|
delta_x, delta_y = entry["grid_deltas"]
|
||||||
elif entry["tile_types"][1] == sys.argv[1]:
|
elif entry["tile_types"][1] == sys.argv[1]:
|
||||||
this_idx, other_idx = 1, 0
|
this_idx, other_idx = 1, 0
|
||||||
delta_x, delta_y = -entry["grid_deltas"][0], -entry["grid_deltas"][1]
|
delta_x, delta_y = -entry["grid_deltas"][0], -entry["grid_deltas"][
|
||||||
|
1]
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
@ -34,7 +37,11 @@ for entry in tileconn:
|
||||||
max_tiletype_len = max(
|
max_tiletype_len = max(
|
||||||
max_tiletype_len, len(entry["tile_types"][other_idx]))
|
max_tiletype_len, len(entry["tile_types"][other_idx]))
|
||||||
|
|
||||||
for entry in outdata:
|
for entry in outdata:
|
||||||
print(
|
print(
|
||||||
"%3d %3d %-*s %s" %
|
"%3d %3d %-*s %s" %
|
||||||
(entry[0], entry[1], max_tiletype_len, entry[2], entry[3]))
|
(entry[0], entry[1], max_tiletype_len, entry[2], entry[3]))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main(sys.argv)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue