Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 695eb705b35b
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d34084be0f37
Choose a head ref
  • 2 commits
  • 4 files changed
  • 1 contributor

Commits on Dec 6, 2016

  1. sawg: documentation

    jordens committed Dec 6, 2016
    Copy the full SHA
    5efd0fc View commit details
  2. README_PHASER: update

    jordens committed Dec 6, 2016
    Copy the full SHA
    d34084b View commit details
Showing with 54 additions and 38 deletions.
  1. +19 −21 README_PHASER.rst
  2. +15 −10 artiq/coredevice/sawg.py
  3. +11 −4 artiq/coredevice/spline.py
  4. +9 −3 doc/manual/core_drivers_reference.rst
40 changes: 19 additions & 21 deletions README_PHASER.rst
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
ARTIQ Phaser
============

This ARTIQ branch contains a proof-of-concept design of a GHz-datarate multichannel direct digital synthesizer (DDS) compatible with ARTIQ's RTIO channels.
In later developments this proof-of-concept can be expanded to provide a two-tone output with spline modulation and multi-DAC synchronization.
Ultimately it will be the basis for the ARTIQ Sayma Smart Arbitrary Waveform Generator project. See https://github.com/m-labs/sayma and https://github.com/m-labs/artiq-hardware.
This ARTIQ branch contains a proof-of-concept design of a GHz-datarate, multi-channel, interpolating, multi-tone, direct digital synthesizer (DDS) compatible with ARTIQ's RTIO channels.
Ultimately it will be the basis for the ARTIQ Sayma Smart Arbitrary Waveform Generator project. See https://github.com/m-labs/sinara and https://github.com/m-labs/artiq-hardware.

*Features*:

* up to 4 channels
* up to 500 MHz data rate per channel (KC705 limitation)
* up to 8x interpolation to 2.4 GHz DAC sample rate
* Real-time control over amplitude, frequency, phase of each channel through ARTIQ RTIO commands
* Real-time sample-coherent control over amplitude, frequency, phase of each channel through ARTIQ RTIO commands
* Full configurability of the AD9154 and AD9516 through SPI with ARTIQ kernel support
* All SPI registers and register bits exposed as human readable names
* Parametrized JESD204B core (also capable of operation with eight lanes)
* The code can be reconfigured. Possible example configurations are: support 2 channels at 1 GHz datarate, support 4 channels at 300 MHz data rate, no interpolation, and using mix mode to stress the second and third Nyquist zones (150-300 MHz and 300-450 MHz).

The hardware required to use the ARTIQ phaser branch is a KC705 with an AD9154-FMC-EBZ plugged into the HPC connector and a low-noise sample rate reference clock.

This work was supported by the Army Research Lab.
This work was supported by the Army Research Lab and the University of Maryland.

The code that was developed for this project is located in several repositories:

* In ARTIQ, the SAWG and Phaser code: https://github.com/m-labs/artiq/compare/phaser
* The CORDIC core has been reused from the PDQ2 gateware https://github.com/m-labs/pdq2
* In ARTIQ, the SAWG and Phaser code: https://github.com/m-labs/artiq/compare/phaser2
* The Migen/MiSoC JESD204B core: https://github.com/m-labs/jesd204b


@@ -32,7 +30,7 @@ Installation

These installation instructions are a short form of those in the ARTIQ manual.
Please refer to and follow the ARTIQ manual for more details:
https://m-labs.hk/artiq/manual-release-2/index.html
https://m-labs.hk/artiq/manual-master/index.html

* Set up a new conda environment and activate it.
* Install the standard ARTIQ runtime/install dependencies.
@@ -42,22 +40,20 @@ https://m-labs.hk/artiq/manual-release-2/index.html
* Install the standard ARTIQ build dependencies.
They are all available as conda packages in m-labs/main or m-labs/dev for linux-64:

- migen =0.4
- misoc =0.4
- llvm-or1k =3.8
- migen
- misoc
- jesd204b
- llvm-or1k
- rust-core-or1k
- cargo
- binutils-or1k-linux >=2.27
- binutils-or1k-linux

* Install a recent version of Vivado (tested and developed with 2016.2).
* Checkout the ARTIQ phaser branch and the JESD204B core: ::
* Do a checkout of the ARTIQ phaser2 branch: ::

mkdir ~/src
cd ~/src
git clone --recursive -b phaser https://github.com/m-labs/artiq.git
git clone https://github.com/m-labs/jesd204b.git
cd jesd204b
python setup.py develop
git clone --recursive -b phaser2 https://github.com/m-labs/artiq.git
cd ../artiq
python setup.py develop

@@ -74,11 +70,13 @@ Setup

* Compile the ARTIQ Phaser bitstream, bios, and runtime (c.f. ARTIQ manual): ::

python -m artiq.gateware.targets.phaser --toolchain vivado
python -m artiq.gateware.targets.phaser

* Generate an ARTIQ configuration flash image with MAC and IP address (see the
documentation for ``artiq_mkfs``). Name it ``phaser_config.bin``.
* Run the following OpenOCD command to flash the ARTIQ phaser design: ::

openocd -f board/kc705.cfg -c "init; jtagspi_init 0 bscan_spi_xc7k325t.bit; jtagspi_program misoc_phaser_kc705/gateware/top.bin 0x000000; jtagspi_program misoc_phaser_kc705/software/bios/bios.bin 0xaf0000; jtagspi_program misoc_phaser_kc705/software/runtime/runtime.fbi 0xb00000; xc7_program xc7.tap; exit"
openocd -f board/kc705.cfg -c "init; jtagspi_init 0 bscan_spi_xc7k325t.bit; jtagspi_program misoc_phaser_kc705/gateware/top.bin 0x000000; jtagspi_program misoc_phaser_kc705/software/bios/bios.bin 0xaf0000; jtagspi_program misoc_phaser_kc705/software/runtime/runtime.fbi 0xb00000;jtagspi_program phaser_config.bin 0xb80000; xc7_program xc7.tap; exit"

The proxy bitstream ``bscan_spi_xc7k325t.bit`` can be found at https://github.com/jordens/bscan_spi_bitstreams or in any ARTIQ conda package for the KC705.
See the source code of ``artiq_flash.py`` from ARTIQ for more details.
@@ -91,7 +89,7 @@ Setup
* Refer to the ARTIQ documentation to configure an IP address and other settings for the transmitter device.
If the board was running stock ARTIQ before, the settings will be kept.
* A 300 MHz clock of roughly 10 dBm (0.2 to 3.4 V peak-to-peak into 50 Ohm) must be connected to the AD9154-FMC-EBZ J1.
The external RTIO clock, DAC deviceclock, FPGA deviceclock, and SYSREF are derived from this signal.
The external RTIO clock, DAC deviceclock, FPGA deviceclock, and SYSREF are derived from this signal. There is no internal RTIO clock.
* An example device database, several status and test scripts are provided in ``artiq/examples/phaser/``. ::

cd artiq/examples/phaser
@@ -109,9 +107,9 @@ Usage
* Run ``artiq_run repository/ad9154_test_status.py`` to retrieve and print several status registers from the AD9154 DAC.
* Run ``artiq_run repository/ad9154_test_prbs.py`` to test the JESD204B PHY layer for bit errors. Reboot the core device afterwards.
* Run ``artiq_run repository/ad9154_test_stpl.py`` to executes a JESD204B short transport layer test.
* Run ``artiq_run repository/sawg.py`` for an example that sets up amplitudes, frequencies, and phases on all four DDS channels.
* Run ``artiq_run repository/demo.py`` for an example that exercises several different use cases of synchronized phase, amplitude, and frequency updates.
for an example that exercises several different use cases of synchronized phase, amplitude, and frequency updates.
* Run ``artiq_run repository/demo_2tone.py`` for an example that emits a shaped two-tone pulse.
* Implement your own experiments using the SAWG channels.
* Verify clock stability between the sample rate reference clock and the DAC outputs.
* Changes to the AD9154 configuration can also be performed at runtime in experiments.
25 changes: 15 additions & 10 deletions artiq/coredevice/sawg.py
Original file line number Diff line number Diff line change
@@ -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 @@ def __init__(self, dmgr, channel_base, parallelism, core_device="core"):
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.)
15 changes: 11 additions & 4 deletions artiq/coredevice/spline.py
Original file line number Diff line number Diff line change
@@ -5,16 +5,23 @@


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`.
If the knot is evaluated starting at time :math:`t_0`, the output
: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 @@ def __init__(self, width, time_width, channel, core_device, scale=1.):
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)
12 changes: 9 additions & 3 deletions doc/manual/core_drivers_reference.rst
Original file line number Diff line number Diff line change
@@ -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,14 +54,20 @@ 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
-----------------------------------

.. automodule:: artiq.coredevice.sawg
:members:

:mod:`artiq.coredevice.ad9154` module
-----------------------------------
-------------------------------------

.. automodule:: artiq.coredevice.ad9154
:members: