diff options
Diffstat (limited to 'lib/harness.py')
-rw-r--r-- | lib/harness.py | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/lib/harness.py b/lib/harness.py index c251ec8..833807e 100644 --- a/lib/harness.py +++ b/lib/harness.py @@ -33,6 +33,7 @@ class TransitionHarness: log_return_values=False, repeat=0, post_transition_delay_us=0, + energytrace_sync=None, ): """ Create a new TransitionHarness @@ -53,6 +54,7 @@ class TransitionHarness: self.log_return_values = log_return_values self.repeat = repeat self.post_transition_delay_us = post_transition_delay_us + self.energytrace_sync = energytrace_sync self.reset() def copy(self): @@ -63,6 +65,7 @@ class TransitionHarness: log_return_values=self.log_return_values, repeat=self.repeat, post_transition_delay_us=self.post_transition_delay_us, + energytrace_sync=self.energytrace_sync, ) new_object.traces = self.traces.copy() new_object.trace_id = self.trace_id @@ -373,6 +376,7 @@ class OnboardTimerHarness(TransitionHarness): pta=self.pta, log_return_values=self.log_return_values, repeat=self.repeat, + energytrace_sync=self.energytrace_sync, ) new_harness.traces = self.traces.copy() new_harness.trace_id = self.trace_id @@ -400,13 +404,45 @@ class OnboardTimerHarness(TransitionHarness): def global_code(self): ret = "#define PTALOG_TIMING\n" ret += super().global_code() + if self.energytrace_sync == "led": + #TODO Make nicer + ret += """\nvoid runLASync(){ + // ======================= LED SYNC ================================ + ptalog.passTransition(0); + ptalog.startTransition(); + gpio.led_toggle(0); + gpio.led_toggle(1); + ptalog.stopTransition(); + + for (unsigned char i = 0; i < 4; i++) { + arch.sleep_ms(250); + } + + ptalog.passTransition(0); + ptalog.startTransition(); + gpio.led_toggle(0); + gpio.led_toggle(1); + ptalog.stopTransition(); + // ======================= LED SYNC ================================ + arch.sleep_ms(250); +}\n\n""" return ret def start_benchmark(self, benchmark_id=0): - ret = "ptalog.passNop();\n" + ret = "" + if self.energytrace_sync == "led": + ret += "runLASync();\n" + ret += "ptalog.passNop();\n" ret += super().start_benchmark(benchmark_id) return ret + def stop_benchmark(self): + ret = "" + if self.energytrace_sync == "led": + ret += "runLASync();\n" + ret += super().stop_benchmark() + return ret + def pass_transition( self, transition_id, transition_code, transition: object = None ): |