diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2020-07-08 13:43:40 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2020-07-08 13:43:40 +0200 |
commit | 7b107ef820684cb6aa7f4fe87d2e462e4fffb5c9 (patch) | |
tree | 39b6d4653c1b63af375bdaca60c302e442e3334c | |
parent | 7be50e50ef9e96747ca1badc66e97efdda553bc4 (diff) |
prepare for Logic Analyzer and Timing based EnergyTrace sync
-rwxr-xr-x | bin/generate-dfa-benchmark.py | 10 | ||||
-rw-r--r-- | lib/harness.py | 2 | ||||
-rw-r--r-- | 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=<transition,transition,transition,...>[ <transition,transition,transition,...> ...] 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) |