mirror of https://github.com/m-labs/artiq.git
sawg: merge set/set64
This commit is contained in:
parent
93a853a0e0
commit
6e9bc7c05d
|
@ -36,23 +36,18 @@ class Spline:
|
||||||
"""
|
"""
|
||||||
rtio_output(now_mu(), self.channel, 0, value)
|
rtio_output(now_mu(), self.channel, 0, value)
|
||||||
|
|
||||||
@kernel
|
@kernel(flags={"fast-math"})
|
||||||
def set(self, value: TFloat):
|
def set(self, value: TFloat):
|
||||||
"""Set spline value.
|
"""Set spline value.
|
||||||
|
|
||||||
:param value: Spline value relative to full-scale.
|
:param value: Spline value relative to full-scale.
|
||||||
"""
|
"""
|
||||||
rtio_output(now_mu(), self.channel, 0, self.to_mu(value))
|
if self.width > 32:
|
||||||
|
|
||||||
@kernel(flags={"fast-math"})
|
|
||||||
def set64(self, value: TFloat):
|
|
||||||
"""Set spline value.
|
|
||||||
|
|
||||||
:param value: Spline value relative to full-scale.
|
|
||||||
"""
|
|
||||||
l = [int32(0)] * 2
|
l = [int32(0)] * 2
|
||||||
self.pack_coeff_mu([self.to_mu64(value)], l)
|
self.pack_coeff_mu([self.to_mu64(value)], l)
|
||||||
rtio_output_wide(now_mu(), self.channel, 0, l)
|
rtio_output_wide(now_mu(), self.channel, 0, l)
|
||||||
|
else:
|
||||||
|
rtio_output(now_mu(), self.channel, 0, self.to_mu(value))
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def set_coeff_mu(self, value): # TList(TInt32)
|
def set_coeff_mu(self, value): # TList(TInt32)
|
||||||
|
|
|
@ -55,8 +55,8 @@ class SAWGTest(unittest.TestCase):
|
||||||
d = self.driver
|
d = self.driver
|
||||||
d.offset.set(.9)
|
d.offset.set(.9)
|
||||||
delay(2*self.t)
|
delay(2*self.t)
|
||||||
d.frequency0.set64(.1)
|
d.frequency0.set(.1)
|
||||||
d.frequency1.set64(.1)
|
d.frequency1.set(.1)
|
||||||
delay(2*self.t)
|
delay(2*self.t)
|
||||||
d.offset.set(0)
|
d.offset.set(0)
|
||||||
v = int(round((1 << 48) * .1 * self.t))
|
v = int(round((1 << 48) * .1 * self.t))
|
||||||
|
@ -64,10 +64,9 @@ class SAWGTest(unittest.TestCase):
|
||||||
self.rtio_manager.outputs, [
|
self.rtio_manager.outputs, [
|
||||||
(0., 1, 0, int(round(
|
(0., 1, 0, int(round(
|
||||||
(1 << self.driver.offset.width - 1)*.9))),
|
(1 << self.driver.offset.width - 1)*.9))),
|
||||||
(2.*self.t, 8, 0, [int(round(
|
(2.*self.t, 8, 0, int(round(
|
||||||
(1 << self.driver.frequency0.width) *
|
(1 << self.driver.frequency0.width) *
|
||||||
self.t/self.channel.parallelism*.1)),
|
self.t/self.channel.parallelism*.1))),
|
||||||
0]),
|
|
||||||
(2.*self.t, 3, 0, [int32(v), int32(v >> 32)]),
|
(2.*self.t, 3, 0, [int32(v), int32(v >> 32)]),
|
||||||
(4.*self.t, 1, 0, 0),
|
(4.*self.t, 1, 0, 0),
|
||||||
])
|
])
|
||||||
|
@ -200,9 +199,9 @@ class SAWGTest(unittest.TestCase):
|
||||||
|
|
||||||
self.sawg0.frequency0.set(10*MHz)
|
self.sawg0.frequency0.set(10*MHz)
|
||||||
self.sawg0.phase0.set(0.)
|
self.sawg0.phase0.set(0.)
|
||||||
self.sawg0.frequency1.set64(1*MHz)
|
self.sawg0.frequency1.set(1*MHz)
|
||||||
self.sawg0.phase1.set(0.)
|
self.sawg0.phase1.set(0.)
|
||||||
self.sawg0.frequency2.set64(13*MHz)
|
self.sawg0.frequency2.set(13*MHz)
|
||||||
self.sawg0.phase2.set(0.)
|
self.sawg0.phase2.set(0.)
|
||||||
t = now_mu()
|
t = now_mu()
|
||||||
self.sawg0.amplitude1.smooth(.0, a1, t_up, order)
|
self.sawg0.amplitude1.smooth(.0, a1, t_up, order)
|
||||||
|
|
Loading…
Reference in New Issue