diff options
author | Tomasz Michalak <tmichalak@antmicro.com> | 2021-06-09 23:01:27 +0200 |
---|---|---|
committer | Tomasz Michalak <tmichalak@antmicro.com> | 2021-06-10 12:06:04 +0200 |
commit | 1cd2901d854b969a8cb1afc66e3f3388766776a0 (patch) | |
tree | 08d7000a9368b13812f2c5a89cb696e0eaebdc2f /fpga_interchange/site_router_tests/common/run_script.py | |
parent | caf7261be7b34b365ab6d8449455891c2ed28faa (diff) | |
download | nextpnr-tests-1cd2901d854b969a8cb1afc66e3f3388766776a0.tar.gz nextpnr-tests-1cd2901d854b969a8cb1afc66e3f3388766776a0.tar.bz2 nextpnr-tests-1cd2901d854b969a8cb1afc66e3f3388766776a0.zip |
fpga_interchange: Add initial site router test framework
Signed-off-by: Tomasz Michalak <tmichalak@antmicro.com>
Diffstat (limited to 'fpga_interchange/site_router_tests/common/run_script.py')
-rw-r--r-- | fpga_interchange/site_router_tests/common/run_script.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/fpga_interchange/site_router_tests/common/run_script.py b/fpga_interchange/site_router_tests/common/run_script.py new file mode 100644 index 0000000..07faf89 --- /dev/null +++ b/fpga_interchange/site_router_tests/common/run_script.py @@ -0,0 +1,29 @@ +import sys +import yaml +import os + +def test_case(ctx): + with open(os.environ['TEST_YAML'], 'r') as f: + test_data = yaml.safe_load(f.read()) + if 'test_case' in test_data: + ctx.pack() + for test_step in test_data['test_case']: + print(test_step) + if "place" in test_step: + for cell, bel in test_step["place"].items(): + print("Binding Bel {} to Cell {}".format(bel, cell)) + assert cell in ctx.cells, "Cell {} does not exist".format(cell) + ctx.bindBel(bel, ctx.cells[cell], STRENGTH_WEAK) + if "test" in test_step: + print(test_step["test"]) + for bel, check in test_step["test"].items(): + print("Checking if location of bel {} is {}".format(bel, check)) + print("Test result: {}, isBelLocationValid: {}, expected: {}".format(ctx.isBelLocationValid(bel) == check, ctx.isBelLocationValid(bel), check)) + if "unplace" in test_step: + print(test_step["unplace"]) + cell = test_step["unplace"] + print("Unbinding Bel {}".format(cell)) + ctx.explain_bel_status(cell) + ctx.unbindBel(cell) + +test_case(ctx) |