diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2020-07-13 10:53:46 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2020-07-13 10:53:46 +0200 |
commit | 701b344471fe5e0b90d95e1ac2c3c9525bb7dcfb (patch) | |
tree | 93343d2a6ce0ea8fe206eaf30950ed0517b75cdd | |
parent | 2f5fa87125ccf44f1c6e208ed736070274ea6e2e (diff) |
Run MSP430FR benchmarks at 8 MHz; support sleep > 500 ms for energytrace
-rwxr-xr-x | bin/generate-dfa-benchmark.py | 17 | ||||
-rw-r--r-- | lib/runner.py | 17 |
2 files changed, 24 insertions, 10 deletions
diff --git a/bin/generate-dfa-benchmark.py b/bin/generate-dfa-benchmark.py index 1410c28..2c53d9f 100755 --- a/bin/generate-dfa-benchmark.py +++ b/bin/generate-dfa-benchmark.py @@ -223,17 +223,11 @@ def benchmark_from_runs( ) elif opt["sleep"]: if "energytrace" in opt: - outbuf.write( - "arch.sleep_ms({:d}); // {}\n".format( - opt["sleep"], transition.destination.name - ) - ) + outbuf.write(f"// -> {transition.destination.name}\n") + outbuf.write(runner.sleep_ms(opt["sleep"], opt["arch"])) else: - outbuf.write( - "arch.delay_ms({:d}); // {}\n".format( - opt["sleep"], transition.destination.name - ) - ) + outbuf.write(f"// -> {transition.destination.name}\n") + outbuf.write("arch.delay_ms({:d});\n".format(opt["sleep"])) outbuf.write(harness.stop_run(num_traces)) if dummy: @@ -597,6 +591,9 @@ if __name__ == "__main__": if run_flags is None: run_flags = opt["run"].split() + if "msp430fr" in opt["arch"]: + run_flags.append("cpu_freq=8000000") + runs = list( pta.dfs( opt["depth"], diff --git a/lib/runner.py b/lib/runner.py index aeb8600..77b7c68 100644 --- a/lib/runner.py +++ b/lib/runner.py @@ -405,6 +405,23 @@ def get_counter_limits(arch: str) -> tuple: raise RuntimeError("Did not find Counter Overflow limits") +def sleep_ms(duration: int, arch: str, cpu_freq: int = None) -> str: + max_sleep = None + if "msp430fr" in arch: + if cpu_freq is not None and cpu_freq > 8000000: + max_sleep = 250 + else: + max_sleep = 500 + if max_sleep is not None and duration > max_sleep: + sub_sleep_count = duration // max_sleep + tail_sleep = duration % max_sleep + ret = f"for (unsigned char i = 0; i < {sub_sleep_count}; i++) {{ arch.sleep_ms({max_sleep}); }}\n" + if tail_sleep > 0: + ret += f"arch.sleep_ms({tail_sleep});\n" + return ret + return "arch.sleep_ms({duration});\n" + + def get_counter_limits_us(arch: str) -> tuple: """Return duration of one counter step and one counter overflow in us.""" cpu_freq = 0 |