sawg: documentation

This commit is contained in:
Robert Jördens 2016-12-06 19:25:40 +01:00
parent 695eb705b3
commit 5efd0fcea5
3 changed files with 35 additions and 17 deletions

View File

@ -13,13 +13,18 @@ class SAWG:
i_enable*Re(oscillators) +
q_enable*Im(buddy_oscillators))
Where:
* offset, amplitude1, amplitude2: in units of full scale
* phase0, phase1, phase2: in units of turns
* frequency0, frequency1, frequency2: in units of Hz
The nine spline interpolators are accessible as attributes:
* :attr:`offset`, :attr:`amplitude1`, :attr:`amplitude2`: in units
of full scale
* :attr:`phase0`, :attr:`phase1`, :attr:`phase2`: in units of turns
* :attr:`frequency0`, :attr:`frequency1`, :attr:`frequency2`: in units
of Hz
:param channel_base: RTIO channel number of the first channel (amplitude).
Frequency and Phase are then assumed to be successive channels.
:param parallelism: Number of output samples per coarse RTIO clock cycle.
:param core_device: Name of the core device that this SAWG is on.
"""
kernel_invariants = {"channel_base", "core",
"amplitude1", "frequency1", "phase1",
@ -34,21 +39,21 @@ class SAWG:
cordic_gain = 1.646760258057163 # Cordic(width=16, guard=None).gain
# cfg: channel_base
self.offset = Spline(width, time_width, channel_base + 1,
self.core, 1/2)
self.core, 2.)
self.amplitude1 = Spline(width, time_width, channel_base + 2,
self.core, 1/(2*cordic_gain**2))
self.core, 2*cordic_gain**2)
self.frequency1 = Spline(3*width, time_width, channel_base + 3,
self.core, self.core.coarse_ref_period)
self.core, 1/self.core.coarse_ref_period)
self.phase1 = Spline(width, time_width, channel_base + 4,
self.core, 1.)
self.amplitude2 = Spline(width, time_width, channel_base + 5,
self.core, 1/(2*cordic_gain**2))
self.core, 2*cordic_gain**2)
self.frequency2 = Spline(3*width, time_width, channel_base + 6,
self.core, self.core.coarse_ref_period)
self.core, 1/self.core.coarse_ref_period)
self.phase2 = Spline(width, time_width, channel_base + 7,
self.core, 1.)
self.frequency0 = Spline(2*width, time_width, channel_base + 8,
self.core,
self.core.coarse_ref_period/parallelism)
parallelism/self.core.coarse_ref_period)
self.phase0 = Spline(width, time_width, channel_base + 9,
self.core, 1.)

View File

@ -5,7 +5,7 @@ from artiq.language.types import TInt32, TInt64, TFloat
class Spline:
"""Spline interpolating RTIO channel.
r"""Spline interpolating RTIO channel.
One knot of a polynomial basis spline (B-spline) :math:`u(t)`
is defined by the coefficients :math:`u_n` up to order :math:`n = k`.
@ -13,8 +13,15 @@ class Spline:
:math:`u(t)` for :math:`t > t_0, t_0` is:
.. math::
u(t) = \sum_{n=0}^k \frac{u_n}{n!} (t - t_0)^n
= u_0 + u_1 (t - t_0) + \frac{u_2}{2} (t - t_0)^2 + \dots
u(t) &= \sum_{n=0}^k \frac{u_n}{n!} (t - t_0)^n \\
&= u_0 + u_1 (t - t_0) + \frac{u_2}{2} (t - t_0)^2 + \dots
:param width: Width in bits of the quantity that this spline controls
:param time_width: Width in bits of the time counter of this spline
:param channel: RTIO channel number
:param core_device: Core device that this spline is attached to
:param scale: Scale for conversion between machine units and physical
units; to be given as the "full scale physical value".
"""
kernel_invariants = {"channel", "core", "scale", "width",
@ -24,7 +31,7 @@ class Spline:
self.core = core_device
self.channel = channel
self.width = width
self.scale = float((int64(1) << width) * scale)
self.scale = float((int64(1) << width) / scale)
self.time_width = time_width
self.time_scale = float((1 << time_width) *
core_device.coarse_ref_period)

View File

@ -10,7 +10,7 @@ These drivers are for the core device and the peripherals closely integrated int
:members:
:mod:`artiq.coredevice.ttl` module
-----------------------------------
----------------------------------
.. automodule:: artiq.coredevice.ttl
:members:
@ -43,7 +43,7 @@ These drivers are for the core device and the peripherals closely integrated int
:members:
:mod:`artiq.coredevice.cache` module
-----------------------------------------
------------------------------------
.. automodule:: artiq.coredevice.cache
:members:
@ -54,6 +54,12 @@ These drivers are for the core device and the peripherals closely integrated int
.. automodule:: artiq.coredevice.exceptions
:members:
:mod:`artiq.coredevice.spline` module
-------------------------------------
.. automodule:: artiq.coredevice.spline
:members:
:mod:`artiq.coredevice.sawg` module
-----------------------------------
@ -61,7 +67,7 @@ These drivers are for the core device and the peripherals closely integrated int
:members:
:mod:`artiq.coredevice.ad9154` module
-----------------------------------
-------------------------------------
.. automodule:: artiq.coredevice.ad9154
:members: