From 7b107ef820684cb6aa7f4fe87d2e462e4fffb5c9 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 8 Jul 2020 13:43:40 +0200 Subject: prepare for Logic Analyzer and Timing based EnergyTrace sync --- bin/generate-dfa-benchmark.py | 10 +++++++++- lib/harness.py | 2 ++ lib/runner.py | 16 ++++++++++++++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/bin/generate-dfa-benchmark.py b/bin/generate-dfa-benchmark.py index b20dc72..1410c28 100755 --- a/bin/generate-dfa-benchmark.py +++ b/bin/generate-dfa-benchmark.py @@ -61,6 +61,10 @@ Options: --energytrace=[k=v,k=v,...] Perform energy measurements using MSP430 EnergyTrace hardware. Includes --timing. + Additional configuration settings: + sync = bar (Barcode mode (default): synchronize measurements via barcodes embedded in the energy trace) + sync = la (Logic Analyzer mode (WIP): An external logic analyzer captures transition timing) + sync = timing (Timing mode (WIP): The on-board cycle counter captures transition timing) --trace-filter=[ ...] Only consider traces whose beginning matches one of the provided transition sequences. @@ -630,9 +634,13 @@ if __name__ == "__main__": post_transition_delay_us=20, ) elif "energytrace" in opt: + # Use barcode sync by default + gpio_mode = "bar" + if "sync" in opt["energytrace"] and opt["energytrace"]["sync"] != "bar": + gpio_mode = "around" harness = OnboardTimerHarness( gpio_pin=timer_pin, - gpio_mode="bar", + gpio_mode=gpio_mode, pta=pta, counter_limits=runner.get_counter_limits_us(opt["arch"]), log_return_values=need_return_values, diff --git a/lib/harness.py b/lib/harness.py index 1c3dbe0..ae9c28c 100644 --- a/lib/harness.py +++ b/lib/harness.py @@ -229,6 +229,7 @@ class TransitionHarness: log_data_target["parameter"][parameter_name] = list() log_data_target["parameter"][parameter_name].append(parameter_value) + # Here Be Dragons def parser_cb(self, line): # print('[HARNESS] got line {}'.format(line)) if re.match(r"\[PTA\] benchmark stop", line): @@ -440,6 +441,7 @@ class OnboardTimerHarness(TransitionHarness): log_data_target["parameter"][parameter_name] = list() log_data_target["parameter"][parameter_name].append(parameter_value) + # Here Be Dragons def parser_cb(self, line): # print('[HARNESS] got line {}'.format(line)) res = re.match(r"\[PTA\] nop=(\S+)/(\S+)", line) diff --git a/lib/runner.py b/lib/runner.py index 0a32091..0d4d449 100644 --- a/lib/runner.py +++ b/lib/runner.py @@ -178,6 +178,12 @@ class EnergyTraceMonitor(SerialMonitor): "voltage": self._voltage, } +class EnergyTraceLogicAnalyzerMonitor(EnergyTraceMonitor): + """EnergyTraceLogicAnalyzerMonitor captures EnergyTrace energy data and LogicAnalyzer timing output.""" + + def __init__(self, port: str, baud: int, callback=None, voltage=3.3): + super().__init__(port=port, baud=baud, callback=callback, voltage=voltage) + class MIMOSAMonitor(SerialMonitor): """MIMOSAMonitor captures serial output and MIMOSA energy data for a specific amount of time.""" @@ -372,8 +378,14 @@ def get_monitor(arch: str, **kwargs) -> object: mimosa_kwargs = kwargs.pop("mimosa") return MIMOSAMonitor(port, arg, **mimosa_kwargs, **kwargs) elif "energytrace" in kwargs and kwargs["energytrace"] is not None: - energytrace_kwargs = kwargs.pop("energytrace") - return EnergyTraceMonitor(port, arg, **energytrace_kwargs, **kwargs) + energytrace_kwargs = kwargs.pop("energytrace").copy() + sync_mode = energytrace_kwargs.pop("sync") + if sync_mode == "la": + return EnergyTraceLogicAnalyzerMonitor( + port, arg, **energytrace_kwargs, **kwargs + ) + else: + return EnergyTraceMonitor(port, arg, **energytrace_kwargs, **kwargs) else: kwargs.pop("energytrace", None) kwargs.pop("mimosa", None) -- cgit v1.2.3