From 75f87538a583c6eb45f1f44fbcb4332c20877b6d Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Thu, 10 Dec 2020 11:21:21 +0100 Subject: [PATCH] bench: use common load_bios function. --- bench/arty.py | 4 ++-- bench/common.py | 37 +++++++++++++++++++------------------ bench/genesys2.py | 4 ++-- bench/kc705.py | 4 ++-- bench/kcu105.py | 4 ++-- bench/xcu1525.py | 4 ++-- 6 files changed, 29 insertions(+), 28 deletions(-) diff --git a/bench/arty.py b/bench/arty.py index ca40c01..824ff92 100755 --- a/bench/arty.py +++ b/bench/arty.py @@ -142,8 +142,8 @@ def main(): prog.load_bitstream(os.path.join(builder.gateware_dir, soc.build_name + ".bit")) if args.load_bios: - from common import s7_load_bios - s7_load_bios("build/arty/software/bios/bios.bin") + from common import load_bios + load_bios("build/arty/software/bios/bios.bin") if args.set_sys_clk is not None: from common import s7_set_sys_clk diff --git a/bench/common.py b/bench/common.py index a3d8378..4056d77 100644 --- a/bench/common.py +++ b/bench/common.py @@ -106,6 +106,24 @@ class BenchController: self.bus.write(self.bus.mems.rom.base + 4*i, data) time.sleep(delay) +def load_bios(bios_filename): + from litex import RemoteClient + + bus = RemoteClient() + bus.open() + + # # # + + # Load BIOS and reboot SoC. + print("Loading BIOS...") + ctrl = BenchController(bus) + ctrl.load_rom(bios_filename, delay=1e-4) # FIXME: delay needed @ 115200bauds. + ctrl.reboot() + + # # # + + bus.close() + # Bench Test --------------------------------------------------------------------------------------- def s7_bench_test(freq_min, freq_max, freq_step, vco_freq, bios_filename, bios_timeout=40): @@ -172,24 +190,6 @@ def s7_bench_test(freq_min, freq_max, freq_step, vco_freq, bios_filename, bios_t bus.close() -def s7_load_bios(bios_filename): - from litex import RemoteClient - - bus = RemoteClient() - bus.open() - - # # # - - # Load BIOS and reboot SoC. - print("Loading BIOS...") - ctrl = BenchController(bus) - ctrl.load_rom(bios_filename, delay=1e-4) # FIXME: delay needed @ 115200bauds. - ctrl.reboot() - - # # # - - bus.close() - def s7_set_sys_clk(clk_freq, vco_freq): import time from litex import RemoteClient @@ -280,6 +280,7 @@ def us_bench_test(freq_min, freq_max, freq_step, vco_freq, bios_filename, bios_t for c in bus.read(bus.regs.uart_xover_rxtx.addr, 1, burst="fixed"): print("{:c}".format(c), end="") print("") + # # # bus.close() diff --git a/bench/genesys2.py b/bench/genesys2.py index 92733b5..414029d 100755 --- a/bench/genesys2.py +++ b/bench/genesys2.py @@ -140,8 +140,8 @@ def main(): prog.load_bitstream(os.path.join(builder.gateware_dir, soc.build_name + ".bit")) if args.load_bios: - from common import s7_load_bios - s7_load_bios("build/genesys2/software/bios/bios.bin") + from common import load_bios + load_bios("build/genesys2/software/bios/bios.bin") if args.set_sys_clk is not None: from common import s7_set_sys_clk diff --git a/bench/kc705.py b/bench/kc705.py index ba25f52..8aae474 100755 --- a/bench/kc705.py +++ b/bench/kc705.py @@ -140,8 +140,8 @@ def main(): prog.load_bitstream(os.path.join(builder.gateware_dir, soc.build_name + ".bit")) if args.load_bios: - from common import s7_load_bios - s7_load_bios("build/kc705/software/bios/bios.bin") + from common import load_bios + load_bios("build/kc705/software/bios/bios.bin") if args.set_sys_clk is not None: from common import us_set_sys_clk diff --git a/bench/kcu105.py b/bench/kcu105.py index a61bf76..0efc26f 100755 --- a/bench/kcu105.py +++ b/bench/kcu105.py @@ -161,8 +161,8 @@ def main(): prog.load_bitstream(os.path.join(builder.gateware_dir, soc.build_name + ".bit")) if args.load_bios: - from common import s7_load_bios - s7_load_bios("build/kcu105/software/bios/bios.bin") + from common import load_bios + load_bios("build/kcu105/software/bios/bios.bin") if args.set_sys_clk is not None: from common import us_set_sys_clk diff --git a/bench/xcu1525.py b/bench/xcu1525.py index 82b2849..cc75d20 100755 --- a/bench/xcu1525.py +++ b/bench/xcu1525.py @@ -151,8 +151,8 @@ def main(): prog.load_bitstream(os.path.join(builder.gateware_dir, soc.build_name + ".bit")) if args.load_bios: - from common import us_load_bios - us_load_bios("build/xcu1525/software/bios/bios.bin") + from common import load_bios + load_bios("build/xcu1525/software/bios/bios.bin") if args.set_sys_clk is not None: from common import us_set_sys_clk