core: Add option to detect kernel invariants

There is already invariant detection in the the compiler, this just
exposes it by adding a flag to Core

Signed-off-by: Adam Chatterley <aschatterley@phys.au.dk>
This commit is contained in:
Adam Chatterley 2024-09-09 13:56:22 +02:00 committed by Sébastien Bourdeauducq
parent ed3b60b270
commit 03606f4d7e
2 changed files with 8 additions and 2 deletions

View File

@ -85,6 +85,8 @@ class Core:
(optional). (optional).
:param analyze_at_run_end: automatically trigger the core device analyzer :param analyze_at_run_end: automatically trigger the core device analyzer
proxy after the Experiment's run stage finishes. proxy after the Experiment's run stage finishes.
:param report_invariants: report variables which are not changed inside
kernels and are thus candidates for inclusion in kernel_invariants
""" """
kernel_invariants = { kernel_invariants = {
@ -95,7 +97,8 @@ class Core:
host, ref_period, host, ref_period,
analyzer_proxy=None, analyze_at_run_end=False, analyzer_proxy=None, analyze_at_run_end=False,
ref_multiplier=8, ref_multiplier=8,
target="rv32g", satellite_cpu_targets={}): target="rv32g", satellite_cpu_targets={},
report_invariants=False):
self.ref_period = ref_period self.ref_period = ref_period
self.ref_multiplier = ref_multiplier self.ref_multiplier = ref_multiplier
self.satellite_cpu_targets = satellite_cpu_targets self.satellite_cpu_targets = satellite_cpu_targets
@ -107,6 +110,7 @@ class Core:
self.comm = CommKernel(host) self.comm = CommKernel(host)
self.analyzer_proxy_name = analyzer_proxy self.analyzer_proxy_name = analyzer_proxy
self.analyze_at_run_end = analyze_at_run_end self.analyze_at_run_end = analyze_at_run_end
self.report_invariants = report_invariants
self.first_run = True self.first_run = True
self.dmgr = dmgr self.dmgr = dmgr
@ -139,7 +143,8 @@ class Core:
module = Module(stitcher, module = Module(stitcher,
ref_period=self.ref_period, ref_period=self.ref_period,
attribute_writeback=attribute_writeback) attribute_writeback=attribute_writeback,
remarks=self.report_invariants)
target = target if target is not None else self.target_cls() target = target if target is not None else self.target_cls()
library = target.compile_and_link([module]) library = target.compile_and_link([module])

View File

@ -187,6 +187,7 @@ class _ExperimentDock(QtWidgets.QMdiSubWindow):
devarg_override.lineEdit().setPlaceholderText("Override device arguments") devarg_override.lineEdit().setPlaceholderText("Override device arguments")
devarg_override.lineEdit().setClearButtonEnabled(True) devarg_override.lineEdit().setClearButtonEnabled(True)
devarg_override.insertItem(0, "core:analyze_at_run_end=True") devarg_override.insertItem(0, "core:analyze_at_run_end=True")
devarg_override.insertItem(1, "core:report_invariants=True")
self.layout.addWidget(devarg_override, 2, 3) self.layout.addWidget(devarg_override, 2, 3)
devarg_override.setCurrentText(options["devarg_override"]) devarg_override.setCurrentText(options["devarg_override"])