From b84017e7eaf7ec1203d318365d9e729953cf656a Mon Sep 17 00:00:00 2001 From: occheung Date: Mon, 18 Nov 2024 15:15:01 +0800 Subject: [PATCH] kernel core: pass return value --- artiq/coredevice/comm_kernel.py | 7 ++++++- artiq/coredevice/core.py | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/artiq/coredevice/comm_kernel.py b/artiq/coredevice/comm_kernel.py index e829b2fc3..a847115ab 100644 --- a/artiq/coredevice/comm_kernel.py +++ b/artiq/coredevice/comm_kernel.py @@ -689,7 +689,12 @@ class CommKernel: if service_id == 0: def service(*values): - counter = 0 + if embedding_map.expects_return: + embedding_map.return_value = values[0] + counter = 1 + else: + counter = 0 + for obj in embedding_map.attributes_writeback: old_val = obj["obj"] if "fields" in obj: diff --git a/artiq/coredevice/core.py b/artiq/coredevice/core.py index 146baadce..a7ea27269 100644 --- a/artiq/coredevice/core.py +++ b/artiq/coredevice/core.py @@ -123,6 +123,10 @@ class Core: self._run_compiled(kernel_library, embedding_map) + # set by NAC3 + if embedding_map.expects_return: + return embedding_map.return_value + def _run_compiled(self, kernel_library, embedding_map): if self.first_run: self.comm.check_system_info()