From 3a6fcd069dec9037595050f7909e80d6fa56293f Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 23 Nov 2021 16:37:40 +0800 Subject: [PATCH] remove old examples --- artiq/examples/kasli/device_db.py | 231 ------------------ artiq/examples/kasli/idle_kernel.py | 21 -- .../kasli_drtioswitching/device_db.py | 34 --- .../kasli_drtioswitching/repository/blink.py | 16 -- artiq/examples/kasli_sawgmaster/device_db.py | 177 -------------- .../kasli_sawgmaster/repository/basemod.py | 25 -- .../repository/sines_2sayma.py | 37 --- .../repository/sines_urukul_sayma.py | 89 ------- artiq/examples/metlino_sayma_ttl/device_db.py | 95 ------- .../metlino_sayma_ttl/repository/demo.py | 129 ---------- artiq/examples/sayma_master/device_db.py | 166 ------------- .../examples/sayma_master/repository/demo.py | 41 ---- 12 files changed, 1061 deletions(-) delete mode 100644 artiq/examples/kasli/device_db.py delete mode 100644 artiq/examples/kasli/idle_kernel.py delete mode 100644 artiq/examples/kasli_drtioswitching/device_db.py delete mode 100644 artiq/examples/kasli_drtioswitching/repository/blink.py delete mode 100644 artiq/examples/kasli_sawgmaster/device_db.py delete mode 100644 artiq/examples/kasli_sawgmaster/repository/basemod.py delete mode 100644 artiq/examples/kasli_sawgmaster/repository/sines_2sayma.py delete mode 100644 artiq/examples/kasli_sawgmaster/repository/sines_urukul_sayma.py delete mode 100644 artiq/examples/metlino_sayma_ttl/device_db.py delete mode 100644 artiq/examples/metlino_sayma_ttl/repository/demo.py delete mode 100644 artiq/examples/sayma_master/device_db.py delete mode 100644 artiq/examples/sayma_master/repository/demo.py diff --git a/artiq/examples/kasli/device_db.py b/artiq/examples/kasli/device_db.py deleted file mode 100644 index 4b20c7a28..000000000 --- a/artiq/examples/kasli/device_db.py +++ /dev/null @@ -1,231 +0,0 @@ -# Tester device database - -core_addr = "192.168.1.70" - -device_db = { - "core": { - "type": "local", - "module": "artiq.coredevice.core", - "class": "Core", - "arguments": {"host": core_addr, "ref_period": 1e-9} - }, - "core_log": { - "type": "controller", - "host": "::1", - "port": 1068, - "command": "aqctl_corelog -p {port} --bind {bind} " + core_addr - }, - "core_cache": { - "type": "local", - "module": "artiq.coredevice.cache", - "class": "CoreCache" - }, - "core_dma": { - "type": "local", - "module": "artiq.coredevice.dma", - "class": "CoreDMA" - }, - - "i2c_switch0": { - "type": "local", - "module": "artiq.coredevice.i2c", - "class": "PCA9548", - "arguments": {"address": 0xe0} - }, - "i2c_switch1": { - "type": "local", - "module": "artiq.coredevice.i2c", - "class": "PCA9548", - "arguments": {"address": 0xe2} - }, -} - - -# DIO (EEM5) starting at RTIO channel 0 -for i in range(8): - device_db["ttl" + str(i)] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLInOut" if i < 4 else "TTLOut", - "arguments": {"channel": i}, - } - device_db["ttl{}_counter".format(i)] = { - "type": "local", - "module": "artiq.coredevice.edge_counter", - "class": "EdgeCounter", - "arguments": {"channel": 8 + i}, - } - - -# Urukul (EEM1) starting at RTIO channel 12 -device_db.update( - eeprom_urukul0={ - "type": "local", - "module": "artiq.coredevice.kasli_i2c", - "class": "KasliEEPROM", - "arguments": {"port": "EEM1"} - }, - spi_urukul0={ - "type": "local", - "module": "artiq.coredevice.spi2", - "class": "SPIMaster", - "arguments": {"channel": 12} - }, - ttl_urukul0_sync={ - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLClockGen", - "arguments": {"channel": 13, "acc_width": 4} - }, - ttl_urukul0_io_update={ - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 14} - }, - ttl_urukul0_sw0={ - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 15} - }, - ttl_urukul0_sw1={ - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 16} - }, - ttl_urukul0_sw2={ - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 17} - }, - ttl_urukul0_sw3={ - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 18} - }, - urukul0_cpld={ - "type": "local", - "module": "artiq.coredevice.urukul", - "class": "CPLD", - "arguments": { - "spi_device": "spi_urukul0", - "io_update_device": "ttl_urukul0_io_update", - "sync_device": "ttl_urukul0_sync", - "refclk": 125e6, - "clk_sel": 2 - } - } -) - -for i in range(4): - device_db["urukul0_ch" + str(i)] = { - "type": "local", - "module": "artiq.coredevice.ad9910", - "class": "AD9910", - "arguments": { - "pll_n": 32, - "chip_select": 4 + i, - "cpld_device": "urukul0_cpld", - "sw_device": "ttl_urukul0_sw" + str(i), - "sync_delay_seed": "eeprom_urukul0:" + str(64 + 4*i), - "io_update_delay": "eeprom_urukul0:" + str(64 + 4*i), - } - } - - -# Sampler (EEM3) starting at RTIO channel 19 -device_db["spi_sampler0_adc"] = { - "type": "local", - "module": "artiq.coredevice.spi2", - "class": "SPIMaster", - "arguments": {"channel": 19} -} -device_db["spi_sampler0_pgia"] = { - "type": "local", - "module": "artiq.coredevice.spi2", - "class": "SPIMaster", - "arguments": {"channel": 20} -} -device_db["spi_sampler0_cnv"] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 21}, -} -device_db["sampler0"] = { - "type": "local", - "module": "artiq.coredevice.sampler", - "class": "Sampler", - "arguments": { - "spi_adc_device": "spi_sampler0_adc", - "spi_pgia_device": "spi_sampler0_pgia", - "cnv_device": "spi_sampler0_cnv" - } -} - - -# Zotino (EEM4) starting at RTIO channel 22 -device_db["spi_zotino0"] = { - "type": "local", - "module": "artiq.coredevice.spi2", - "class": "SPIMaster", - "arguments": {"channel": 22} -} -device_db["ttl_zotino0_ldac"] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 23} -} -device_db["ttl_zotino0_clr"] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 24} -} -device_db["zotino0"] = { - "type": "local", - "module": "artiq.coredevice.zotino", - "class": "Zotino", - "arguments": { - "spi_device": "spi_zotino0", - "ldac_device": "ttl_zotino0_ldac", - "clr_device": "ttl_zotino0_clr" - } -} - - -device_db.update( - led0={ - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 25} - }, - led1={ - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 26} - }, -) - -device_db.update( - i2c_switch="i2c_switch0", - - ttl_out="ttl4", - ttl_out_serdes="ttl4", - - loop_out="ttl4", - loop_in="ttl0", - loop_in_counter="ttl0_counter", - - # Urukul CPLD with sync and io_update, IFC MODE 0b1000 - urukul_cpld="urukul0_cpld", - # Urukul AD9910 with switch TTL, internal 125 MHz MMCX connection - urukul_ad9910="urukul0_ch0", -) diff --git a/artiq/examples/kasli/idle_kernel.py b/artiq/examples/kasli/idle_kernel.py deleted file mode 100644 index 05184f731..000000000 --- a/artiq/examples/kasli/idle_kernel.py +++ /dev/null @@ -1,21 +0,0 @@ -from artiq.experiment import * - - -class IdleKernel(EnvExperiment): - def build(self): - self.setattr_device("core") - self.setattr_device("led0") - - @kernel - def run(self): - start_time = now_mu() + self.core.seconds_to_mu(500*ms) - while self.core.get_rtio_counter_mu() < start_time: - pass - self.core.reset() - while True: - self.led0.pulse(250*ms) - delay(125*ms) - self.led0.pulse(125*ms) - delay(125*ms) - self.led0.pulse(125*ms) - delay(250*ms) diff --git a/artiq/examples/kasli_drtioswitching/device_db.py b/artiq/examples/kasli_drtioswitching/device_db.py deleted file mode 100644 index 433eaf7bc..000000000 --- a/artiq/examples/kasli_drtioswitching/device_db.py +++ /dev/null @@ -1,34 +0,0 @@ -core_addr = "192.168.1.70" - -device_db = { - "core": { - "type": "local", - "module": "artiq.coredevice.core", - "class": "Core", - "arguments": {"host": core_addr, "ref_period": 1/(8*150e6)} - }, - "core_log": { - "type": "controller", - "host": "::1", - "port": 1068, - "command": "aqctl_corelog -p {port} --bind {bind} " + core_addr - }, - "core_cache": { - "type": "local", - "module": "artiq.coredevice.cache", - "class": "CoreCache" - }, - "core_dma": { - "type": "local", - "module": "artiq.coredevice.dma", - "class": "CoreDMA" - }, -} - -for i in range(3): - device_db["led" + str(i)] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": i << 16}, - } diff --git a/artiq/examples/kasli_drtioswitching/repository/blink.py b/artiq/examples/kasli_drtioswitching/repository/blink.py deleted file mode 100644 index 2af2d1233..000000000 --- a/artiq/examples/kasli_drtioswitching/repository/blink.py +++ /dev/null @@ -1,16 +0,0 @@ -from artiq.experiment import * - - -class Blink(EnvExperiment): - def build(self): - self.setattr_device("core") - self.leds = [self.get_device("led0"), self.get_device("led2")] - - @kernel - def run(self): - self.core.reset() - - while True: - for led in self.leds: - led.pulse(200*ms) - delay(200*ms) diff --git a/artiq/examples/kasli_sawgmaster/device_db.py b/artiq/examples/kasli_sawgmaster/device_db.py deleted file mode 100644 index 4cba2bbd2..000000000 --- a/artiq/examples/kasli_sawgmaster/device_db.py +++ /dev/null @@ -1,177 +0,0 @@ -core_addr = "192.168.1.70" - -device_db = { - "core": { - "type": "local", - "module": "artiq.coredevice.core", - "class": "Core", - "arguments": {"host": core_addr, "ref_period": 1/(8*150e6)} - }, - "core_log": { - "type": "controller", - "host": "::1", - "port": 1068, - "command": "aqctl_corelog -p {port} --bind {bind} " + core_addr - }, - "core_cache": { - "type": "local", - "module": "artiq.coredevice.cache", - "class": "CoreCache" - }, - "core_dma": { - "type": "local", - "module": "artiq.coredevice.dma", - "class": "CoreDMA" - }, -} - -device_db.update( - spi_urukul0={ - "type": "local", - "module": "artiq.coredevice.spi2", - "class": "SPIMaster", - "arguments": {"channel": 0} - }, - ttl_urukul0_io_update={ - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 1} - }, - ttl_urukul0_sw0={ - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 2} - }, - ttl_urukul0_sw1={ - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 3} - }, - ttl_urukul0_sw2={ - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 4} - }, - ttl_urukul0_sw3={ - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 5} - }, - urukul0_cpld={ - "type": "local", - "module": "artiq.coredevice.urukul", - "class": "CPLD", - "arguments": { - "spi_device": "spi_urukul0", - "io_update_device": "ttl_urukul0_io_update", - "refclk": 150e6, - "clk_sel": 2 - } - } -) - -for i in range(4): - device_db["urukul0_ch" + str(i)] = { - "type": "local", - "module": "artiq.coredevice.ad9910", - "class": "AD9910", - "arguments": { - "pll_n": 16, # 600MHz sample rate - "pll_vco": 2, - "chip_select": 4 + i, - "cpld_device": "urukul0_cpld", - "sw_device": "ttl_urukul0_sw" + str(i) - } - } - -""" -artiq_route routing.bin init -artiq_route routing.bin set 0 0 -artiq_route routing.bin set 1 1 0 -artiq_route routing.bin set 2 1 1 0 -artiq_route routing.bin set 3 2 0 -artiq_route routing.bin set 4 2 1 0 -artiq_coremgmt -D kasli config write -f routing_table routing.bin -""" - -for sayma in range(2): - amc_base = 0x010000 + sayma*0x020000 - rtm_base = 0x020000 + sayma*0x020000 - for i in range(4): - device_db["led" + str(4*sayma+i)] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": amc_base + i} - } - for i in range(2): - device_db["ttl_mcx" + str(2*sayma+i)] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLInOut", - "arguments": {"channel": amc_base + 4 + i} - } - for i in range(8): - device_db["sawg" + str(8*sayma+i)] = { - "type": "local", - "module": "artiq.coredevice.sawg", - "class": "SAWG", - "arguments": {"channel_base": amc_base + 6 + i*10, "parallelism": 4} - } - for basemod in range(2): - for i in range(4): - device_db["sawg_sw" + str(8*sayma+4*basemod+i)] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": rtm_base + basemod*9 + i} - } - att_idx = 2*sayma + basemod - device_db["basemod_att_rst_n"+str(att_idx)] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": rtm_base + basemod*9 + 4} - } - device_db["basemod_att_clk"+str(att_idx)] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": rtm_base + basemod*9 + 5} - } - device_db["basemod_att_le"+str(att_idx)] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": rtm_base + basemod*9 + 6} - } - device_db["basemod_att_mosi"+str(att_idx)] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": rtm_base + basemod*9 + 7} - } - device_db["basemod_att_miso"+str(att_idx)] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLInOut", - "arguments": {"channel": rtm_base + basemod*9 + 8} - } - device_db["basemod_att"+str(att_idx)] = { - "type": "local", - "module": "artiq.coredevice.basemod_att", - "class": "BaseModAtt", - "arguments": { - "rst_n": "basemod_att_rst_n"+str(att_idx), - "clk": "basemod_att_clk"+str(att_idx), - "le": "basemod_att_le"+str(att_idx), - "mosi": "basemod_att_mosi"+str(att_idx), - "miso": "basemod_att_miso"+str(att_idx), - } - } - diff --git a/artiq/examples/kasli_sawgmaster/repository/basemod.py b/artiq/examples/kasli_sawgmaster/repository/basemod.py deleted file mode 100644 index 3ca9a1c86..000000000 --- a/artiq/examples/kasli_sawgmaster/repository/basemod.py +++ /dev/null @@ -1,25 +0,0 @@ -from artiq.experiment import * - - -class BaseMod(EnvExperiment): - def build(self): - self.setattr_device("core") - self.basemods = [self.get_device("basemod_att0"), self.get_device("basemod_att1")] - self.rfsws = [self.get_device("sawg_sw"+str(i)) for i in range(8)] - - @kernel - def run(self): - self.core.reset() - for basemod in self.basemods: - self.core.break_realtime() - delay(10*ms) - basemod.reset() - delay(10*ms) - basemod.set(0.0, 0.0, 0.0, 0.0) - delay(10*ms) - print(basemod.get_mu()) - - self.core.break_realtime() - for rfsw in self.rfsws: - rfsw.on() - delay(1*ms) diff --git a/artiq/examples/kasli_sawgmaster/repository/sines_2sayma.py b/artiq/examples/kasli_sawgmaster/repository/sines_2sayma.py deleted file mode 100644 index 3a8204941..000000000 --- a/artiq/examples/kasli_sawgmaster/repository/sines_2sayma.py +++ /dev/null @@ -1,37 +0,0 @@ -from artiq.experiment import * - - -class Sines2Sayma(EnvExperiment): - def build(self): - self.setattr_device("core") - self.sawgs = [self.get_device("sawg"+str(i)) for i in range(16)] - - @kernel - def drtio_is_up(self): - for i in range(5): - if not self.core.get_rtio_destination_status(i): - return False - return True - - @kernel - def run(self): - while True: - print("waiting for DRTIO ready...") - while not self.drtio_is_up(): - pass - print("OK") - - self.core.reset() - - for sawg in self.sawgs: - delay(1*ms) - sawg.reset() - - for sawg in self.sawgs: - delay(1*ms) - sawg.amplitude1.set(.4) - # Do not use a sub-multiple of oscilloscope sample rates. - sawg.frequency0.set(9*MHz) - - while self.drtio_is_up(): - pass diff --git a/artiq/examples/kasli_sawgmaster/repository/sines_urukul_sayma.py b/artiq/examples/kasli_sawgmaster/repository/sines_urukul_sayma.py deleted file mode 100644 index dfd8e46c9..000000000 --- a/artiq/examples/kasli_sawgmaster/repository/sines_urukul_sayma.py +++ /dev/null @@ -1,89 +0,0 @@ -from artiq.experiment import * - - -class SinesUrukulSayma(EnvExperiment): - def build(self): - self.setattr_device("core") - self.setattr_device("urukul0_cpld") - - # Urukul clock output syntonized to the RTIO clock. - # Can be used as HMC830 reference on Sayma RTM. - # When using this reference, Sayma must be recalibrated every time Urukul - # is rebooted, as Urukul is not synchronized to the Kasli. - self.urukul_hmc_ref = self.get_device("urukul0_ch3") - - # Urukul measurement channels - compare with SAWG outputs. - # When testing sync, do not reboot Urukul, as it is not - # synchronized to the Kasli. - self.urukul_meas = [self.get_device("urukul0_ch" + str(i)) for i in range(3)] - # The same waveform is output on all first 4 SAWG channels (first DAC). - self.sawgs = [self.get_device("sawg"+str(i)) for i in range(4)] - self.basemod = self.get_device("basemod_att0") - self.rfsws = [self.get_device("sawg_sw"+str(i)) for i in range(4)] - - - # DRTIO destinations: - # 0: local - # 1: Sayma AMC - # 2: Sayma RTM - @kernel - def drtio_is_up(self): - for i in range(3): - if not self.core.get_rtio_destination_status(i): - return False - return True - - @kernel - def run(self): - f = 9*MHz - dds_ftw = self.urukul_meas[0].frequency_to_ftw(f) - sawg_ftw = self.sawgs[0].frequency0.to_mu(f) - if dds_ftw != sawg_ftw: - print("DDS and SAWG FTWs do not match:", dds_ftw, sawg_ftw) - return - - self.core.reset() - self.urukul0_cpld.init() - - delay(1*ms) - self.urukul_hmc_ref.init() - self.urukul_hmc_ref.set_mu(0x40000000, asf=self.urukul_hmc_ref.amplitude_to_asf(0.6)) - self.urukul_hmc_ref.set_att(6.) - self.urukul_hmc_ref.sw.on() - - for urukul_ch in self.urukul_meas: - delay(1*ms) - urukul_ch.init() - urukul_ch.set_mu(dds_ftw, asf=urukul_ch.amplitude_to_asf(0.5)) - urukul_ch.set_att(6.) - urukul_ch.sw.on() - - while True: - print("waiting for DRTIO ready...") - while not self.drtio_is_up(): - pass - print("OK") - - self.core.reset() - - delay(10*ms) - self.basemod.reset() - delay(10*ms) - self.basemod.set(3.0, 3.0, 3.0, 3.0) - delay(10*ms) - for rfsw in self.rfsws: - delay(1*ms) - rfsw.on() - - for sawg in self.sawgs: - delay(1*ms) - sawg.reset() - - for sawg in self.sawgs: - delay(1*ms) - sawg.amplitude1.set(.4) - sawg.frequency0.set_mu(sawg_ftw) - sawg.phase0.set_mu(sawg_ftw*now_mu() >> 17) - - while self.drtio_is_up(): - pass diff --git a/artiq/examples/metlino_sayma_ttl/device_db.py b/artiq/examples/metlino_sayma_ttl/device_db.py deleted file mode 100644 index c8c3acb8e..000000000 --- a/artiq/examples/metlino_sayma_ttl/device_db.py +++ /dev/null @@ -1,95 +0,0 @@ -core_addr = "192.168.1.65" - -device_db = { - "core": { - "type": "local", - "module": "artiq.coredevice.core", - "class": "Core", - "arguments": {"host": core_addr, "ref_period": 1/(8*150e6)} - }, - "core_log": { - "type": "controller", - "host": "::1", - "port": 1068, - "command": "aqctl_corelog -p {port} --bind {bind} " + core_addr - }, - "core_cache": { - "type": "local", - "module": "artiq.coredevice.cache", - "class": "CoreCache" - }, - "core_dma": { - "type": "local", - "module": "artiq.coredevice.dma", - "class": "CoreDMA" - } -} - -# master peripherals -for i in range(4): - device_db["led" + str(i)] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": i}, -} - -# DEST#1 peripherals -amc_base = 0x070000 -rtm_base = 0x020000 - -for i in range(4): - device_db["led" + str(4+i)] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": amc_base + i}, - } - -#DIO (EEM0) starting at RTIO channel 0x000056 -for i in range(8): - device_db["ttl" + str(i)] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": amc_base + 0x000056 + i}, - } - -#DIO (EEM1) starting at RTIO channel 0x00005e -for i in range(8): - device_db["ttl" + str(8+i)] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": amc_base + 0x00005e + i}, - } - -device_db["fmcdio_dirctl_clk"] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": amc_base + 0x000066} -} - -device_db["fmcdio_dirctl_ser"] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": amc_base + 0x000067} -} - -device_db["fmcdio_dirctl_latch"] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": amc_base + 0x000068} -} - -device_db["fmcdio_dirctl"] = { - "type": "local", - "module": "artiq.coredevice.shiftreg", - "class": "ShiftReg", - "arguments": {"clk": "fmcdio_dirctl_clk", - "ser": "fmcdio_dirctl_ser", - "latch": "fmcdio_dirctl_latch"} -} diff --git a/artiq/examples/metlino_sayma_ttl/repository/demo.py b/artiq/examples/metlino_sayma_ttl/repository/demo.py deleted file mode 100644 index bb273ce2c..000000000 --- a/artiq/examples/metlino_sayma_ttl/repository/demo.py +++ /dev/null @@ -1,129 +0,0 @@ -import sys -import os -import select - -from artiq.experiment import * -from artiq.coredevice.fmcdio_vhdci_eem import * - - -def chunker(seq, size): - res = [] - for el in seq: - res.append(el) - if len(res) == size: - yield res - res = [] - if res: - yield res - - -def is_enter_pressed() -> TBool: - if os.name == "nt": - if msvcrt.kbhit() and msvcrt.getch() == b"\r": - return True - else: - return False - else: - if select.select([sys.stdin, ], [], [], 0.0)[0]: - sys.stdin.read(1) - return True - else: - return False - - -class Demo(EnvExperiment): - def build(self): - self.setattr_device("core") - self.setattr_device("fmcdio_dirctl") - - self.leds = dict() - self.ttl_outs = dict() - - ddb = self.get_device_db() - for name, desc in ddb.items(): - if isinstance(desc, dict) and desc["type"] == "local": - module, cls = desc["module"], desc["class"] - if (module, cls) == ("artiq.coredevice.ttl", "TTLOut"): - dev = self.get_device(name) - if "led" in name: # guess - self.leds[name] = dev - elif "ttl" in name: # to exclude fmcdio_dirctl - self.ttl_outs[name] = dev - - self.leds = sorted(self.leds.items(), key=lambda x: x[1].channel) - self.ttl_outs = sorted(self.ttl_outs.items(), key=lambda x: x[1].channel) - - self.dirctl_word = ( - shiftreg_bits(0, dio_bank0_out_pins | dio_bank1_out_pins) | - shiftreg_bits(1, dio_bank0_out_pins | dio_bank1_out_pins) - ) - - @kernel - def init(self): - self.core.break_realtime() - print("*** Waiting for DRTIO ready...") - drtio_indices = [7] - for i in drtio_indices: - while not self.drtio_is_up(i): - pass - - self.fmcdio_dirctl.set(self.dirctl_word) - - @kernel - def drtio_is_up(self, drtio_index): - if not self.core.get_rtio_destination_status(drtio_index): - return False - print("DRTIO #", drtio_index, "is ready\n") - return True - - @kernel - def test_led(self, led): - while not is_enter_pressed(): - self.core.break_realtime() - # do not fill the FIFOs too much to avoid long response times - t = now_mu() - self.core.seconds_to_mu(0.2) - while self.core.get_rtio_counter_mu() < t: - pass - for i in range(3): - led.pulse(100*ms) - delay(100*ms) - - def test_leds(self): - print("*** Testing LEDs.") - print("Check for blinking. Press ENTER when done.") - - for led_name, led_dev in self.leds: - print("Testing LED: {}".format(led_name)) - self.test_led(led_dev) - - @kernel - def test_ttl_out_chunk(self, ttl_chunk): - while not is_enter_pressed(): - self.core.break_realtime() - for _ in range(50000): - i = 0 - for ttl in ttl_chunk: - i += 1 - for _ in range(i): - ttl.pulse(1*us) - delay(1*us) - delay(10*us) - - def test_ttl_outs(self): - print("*** Testing TTL outputs.") - print("Outputs are tested in groups of 4. Touch each TTL connector") - print("with the oscilloscope probe tip, and check that the number of") - print("pulses corresponds to its number in the group.") - print("Press ENTER when done.") - - for ttl_chunk in chunker(self.ttl_outs, 4): - print("Testing TTL outputs: {}.".format(", ".join(name for name, dev in ttl_chunk))) - self.test_ttl_out_chunk([dev for name, dev in ttl_chunk]) - - def run(self): - self.core.reset() - - if self.leds: - self.test_leds() - if self.ttl_outs: - self.test_ttl_outs() diff --git a/artiq/examples/sayma_master/device_db.py b/artiq/examples/sayma_master/device_db.py deleted file mode 100644 index 51eede704..000000000 --- a/artiq/examples/sayma_master/device_db.py +++ /dev/null @@ -1,166 +0,0 @@ -core_addr = "192.168.1.60" - -device_db = { - "core": { - "type": "local", - "module": "artiq.coredevice.core", - "class": "Core", - "arguments": {"host": core_addr, "ref_period": 1/(8*150e6)} - }, - "core_log": { - "type": "controller", - "host": "::1", - "port": 1068, - "command": "aqctl_corelog -p {port} --bind {bind} " + core_addr - }, - "core_cache": { - "type": "local", - "module": "artiq.coredevice.cache", - "class": "CoreCache" - }, - "core_dma": { - "type": "local", - "module": "artiq.coredevice.dma", - "class": "CoreDMA" - }, -} - -for i in range(4): - device_db["led" + str(i)] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": i}, - } - - -for i in range(2): - device_db["ttl" + str(i)] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLInOut", - "arguments": {"channel": 4 + i}, - } - - -device_db.update( - fmcdio_dirctl_clk={ - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 6} - }, - fmcdio_dirctl_ser={ - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 7} - }, - fmcdio_dirctl_latch={ - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 8} - }, - fmcdio_dirctl={ - "type": "local", - "module": "artiq.coredevice.shiftreg", - "class": "ShiftReg", - "arguments": {"clk": "fmcdio_dirctl_clk", - "ser": "fmcdio_dirctl_ser", - "latch": "fmcdio_dirctl_latch"} - } -) - -device_db.update( - spi_urukul0={ - "type": "local", - "module": "artiq.coredevice.spi2", - "class": "SPIMaster", - "arguments": {"channel": 17} - }, - ttl_urukul0_io_update={ - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 18} - }, - ttl_urukul0_sw0={ - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 19} - }, - ttl_urukul0_sw1={ - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 20} - }, - ttl_urukul0_sw2={ - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 21} - }, - ttl_urukul0_sw3={ - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 22} - }, - urukul0_cpld={ - "type": "local", - "module": "artiq.coredevice.urukul", - "class": "CPLD", - "arguments": { - "spi_device": "spi_urukul0", - "io_update_device": "ttl_urukul0_io_update", - "refclk": 125e6, - "clk_sel": 0 - } - } -) - -for i in range(4): - device_db["urukul0_ch" + str(i)] = { - "type": "local", - "module": "artiq.coredevice.ad9910", - "class": "AD9910", - "arguments": { - "pll_n": 32, - "chip_select": 4 + i, - "cpld_device": "urukul0_cpld", - "sw_device": "ttl_urukul0_sw" + str(i) - } - } - - -device_db["spi_zotino0"] = { - "type": "local", - "module": "artiq.coredevice.spi2", - "class": "SPIMaster", - "arguments": {"channel": 23} -} -device_db["ttl_zotino0_ldac"] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 24} -} -device_db["ttl_zotino0_clr"] = { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 25} -} -device_db["zotino0"] = { - "type": "local", - "module": "artiq.coredevice.zotino", - "class": "Zotino", - "arguments": { - "spi_device": "spi_zotino0", - "ldac_device": "ttl_zotino0_ldac", - "clr_device": "ttl_zotino0_clr" - } -} diff --git a/artiq/examples/sayma_master/repository/demo.py b/artiq/examples/sayma_master/repository/demo.py deleted file mode 100644 index 9b40f4b42..000000000 --- a/artiq/examples/sayma_master/repository/demo.py +++ /dev/null @@ -1,41 +0,0 @@ -from artiq.experiment import * -from artiq.coredevice.fmcdio_vhdci_eem import * - - -class Demo(EnvExperiment): - def build(self): - self.setattr_device("core") - self.setattr_device("fmcdio_dirctl") - - self.ttls = [self.get_device("ttl" + str(i)) for i in range(8)] - self.setattr_device("urukul0_cpld") - self.urukul_chs = [self.get_device("urukul0_ch" + str(i)) for i in range(4)] - self.setattr_device("zotino0") - - self.dirctl_word = ( - shiftreg_bits(1, urukul_out_pins) | - shiftreg_bits(0, urukul_aux_out_pins) | - shiftreg_bits(2, dio_bank0_out_pins | dio_bank1_out_pins) | - shiftreg_bits(3, zotino_out_pins)) - - @kernel - def run(self): - self.core.reset() - delay(10*ms) - self.fmcdio_dirctl.set(self.dirctl_word) - delay(10*ms) - - self.urukul0_cpld.init() - delay(10*ms) - - self.zotino0.init() - delay(1*ms) - for i in range(32): - self.zotino0.write_dac(i, i/4) - delay(1*ms) - - while True: - for ttl in self.ttls: - ttl.pulse(100*ms) - for urukul_ch in self.urukul_chs: - urukul_ch.sw.pulse(100*ms)