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 /lib | |
parent | 2f5fa87125ccf44f1c6e208ed736070274ea6e2e (diff) |
Run MSP430FR benchmarks at 8 MHz; support sleep > 500 ms for energytrace
Diffstat (limited to 'lib')
-rw-r--r-- | lib/runner.py | 17 |
1 files changed, 17 insertions, 0 deletions
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 |