suservo experimentals: fix rtio ch name changes

This commit is contained in:
mwojcik 2023-01-04 14:28:42 +08:00 committed by Sébastien Bourdeauducq
parent 8dc6902c23
commit bdae594c79
3 changed files with 23 additions and 15 deletions

View File

@ -104,15 +104,15 @@ index 1d0a72dad1..f7b516a4e7 100644
:param core_device: Core device name
"""
kernel_invariants = {"channel", "core", "pgia", "cplds", "ddses",
- "ref_period_mu"}
- "ref_period_mu", "corrected_fs"}
+ "ref_period_mu", "num_channels", "coeff_sel",
+ "state_sel", "io_dly_addr", "config_addr",
+ "write_enable"}
+ "corrected_fs", "write_enable"}
def __init__(self, dmgr, channel, pgia_device,
cpld_devices, dds_devices,
@@ -83,9 +85,20 @@ def __init__(self, dmgr, channel, pgia_device,
self.core.coarse_ref_period)
@@ -83,13 +85,24 @@ def __init__(self, dmgr, channel, pgia_device,
self.corrected_fs = sampler.Sampler.use_corrected_fs(sampler_hw_rev)
assert self.ref_period_mu == self.core.ref_multiplier
+ # The width of parts of the servo memory address depends on the number
@ -126,6 +126,10 @@ index 1d0a72dad1..f7b516a4e7 100644
+ self.coeff_sel = 1 << coeff_depth
+ self.write_enable = 1 << (coeff_depth + 1)
+
@staticmethod
def get_rtio_channels(channel, **kwargs):
return [(channel, None)]
@kernel
def init(self):
- """Initialize the servo, Sampler and both Urukuls.
@ -191,9 +195,9 @@ index 1d0a72dad1..f7b516a4e7 100644
@kernel
def set_pgia_mu(self, channel, gain):
@@ -236,6 +262,18 @@ def get_adc(self, channel):
@@ -242,6 +268,18 @@ def get_adc(self, channel):
gain = (self.gains >> (channel*2)) & 0b11
return adc_mu_to_volts(val, gain)
return adc_mu_to_volts(val, gain, self.corrected_fs)
+ @kernel
+ def set_io_update_delays(self, dlys):
@ -211,7 +215,7 @@ index 1d0a72dad1..f7b516a4e7 100644
class Channel:
"""Sampler-Urukul Servo channel
@@ -256,7 +294,7 @@ def __init__(self, dmgr, channel, servo_device):
self.dds = self.servo.ddses[self.servo_channel // 4]
return [(channel, None)]
@kernel
- def set(self, en_out, en_iir=0, profile=0):

View File

@ -80,9 +80,9 @@ index a89cdcca..f7b516a4 100644
"""
kernel_invariants = {"channel", "core", "pgia", "cplds", "ddses",
"ref_period_mu", "num_channels", "coeff_sel",
- "state_sel", "config_addr", "write_enable"}
- "corrected_fs", "state_sel", "config_addr", "write_enable"}
+ "state_sel", "io_dly_addr", "config_addr",
+ "write_enable"}
+ "corrected_fs", "write_enable"}
def __init__(self, dmgr, channel, pgia_device,
cpld_devices, dds_devices,
@ -117,7 +117,7 @@ index a89cdcca..f7b516a4 100644
"""Write to servo memory.
@@ -245,6 +262,18 @@ class SUServo:
gain = (self.gains >> (channel*2)) & 0b11
return adc_mu_to_volts(val, gain)
return adc_mu_to_volts(val, gain, self.corrected_fs)
+ @kernel
+ def set_io_update_delays(self, dlys):
@ -135,7 +135,7 @@ index a89cdcca..f7b516a4 100644
class Channel:
"""Sampler-Urukul Servo channel
@@ -265,7 +294,7 @@ class Channel:
self.dds = self.servo.ddses[self.servo_channel // 4]
return [(channel, None)]
@kernel
- def set(self, en_out, en_iir=0, profile=0):

View File

@ -48,14 +48,14 @@ index 1d0a72dad..a89cdcca4 100644
:param core_device: Core device name
"""
kernel_invariants = {"channel", "core", "pgia", "cplds", "ddses",
- "ref_period_mu"}
- "ref_period_mu", "corrected_fs"}
+ "ref_period_mu", "num_channels", "coeff_sel",
+ "state_sel", "config_addr", "write_enable"}
+ "corrected_fs", "state_sel", "config_addr", "write_enable"}
def __init__(self, dmgr, channel, pgia_device,
cpld_devices, dds_devices,
@@ -83,9 +81,19 @@ def __init__(self, dmgr, channel, pgia_device,
self.core.coarse_ref_period)
@@ -83,13 +81,23 @@ def __init__(self, dmgr, channel, pgia_device,
self.corrected_fs = sampler.Sampler.use_corrected_fs(sampler_hw_rev)
assert self.ref_period_mu == self.core.ref_multiplier
+ # The width of parts of the servo memory address depends on the number
@ -68,6 +68,10 @@ index 1d0a72dad..a89cdcca4 100644
+ self.coeff_sel = 1 << coeff_depth
+ self.write_enable = 1 << (coeff_depth + 1)
+
@staticmethod
def get_rtio_channels(channel, **kwargs):
return [(channel, None)]
@kernel
def init(self):
- """Initialize the servo, Sampler and both Urukuls.