From 263c2751b31a165bd836a93c4cc74087e8c0c7ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Sun, 4 Sep 2022 20:43:28 +0000 Subject: [PATCH] add profile_mu --- artiq/coredevice/phaser.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/artiq/coredevice/phaser.py b/artiq/coredevice/phaser.py index 7686bf40c..9bf7f042e 100644 --- a/artiq/coredevice/phaser.py +++ b/artiq/coredevice/phaser.py @@ -1456,12 +1456,12 @@ class Miqro: return (start + 1 + len(data)) & 0x3ff @kernel - def pulse(self, window, profiles): + def encode(self, window, profiles, data): if len(profiles) > 16: raise ValueError("too many oscillators") if window > 0x3ff: raise ValueError("window start out of bounds") - data = [window, 0, 0] + data[0] = window word = 0 idx = 10 for i in range(len(profiles)): @@ -1472,8 +1472,17 @@ class Miqro: idx = 0 data[word] |= (profiles[i] & 0x1f) << idx idx += 5 - delay_mu(-8*word) - while word >= 0: + return word + + @kernel + def pulse_mu(self, data): + for word in range(len(data) - 1, -1, -1): rtio_output(self.base_addr + word, data[word]) delay_mu(8) - word -= 1 + + @kernel + def pulse(self, window, profiles): + data = [0, 0, 0] + words = self.encode(window, profiles, data) + delay_mu(-8*words) + self.pulse_mu(data[:words])